From: Guenter Roeck <linux@roeck-us.net>
To: Andrew Morton <akpm@linux-foundation.org>,
Rasmus Villemoes <linux@rasmusvillemoes.dk>
Cc: Sowmini Varadhan <sowmini.varadhan@oracle.com>,
linux-kernel@vger.kernel.org, benh@kernel.crashing.org,
davem@davemloft.net
Subject: Re: [PATCH] iommu-common: Do not use 64 bit constant 0xffffffffffffffffl for computing align_mask
Date: Mon, 20 Jul 2015 17:26:16 -0700 [thread overview]
Message-ID: <55AD91A8.8060800@roeck-us.net> (raw)
In-Reply-To: <20150720162800.734632f4e05ffae173cff527@linux-foundation.org>
On 07/20/2015 04:28 PM, Andrew Morton wrote:
> On Mon, 20 Jul 2015 19:57:18 +0200 Rasmus Villemoes <linux@rasmusvillemoes.dk> wrote:
>
>> On Mon, Jul 20 2015, Guenter Roeck <linux@roeck-us.net> wrote:
>>
>>> So either case ~0l appears to be wrong; it should be ~0ul.
>>
>> Yes, right-shifting -1 of any type is probably always wrong, as it will
>> always give -1 again.
>
> Not for unsigned types.
>
> The kernel uses "-1UL" and "-1ULL" quite a lot - it's a convenient way
> of saying "all ones, regardless of size". Also, assigning plain old
> "-1" to an unsigned variable will make that variable all-ones
> regardless of size.
>
> In this case I expect we could do
>
> align_mask = -1UL >> (64 - align_order);
>
-1ul works, at least on x86 (32 and 64 bit).
> but I don't know about that 64. Maybe it should be BITS_PER_LONG?
>
I think that is going to be in the next version of the patch.
Guenter
next prev parent reply other threads:[~2015-07-21 0:26 UTC|newest]
Thread overview: 10+ messages / expand[flat|nested] mbox.gz Atom feed top
2015-07-19 12:20 [PATCH] iommu-common: Do not use 64 bit constant 0xffffffffffffffffl for computing align_mask Sowmini Varadhan
2015-07-19 15:27 ` Guenter Roeck
2015-07-19 20:25 ` Rasmus Villemoes
2015-07-19 20:41 ` Sowmini Varadhan
2015-07-20 1:58 ` Guenter Roeck
2015-07-20 17:57 ` Rasmus Villemoes
2015-07-20 19:25 ` Sowmini Varadhan
2015-07-20 23:28 ` Andrew Morton
2015-07-21 0:26 ` Guenter Roeck [this message]
2015-07-20 14:44 ` Sowmini Varadhan
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=55AD91A8.8060800@roeck-us.net \
--to=linux@roeck-us.net \
--cc=akpm@linux-foundation.org \
--cc=benh@kernel.crashing.org \
--cc=davem@davemloft.net \
--cc=linux-kernel@vger.kernel.org \
--cc=linux@rasmusvillemoes.dk \
--cc=sowmini.varadhan@oracle.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;
as well as URLs for NNTP newsgroup(s).