Ingo Molnar wrote:
> no, that's not what it does. It measures 50000000 switches of the _same_
> selector value, without using any of the selectors in the loop itself.
> I.e. no mixing at all! But when the kernel and userspace uses %gs, it's
> the cost of switching between two selector values of %gs that has to be
> measured. Your code does not measure that at all, AFAICS.
>
I think you're misreading it. This is the inner loop:
for(i = 0; i < COUNT; i++) {
asm volatile("push %%gs; mov %1, %%gs; addl $1, %%gs:%0; popl %%gs"
: "+m" (*offset): "r" (seg) : "memory");
sync();
}
return "gs";
On entry, %gs will contain the normal usermode TLS selector. "seg" is
another selector allocated with set_thread_area(). The asm pushes the
old %gs, loads the new one, uses a memory address via the new segment,
then restores the previous %gs.
So given this output:
"Genuine Intel(R) CPU T2400 @ 1.83GHz" @1000Mhz (6,14,8):
ds=7b fs=0 gs=33 ldt=f gdt=3b CPUTIME
[...]
The initial %fs and %gs are 0 and 0x33 respectively, and it is using
0x3b as the other GDT selector (and 0xf as the other LDT selector).
J
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to [email protected]
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
[Index of Archives]
[Kernel Newbies]
[Netfilter]
[Bugtraq]
[Photo]
[Stuff]
[Gimp]
[Yosemite News]
[MIPS Linux]
[ARM Linux]
[Linux Security]
[Linux RAID]
[Video 4 Linux]
[Linux for the blind]
[Linux Resources]