svn commit: r280279 - head/sys/sys

Konstantin Belousov kostikbel at gmail.com
Tue Mar 31 00:32:46 UTC 2015


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 at plt
	jmp	*symbol at gotpcrel
while this code results in
	call	*symbol_selector


More information about the svn-src-all mailing list