Re: memory barriers

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

 



Hi,

Le Thu, 16 Aug 2007 10:03:47 +0530,
Venky Shankar <venkykshankar@xxxxxxxxx> a écrit :

> #define mb() alternative("lock; addl $0,0(%%esp)", "mfence",
> X86_FEATURE_XMM2)
> 
> can someone please help me understanding the alternative inline
> assembly, i am finding it a bit confusing. source is in :

You can read http://lwn.net/Articles/164121/, which explains how the
alternatives mechanism works, by precisely taking the mb() example.

Briefly, the alternatives mechanism allows the kernel to optimize
itself at boot-time, depending on the capabilities of the processor.
Here, it means that mb() will either be implemented as "lock; addl
$0,0(%%esp)" or as "mfence", depending on whether the processor
supports MMX2 or not.

Sincerly,

Thomas
-- 
Thomas Petazzoni - thomas.petazzoni@xxxxxxxx
http://{thomas,sos,kos}.enix.org - http://www.toulibre.org
http://www.{livret,agenda}dulibre.org

--
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