From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from smtp.kernel.org (aws-us-west-2-korg-mail-alma10-1.taild15c8.ts.net [100.103.45.18]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id A0B1C3AD50A for ; Mon, 29 Jun 2026 12:27:50 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=100.103.45.18 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1782736071; cv=none; b=Ccg04wp2dMtVaiCki8RekcmHBTHkvKUTKzTwD2cJdtkw7lSeNKqyIoSclWR/52TnUmWW1+feifUKLLyjY89RYHrC0jv7jpxmAGrdmglzP5ioEC3Ya9SahE76jByXvVVwHJqy/0UJKlikb2ezHxI01diKHHGb3ecoGkNgfY4Sx98= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1782736071; c=relaxed/simple; bh=85eKGQKwWfzOPBX7J9CJtxrLtLbatrUi5aFs01RBVM4=; h=Date:From:To:Cc:Subject:Message-ID:References:MIME-Version: Content-Type:Content-Disposition:In-Reply-To; b=HuuOsbqjTfiHZaVpMVZFpRQRTURPYIxUS6zVjm3FpV83U23vgEhCmpYJ9KDIEySdkOGT4Y1VeSfIg35bHvUQFHWEu/tDGYdFekxpme7WllFtEghHR3hiV+s9F3YATlN47JAAnKdvEc2/M8/S/IP1G/oLfWWKOqW7jKUdXIzt8Yo= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=dYPXGfop; arc=none smtp.client-ip=100.103.45.18 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b="dYPXGfop" Received: by smtp.kernel.org (Postfix) with ESMTPSA id 4947F1F000E9; Mon, 29 Jun 2026 12:27:48 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=kernel.org; s=k20260515; t=1782736070; bh=GIPxz25GEHxESPXBWRSMUwjIkCQV5O8AN94XNhE/msU=; h=Date:From:To:Cc:Subject:References:In-Reply-To; b=dYPXGfopVcOHJjK/Zn++FDeBuWKhoQgDiowu4qCakw8NtZslb+ojYxwKe5dnXd023 2ZpBYsQRsZ9jcRz2DWJVXHIysxShVGKC24vel3S5Y2lsFgOTNE5SD7pKK07kQDJMMO AKUSGfyL8YkkDQOlNl20uNprgBhu2vqRLtUt9fBBTxmib1OiVqE2vd8ACBoCX+nBBn Give9ReNv7OaINN7cAGXaRYRYCTuFOmRrNqkVMlBSG1JGT7/p/AOzQa3iiX+zLSyE2 UHm8flQTAjq7BtiJlHAUR5HWgGCXpktKEe58e1nT143LEjK2HyGFI7eer5Ri0vnG7S okCDTx+ylYkUA== Date: Mon, 29 Jun 2026 14:27:46 +0200 From: Ingo Molnar To: =?iso-8859-1?Q?J=FCrgen_Gro=DF?= Cc: linux-kernel@vger.kernel.org, x86@kernel.org, Thomas Gleixner , Ingo Molnar , Borislav Petkov , Dave Hansen , "H. Peter Anvin" Subject: Re: [PATCH 05/32] x86/mtrr: Stop using 32-bit MSR interfaces Message-ID: References: <20260629060526.3638272-1-jgross@suse.com> <20260629060526.3638272-6-jgross@suse.com> <3e762bea-1680-4029-a682-7fd33a76c3a2@suse.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset=iso-8859-1 Content-Disposition: inline Content-Transfer-Encoding: 8bit In-Reply-To: <3e762bea-1680-4029-a682-7fd33a76c3a2@suse.com> * Jürgen Groß wrote: > On 29.06.26 13:33, Ingo Molnar wrote: > > > > * Juergen Gross 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 , 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