From: Josh Stone <jistone@redhat.com>
To: Linus Torvalds <torvalds@linux-foundation.org>
Cc: linux-kernel@vger.kernel.org,
Masami Hiramatsu <masami.hiramatsu.pt@hitachi.com>,
Thomas Gleixner <tglx@linutronix.de>,
Ingo Molnar <mingo@redhat.com>, "H. Peter Anvin" <hpa@zytor.com>,
x86@kernel.org, Srikar Dronamraju <srikar@linux.vnet.ibm.com>,
Jakub Jelinek <jakub@redhat.com>
Subject: Re: [PATCH] x86: Fix compilation bug in kprobes' twobyte_is_boostable
Date: Sun, 23 Oct 2011 10:07:41 -0700 [thread overview]
Message-ID: <4EA449DD.1010801@redhat.com> (raw)
In-Reply-To: <CA+55aFzXHLrcP1idskKJXcxdPfjSCfgmtYzd7r4uA4ni1E+k+A@mail.gmail.com>
On 10/22/2011 05:25 PM, Linus Torvalds wrote:
> Hmm. I'd *much* rather do this in arch/x86/include/asm/bitops.h
> instead, methinks.
Agreed, that's why I tried that first.
> Also, rather than your
>
>> See also my more general fix, https://lkml.org/lkml/2011/10/6/412
>
> wouldn't the simple fix be just to add the volatile there to the cast
> we already do, ie something like the appended (cut-and-paste, so it's
> whitespace-damaged, but you get the idea).
Unfortunately, no. Whatever const-propagation gcc is doing here
(somewhat wrongly per PR50571) is not affected by volatile on that cast.
I also tried leaving it to the parameter type (no cast), no help.
Another historical note is that the parameter used to be void* until
commit 5136dea5, which I suppose is why the current cast exists at all.
Reverting that still doesn't affect the immediate problem.
It may have gotten lost in the various messages I sent, but note that
this is only happening on i386, where the source u32 matches the size of
the casted long. On x86_64, where long is of course bigger than u32,
the pointer aliasing seems to prevent the issue. So yet another fix is
to make that asm cast something silly that will always alias, like
(*(char*)addr). That might be even more magical/fragile though.
> And I don't mind volatile in code nearly as much as I mind volatile on
> the data structures (it's one of my "C typing was misdesigned" pet
> peeves: I think "volatile" is about the access, not about the data)
I just tried removing the const from twobyte_is_boostable[], and that
also does the trick. Not sure why I didn't try that first -- I guess
because I saw all the volatiles in bitops. Is that more palatable, or
would you still rather try to fix it in bitops.h directly?
> - Long long ago, we had that "big array" approach for ADDR too. So
> we've wavered between the volatile and using a block memory op. But
> we've used the "volatile" for a long time now for the bit change ones,
> so I don't think we should mix concepts like your patch.
Do you recall why it settled on volatile? That seems like the less
descriptive of the two approaches. But "long long ago" appears to be
beyond recorded (git) history...
Thanks,
Josh
next prev parent reply other threads:[~2011-10-23 17:07 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2011-10-21 20:33 [PATCH] x86: Fix compilation bug in kprobes' twobyte_is_boostable Josh Stone
2011-10-23 0:25 ` Linus Torvalds
2011-10-23 17:07 ` Josh Stone [this message]
2011-10-23 21:19 ` Linus Torvalds
2011-10-24 17:15 ` Josh Stone
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=4EA449DD.1010801@redhat.com \
--to=jistone@redhat.com \
--cc=hpa@zytor.com \
--cc=jakub@redhat.com \
--cc=linux-kernel@vger.kernel.org \
--cc=masami.hiramatsu.pt@hitachi.com \
--cc=mingo@redhat.com \
--cc=srikar@linux.vnet.ibm.com \
--cc=tglx@linutronix.de \
--cc=torvalds@linux-foundation.org \
--cc=x86@kernel.org \
/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;
as well as URLs for NNTP newsgroup(s).