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: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <7a7a94db-9019-44bb-95b0-dd3ef3560178@intel.com>
Date: Fri, 24 May 2024 10:42:50 +1200
From: "Huang, Kai" <kai.huang@...el.com>
To: Sean Christopherson <seanjc@...gle.com>, Marc Zyngier <maz@...nel.org>,
	Oliver Upton <oliver.upton@...ux.dev>, Tianrui Zhao
	<zhaotianrui@...ngson.cn>, Bibo Mao <maobibo@...ngson.cn>, Huacai Chen
	<chenhuacai@...nel.org>, Michael Ellerman <mpe@...erman.id.au>, Anup Patel
	<anup@...infault.org>, Paul Walmsley <paul.walmsley@...ive.com>, "Palmer
 Dabbelt" <palmer@...belt.com>, Albert Ou <aou@...s.berkeley.edu>, "Christian
 Borntraeger" <borntraeger@...ux.ibm.com>, Janosch Frank
	<frankja@...ux.ibm.com>, Claudio Imbrenda <imbrenda@...ux.ibm.com>, "Paolo
 Bonzini" <pbonzini@...hat.com>
CC: <linux-arm-kernel@...ts.infradead.org>, <kvmarm@...ts.linux.dev>,
	<kvm@...r.kernel.org>, <loongarch@...ts.linux.dev>,
	<linux-mips@...r.kernel.org>, <linuxppc-dev@...ts.ozlabs.org>,
	<kvm-riscv@...ts.infradead.org>, <linux-riscv@...ts.infradead.org>,
	<linux-kernel@...r.kernel.org>
Subject: Re: [PATCH v2 5/6] KVM: x86: Unconditionally set l1tf_flush_l1d
 during vCPU load



On 22/05/2024 1:40 pm, Sean Christopherson wrote:
> Always set l1tf_flush_l1d during kvm_arch_vcpu_load() instead of setting
> it only when the vCPU is being scheduled back in.  The flag is processed
> only when VM-Enter is imminent, and KVM obviously needs to load the vCPU
> before VM-Enter, so attempting to precisely set l1tf_flush_l1d provides no
> meaningful value.  I.e. the flag _will_ be set either way, it's simply a
> matter of when.

Seems reasonable.

> 
> Signed-off-by: Sean Christopherson <seanjc@...gle.com>
> ---

Acked-by: Kai Huang <kai.huang@...el.com>

>   arch/x86/kvm/x86.c | 11 +++++------
>   1 file changed, 5 insertions(+), 6 deletions(-)
> 
> diff --git a/arch/x86/kvm/x86.c b/arch/x86/kvm/x86.c
> index 59aa772af755..60fea297f91f 100644
> --- a/arch/x86/kvm/x86.c
> +++ b/arch/x86/kvm/x86.c
> @@ -5006,12 +5006,11 @@ void kvm_arch_vcpu_load(struct kvm_vcpu *vcpu, int cpu)
>   {
>   	struct kvm_pmu *pmu = vcpu_to_pmu(vcpu);
>   
> -	if (vcpu->scheduled_out) {
> -		vcpu->arch.l1tf_flush_l1d = true;
> -		if (pmu->version && unlikely(pmu->event_count)) {
> -			pmu->need_cleanup = true;
> -			kvm_make_request(KVM_REQ_PMU, vcpu);
> -		}
> +	vcpu->arch.l1tf_flush_l1d = true;
> +
> +	if (vcpu->scheduled_out && pmu->version && pmu->event_count) {
> +		pmu->need_cleanup = true;
> +		kvm_make_request(KVM_REQ_PMU, vcpu);
>   	}

Nit, the unlikely() is lost, but I guess it is OK?

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ