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:	Thu, 08 Mar 2012 22:27:59 +0100
From:	Davidlohr Bueso <dave@....org>
To:	Christian Borntraeger <borntraeger@...ibm.com>
Cc:	Avi Kivity <avi@...hat.com>, Marcelo Tosatti <mtosatti@...hat.com>,
	KVM <kvm@...r.kernel.org>, lkml <linux-kernel@...r.kernel.org>
Subject: Re: [PATCH v2] KVM: x86: add paging gcc optimization

On Thu, 2012-03-08 at 16:47 +0100, Christian Borntraeger wrote:
> On 08/03/12 12:45, Davidlohr Bueso wrote:
> > From: Davidlohr Bueso <dave@....org>
> > 
> > Since most guests will have paging enabled for memory management, add likely() optimization
> > around CR0.PG checks.
> 
> >  {
> > -	return kvm_read_cr0_bits(vcpu, X86_CR0_PG);
> > +	return likely(kvm_read_cr0_bits(vcpu, X86_CR0_PG));
> 
> 
> IMHO likely/unlikely should be considered more as fast-path/slow-path and not as often/less often.
> Is that the case here? This patch  might cause a mis-prediction for non-paging guests all 
> the time. 

Branch predictions are all about probability of occurrence, and I cannot
imagine guests having paging disabled and mapping gva->gpa directly, so
for most of the cases it would be beneficial. For those peculiar users
that actually don't use paging, then yes, mispredictions would occur.

- Davidlohr

> 
> Non-paging might be really irrelevant, so I am just making a point, since
> likely/unlikely is mis-used too often especially for "most users do it that way".
> 
> 
> Christian
> 
> 


--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ