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>] [day] [month] [year] [list]
Message-ID: <99e47cc1-43d6-ff05-46b8-6a96ebc34b2a@redhat.com>
Date:   Mon, 7 Jan 2019 17:07:58 +0100
From:   Paolo Bonzini <pbonzini@...hat.com>
To:     Sean Christopherson <sean.j.christopherson@...el.com>,
        lantianyu1986@...il.com
Cc:     kvm@...r.kernel.org, rkrcmar@...hat.com, catalin.marinas@....com,
        will.deacon@....com, linux-kernel@...r.kernel.org,
        paulus@...abs.org, hpa@...or.com, kys@...rosoft.com,
        kvmarm@...ts.cs.columbia.edu, mpe@...erman.id.au, x86@...nel.org,
        linux@...linux.org.uk, michael.h.kelley@...rosoft.com,
        mingo@...hat.com, benh@...nel.crashing.org, jhogan@...nel.org,
        linux-mips@...r.kernel.org, Lan Tianyu <Tianyu.Lan@...rosoft.com>,
        marc.zyngier@....com, kvm-ppc@...r.kernel.org, bp@...en8.de,
        tglx@...utronix.de, linux-arm-kernel@...ts.infradead.org,
        christoffer.dall@....com, ralf@...ux-mips.org,
        paul.burton@...s.com, vkuznets@...hat.com,
        linuxppc-dev@...ts.ozlabs.org
Subject: Re: [PATCH 6/11] KVM/MMU: Flush tlb with range list in sync_page()

On 04/01/19 17:30, Sean Christopherson wrote:
>> +
>> +		if (kvm_available_flush_tlb_with_range()
>> +		    && (tmp_spte_ret & SET_SPTE_NEED_REMOTE_TLB_FLUSH)) {
>> +			struct kvm_mmu_page *leaf_sp = page_header(sp->spt[i]
>> +					& PT64_BASE_ADDR_MASK);
>> +			list_add(&leaf_sp->flush_link, &flush_list);
>> +		}
>> +
>> +		set_spte_ret |= tmp_spte_ret;
>> +
>>  	}
>>  
>>  	if (set_spte_ret & SET_SPTE_NEED_REMOTE_TLB_FLUSH)
>> -		kvm_flush_remote_tlbs(vcpu->kvm);
>> +		kvm_flush_remote_tlbs_with_list(vcpu->kvm, &flush_list);
> This is a bit confusing and potentially fragile.  It's not obvious that
> kvm_flush_remote_tlbs_with_list() is guaranteed to call
> kvm_flush_remote_tlbs() when kvm_available_flush_tlb_with_range() is
> false, and you're relying on the kvm_flush_remote_tlbs_with_list() call
> chain to never optimize away the empty list case.  Rechecking
> kvm_available_flush_tlb_with_range() isn't expensive.
> 

Alternatively, do not check it during the loop: always build the
flush_list, and always call kvm_flush_remote_tlbs_with_list.  The
function can then check whether the list is empty, and the OR of
tmp_spte_ret on every iteration goes away.

Paolo

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ