From: "H. Peter Anvin" <hpa@zytor.com>
To: Ingo Molnar <mingo@elte.hu>
Cc: Andi Kleen <andi@firstfloor.org>,
Linus Torvalds <torvalds@linux-foundation.org>,
Andi Kleen <ak@suse.de>, Chuck Ebbert <cebbert@redhat.com>,
Roland McGrath <roland@redhat.com>,
Andrew Morton <akpm@linux-foundation.org>,
linux-kernel@vger.kernel.org,
Thomas Gleixner <tglx@linutronix.de>,
Jeremy Fitzhardinge <jeremy@goop.org>,
zach@vmware.com
Subject: Re: [PATCH x86/mm 6/6] x86-64 ia32 ptrace get/putreg32 current task
Date: Thu, 29 Nov 2007 12:01:53 -0800 [thread overview]
Message-ID: <474F1AB1.1060300@zytor.com> (raw)
In-Reply-To: <20071129194416.GB15245@elte.hu>
Ingo Molnar wrote:
> * Andi Kleen <andi@firstfloor.org> wrote:
>
>> For i386 iirc Jeremy/Zach did the benchmarking and they settled on %fs
>> because it was faster for something (originally it was %gs too)
>
> yep. IIRC, some CPUs only optimize %fs because that's what Windows uses
> and leaves Linux with %gs out in the cold. There's also a performance
> penalty for overlapping segment use, if the segment cache is single
> entry only with an additional optimization for NULL [which just hides
> the segment cache].
>
For the 32-bit case, which is the only one that can be changed at all:
I guess, specifically, that assuming a sysenter implementation (meaning
CS is handled ad hoc by the sysenter/sysexit instructions) we have
USER_DS, KERNEL_DS, and the kernel thread pointer. If the segments
don't overlap, the user thread pointer gets loaded once per exec or task
switch, and doesn't change in between. If they do, the user thread
pointer has to be reloaded on system call exit.
A nonzero segment load involves a memory reference followed by
data-dependent traps on that reference, so the amount of reordering the
CPU can do to hide that latency is limited. A zero segment load doesn't
perform the memory reference at all.
Note that a segment cache (a proper cache, not the segment descriptor
registers that the Intel docs bogusly call a "cache") does *not* save
the memory reference, since if the descriptor has changed in memory it
*has* to be honoured; it only allows it to be performed lazily (assume
the cache is valid, then throw an internal exception and don't commit
state if the descriptor stored in the cache tag doesn't match the
descriptor loaded from memory.)
-hpa
next prev parent reply other threads:[~2007-11-29 20:03 UTC|newest]
Thread overview: 28+ messages / expand[flat|nested] mbox.gz Atom feed top
2007-11-29 0:38 [PATCH x86/mm 1/6] x86-64 ia32 ptrace pt_regs cleanup Roland McGrath
2007-11-29 0:40 ` [PATCH x86/mm 2/6] x86-64 ptrace whitespace Roland McGrath
2007-11-29 0:40 ` [PATCH x86/mm 3/6] x86-32 " Roland McGrath
2007-11-29 0:41 ` [PATCH x86/mm 4/6] x86-64 ptrace get/putreg current task Roland McGrath
2007-11-29 17:39 ` Christoph Hellwig
2007-11-29 0:42 ` [PATCH x86/mm 5/6] x86-32 " Roland McGrath
2007-11-29 0:42 ` [PATCH x86/mm 6/6] x86-64 ia32 ptrace get/putreg32 " Roland McGrath
2007-11-29 17:34 ` Chuck Ebbert
2007-11-29 18:09 ` Linus Torvalds
2007-11-29 18:16 ` H. Peter Anvin
2007-11-29 18:31 ` Linus Torvalds
2007-11-29 18:45 ` H. Peter Anvin
2007-11-29 19:08 ` Linus Torvalds
2007-11-29 19:16 ` H. Peter Anvin
2007-11-29 19:27 ` Andi Kleen
2007-11-29 19:44 ` Ingo Molnar
2007-11-29 20:01 ` H. Peter Anvin [this message]
2007-12-01 23:44 ` Jeremy Fitzhardinge
2007-11-29 19:49 ` Linus Torvalds
2007-11-29 20:11 ` Andi Kleen
2007-11-29 20:23 ` Linus Torvalds
2007-11-29 18:17 ` Chuck Ebbert
2007-11-29 18:23 ` H. Peter Anvin
2007-11-29 22:25 ` Roland McGrath
2007-11-29 22:34 ` Linus Torvalds
2007-11-29 22:21 ` Roland McGrath
2007-11-29 23:00 ` Chuck Ebbert
2007-11-29 10:39 ` [PATCH x86/mm 1/6] x86-64 ia32 ptrace pt_regs cleanup Ingo Molnar
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=474F1AB1.1060300@zytor.com \
--to=hpa@zytor.com \
--cc=ak@suse.de \
--cc=akpm@linux-foundation.org \
--cc=andi@firstfloor.org \
--cc=cebbert@redhat.com \
--cc=jeremy@goop.org \
--cc=linux-kernel@vger.kernel.org \
--cc=mingo@elte.hu \
--cc=roland@redhat.com \
--cc=tglx@linutronix.de \
--cc=torvalds@linux-foundation.org \
--cc=zach@vmware.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox