From: Albert Cahalan <albert@users.sf.net>
To: William Lee Irwin III <wli@holomorphy.com>
Cc: Jakub Jelinek <jakub@redhat.com>,
Albert Cahalan <albert@users.sourceforge.net>,
linux-kernel mailing list <linux-kernel@vger.kernel.org>,
ak@muc.de
Subject: Re: get_current is __pure__, maybe __const__ even
Date: 15 Sep 2004 23:49:38 -0400 [thread overview]
Message-ID: <1095306363.3874.101.camel@cube> (raw)
In-Reply-To: <20040916023604.GH9106@holomorphy.com>
On Wed, 2004-09-15 at 22:36, William Lee Irwin III wrote:
> On Wed, Sep 15, 2004 at 07:15:18PM -0400, Jakub Jelinek wrote:
> >>> current will certainly change in schedule (),
>
> On Wed, Sep 15, 2004 at 10:10:20PM -0400, Albert Cahalan wrote:
> > Not really!
>
> Yes it does. The interior of schedule() is C and must be compiled also.
Sure. It doesn't matter. The part that matters is
all arch-specific assembly.
Hey, the arm port already uses __const__.
Unless the arm port is broken, there's proof.
> At some point in the past, I wrote:
> >> Why would barrier() not suffice?
>
> On Wed, Sep 15, 2004 at 10:10:20PM -0400, Albert Cahalan wrote:
> > I don't think even barrier() is needed.
> > Suppose gcc were to cache the value of
> > current over a schedule. Who cares? It'll
> > be the same after schedule() as it was
> > before.
>
> Not over a call to schedule(). In the midst of schedule().
OK, let's look.
First, there's fork/vfork/clone. At no point does
"current" change. A process comes into existance
with a ready-made current.
Second, there's sched.c with context_switch().
That does everything via switch_to, like so:
/* Here we just switch the register state and the stack. */
switch_to(prev, next, prev);
No problem. Now I only need to show that switch_to()
is safe. Unfortunately, it's arch-specific code.
I'll look at a few examples...
x86_64: assembly, and thus OK
i386: assembly, and thus OK
ppc: assembly, and thus OK
arm: already uses __const__ :-)
To find a problem, you need to find an arch which
runs C code with current being inconsistent with
the stack or registers. That would be wild and evil.
In any case, adding __attribute__((__const__)) is
an arch-specific change. A truly evil arch running
C code with an inconsistent current can just leave
off the attribute or, better yet, stop being evil.
next prev parent reply other threads:[~2004-09-16 3:53 UTC|newest]
Thread overview: 19+ messages / expand[flat|nested] mbox.gz Atom feed top
2004-09-15 22:50 get_current is __pure__, maybe __const__ even Albert Cahalan
2004-09-15 23:15 ` Jakub Jelinek
2004-09-15 23:29 ` William Lee Irwin III
2004-09-16 2:10 ` Albert Cahalan
2004-09-16 2:36 ` William Lee Irwin III
2004-09-16 2:47 ` Nick Piggin
2004-09-16 3:23 ` William Lee Irwin III
2004-09-16 3:49 ` Albert Cahalan [this message]
2004-09-16 3:59 ` William Lee Irwin III
2004-09-16 9:04 ` Russell King
2004-09-16 9:11 ` Andi Kleen
2004-09-16 9:30 ` Russell King
2004-09-16 11:03 ` Andi Kleen
2004-09-16 14:36 ` Russell King
2004-09-15 23:27 ` William Lee Irwin III
[not found] <2ER4z-46B-17@gated-at.bofh.it>
2004-09-16 6:58 ` Andi Kleen
2004-09-16 13:43 ` Albert Cahalan
2004-09-16 14:14 ` Albert Cahalan
2004-09-16 19:27 ` Andi Kleen
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=1095306363.3874.101.camel@cube \
--to=albert@users.sf.net \
--cc=ak@muc.de \
--cc=albert@users.sourceforge.net \
--cc=jakub@redhat.com \
--cc=linux-kernel@vger.kernel.org \
--cc=wli@holomorphy.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