Re: [RFC, patch] i386: vgetcpu(), take 2

From: Andi Kleen
Date: Wed Jun 21 2006 - 19:04:07 EST


On Thursday 22 June 2006 00:59, Rohit Seth wrote:
> On Thu, 2006-06-22 at 00:21 +0200, Andi Kleen wrote:
> > > Can we use similar mechanism to access pda in vsyscall in x86_64 (by
> > > storing the address of pda there).
> >
> >
> > You mean in the kernel? %gs prefix is a lot faster than this.
> >
>
> Yes it is. And will work if we are okay to swap to kernel gs in
> vsyscall code.

swapgs is only allowed in ring 0.

>
> > Also the limit is only 20bit, not enough for a full address.
> >
>
> I was thinking of storing it is base address part of the descriptor and
> then using the memory load to read it in vsyscall. (Keeping the p bit
> to zero in the descriptor).

I'm still not sure where and for what you want to use this. In user space
or in kernel space? And what information should be stored in there?

>
> > For user space it's useful though, but I don't see any immediate uses
> > other than cpu number and node number. For most purposes glibc TLS
> > (which uses %fs) is probably sufficient.
>
> cpu and node number are really important (for the reasons that you
> mentioned in your initial mail on vgetcpu). In addition to that I was
> thinking in terms of having some counters like nmi_count that is already
> there and per cpu specific.

For what would you need nmi count in user space?

> Besides, not having to use the tcache part in the proposed system call
> seems to just make the interface cleaner.

tcache is still far faster than LSL (which is slower than RDTSCP)

-Andi
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/