[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <33c61588-7083-4851-965a-f4f1d46ff44c@intel.com>
Date: Wed, 16 Oct 2024 12:43:46 -0700
From: Dave Hansen <dave.hansen@...el.com>
To: Andy Shevchenko <andriy.shevchenko@...ux.intel.com>
Cc: Ingo Molnar <mingo@...nel.org>, Uros Bizjak <ubizjak@...il.com>,
linux-mm@...ck.org, linux-kernel@...r.kernel.org, llvm@...ts.linux.dev,
Dennis Zhou <dennis@...nel.org>, Tejun Heo <tj@...nel.org>,
Christoph Lameter <cl@...ux.com>, Thomas Gleixner <tglx@...utronix.de>,
Ingo Molnar <mingo@...hat.com>, Borislav Petkov <bp@...en8.de>,
Dave Hansen <dave.hansen@...ux.intel.com>, x86@...nel.org,
"H. Peter Anvin" <hpa@...or.com>, Nathan Chancellor <nathan@...nel.org>,
Nick Desaulniers <ndesaulniers@...gle.com>, Bill Wendling
<morbo@...gle.com>, Justin Stitt <justinstitt@...gle.com>
Subject: Re: [PATCH v1 1/1] x86/percpu: Cast -1 to argument type when
comparing in percpu_add_op()
On 10/16/24 11:20, Andy Shevchenko wrote:
>> Maybe more readable, but wouldn't it be theoretically buggy for u64?
>> I'm talking about the case when u64 == UINT_MAX, which will be true
>> in your case and false in mine.
>>
>>> const int pao_ID__ = (__builtin_constant_p(val) &&
>>> ((val) == 1 || (int)(val) == -1)) ?
>>>
>>> (int)(val) : 0;
> This code _is_ buggy, thanks to my new test case.
>
> [ 66.161375] pcp -1 (0xffffffffffffffff) != expected 4294967295 (0xffffffff)
Thanks for pointing that out Andy (and Peter too)!
Powered by blists - more mailing lists