Re: alternatives

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



2007/11/5, Thomas Petazzoni <thomas.petazzoni@xxxxxxxx>:
> Hi,
>
> Le Sat, 3 Nov 2007 13:33:12 +0000,
> ninjaboy <n0b0dyn1nj4@xxxxxxxxx> a écrit :
>
> > I've seen that there are two section (.altinstructions and
> > .altinstr_replacement), there are some "polimorphic" code that is
> > replaced at runtime, now in arch/x86_64/lib/copy_user.S there are
> > copy_user_generic_unrolled and copy_user_generic_string, that replaces
> > the function that is used, my question is: where and how the decision
> > on what code is used (in this case
> > copy_user_generic_unrolled or copy_user_generic_string) for replace
> > code?
>
> Here:
> http://lxr.free-electrons.com/source/arch/x86_64/lib/copy_user.S#046
>
> with the following line:
> ALTERNATIVE_JUMP
> X86_FEATURE_REP_GOOD,copy_user_generic_unrolled,copy_user_generic_string
>
> with the ALTERNATIVE_JUMP macro being defined at the top of the
> copy_user.S file. It adds:
>
>  * code to the normal text section to call the "default" function, the
>    unrolled version ;
>
>  * code to the altinstr_replacement section to call the
>    copy_user_generic_string function ;
>
>  * informations to the altinstructions section, which is processed at
>    boot time by arch/i386/kernel/alternative.c in order to know if an
>    alternative must be applied or not, depending on the presence/absence
>    on some processor features (here X86_FEATURE_REP_GOOD)
>
Yes, that makes sense, but why on AMD64 X2 is better rep insn than unrolled?
In my userspace test case rep is slower than unrolled.

thanks,

-- 
noone is alone.

--
To unsubscribe from this list: send an email with
"unsubscribe kernelnewbies" to ecartis@xxxxxxxxxxxx
Please read the FAQ at http://kernelnewbies.org/FAQ



[Index of Archives]     [Newbies FAQ]     [Linux Kernel Mentors]     [Linux Kernel Development]     [IETF Annouce]     [Git]     [Networking]     [Security]     [Bugtraq]     [Yosemite]     [MIPS Linux]     [ARM Linux]     [Linux RAID]     [Linux SCSI]     [Linux ACPI]
  Powered by Linux