From: Jan Beulich <jbeulich@suse.com>
To: "Roger Pau Monné" <roger.pau@citrix.com>
Cc: Henry Wang <Henry.Wang@arm.com>,
Andrew Cooper <andrew.cooper3@citrix.com>, Wei Liu <wl@xen.org>,
Paul Durrant <paul@xen.org>,
xen-devel@lists.xenproject.org
Subject: Re: [PATCH for-4.18 v2] x86/pvh: fix identity mapping of low 1MB
Date: Mon, 16 Oct 2023 16:55:30 +0200 [thread overview]
Message-ID: <35528dc6-dbc0-3f3e-e774-c2fe4094bffa@suse.com> (raw)
In-Reply-To: <ZS1N9wZ05ebun3WJ@macbook>
On 16.10.2023 16:51, Roger Pau Monné wrote:
> On Mon, Oct 16, 2023 at 04:07:22PM +0200, Jan Beulich wrote:
>> On 16.10.2023 15:51, Roger Pau Monné wrote:
>>> On Mon, Oct 16, 2023 at 03:32:54PM +0200, Jan Beulich wrote:
>>>> On 13.10.2023 10:56, Roger Pau Monne wrote:
>>>>> The mapping of memory regions below the 1MB mark was all done by the PVH dom0
>>>>> builder code, causing the region to be avoided by the arch specific IOMMU
>>>>> hardware domain initialization code. That lead to the IOMMU being enabled
>>>>> without reserved regions in the low 1MB identity mapped in the p2m for PVH
>>>>> hardware domains. Firmware which happens to be missing RMRR/IVMD ranges
>>>>> describing E820 reserved regions in the low 1MB would transiently trigger IOMMU
>>>>> faults until the p2m is populated by the PVH dom0 builder:
>>>>>
>>>>> AMD-Vi: IO_PAGE_FAULT: 0000:00:13.1 d0 addr 00000000000eb380 flags 0x20 RW
>>>>> AMD-Vi: IO_PAGE_FAULT: 0000:00:13.1 d0 addr 00000000000eb340 flags 0
>>>>> AMD-Vi: IO_PAGE_FAULT: 0000:00:13.2 d0 addr 00000000000ea1c0 flags 0
>>>>> AMD-Vi: IO_PAGE_FAULT: 0000:00:14.5 d0 addr 00000000000eb480 flags 0x20 RW
>>>>> AMD-Vi: IO_PAGE_FAULT: 0000:00:12.0 d0 addr 00000000000eb080 flags 0x20 RW
>>>>> AMD-Vi: IO_PAGE_FAULT: 0000:00:14.5 d0 addr 00000000000eb400 flags 0
>>>>> AMD-Vi: IO_PAGE_FAULT: 0000:00:12.0 d0 addr 00000000000eb040 flags 0
>>>>>
>>>>> Those errors have been observed on the osstest pinot{0,1} boxes (AMD Fam15h
>>>>> Opteron(tm) Processor 3350 HE).
>>>>>
>>>>> Mostly remove the special handling of the low 1MB done by the PVH dom0 builder,
>>>>> leaving just the data copy between RAM regions. Otherwise rely on the IOMMU
>>>>> arch init code to create any identity mappings for reserved regions in that
>>>>> range (like it already does for reserved regions elsewhere).
>>>>>
>>>>> Note there's a small difference in behavior, as holes in the low 1MB will no
>>>>> longer be identity mapped to the p2m.
>>>>
>>>> I certainly like the simplification, but I'm concerned by this: The BDA
>>>> is not normally reserved, yet may want accessing by Dom0 (to see the real
>>>> machine contents). We do access that first page of memory ourselves, so
>>>> I expect OSes may do so as well (even if the specific aspect I'm thinking
>>>> of - the warm/cold reboot field - is under Xen's control).
>>>
>>> The BDA on the systems I've checked falls into a RAM area on the
>>> memory map, but if you think it can be problematic I could arrange for
>>> arch_iommu_hwdom_init() to also identity map holes in the low 1MB.
>>
>> Hmm, this again is a case where I'd wish CPU and IOMMU mappings could
>> be different. I don't see reasons to try I/O to such holes, but I can
>> see reasons for CPU accesses (of more or less probing kind).
>
> Hm, while I agree devices have likely no reason to access holes (there
> or elsewhere) I don't see much benefit of having this differentiation,
> it's easier to just map everything for accesses from both device and
> CPU rather than us having to decide (and maybe get wrong) whether
> ranges should only be accessed by the CPU.
I understand that, and I also follow Andrew's arguments towards not
making such a distinction. The consequence though is that we need
to map more than possibly necessary, and never too little.
>>> Keep in mind this is only for PVH, it won't affect PV.
>>
>> Of course.
>
> Would you be willing to Ack it?
If "it" is the present version, then me doing so would be stretch.
How averse are you to re-adding the hole mappings?
Jan
next prev parent reply other threads:[~2023-10-16 14:56 UTC|newest]
Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-10-13 8:56 [PATCH for-4.18 v2] x86/pvh: fix identity mapping of low 1MB Roger Pau Monne
2023-10-13 9:17 ` Henry Wang
2023-10-16 13:32 ` Jan Beulich
2023-10-16 13:51 ` Roger Pau Monné
2023-10-16 14:07 ` Jan Beulich
2023-10-16 14:51 ` Roger Pau Monné
2023-10-16 14:55 ` Jan Beulich [this message]
2023-10-17 8:27 ` Roger Pau Monné
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=35528dc6-dbc0-3f3e-e774-c2fe4094bffa@suse.com \
--to=jbeulich@suse.com \
--cc=Henry.Wang@arm.com \
--cc=andrew.cooper3@citrix.com \
--cc=paul@xen.org \
--cc=roger.pau@citrix.com \
--cc=wl@xen.org \
--cc=xen-devel@lists.xenproject.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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.