[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <59a24334-35c7-8afa-f35d-d654dd2823ba@suse.com>
Date: Wed, 8 Feb 2023 07:20:00 +0100
From: Juergen Gross <jgross@...e.com>
To: Linus Torvalds <torvalds@...ux-foundation.org>
Cc: linux-kernel@...r.kernel.org, x86@...nel.org,
lists@...dbynature.de, mikelley@...rosoft.com,
Thomas Gleixner <tglx@...utronix.de>,
Ingo Molnar <mingo@...hat.com>, Borislav Petkov <bp@...en8.de>,
Dave Hansen <dave.hansen@...ux.intel.com>,
"H. Peter Anvin" <hpa@...or.com>
Subject: Re: [PATCH 4/6] x86/mtrr: don't let mtrr_type_lookup() return
MTRR_TYPE_INVALID
On 07.02.23 17:20, Linus Torvalds wrote:
> On Mon, Feb 6, 2023 at 11:29 PM Juergen Gross <jgross@...e.com> wrote:
>>
>> mtrr_type_lookup() should always return a valid memory type. In case
>> there is no information available, it should return the default UC.
>
> Why isn't the second case (ie MTRR_STATE_MTRR_ENABLED not being set)
> returning 'mtrr_state.def_type'. That's what the hw does, no?
Are you sure? In the SDM I'm reading:
* E (MTRRs enabled) flag, bit 11 — MTRRs are enabled when set; all MTRRs are
disabled when clear, and the UC memory type is applied to all of physical
memory.
So UC it should be IMHO.
>> At the same time the mtrr_type_lookup() stub for the !CONFIG_MTRR
>> case should set uniform to 1, as if the memory range would be
>> covered by no MTRR at all.
>
> .. but you didn't do that for the CONFIG_MTRR, so now they return
> MTRR_TYPE_UNCACHABLE, but don't set uniform=1.
I agree that setting uniform should be done at least for the case of not
enabled MTRRs.
The case of !mtrr_state_set is different, as the data regarding setting
uniform isn't known yet. OTOH there is no caller of mtrr_type_lookup()
interested in the uniform setting so early in boot, so I guess not
setting it is fine (setting it would be okay for the same reason, but
it would be technically wrong IMO).
Juergen
Download attachment "OpenPGP_0xB0DE9DD628BF132F.asc" of type "application/pgp-keys" (3099 bytes)
Download attachment "OpenPGP_signature" of type "application/pgp-signature" (496 bytes)
Powered by blists - more mailing lists