[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <8475003d-d15d-4b70-abdf-1138626739e4@zytor.com>
Date: Sat, 26 Oct 2024 18:23:52 -0700
From: "H. Peter Anvin" <hpa@...or.com>
To: Uros Bizjak <ubizjak@...il.com>
Cc: Dave Hansen <dave.hansen@...el.com>, x86@...nel.org,
linux-kernel@...r.kernel.org, Thomas Gleixner <tglx@...utronix.de>,
Ingo Molnar <mingo@...nel.org>, Borislav Petkov <bp@...en8.de>,
Dave Hansen <dave.hansen@...ux.intel.com>
Subject: Re: [PATCH] x86/ioperm: Use atomic64_inc_return() in ksys_ioperm()
On 10/26/24 16:38, H. Peter Anvin wrote:
> On 10/26/24 16:28, H. Peter Anvin wrote:
>>
>> By any sane definition, the constraint should actually be an input
>> constraint on the frame pointer itself; something like:
>>
>> #define ASM_CALL_CONSTRAINT "r" (__builtin_frame_address(0))
>>
>> ... except that "r" really should be a %rbp constraint, but %rbp
>> doesn't seem to have a constraint letter. At least gcc 14.2 seems to
>> do the right thing anyway, though: __builtin_frame_address(0) seems to
>> force a frame pointer to have been created (even with -fomit-frame-
>> pointer specified, and in a leaf function), and the value is always
>> passed in %rbp (because why on Earth would it do it differently, when
>> it is sitting right there?)
>>
> cl
> This also matches the "tell the compiler [and programmer] what we
> actually mean" issue that you have mentioned in other contexts.
>
> Anyway, here is a simple test case that can be used to verify that this
> construct does indeed work; at least with gcc 14.2.1 and clang 18.1.8
> (the ones I ran a very quick test on).
>
> It's simple enough that it is pretty straightforward to mess around with
> various modifications. So far I haven't been able to trip up the
> compilers this way.
>
I filed a gcc bug report asking to clarify the documentation to
explicitly support this use case:
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=117311
-hpa
Powered by blists - more mailing lists