From: Alexey Dobriyan <adobriyan@gmail.com>
To: Dave Hansen <dave.hansen@intel.com>
Cc: tglx@linutronix.de, mingo@redhat.com, bp@alien8.de,
dave.hansen@linux.intel.com, x86@kernel.org, hpa@zytor.com,
linux-kernel@vger.kernel.org
Subject: Re: [PATCH 1/4] x86/asm: inline constant inputs in rdpkru(), wrpkru()
Date: Fri, 7 Mar 2025 19:19:52 +0300 [thread overview]
Message-ID: <360f4fcc-8141-449c-a5fc-cd91182e0899@p183> (raw)
In-Reply-To: <3e354397-1666-4d63-b863-ef9f9d31fa37@intel.com>
On Thu, Mar 06, 2025 at 01:35:01PM -0800, Dave Hansen wrote:
> On 3/6/25 13:07, Alexey Dobriyan wrote:
> > static inline void wrpkru(u32 pkru)
> > {
> > - u32 ecx = 0, edx = 0;
> > -
> > /*
> > * "wrpkru" instruction. Loads contents in EAX to PKRU,
> > * requires that ecx = edx = 0.
> > */
> > asm volatile(".byte 0x0f,0x01,0xef\n\t"
> > - : : "a" (pkru), "c"(ecx), "d"(edx));
> > + : : "a" (pkru), "c" (0), "d" (0));
> > }
>
> Hey Alexey,
>
> I appreciate the patch. But I do like how it's written currently. I
> honestly kinda wish it went even further and did:
>
> u32 eax = pkru;
I _think_ you can write "eax" (pkru) .
I don't like the comment either. It just reiterates the SDM.
Trailing \n\t too -- they don't do anything in one-liners.
The function is basically:
// wrpkru
asm volatile (
".byte 0x0f,0x01,0xef"
:
: "a" (pkru), "d" (0) , "c" (0)
);
next prev parent reply other threads:[~2025-03-07 16:19 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-03-06 21:07 Alexey Dobriyan
2025-03-06 21:35 ` Dave Hansen
2025-03-07 16:19 ` Alexey Dobriyan [this message]
2025-03-07 6:12 Alexey Dobriyan
2025-03-07 16:29 ` Dave Hansen
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=360f4fcc-8141-449c-a5fc-cd91182e0899@p183 \
--to=adobriyan@gmail.com \
--cc=bp@alien8.de \
--cc=dave.hansen@intel.com \
--cc=dave.hansen@linux.intel.com \
--cc=hpa@zytor.com \
--cc=linux-kernel@vger.kernel.org \
--cc=mingo@redhat.com \
--cc=tglx@linutronix.de \
--cc=x86@kernel.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
all inboxes | Powered by JetHome®