[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [PATCH 00/32] x86/msr: Drop 32-bit MSR interfaces
- To: Arnd Bergmann <arnd@xxxxxxxx>, linux-kernel@xxxxxxxxxxxxxxx, linux-pm@xxxxxxxxxxxxxxx, "linux-edac@xxxxxxxxxxxxxxx" <linux-edac@xxxxxxxxxxxxxxx>, x86@xxxxxxxxxx, linux-acpi@xxxxxxxxxxxxxxx, kvm@xxxxxxxxxxxxxxx, linux-coco@xxxxxxxxxxxxxxx, linux-pci@xxxxxxxxxxxxxxx, virtualization@xxxxxxxxxxxxxxx, linux-ide@xxxxxxxxxxxxxxx, dri-devel@xxxxxxxxxxxxxxxxxxxxx, linux-fbdev@xxxxxxxxxxxxxxx, linux-crypto@xxxxxxxxxxxxxxx, "open list:GPIO SUBSYSTEM" <linux-gpio@xxxxxxxxxxxxxxx>, linux-hyperv@xxxxxxxxxxxxxxx, linux-hwmon@xxxxxxxxxxxxxxx, linux-perf-users@xxxxxxxxxxxxxxx, linux-mtd@xxxxxxxxxxxxxxxxxxx, platform-driver-x86@xxxxxxxxxxxxxxx
- From: Jürgen Groß <jgross@xxxxxxxx>
- Date: Mon, 29 Jun 2026 09:01:34 +0200
- Authentication-results: eu.smtp.expurgate.cloud; dkim=pass header.s=google header.d=suse.com header.i="@suse.com" header.h="In-Reply-To:Autocrypt:From:Content-Language:References:Cc:To:Subject:User-Agent:MIME-Version:Date:Message-ID"
- Autocrypt: addr=jgross@xxxxxxxx; keydata= xsBNBFOMcBYBCACgGjqjoGvbEouQZw/ToiBg9W98AlM2QHV+iNHsEs7kxWhKMjrioyspZKOB ycWxw3ie3j9uvg9EOB3aN4xiTv4qbnGiTr3oJhkB1gsb6ToJQZ8uxGq2kaV2KL9650I1SJve dYm8Of8Zd621lSmoKOwlNClALZNew72NjJLEzTalU1OdT7/i1TXkH09XSSI8mEQ/ouNcMvIJ NwQpd369y9bfIhWUiVXEK7MlRgUG6MvIj6Y3Am/BBLUVbDa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V85TyVgWlldNcgdv7nn1Sq8g HwB2BHdIAkYce3hEoDQXt/mKlgEGsLpzJcnLKimtPXQQy9TxUaLBe9PInPd+Ohix0XOlY+Uk QFEx50Ki3rSDl2Zt2tnkNYKUCvTJq7jvOlaPd6d/W0tZqpyy7KVay+K4aMobDsodB3dvEAs6 ScCnh03dDAFgIq5nsB11j3KPKdVoPlfucX2c7kGNH+LUMbzqV6beIENfNexkOfxHfw==
- Cc: "Rafael J . Wysocki" <rafael@xxxxxxxxxx>, Daniel Lezcano <daniel.lezcano@xxxxxxxxxx>, Zhang Rui <rui.zhang@xxxxxxxxx>, "lukasz.luba@xxxxxxx" <lukasz.luba@xxxxxxx>, Jason Baron <jbaron@xxxxxxxxxx>, Borislav Petkov <bp@xxxxxxxxx>, Tony Luck <tony.luck@xxxxxxxxx>, Yazen Ghannam <yazen.ghannam@xxxxxxx>, Len Brown <lenb@xxxxxxxxxx>, Pavel Machek <pavel@xxxxxxxxxx>, Thomas Gleixner <tglx@xxxxxxxxxx>, Ingo Molnar <mingo@xxxxxxxxxx>, Dave Hansen <dave.hansen@xxxxxxxxxxxxxxx>, "H. Peter Anvin" <hpa@xxxxxxxxx>, Sean Christopherson <seanjc@xxxxxxxxxx>, Paolo Bonzini <pbonzini@xxxxxxxxxx>, "Kirill A. Shutemov" <kas@xxxxxxxxxx>, Rick Edgecombe <rick.p.edgecombe@xxxxxxxxx>, Pu Wen <puwen@xxxxxxxx>, Bjorn Helgaas <bhelgaas@xxxxxxxxxx>, Ajay Kaher <ajay.kaher@xxxxxxxxxxxx>, Alexey Makhalov <alexey.makhalov@xxxxxxxxxxxx>, Broadcom internal kernel review list <bcm-kernel-feedback-list@xxxxxxxxxxxx>, Viresh Kumar <viresh.kumar@xxxxxxxxxx>, Reinette Chatre <reinette.chatre@xxxxxxxxx>, Dave Martin <Dave.Martin@xxxxxxx>, James Morse <james.morse@xxxxxxx>, Babu Moger <babu.moger@xxxxxxx>, Tony W Wang-oc <TonyWWang-oc@xxxxxxxxxxx>, Damien Le Moal <dlemoal@xxxxxxxxxx>, Niklas Cassel <cassel@xxxxxxxxxx>, Dave Airlie <airlied@xxxxxxxxxx>, Helge Deller <deller@xxxxxx>, linux-geode@xxxxxxxxxxxxxxxxxxx, Olivia Mackall <olivia@xxxxxxxxxxx>, Herbert Xu <herbert@xxxxxxxxxxxxxxxxxxx>, Linus Walleij <linusw@xxxxxxxxxx>, Bartosz Golaszewski <brgl@xxxxxxxxxx>, Greg Kroah-Hartman <gregkh@xxxxxxxxxxxxxxxxxxx>, "K. Y. Srinivasan" <kys@xxxxxxxxxxxxx>, Haiyang Zhang <haiyangz@xxxxxxxxxxxxx>, Wei Liu <wei.liu@xxxxxxxxxx>, Dexuan Cui <decui@xxxxxxxxxxxxx>, Long Li <longli@xxxxxxxxxxxxx>, Guenter Roeck <linux@xxxxxxxxxxxx>, Peter Zijlstra <peterz@xxxxxxxxxxxxx>, Arnaldo Carvalho de Melo <acme@xxxxxxxxxx>, Namhyung Kim <namhyung@xxxxxxxxxx>, Mark Rutland <mark.rutland@xxxxxxx>, Alexander Shishkin <alexander.shishkin@xxxxxxxxxxxxxxx>, Jiri Olsa <jolsa@xxxxxxxxxx>, Ian Rogers <irogers@xxxxxxxxxx>, Adrian Hunter <adrian.hunter@xxxxxxxxx>, James Clark <james.clark@xxxxxxxxxx>, Josh Poimboeuf <jpoimboe@xxxxxxxxxx>, Pawan Gupta <pawan.kumar.gupta@xxxxxxxxxxxxxxx>, Vitaly Kuznetsov <vkuznets@xxxxxxxxxx>, Andy Lutomirski <luto@xxxxxxxxxx>, Boris Ostrovsky <boris.ostrovsky@xxxxxxxxxx>, Huang Rui <ray.huang@xxxxxxx>, Mario Limonciello <mario.limonciello@xxxxxxx>, Perry Yuan <perry.yuan@xxxxxxx>, K Prateek Nayak <kprateek.nayak@xxxxxxx>, "srinivas.pandruvada@xxxxxxxxxxxxxxx" <srinivas.pandruvada@xxxxxxxxxxxxxxx>, Artem Bityutskiy <artem.bityutskiy@xxxxxxxxxxxxxxx>, Artem Bityutskiy <dedekind1@xxxxxxxxx>, Miquel Raynal <miquel.raynal@xxxxxxxxxxx>, Richard Weinberger <richard@xxxxxx>, Vignesh Raghavendra <vigneshr@xxxxxx>, Ashok Raj <ashok.raj.linux@xxxxxxxxx>, Hans de Goede <hansg@xxxxxxxxxx>, Ilpo Järvinen <ilpo.jarvinen@xxxxxxxxxxxxxxx>, Rajneesh Bhardwaj <irenic.rajneesh@xxxxxxxxx>, David E Box <david.e.box@xxxxxxxxx>, xen-devel@xxxxxxxxxxxxxxxxxxxx
- Delivery-date: Mon, 29 Jun 2026 07:01:44 +0000
- List-id: Xen developer discussion <xen-devel.lists.xenproject.org>
On 29.06.26 08:52, Arnd Bergmann wrote:
On Mon, Jun 29, 2026, at 08:04, Juergen Gross wrote:
For accessing the MSR registers on the local CPU, there are 2 types of
interfaces: the "modern" 64-bit ones (rdmsrq() etc.) and the 32-bit
ones (rdmsr() etc.) which are using the upper and lower 32-bit halves
of the 64-bit wide MSR register values.
The 32-bit interfaces are not optimal for 3 reasons:
- They are based on primitives using 64-bit sized values anyway.
- Modern x86 CPUs have added support for MSR access instructions using
an immediate value instead of a register for addressing the MSR,
while the value is in a 64-bit register.
- rdmsr() is a macro storing the upper and lower 32-bit halves in
variables specified as macro parameters. This is obscuring variable
assignment through a macro. Additionally rdmsrq() is mimicking this
pattern by being a macro, too, with the target variable specified as
a parameter as well.
For those reasons drop the 32-bit interfaces for accessing the x86 MSR
registers completely and only use the 64-bit variants.
Hi Jürgen,
I assume this is fine, but since you don't mention it explicitly here,
please clarify what this means for 32-bit CPUs without the rdmsrq
instruction. Those will continue using the same instructions as before
and just change the calling conventions, right?
Yes. I thought this would be clear from the following:
- They are based on primitives using 64-bit sized values anyway.
Note that most patches of this series are independent from each other.
Only the patches removing a specific interface (patches 7, 15, 26 and
30) and the last two patches of the series depend on all previous
patches.
It looks like you are touching most files twice or more here, to
first convert from rdmsr to rdmsrq and then to change the
two-argument rdmsrq() macro to a single-argument inline. If you
introduce the inline version of rdmsrq() first, you should be
able to skip the second step (patch 31) as they could be able
to coexist.
I've discussed how to structure the series with Ingo Molnar before [1]. The
current approach was his preference.
Juergen
[1]: https://lore.kernel.org/lkml/f8d02c78-4681-4043-a5fa-921fa790b1b4@xxxxxxxx/
Attachment:
OpenPGP_0xB0DE9DD628BF132F.asc
Description: OpenPGP public key
Attachment:
OpenPGP_signature.asc
Description: OpenPGP digital signature
|