From: Arvind Sankar <nivedita@alum.mit.edu>
To: Borislav Petkov <bp@alien8.de>
Cc: Arvind Sankar <nivedita@alum.mit.edu>,
Tom Lendacky <thomas.lendacky@amd.com>,
x86@kernel.org, Kim Phillips <kim.phillips@amd.com>,
Yazen Ghannam <yazen.ghannam@amd.com>, Pu Wen <puwen@hygon.cn>,
linux-kernel@vger.kernel.org
Subject: Re: [PATCH] x86/cpu/amd: Remove dead code for TSEG region remapping
Date: Thu, 3 Dec 2020 11:14:06 -0500 [thread overview]
Message-ID: <X8kOzpXyDXNo2PE7@rani.riverdale.lan> (raw)
In-Reply-To: <20201203084857.GD3059@zn.tnic>
On Thu, Dec 03, 2020 at 09:48:57AM +0100, Borislav Petkov wrote:
> On Wed, Dec 02, 2020 at 05:32:32PM -0500, Arvind Sankar wrote:
> > The pfn_range_is_mapped() call just checks whether it is mapped at all
> > in the direct mapping. Is the TSEG range supposed to be marked as
> > non-RAM in the E820 map? AFAICS, the only case when a direct mapping is
> > created for non-RAM is for the 0-1Mb real-mode range, and that will
> > always use 4k pages. Above that anything not marked as RAM will create
> > an unmapped hole in the direct map, so in this case the memory just
> > below the TSEG base would already use smaller pages if needed.
> >
> > If it's possible that the E820 mapping says this range is RAM, then
> > should we also break up the direct map just after the end of the TSEG
> > range for the same reason?
>
> So I have a machine where TSEG is not 2M aligned and somewhere in the 1G
> range:
>
> [ 1.135094] tseg: 003bf00000
>
> It is not in the E820 map either:
>
> [ 0.019784] init_memory_mapping: [mem 0x00000000-0x000fffff]
> [ 0.020014] init_memory_mapping: [mem 0x3bc00000-0x3bdfffff]
> [ 0.020166] init_memory_mapping: [mem 0x20000000-0x3bbfffff]
> [ 0.020327] init_memory_mapping: [mem 0x00100000-0x1fffffff]
> [ 0.020677] init_memory_mapping: [mem 0x3be00000-0x3be8ffff]
>
> That doesn't mean that it can happen that there might be some
> configuration where it ends up being mapped.
>
> So looking at what the code does, it kinda makes sense: you want the 2M
> range between 0x3be00000 and 0x3c000000 to be split into 4K mappings,
> *if* it is mapped.
>
> I need to find a box where it is mapped *and* not 2M aligned, though,
> for testing. Which appears kinda hard to do as all the new ones are
> aligned.
Do any of them have it mapped at all, regardless of the alignment? There
seems to be nothing else in the kernel that ever looks at the TSEG MSR,
so I would guess that it has to be non-RAM in the E820 map, otherwise
nothing would prevent the kernel from allocating and using that space.
I found the actual original commit, which does has a description of the
reasoning. It's
8346ea17aa20 ("x86: split large page mapping for AMD TSEG")
It looks like at the time, the direct mapping didn't really look at the
E820 map in any detail, and was always set up with at least 2Mb pages,
or Gb pages if they were available, from 0 to max_pfn_mapped. So the
direct mapping would have covered even holes that weren't in the E820
map.
Commit
66520ebc2df3 ("x86, mm: Only direct map addresses that are marked as E820_RAM")
changed the direct map setup to avoid mapping holes, because it
apparently became more serious than performance issues: this commit
mentions MCE's getting triggered because of the overmapping.
>
> The above is from a K8 box which should already be dead, as a matter of
> fact.
>
> --
> Regards/Gruss,
> Boris.
>
> https://people.kernel.org/tglx/notes-about-netiquette
next prev parent reply other threads:[~2020-12-03 16:15 UTC|newest]
Thread overview: 9+ messages / expand[flat|nested] mbox.gz Atom feed top
2020-11-27 17:13 Arvind Sankar
2020-11-27 17:27 ` Borislav Petkov
2020-12-02 17:58 ` Tom Lendacky
2020-12-02 18:10 ` Borislav Petkov
2020-12-02 22:32 ` Arvind Sankar
2020-12-03 8:48 ` Borislav Petkov
2020-12-03 16:14 ` Arvind Sankar [this message]
2020-12-03 16:44 ` Borislav Petkov
2020-12-08 18:12 ` [tip: x86/cpu] " tip-bot2 for Arvind Sankar
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=X8kOzpXyDXNo2PE7@rani.riverdale.lan \
--to=nivedita@alum.mit.edu \
--cc=bp@alien8.de \
--cc=kim.phillips@amd.com \
--cc=linux-kernel@vger.kernel.org \
--cc=puwen@hygon.cn \
--cc=thomas.lendacky@amd.com \
--cc=x86@kernel.org \
--cc=yazen.ghannam@amd.com \
/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®