lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite for Android: free password hash cracker in your pocket
[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <Z5j7Wq1E6DqUYu8D@kbusch-mbp>
Date: Tue, 28 Jan 2025 08:44:26 -0700
From: Keith Busch <kbusch@...nel.org>
To: Paolo Bonzini <pbonzini@...hat.com>
Cc: Sean Christopherson <seanjc@...gle.com>, kvm@...r.kernel.org,
	linux-kernel@...r.kernel.org
Subject: Re: [PATCH] KVM: x86/mmu: Ensure NX huge page recovery thread is
 alive before waking

On Tue, Jan 28, 2025 at 04:41:41PM +0100, Paolo Bonzini wrote:
> I'm queuing the patch with the store before vhost_task_start, and
> acquire/release instead of just READ_ONCE/WRITE_ONCE.

Thanks, looks good to me:

Reviewed-by: Keith Busch <kbusch@...nel.org>
 
> diff --git a/arch/x86/kvm/mmu/mmu.c b/arch/x86/kvm/mmu/mmu.c
> index 74c20dbb92da..6d5708146384 100644
> --- a/arch/x86/kvm/mmu/mmu.c
> +++ b/arch/x86/kvm/mmu/mmu.c
> @@ -7127,7 +7127,8 @@ static void kvm_wake_nx_recovery_thread(struct kvm *kvm)
>  	 * may not be valid even though the VM is globally visible.  Do nothing,
>  	 * as such a VM can't have any possible NX huge pages.
>  	 */
> -	struct vhost_task *nx_thread = READ_ONCE(kvm->arch.nx_huge_page_recovery_thread);
> +	struct vhost_task *nx_thread =
> +		smp_load_acquire(&kvm->arch.nx_huge_page_recovery_thread);
>  	if (nx_thread)
>  		vhost_task_wake(nx_thread);
> @@ -7474,10 +7475,10 @@ static void kvm_mmu_start_lpage_recovery(struct once *once)
>  	if (!nx_thread)
>  		return;
> -	vhost_task_start(nx_thread);
> +	/* Make the task visible only once it is fully created. */
> +	smp_store_release(&kvm->arch.nx_huge_page_recovery_thread, nx_thread);
> -	/* Make the task visible only once it is fully started. */
> -	WRITE_ONCE(kvm->arch.nx_huge_page_recovery_thread, nx_thread);
> +	vhost_task_start(nx_thread);
>  }
>  int kvm_mmu_post_init_vm(struct kvm *kvm)
> 

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ