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

Re: [PATCH v2] x86/AMD: make HT range dynamic for Fam17 and up


  • To: Jan Beulich <jbeulich@xxxxxxxx>
  • From: Roger Pau Monné <roger.pau@xxxxxxxxxx>
  • Date: Mon, 18 Oct 2021 15:10:43 +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=cwTZ7GKdwhK81iZaOunI8wN7Z8h1DV50wyJxzgqVrKE=; b=VDKfbByjd+DhsyT3dtGoEwnseGCkyKlXHxEKB6cXSuH6ETgHsFHoL6PQPgcpX5aiJrFZQXLGqT6D46JEicfjhqhU//1xV61FzMTebN4O3kb2qYAJFkyeUzNxckh0VyXl4eVvoXrBaDw4+rA6HPb5smtPfunwQxFxSjyQitvH0Q+UYWtE9KuPuB+YyHT3ExgkNvdUJKVYo3uj3KN+MMkOsiYqIgTXXPqOLnG5FvzDrbPmkzQsOKUpFF65Kt2Z49NSV4jaBZ0XrybEN4Mfgsya/b1n1tXKuyrNd4OiZyt+3obpAR6bqddptAC+cmPrK718127eL3PzLmz5T3DmhGGLeA==
  • Arc-seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=CBBoV/doUpRFxJRhvjpK4m7xWB0EcQ6CVEWlZSOKLLP11l9q1IJ5gRjVtiPD/yg+GJN5K9WSkBRlWJJmdI6/9hM/hCvKMCLSwfsC8e6SGoYnAWv1ly++1qKZoQM1nBIbqPI3GIxFxSpizaTf/0M56aEibCDIjl+Cc1w7eUiH9BKc2+pcLXhdnEkyCmN7GS+KqV4ePHh1esFAl6I0GfmGFGOQ6sxankJ/5cY7VmuzTo648CXafmV9DZpamzKsSyKSLWjLS+o+Dvpc++//4bacXQxbKB4pNDjAP9B1TgSrNxo5HaKoeNVgj0IMM+5BGo6kqdqSuIz/EjXahDAbMooVUw==
  • Authentication-results: esa4.hc3370-68.iphmx.com; dkim=pass (signature verified) header.i=@citrix.onmicrosoft.com
  • Cc: Andrew Cooper <andrew.cooper3@xxxxxxxxxx>, "xen-devel@xxxxxxxxxxxxxxxxxxxx" <xen-devel@xxxxxxxxxxxxxxxxxxxx>, Wei Liu <wl@xxxxxxx>
  • Delivery-date: Mon, 18 Oct 2021 13:11:24 +0000
  • Ironport-data: A9a23:wrRXA6A2rcS81hVW//Lkw5YqxClBgxIJ4kV8jS/XYbTApDtz0jRVy TEeX2HSMquMamL9fdBzPtyx9UMAuZGDmoNqQQY4rX1jcSlH+JHPbTi7wuYcHM8wwunrFh8PA xA2M4GYRCwMo/u1Si6FatANl1ElvU2zbue6WLOs1hxZH1c+EX550EI7wYbVv6Yz6TSHK1LV0 T/Ni5W31G+Ng1aY5UpNtspvADs21BjDkGtwUm4WPJinj3eH/5UhN7oNJLnZEpfNatI88thW5 Qr05OrREmvxp3/BAz4++1rxWhVirrX6ZWBihpfKMkQLb9crSiEai84G2PQghUh/lxiNltUp+ u128qORQgEXLKTDvPQ3akwNe81+FfUuFL7vJHG+tYqYzlHccmuqyPJrZK00FdRGoKAtWzgIr KFGbmBWBvyAr7veLLaTUO5ji95lNMD2FIgepmth3XfSCvNOrZXrHvqRv4MHhWtYasZmDav/e fMLezlWXDODIANgZGxULs08tbL97pX4W2IB8w/EzUYt2EDMyCRh3b6rN8DaEvSaSMMQkkuGq 2bu+2XiHgpcJNGZ0SCC8H+nmqnIhyyTcIAYGaC89/VqqEaO3WFVAxoTPWZXutHg1BT4AYgGb RVJpGx+9sDe6XBHUPHhchmxpSa2hiVbZPtbFdMo4Q6p2oDttlPx6nc/chZNb9kvtckTTDMs1 0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=
  • Ironport-sdr: CnbwzMbpWD1QZ1WySLERW8/JJRKgpGb8zct8p3oVAdBb3bzdZk0bhVTD7+Nib50hB/oHbPMsCx ER8T2L+arY45dQIcfgeT61hYAX0SmDHCT26YRHz0a9mEhMoU4npJki6hIlEAQic19F4vjasZRg uvzohGCihYEOmTZ4A44rXy0PL+Ye8Ae6xbJgt1eOAD8CEMY/9BJdPrARzfUfqQ1WFaGLKakszG 3KwM+lYj6rA+X9DcD+/qJqcvCzVD/N3Op45fYKY1mogpoZ3M+aN1Ew1RMRZL1KajegXxyNwHth xIY7rRVluB1jZ7NRZiRfmmxn
  • List-id: Xen developer discussion <xen-devel.lists.xenproject.org>

On Mon, Oct 18, 2021 at 12:18:16PM +0200, Jan Beulich wrote:
> On 18.10.2021 11:41, Roger Pau Monné wrote:
> > On Mon, Jun 28, 2021 at 01:48:53PM +0200, Jan Beulich wrote:
> >> At the time of d838ac2539cf ("x86: don't allow Dom0 access to the HT
> >> address range") documentation correctly stated that the range was
> >> completely fixed. For Fam17 and newer, it lives at the top of physical
> >> address space, though.
> >>
> >> To correctly determine the top of physical address space, we need to
> >> account for their physical address reduction, hence the calculation of
> >> paddr_bits also gets adjusted.
> >>
> >> While for paddr_bits < 40 the HT range is completely hidden, there's no
> >> need to suppress the range insertion in that case: It'll just have no
> >> real meaning.
> >>
> >> Reported-by: Igor Druzhinin <igor.druzhinin@xxxxxxxxxx>
> >> Signed-off-by: Jan Beulich <jbeulich@xxxxxxxx>
> > 
> > Reviewed-by: Roger Pau Monné <roger.pau@xxxxxxxxxx>
> 
> Thanks, but before applying this I'd prefer to resolve your concern
> voiced below.
> 
> >> --- a/xen/arch/x86/cpu/common.c
> >> +++ b/xen/arch/x86/cpu/common.c
> >> @@ -349,16 +349,23 @@ void __init early_cpu_init(void)
> >>  
> >>    eax = cpuid_eax(0x80000000);
> >>    if ((eax >> 16) == 0x8000 && eax >= 0x80000008) {
> >> +          ebx = eax >= 0x8000001f ? cpuid_ebx(0x8000001f) : 0;
> >>            eax = cpuid_eax(0x80000008);
> >> +
> >>            paddr_bits = eax & 0xff;
> >>            if (paddr_bits > PADDR_BITS)
> >>                    paddr_bits = PADDR_BITS;
> >> +
> >>            vaddr_bits = (eax >> 8) & 0xff;
> >>            if (vaddr_bits > VADDR_BITS)
> >>                    vaddr_bits = VADDR_BITS;
> >> +
> >>            hap_paddr_bits = ((eax >> 16) & 0xff) ?: paddr_bits;
> >>            if (hap_paddr_bits > PADDR_BITS)
> >>                    hap_paddr_bits = PADDR_BITS;
> >> +
> >> +          /* Account for SME's physical address space reduction. */
> >> +          paddr_bits -= (ebx >> 6) & 0x3f;
> > 
> > Does it make sense to check for 0x8000001f[eax] bit 0 in order to
> > assert that there's support for SME, or assuming that the reduction is
> > != 0 in the other cpuid leaf is enough.
> 
> Documentation doesn't really tie them together afaics, so I thought
> I wouldn't either. I was reading into this lack of an explicit
> connection the possibility of address space reduction to also,
> hypothetically at this point, apply to other features.
> 
> > It's possible for firmware vendors to disable advertising the SME
> > support bit and leave the physical address space reduction one in
> > place?
> 
> I don't know if it's possible (I'm unaware of e.g. MSR-level control
> allowing to modify these independently), but if it is I'd consider
> it inconsistent if one but not the other was zapped. I'm unconvinced
> that we really would need to deal with such inconsistencies, the
> more that it's not really clear what the inconsistent setting would
> really mean for the placement of the HT range.

Thanks, I think your proposed solution is fine.

> While writing this, there was one more thing I came to think of:
> Should we perhaps suppress the iomem_deny_access() altogether when
> running virtualized ourselves?

Hm, hard to tell TBH. HT being part of the platform specification
for AMD it would feel wrong for hypervisors to attempt to populate
this range.

Regards, Roger.



 


Rackspace

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