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]
Date:   Wed, 18 Jul 2018 13:25:44 +0000
From:   Tianyu Lan <Tianyu.Lan@...rosoft.com>
To:     Paolo Bonzini <pbonzini@...hat.com>,
        Tianyu Lan <Tianyu.Lan@...rosoft.com>
CC:     KY Srinivasan <kys@...rosoft.com>,
        Haiyang Zhang <haiyangz@...rosoft.com>,
        Stephen Hemminger <sthemmin@...rosoft.com>,
        "tglx@...utronix.de" <tglx@...utronix.de>,
        "mingo@...hat.com" <mingo@...hat.com>,
        "hpa@...or.com" <hpa@...or.com>, "x86@...nel.org" <x86@...nel.org>,
        "rkrcmar@...hat.com" <rkrcmar@...hat.com>,
        "devel@...uxdriverproject.org" <devel@...uxdriverproject.org>,
        "linux-kernel@...r.kernel.org" <linux-kernel@...r.kernel.org>,
        "kvm@...r.kernel.org" <kvm@...r.kernel.org>,
        "Michael Kelley (EOSG)" <Michael.H.Kelley@...rosoft.com>,
        "vkuznets@...hat.com" <vkuznets@...hat.com>
Subject: Re: [PATCH V2 2/5] KVM: Add tlb remote flush callback in kvm_x86_ops.

Hi Paolo:
	Thanks for review.

On 7/18/2018 8:01 PM, Paolo Bonzini wrote:
> On 09/07/2018 11:02, Tianyu Lan wrote:
>> +	/*
>> +	 * Call kvm_arch_hv_tlb_remote first and go back old way when
>> +	 * return failure.
>> +	 */
>> +	if (!kvm_arch_hv_flush_remote_tlb(kvm))
>> +		return;
>> +
>>   	/*
>>   	 * Read tlbs_dirty before setting KVM_REQ_TLB_FLUSH in
>>   	 * kvm_make_all_cpus_request.
>>   	 */
>> -	long dirty_count = smp_load_acquire(&kvm->tlbs_dirty);
>> +	dirty_count = smp_load_acquire(&kvm->tlbs_dirty);
> 
> Also, the call to kvm_arch_flush_remote_tlbs should not replace the
> whole function.  It should be something like:
> 
>          long dirty_count = smp_load_acquire(&kvm->tlbs_dirty);
> 
>          /*
>           * We want to publish modifications to the page tables before reading
>           * mode. Pairs with a memory barrier in arch-specific code.
>           * - x86: smp_mb__after_srcu_read_unlock in vcpu_enter_guest
>           * and smp_mb in walk_shadow_page_lockless_begin/end.
>           * - powerpc: smp_mb in kvmppc_prepare_to_enter.
>           *
>           * There is already an smp_mb__after_atomic() before
>           * kvm_make_all_cpus_request() reads vcpu->mode. We reuse that
>           * barrier here.
>           */
>          if (!kvm_arch_hv_flush_remote_tlb(kvm) ||
> 	    kvm_make_all_cpus_request(kvm, KVM_REQ_TLB_FLUSH))
>                  ++kvm->stat.remote_tlb_flush;
>          cmpxchg(&kvm->tlbs_dirty, dirty_count, 0);
> 
> Otherwise, kvm_mmu_notifier_invalidate_range_start will incorrectly skip
> a TLB flush.

Nice catch. Will update in the next version.

> 
> Thanks,
> 
> Paolo
> 

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ