The Linux Kernel Mailing List
 help / color / mirror / Atom feed
From: Ingo Molnar <mingo@kernel.org>
To: "Jürgen Groß" <jgross@suse.com>
Cc: linux-kernel@vger.kernel.org, x86@kernel.org,
	Thomas Gleixner <tglx@kernel.org>, Ingo Molnar <mingo@redhat.com>,
	Borislav Petkov <bp@alien8.de>,
	Dave Hansen <dave.hansen@linux.intel.com>,
	"H. Peter Anvin" <hpa@zytor.com>
Subject: Re: [PATCH 05/32] x86/mtrr: Stop using 32-bit MSR interfaces
Date: Mon, 29 Jun 2026 14:27:46 +0200	[thread overview]
Message-ID: <akJkwkwdSENZ-Jog@gmail.com> (raw)
In-Reply-To: <3e762bea-1680-4029-a682-7fd33a76c3a2@suse.com>


* Jürgen Groß <jgross@suse.com> wrote:

> On 29.06.26 13:33, Ingo Molnar wrote:
> > 
> > * Juergen Gross <jgross@suse.com> wrote:
> > 
> > >   amd_get_mtrr(unsigned int reg, unsigned long *base,
> > >   	     unsigned long *size, mtrr_type *type)
> > >   {
> > > -	unsigned long low, high;
> > > +	unsigned long val;
> > > +	struct msr msr;
> > 
> > So, 'struct msr' is defined in <asm/msr.h>, but:
> > 
> > >   static void
> > >   amd_set_mtrr(unsigned int reg, unsigned long base, unsigned long size, mtrr_type type)
> > >   {
> > > -	u32 regs[2];
> > > +	union {
> > > +		u32 regs[2];
> > > +		u64 val;
> > > +	} msr;
> > 
> > Why do we use a local anonymous union here with overlapping
> > nomenclature and a confusingly different but (AFAICS) functionally
> > equivalent definition to 'struct msr'?
> 
> This is done in order to avoid having to change the code too much.

That's OK, but I'd suggest a followup cleanup in a separate patch:

> alternative I could use struct msr by doing:
> 
>   rdmsrq(MSR_K6_UWCCR, msr.q);
>   regs[0] = msr.l;
>   regs[1] = msr.h;
> 
>   ...
> 
>   msr.l = regs[0];
>   msr.h = regs[1];
>   wrmsrq(MSR_K6_UWCCR, msr.q);

Or just move regs[] over to a struct msr variable use?

Thanks,

	Ingo





  reply	other threads:[~2026-06-29 12:27 UTC|newest]

Thread overview: 61+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-06-29  6:04 [PATCH 00/32] x86/msr: Drop 32-bit MSR interfaces Juergen Gross
2026-06-29  6:04 ` [PATCH 01/32] thermal/intel: Stop using " Juergen Gross
2026-06-29  6:04 ` [PATCH 02/32] powercap: " Juergen Gross
2026-06-29 11:25   ` Ingo Molnar
2026-06-29 11:33     ` Jürgen Groß
2026-06-29 12:31       ` Ingo Molnar
2026-06-29 12:52         ` Jürgen Groß
2026-06-29  6:04 ` [PATCH 03/32] edac: " Juergen Gross
2026-06-30  1:50   ` Zhuo, Qiuxu
2026-06-29  6:04 ` [PATCH 04/32] acpi: " Juergen Gross
2026-06-30 12:30   ` Rafael J. Wysocki (Intel)
2026-06-30 12:42     ` Jürgen Groß
2026-06-29  6:04 ` [PATCH 05/32] x86/mtrr: " Juergen Gross
2026-06-29 11:33   ` Ingo Molnar
2026-06-29 11:41     ` Jürgen Groß
2026-06-29 12:27       ` Ingo Molnar [this message]
2026-06-29 13:04         ` Jürgen Groß
2026-06-29  6:04 ` [PATCH 06/32] x86/msr: Stop using 32-bit MSR interfaces in lib/msr-smp.c Juergen Gross
2026-06-29  6:04 ` [PATCH 07/32] x86/msr: Remove wrmsr_safe() Juergen Gross
2026-06-29  6:04 ` [PATCH 08/32] x86/mce: Stop using 32-bit MSR interfaces Juergen Gross
2026-06-29  6:05 ` [PATCH 09/32] KVM/x86: " Juergen Gross
2026-06-29  6:05 ` [PATCH 10/32] x86/hygon: " Juergen Gross
2026-06-29  6:05 ` [PATCH 11/32] x86/pci: " Juergen Gross
2026-06-29  6:05 ` [PATCH 12/32] x86/amd: " Juergen Gross
2026-06-29  6:05 ` [PATCH 13/32] x86/featctl: " Juergen Gross
2026-06-29  6:05 ` [PATCH 14/32] x86/tsc: " Juergen Gross
2026-06-29  6:05 ` [PATCH 15/32] x86/msr: Remove rdmsr_safe() Juergen Gross
2026-06-29  6:05 ` [PATCH 16/32] cpufreq: Stop using 32-bit MSR interfaces Juergen Gross
2026-06-29 14:55   ` Zhongqiu Han
2026-06-30  6:38     ` Juergen Gross
2026-06-29  6:05 ` [PATCH 17/32] x86/resctrl: " Juergen Gross
2026-07-01 16:49   ` Reinette Chatre
2026-06-29  6:05 ` [PATCH 18/32] x86/apic: " Juergen Gross
2026-06-29  6:05 ` [PATCH 19/32] x86/cpu: " Juergen Gross
2026-06-29  6:05 ` [PATCH 20/32] drivers/ata: " Juergen Gross
2026-06-29  6:05 ` [PATCH 21/32] agp/nvidia: " Juergen Gross
2026-06-29  6:05 ` [PATCH 22/32] fbdev/geode: " Juergen Gross
2026-06-29  6:05 ` [PATCH 23/32] hw_random/via-rng: " Juergen Gross
2026-06-29  6:05 ` [PATCH 24/32] drivers/gpio: " Juergen Gross
2026-06-29 10:33   ` Bartosz Golaszewski
2026-07-01  8:13   ` Linus Walleij
2026-07-01  8:32     ` Juergen Gross
2026-06-29  6:05 ` [PATCH 25/32] drivers/misc: " Juergen Gross
2026-06-29  6:05 ` [PATCH 26/32] x86/msr: Remove wrmsr() Juergen Gross
2026-06-29  6:05 ` [PATCH 27/32] x86/hyperv: Stop using 32-bit MSR interfaces Juergen Gross
2026-06-29  6:05 ` [PATCH 28/32] x86/olpc: " Juergen Gross
2026-06-29  6:05 ` [PATCH 29/32] hwmon: " Juergen Gross
2026-06-29 15:05   ` Guenter Roeck
2026-06-29  6:05 ` [PATCH 30/32] x86/msr: Remove rdmsr() Juergen Gross
2026-06-29  6:05 ` [PATCH 31/32] treewide: convert rdmsrq() from a macro to an inline function Juergen Gross
2026-06-29  6:05 ` [PATCH 32/32] x86/msr: Simplify some rdmsrq() use cases Juergen Gross
2026-06-29  6:52 ` [PATCH 00/32] x86/msr: Drop 32-bit MSR interfaces Arnd Bergmann
2026-06-29  7:01   ` Jürgen Groß
2026-06-29  8:06     ` Arnd Bergmann
2026-06-29  8:15       ` Jürgen Groß
2026-06-29  8:30         ` Jan Beulich
2026-06-29  8:38         ` Arnd Bergmann
2026-06-30 20:06           ` H. Peter Anvin
2026-06-29 11:19       ` Ingo Molnar
2026-06-30 18:59         ` Sean Christopherson
2026-07-01  8:33           ` Jürgen Groß

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=akJkwkwdSENZ-Jog@gmail.com \
    --to=mingo@kernel.org \
    --cc=bp@alien8.de \
    --cc=dave.hansen@linux.intel.com \
    --cc=hpa@zytor.com \
    --cc=jgross@suse.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mingo@redhat.com \
    --cc=tglx@kernel.org \
    --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