Skip site navigation (1)Skip section navigation (2)
Date:      Tue, 31 Mar 2015 03:32:39 +0300
From:      Konstantin Belousov <kostikbel@gmail.com>
To:        John Baldwin <jhb@freebsd.org>
Cc:        svn-src-head@freebsd.org, svn-src-all@freebsd.org, src-committers@freebsd.org, Bruce Evans <brde@optusnet.com.au>
Subject:   Re: svn commit: r280279 - head/sys/sys
Message-ID:  <20150331003239.GK2379@kib.kiev.ua>
In-Reply-To: <1853187.nsx00mfzo7@ralph.baldwin.cx>
References:  <201503201027.t2KAR6Ze053047@svn.freebsd.org> <2526359.g5B2nXdKeQ@ralph.baldwin.cx> <20150330172434.GG2379@kib.kiev.ua> <1853187.nsx00mfzo7@ralph.baldwin.cx>

next in thread | previous in thread | raw e-mail | index | archive | help
On Mon, Mar 30, 2015 at 04:37:10PM -0400, John Baldwin wrote:
> On Monday, March 30, 2015 08:24:34 PM Konstantin Belousov wrote:
> > > That is not what Bruce said.  He suggested using bitcount64() for the fallback
> > > if the cpuid check fails.  He did not say to remove the runtime check to use
> > > popcnt if it is available:
> > > 
> > > "Always using [bitcount64] would lose the micro-optimization... [to] keep
> > > [it], it seems best to keep the inline asm but replace popcnt_pc_map_elem(elem)
> > > by [bitcount64(elem)]."
> > Ok, thank you for the clarification.
> > 
> > I updated the pmap patch, see the end of the message.
> 
> I think the pmap change looks fine.  If we know which compilers include a
> workaround we might also consider specifying "-mno-popcount" for everything
> except known-ok compilers in at least kern.mk.
Right now the compilers which implement the workaround are gcc 4.9.2 and
gcc trunk, to be released as gcc 5.0.  In-tree clang 3.6.0 does not
try to eliminate the false dependency.

> 
> > > This looks fine to me.  It seems to be manually converting certain symbols
> > > to use a dynamic lookup that must be explicitly resolved before first
> > > use?
> > I am not sure what do you mean by dynamic lookup, but possibly it
> > was mentioned. I can emulate the ifuncs more sincerely, by requiring
> > a resolver function, which is called on the first real function
> > invocation. I did not see it as very useful, but it is definitely
> > doable.
> 
> I just mean that the effect at runtime is similar to that of dynamic
> symbols once they are resolved (a call into a PLT entry (or is it GOT?
> I keep getting those confused) that does a jump to the resolved symbol).
PLT is slightly more expensive, since after the resolution it gives
	call	symbol@plt
	jmp	*symbol@gotpcrel
while this code results in
	call	*symbol_selector



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?20150331003239.GK2379>