[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <CAFULd4YBRcWhjwg_kMcDi4rN2rL61hAOwbe=b8FJfhxaS7VDhg@mail.gmail.com>
Date: Wed, 2 Apr 2025 23:18:48 +0200
From: Uros Bizjak <ubizjak@...il.com>
To: Ingo Molnar <mingo@...nel.org>
Cc: Linus Torvalds <torvalds@...ux-foundation.org>, x86@...nel.org,
linux-kernel@...r.kernel.org, Thomas Gleixner <tglx@...utronix.de>,
Borislav Petkov <bp@...en8.de>, Dave Hansen <dave.hansen@...ux.intel.com>,
"H. Peter Anvin" <hpa@...or.com>
Subject: Re: [PATCH -tip 1/4] x86/idle: Fix argument type for MONITOR{,X} and
MWAIT{,X} instructions
On Wed, Apr 2, 2025 at 10:48 PM Ingo Molnar <mingo@...nel.org> wrote:
>
>
> * Uros Bizjak <ubizjak@...il.com> wrote:
>
> > MONITOR and MONITORX expect 32-bit unsigned integer argument in %ecx
> > and %edx registers. MWAIT and MWAITX expect 32-bit usigned int
> > argument in %eax and %ecx registers.
>
> Please always include a 0/4 cover letter as well for such series, which
> gives people a chance to reply to the whole series, instead of having
> to awkwardly pick a patch to reply to. :-)
>
> Such as this general feedback:
>
> I've applied this series with edits to the changelogs, note in
> particular:
>
> patch #1:
>
> - Changed verbiage from 'fix' to 'standardize to u32'. There was no
> bug to fix, using 'long' instead of 'int' is at worst an ineffiency.
Indeed, but when patch #2 introduces insn mnemonic:
asm volatile("monitor %0, %1, %2" :: "a" (eax), "c" (ecx), "d" (edx));
then the type decides between %rcx/%rdx and %ecx/%edx. Assembler
checks arguments of MONITOR insn mnemonic and fails compilation with
the former.
> patch #3:
>
> - Provided much needed historic context behind ;, \t, \n beautifiers
> used in asm() statements. These aren't just random noise added in.
Please note that removed delimiters were at the end of asm template.
The compiler adds \n\t at the end on its own, as demonstrated with the
following example:
void foo (unsigned int a, unsigned long b)
{
asm ("foo %0 %1" :: "r" (a), "r" (b));
}
gcc -S (unredacted dump):
foo:
.LFB0:
.cfi_startproc
#APP
# 3 "tt.c" 1
foo %edi %rsi
# 0 "" 2
#NO_APP
ret
.cfi_endproc
.LFE0:
Please note that asm instructions are perfectly aligned. So, at the
end of the day, the delimiters at the end of asm templates *are* just
noise.
Thanks,
Uros.
Powered by blists - more mailing lists