From: "H. Peter Anvin" <hpa@zytor.com>
To: Linus Torvalds <torvalds@linux-foundation.org>
Cc: Peter Zijlstra <a.p.zijlstra@chello.nl>,
Borislav Petkov <borislav.petkov@amd.com>,
mingo@kernel.org, linux-kernel@vger.kernel.org,
frank.arnold@amd.com, akpm@linux-foundation.org,
tglx@linutronix.de, linux-tip-commits@vger.kernel.org
Subject: Re: [tip:x86/mce] x86/bitops: Move BIT_64() for a wider use
Date: Wed, 23 May 2012 09:47:15 -0700 [thread overview]
Message-ID: <4FBD1493.7000104@zytor.com> (raw)
In-Reply-To: <CA+55aFx383ZXZPrbe+C2Cv=Rr=FsARfs8=OXs-B0hK4Dzb-QLg@mail.gmail.com>
On 05/23/2012 09:43 AM, Linus Torvalds wrote:
> On Wed, May 23, 2012 at 9:31 AM, H. Peter Anvin <hpa@zytor.com> wrote:
>>>>
>>>> And it should return UL for shift values < 32 and ULL otherwise.
>>>
>>
>> Why do you want that behavior? That seems bizarre...
>
> We *have* to have that behavior.
>
> A 64-bit value on a 32-bit architecture has fundamentally different
> semantics than a 32-bit one.
>
> It expands arithmetic, but it has other semantic differences too.
> Think "printf()" etc. We don't want to force people to do 64-bit
> arithmetic on x86-32 when they are working with BIT(0), for chrissake!
>
> So if people make BIT(0) be a 64-bit value on a 32-bit architecture,
> I'm going to run around naked with a chainsaw, and call people morons.
> That's just not acceptable.
>
BIT(0), okay. I thought we were talking about BIT_64() here...
Any reason we can't just tell people to use BIT() for a native "unsigned
long" type (32/64 bits) and BIT_64() if they really want a 64-bit result?
There are good reasons for the latter. Consider, for example:
u64 msr;
...
msr &= ~BIT_64(1);
This *better* not be an unsigned 32 bit value, or we just chopped off
the upper half. In this case and similar ones the 64-bitness of the
result really matters.
-hpa
--
H. Peter Anvin, Intel Open Source Technology Center
I work for Intel. I don't speak on their behalf.
next prev parent reply other threads:[~2012-05-23 16:47 UTC|newest]
Thread overview: 28+ messages / expand[flat|nested] mbox.gz Atom feed top
2012-05-22 10:53 [PATCH 1/2] x86, bitops: Move BIT_64 " Borislav Petkov
2012-05-22 10:53 ` [PATCH 2/2] x86, MCE: Fix 32-bit build Borislav Petkov
2012-05-23 16:08 ` [tip:x86/mce] x86/mce: " tip-bot for Borislav Petkov
2012-05-23 16:18 ` Peter Zijlstra
2012-05-23 16:23 ` Borislav Petkov
2012-05-23 16:31 ` Peter Zijlstra
2012-05-23 16:44 ` Borislav Petkov
2012-05-23 16:46 ` Peter Zijlstra
2012-05-23 16:54 ` Borislav Petkov
2012-05-23 16:07 ` [tip:x86/mce] x86/bitops: Move BIT_64() for a wider use tip-bot for Borislav Petkov
2012-05-23 16:10 ` Peter Zijlstra
2012-05-23 16:11 ` H. Peter Anvin
2012-05-23 16:19 ` Borislav Petkov
2012-05-23 16:29 ` Peter Zijlstra
2012-05-23 16:31 ` H. Peter Anvin
2012-05-23 16:43 ` Linus Torvalds
2012-05-23 16:47 ` H. Peter Anvin [this message]
2012-05-23 16:50 ` H. Peter Anvin
2012-05-23 16:54 ` Linus Torvalds
2012-05-23 16:55 ` H. Peter Anvin
2012-05-23 16:53 ` Borislav Petkov
2012-05-23 16:57 ` Linus Torvalds
2012-05-23 17:11 ` Borislav Petkov
2012-05-23 17:37 ` Linus Torvalds
2012-05-23 16:54 ` Peter Zijlstra
2012-05-23 16:40 ` Linus Torvalds
2012-05-23 16:42 ` H. Peter Anvin
2012-05-23 16:45 ` 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=4FBD1493.7000104@zytor.com \
--to=hpa@zytor.com \
--cc=a.p.zijlstra@chello.nl \
--cc=akpm@linux-foundation.org \
--cc=borislav.petkov@amd.com \
--cc=frank.arnold@amd.com \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-tip-commits@vger.kernel.org \
--cc=mingo@kernel.org \
--cc=tglx@linutronix.de \
--cc=torvalds@linux-foundation.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
Powered by JetHome