[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [PATCH for-4.18 v2] x86/pvh: fix identity mapping of low 1MB


  • To: Jan Beulich <jbeulich@xxxxxxxx>
  • From: Roger Pau Monné <roger.pau@xxxxxxxxxx>
  • Date: Tue, 17 Oct 2023 10:27:36 +0200
  • Arc-authentication-results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=citrix.com; dmarc=pass action=none header.from=citrix.com; dkim=pass header.d=citrix.com; arc=none
  • Arc-message-signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=f54w6Zr3KCTJo1wod39vZ3xfbmZtRo0OPjz69LMXohI=; b=fx9GD6aT04eJPMIhLknXsLNefKtKG6rW28cO4AMxnPb+XvrBpMJ7GOQD6squb8Md0kfW6lrmS8/kQhhgoszq7mj06r0p6BmWTpq1y6ZJ0CJ5Xt5Xvzz1w9RKj9MMvuV6boxixA51JwuAzUkGXswHePbMZG/z2FSLG3LRmIy7+eK6e9YruldzR/5Q/517hIQ87NcQNz8IA09AsUder7PzQoauS8OCIy8YbQ0WsBKqC4ml/yG9vhUBjOSYNbAUoXX2apAe+7u7z7iYyMEhg9uewFbQ3HY4y1HqqMiupcw8+0EK80XpLU+6rTADVK8v3LP6lMObnRTlCeRNwyIjBBlwqg==
  • Arc-seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=jer61pZKCNcZMGN3gm0W3uS6p6/Sq3PQ5+yAoUTUbRq8+9AWm9YSmCtcv0hVhS5hqFegyeDYlPZMp+M3JQ7kCEvfejZ8mDswtG8aY1zVDfCWmoKe3D4iTubNowFihJPskI+hbqLyEjE/NAC1qfF0VqNFcJY1fPJFJHw2o2StciJMdqpcZ9E+GTyIdfB1cllXRzLYfDV6Fk1azpORpMfLKMO0pyi9+4+lDH2f0rRSIJ2d9ArsN4sizmnxLcJPpHwkAYzDmaW9Wjxp25S47WgFFZjeS8LiF2DQ2YMKbbGp+1hhsKF7WaIbP4pv1XrOV6NQifsWNtw+tRaXJw1+2p97xA==
  • Authentication-results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=citrix.com;
  • Cc: Henry Wang <Henry.Wang@xxxxxxx>, Andrew Cooper <andrew.cooper3@xxxxxxxxxx>, Wei Liu <wl@xxxxxxx>, Paul Durrant <paul@xxxxxxx>, xen-devel@xxxxxxxxxxxxxxxxxxxx
  • Delivery-date: Tue, 17 Oct 2023 08:28:16 +0000
  • Ironport-data: A9a23:LHW9A6BWy9p9VhVW/+niw5YqxClBgxIJ4kV8jS/XYbTApDl3gjUOm GYcWmqCPqrbZGP1KItxOo639kwAsJeDx9AyQQY4rX1jcSlH+JHPbTi7wuUcHAvJd5GeExg3h yk6QoOdRCzhZiaE/n9BCpC48D8kk/nOH+KgYAL9EngZbRd+Tys8gg5Ulec8g4p56fC0GArIs t7pyyHlEAbNNwVcbCRMsMpvlDs15K6p4WtB4QRnDRx2lAS2e0c9Xcp3yZ6ZdxMUcqEMdsamS uDKyq2O/2+x13/B3fv8z94X2mVTKlLjFVDmZkh+AsBOsTAbzsAG6Y4pNeJ0VKtio27hc+ada jl6ncfYpQ8BZsUgkQmGOvVSO3kW0aZuoNcrLZUj2CA6IoKvn3bEmp1T4E8K0YIw5tRbKD1n2 OchN3MBSU6ShOi16fGEc7w57igjBJGD0II3nFhFlGmcIdN4BJfJTuPN+MNS2yo2ioZWB/HCa sEFaD1pKhPdfxlIPVRRA5U79AuqriCnL3sE9xTI9exuuzG7IA9ZidABNPLPfdOHX4NNl1uwr WPa5WXpRBodMbRzzBLcqC/y2LCSzHiTtIQ6Hp7mxKFpomOo/zIZDTY/T0OkiKG9sxvrMz5YA wlOksY0loAw/kG2Stj2XzWjvWWJ+BUbXrJ4M+A88hDL9aPS7C6QHG1CRTlEAPQ5sOcmSDps0 UWG9/vxDCFrmK2YTzSa7Lj8hSO/P20ZIHEPYQcATBAZ+J/zrYcrlBXNQ91/VqmvgbXI9SrYx jmLqG0ygusVhMtSj6Gjpwmf2nSru4TDSRMz6kPPRGW54whlZYmjIYu19Vzc6vUGJ4GcJrWcg EU5dwGlxLhmJfmweOalGY3hwJnBCy65DQDh
  • Ironport-hdrordr: A9a23:UjwOgKOc9z4MXsBcT1X155DYdb4zR+YMi2TDiHoddfUFSKalfp 6V98jzjSWE8Ar4WBkb+exoS5PwOk80lKQFqLX5Uo3SODUO1FHHEGgm1/qa/9SCIVy3ygc+79 YGT0EWMrSZYTdHZITBkW+F+r0bsbq6GdWT9ILjJgBWPGNXgs9bjjtRO0K+KAlbVQNGDZ02GN 63/cxcvQetfnwRc4CSGmQFd/KrnayAqLvWJTo9QzI34giHij2lrJTgFQKD4xsYWzRThZ8/7G n+lRDj7KnLiYD39vac7R6e031loqqu9jJxPr3MtiHTEESttu+cXvUvZ1RFhkF3nAjg0idprD CGmWZbAy060QKtQojym2qn5+Co6kdT11byjVCfmnftusr/WXYzDNdAn5tQdl/D51Mnp8wU6t M+44u1jeskMfr7plWJ2/HYExVx0kakq3srluAey3RZTIsFcbdU6YgS5llcHpsMFD/zrNlPKp gZMOjMoPJNNV+KZXHQuWdihNSqQ3QoBx+DBkwPoNac3TRalG1wi0EY2MsclHEd849Vcegy28 3UdqBz0L1eRM4faqxwQO8HXMusE2TIBQnBNWqDSG6XZ53v+0i926IfzI9Fld1CIqZ4s6fasK 6xLm9liQ==
  • List-id: Xen developer discussion <xen-devel.lists.xenproject.org>

On Mon, Oct 16, 2023 at 04:55:30PM +0200, Jan Beulich wrote:
> 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?

Given the point we are regarding the release I guess it's safer to
leave the mapping of the holes in the low 1MB as-is, and consider
removing it for 4.19?  That would give us a full release cycle to
check whether it causes issues on systems.

I will send the updated patch.

Thanks, Roger.



 


Rackspace

Lists.xenproject.org is hosted with RackSpace, monitoring our
servers 24x7x365 and backed by RackSpace's Fanatical Support®.