From: Jakub Jelinek <jakub@redhat.com>
To: Andi Kleen <ak@muc.de>
Cc: Linus Torvalds <torvalds@transmeta.com>, linux-kernel@vger.kernel.org
Subject: Re: Why is get_current() not const function?
Date: Mon, 17 Mar 2003 12:39:39 -0500 [thread overview]
Message-ID: <20030317123939.H13397@devserv.devel.redhat.com> (raw)
In-Reply-To: <m3u1e1ykeq.fsf@averell.firstfloor.org>; from ak@muc.de on Mon, Mar 17, 2003 at 06:26:05PM +0100
On Mon, Mar 17, 2003 at 06:26:05PM +0100, Andi Kleen wrote:
> torvalds@transmeta.com (Linus Torvalds) writes:
>
> >> and why on x86-64
> >>the movq %%gs:0, %0 inline asm is volatile with "memory" clobber?
> >
> > Can't help you on that one, but it looks like it uses various helper
> > functions for doing the x86-64 per-processor data structures, and I bet
> > those helper functions are shared by _other_ users who definitely want
> > to have their data properly re-read. Ie "current()" may be constant in
> > process context, but that sure isn't true about a lot of other things in
> > the per-processor data structures.
>
> Yes, that's the big issue. const current requires non volatile read_pda()
> and making read_pda non volatile breaks lots of code currently and probably
> needs an audit over all users.
Well, that's one that is not particularly hard to fix.
Either a new set of pda access macros without volatile and memory clobber
can be written, or just get_current can use its own asm, ie.
static inline struct task_struct *get_current(void)
{
struct task_struct *t;
asm ("movq %%gs:%c1,%0" : "=r" (t) : "i"(pda_offset(pcurrent)));
return t;
}
Jakub
next prev parent reply other threads:[~2003-03-17 17:28 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
[not found] <20030313061926.S3910@devserv.devel.redhat.com.suse.lists.linux.kernel>
2003-03-13 13:31 ` Why is get_current() not const function? Andi Kleen
[not found] ` <b53pqi$ud9$1@penguin.transmeta.com.suse.lists.linux.kernel>
2003-03-17 17:26 ` Andi Kleen
2003-03-17 17:39 ` Jakub Jelinek [this message]
2003-03-17 19:11 Manfred Spraul
-- strict thread matches above, loose matches on Subject: below --
2003-03-13 11:19 Jakub Jelinek
2003-03-17 6:26 ` Linus Torvalds
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=20030317123939.H13397@devserv.devel.redhat.com \
--to=jakub@redhat.com \
--cc=ak@muc.de \
--cc=linux-kernel@vger.kernel.org \
--cc=torvalds@transmeta.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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.