From: Juergen Gross <jgross@suse.com>
To: Linus Torvalds <torvalds@linux-foundation.org>
Cc: linux-kernel@vger.kernel.org, x86@kernel.org,
lists@nerdbynature.de, mikelley@microsoft.com,
Thomas Gleixner <tglx@linutronix.de>,
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 4/6] x86/mtrr: don't let mtrr_type_lookup() return MTRR_TYPE_INVALID
Date: Wed, 8 Feb 2023 07:20:00 +0100 [thread overview]
Message-ID: <59a24334-35c7-8afa-f35d-d654dd2823ba@suse.com> (raw)
In-Reply-To: <CAHk-=wi53OX86-yLBp4rCHOH67XhVbzV78qa63mh4-rOhxQSLw@mail.gmail.com>
[-- Attachment #1.1.1: Type: text/plain, Size: 1367 bytes --]
On 07.02.23 17:20, Linus Torvalds wrote:
> On Mon, Feb 6, 2023 at 11:29 PM Juergen Gross <jgross@suse.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
[-- Attachment #1.1.2: OpenPGP public key --]
[-- Type: application/pgp-keys, Size: 3149 bytes --]
[-- Attachment #2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 495 bytes --]
next prev parent reply other threads:[~2023-02-08 6:20 UTC|newest]
Thread overview: 19+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-02-07 7:28 [PATCH 0/6] x86/mtrr: fix handling with PAT but without MTRR Juergen Gross
2023-02-07 7:28 ` [PATCH 1/6] x86/mtrr: make mtrr_enabled() non-static Juergen Gross
2023-02-07 7:28 ` [PATCH 2/6] x86/pat: check for MTRRs enabled in memtype_reserve() Juergen Gross
2023-02-07 8:49 ` Ingo Molnar
2023-02-07 9:12 ` Juergen Gross
2023-02-07 11:31 ` Borislav Petkov
2023-02-07 7:28 ` [PATCH 3/6] x86/mtrr: revert commit 90b926e68f50 Juergen Gross
2023-02-07 7:29 ` [PATCH 4/6] x86/mtrr: don't let mtrr_type_lookup() return MTRR_TYPE_INVALID Juergen Gross
2023-02-07 16:20 ` Linus Torvalds
2023-02-08 6:20 ` Juergen Gross [this message]
2023-02-08 15:42 ` Linus Torvalds
2023-02-07 7:29 ` [PATCH 5/6] x86/mm: only check uniform after calling mtrr_type_lookup() Juergen Gross
2023-02-07 11:42 ` Borislav Petkov
2023-02-07 11:54 ` Juergen Gross
2023-02-07 12:21 ` Borislav Petkov
2023-02-08 1:13 ` Kani, Toshi
2023-02-07 7:29 ` [PATCH 6/6] x86/mtrr: drop sanity check in mtrr_type_lookup_fixed() Juergen Gross
2023-02-08 15:08 ` [PATCH 0/6] x86/mtrr: fix handling with PAT but without MTRR Michael Kelley (LINUX)
2023-02-08 15:19 ` Juergen Gross
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=59a24334-35c7-8afa-f35d-d654dd2823ba@suse.com \
--to=jgross@suse.com \
--cc=bp@alien8.de \
--cc=dave.hansen@linux.intel.com \
--cc=hpa@zytor.com \
--cc=linux-kernel@vger.kernel.org \
--cc=lists@nerdbynature.de \
--cc=mikelley@microsoft.com \
--cc=mingo@redhat.com \
--cc=tglx@linutronix.de \
--cc=torvalds@linux-foundation.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
all inboxes | Powered by JetHome®