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

Re: [PATCH v4] VMX: use a single, global APIC access page


  • To: Jan Beulich <jbeulich@xxxxxxxx>
  • From: Roger Pau Monné <roger.pau@xxxxxxxxxx>
  • Date: Tue, 13 Apr 2021 12:18:39 +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-SenderADCheck; bh=gjIqRuj6qL85WDmtAGe/nxNv4yRU1JrU/iuqUWrAU6I=; b=U1iswAEFslcOB2uplTzRuX4QA1nKl968jCV2hmaiK69A0lOjW/5PEnkDHcTQV1kCgXhFhSIt29L23O3MwSz1RF40TBTIbRjK6vu+fJ35xa67PfTJ6fQUJWYlz7V2c+j6dz/SF9YYaioCSMyao30AgrQ9PLSj7XPZZ33e7EpNDcu+i1X76JSCLu/9ve4sXvs6Yc8qUdEy2EYb7m1vuExLkCNmCuh03PjY2SMYyW4pSDzQihF6ScTZ+NABlmT2uooHOQwcMe0+bELYM85vTJF15HU26yt63q1IWZZhiu7CN3Enw+leI+X0D1hrRrIYqKS36c3sMCWz0BzCNvMbJgtiaw==
  • Arc-seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=LLzeQD1fYSYTv5AeNTowbKhactxReYLK59S+tL+SaHI3Xz4ASfyfo4fQscY3Co06CjUvCCQIqXDfAxk9Z5o65ml+lsGuTVu9Njxw2c6AYQzZHSZGdXCcKf24XeVFoILsNzfTkJ86zGfE/HWZtbwOnKbUtDjny2agg0RkJfJpf86caxSXgyzOI1w/XQmOMp31PO+E8rkbk+NUD0tohUG0nPJsxMeO/Y/vzWpkd0wwEaYUsrcklM8cr4p1Qd4QA9S8CrQW5XuoQpMU8U5j8MctqV+bq037RyRUGh6qcbqvv5SCiLtdIuqD4Cv9VWiWFEThC30s+KmrQ5F17rFKkCcBTg==
  • Authentication-results: esa5.hc3370-68.iphmx.com; dkim=pass (signature verified) header.i=@citrix.onmicrosoft.com
  • Cc: "xen-devel@xxxxxxxxxxxxxxxxxxxx" <xen-devel@xxxxxxxxxxxxxxxxxxxx>, Andrew Cooper <andrew.cooper3@xxxxxxxxxx>, Wei Liu <wl@xxxxxxx>, George Dunlap <george.dunlap@xxxxxxxxxx>, Kevin Tian <kevin.tian@xxxxxxxxx>, Jun Nakajima <jun.nakajima@xxxxxxxxx>, Tim Deegan <tim@xxxxxxx>
  • Delivery-date: Tue, 13 Apr 2021 10:18:53 +0000
  • Ironport-hdrordr: A9a23:yBx7Cq5gqCzBZ64jzAPXwWyEI+orLtY04lQ7vn1ZYSd+NuSFis Gjm+ka3xfoiDAXHEotg8yEJbPoexzh3LZPy800Ma25VAfr/FGpIoZr8Jf4z1TbdxHW3tV2kZ 1te60WMrDNJHBnkMf35xS5Gd48wN+BtJuln/va0m0Fd2BXQotLhj0JbTqzOEtwWQVAGN4VFI CE4NBGujqnfh0sH76GL1MCWPXOoMCOqYnvZgQICwVixA6Fiz6p77CSKWnk4j41VTRTzbA+tV XUigCR3NTZj9iX6D/5k1XS4ZNfhcf7xrJ4avCkp8AJJlzX+2SVTat7XbnqhkFRnMiO7xIQnM DIs1McOa1Img/sV0WUhTeo5AX6yjYp7BbZuC+lqF/uu9bwSj5/K+cpv/MhTjLj50AtvM5x3c twtgrz3fonbmKzoA3H69fFTB1snEavyEBS6dI7tHBDTZAYLIZYsI13xjIlLL47ACn45Io7ed Meav302fA+SyL/U1np+kNrwNCqQ00pGAaHTkUoqqWuokZrtUE84E0CyMMFmHAcsLo7Vplf/u zBdp9ljbdUU6YtHO1ALdZEZObyM3fKSx7XKm6eSG6XYp0vCjbokdra8b817OaldNghy4Yzoo 3IVBd9uXQpc0zjJMWS1PRwg17waVT4eQ6o5tBV5pB/tL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NW0nqppfGKRk4C2Lp0e2Wdpvc134YzMEO1oms0isUmUGIPIu39BDizW2Mm0e1irbe3LzV3tljF /fgTzwuDN4Axcwb57RWmwJdhdP3HjHmcrJ45xnDg8W3eMiK3hc1LrevvOxa8OY8XVOYG/rUYjK Th+CWbZzPZ1S8fA5zyKfIsWpLJdZMOJNvxWQEtgDOr7SP3Q4UriCZb962L7FitVxinF2eQUZtY fTTMv8U8FL2nsumLqZXxMXZcf6JiGYZocKPaugfhux0GGMwwy44HmI0NFToC2yT6L3DsJm9Dy5 WQI=
  • List-id: Xen developer discussion <xen-devel.lists.xenproject.org>

On Tue, Apr 13, 2021 at 11:24:09AM +0200, Jan Beulich wrote:
> On 12.04.2021 17:31, Roger Pau Monné wrote:
> > On Mon, Apr 12, 2021 at 12:40:48PM +0200, Jan Beulich wrote:
> >> The address of this page is used by the CPU only to recognize when to
> >> access the virtual APIC page instead. No accesses would ever go to this
> >> page. It only needs to be present in the (CPU) page tables so that
> >> address translation will produce its address as result for respective
> >> accesses.
> >>
> >> By making this page global, we also eliminate the need to refcount it,
> >> or to assign it to any domain in the first place.
> >>
> >> Signed-off-by: Jan Beulich <jbeulich@xxxxxxxx>
> >> Reviewed-by: Kevin Tian <kevin.tian@xxxxxxxxx>
> >> ---
> >> v4: Set PGC_extra on the page. Make shadow mode work.
> >> v3: Split p2m insertion change to a separate patch.
> >> v2: Avoid insertion when !has_vlapic(). Split off change to
> >>     p2m_get_iommu_flags().
> >> ---
> >> I did further consider not allocating any real page at all, but just
> >> using the address of some unpopulated space (which would require
> >> announcing this page as reserved to Dom0, so it wouldn't put any PCI
> >> MMIO BARs there). But I thought this would be too controversial, because
> >> of the possible risks associated with this.
> > 
> > Really seems more trouble than reward. Also there are systems with
> > MMIO regions in holes on the memory map, like the issue I had with the
> > Intel pinctrl stuff that had an MMIO region in a hole on the memory
> > map [0], so I'm not sure Xen would be in a position to select a
> > suitable unpopulated page anyway.
> > 
> > [0] https://lore.kernel.org/xen-devel/YFx80wYt%2FKcHanC7@xxxxxxxxxxxxxxxxxx/
> 
> Yeah, I had seen that. What I'm having trouble to understand is how the
> OS will know to avoid that range for e.g. placing BARs.

No idea really, I assume they expect that you parse all possible ACPI
devices from the dynamic tables before deciding on any BAR placements?

I still consider a bug that the pinctrl MMIO region is not marked as
reserved in the memory map.

> >> +    {
> >> +        const struct page_info *pg = mfn_to_page(mfn);
> >> +
> >> +        if ( !page_get_owner(pg) && (pg->count_info & PGC_extra) )
> >> +        {
> >> +            ASSERT(type == p2m_mmio_direct);
> >> +            return 0;
> > 
> > Are there any other pages that could pass this check? I don't think
> > so, but wanted to assert.
> 
> "Normal" extra pages have an owner, so no, there aren't any others.
> If and when any appear, this may need further customizing, albeit
> generally I'd hope further pages matching this pattern would also
> want similar treatment.

I wonder whether we want to add an assert here to make sure only the
APIC access page receives this special handling by the shadow code,
but maybe that's a bit too much?

Thanks, Roger.



 


Rackspace

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