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

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


  • To: Andrew Cooper <andrew.cooper3@xxxxxxxxxx>
  • From: Jan Beulich <jbeulich@xxxxxxxx>
  • Date: Mon, 21 Jun 2021 08:29:31 +0200
  • Arc-authentication-results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=suse.com; dmarc=pass action=none header.from=suse.com; dkim=pass header.d=suse.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=I91bC7ihyW4hvTflqsSmS4NmmT/3qXbhdMHAfE7waik=; b=l9aBuZUPHhsoZPhc8Be9vbpD0Ocs1LpTP6xqxQv8cF6puGA8Jsze09CWA9ifY/A+gX5CryEWyZaaXmgf/V/2W4zkxTC5XACeglPlaa6S1Bu7Sarj+A1d+sOnyYrwcNFVvTR7uGQJStorw8kojYAKaQzkBUeN5zifd8FDVvxtbqBl++mRHnO/Ay/GtOgrNuj8tVquCwJPC9OxisFtrnNc24Wz/5rjZZmi73eLflQM8H/O/1zvnNTmaUhr22Zn3cbT+MvFjJGl/TJMixj+0MPOhqNRAH2Q1wkQ0aHPYEnCMzJ+WXH/8odi7tv9kcLWrjWb1xb253QqGa4PWrP/9ln+TQ==
  • Arc-seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=GfqLiWbRCaPHeEtQvhhgxL581LjB0mHVeTnGtSGTxP49eI7NydKRjCP0T9IIIHIfzA5xJ7Z+P6bFCoJe7k1jIPO21BKQeOQE8bxS4Z1bAqRa3pTVNcinNUjq7NG9FnhJojd2uS/eC9N24A0WU+mnYqr50vFSXJwrPDauqTYrNn0Zusb/Ca+9nlWasE+1623WdMBQzEG0PJU5TqT4+t8k3YWkzKWJpuuHxERekFg5xjgLiAOpkA61E1ZcUZv6UF/7Io85XlARe4FuS+HFFgFghDiU57tdm8fauUJMpt6zFW4TmB3ZGcJyHbcsBSG6xp/eEYOa+rVqPSCk+/fCMFAleg==
  • Authentication-results: lists.xenproject.org; dkim=none (message not signed) header.d=none;lists.xenproject.org; dmarc=none action=none header.from=suse.com;
  • Cc: Wei Liu <wl@xxxxxxx>, Roger Pau Monné <roger.pau@xxxxxxxxxx>, Igor Druzhinin <igor.druzhinin@xxxxxxxxxx>, "xen-devel@xxxxxxxxxxxxxxxxxxxx" <xen-devel@xxxxxxxxxxxxxxxxxxxx>
  • Delivery-date: Mon, 21 Jun 2021 06:29:42 +0000
  • List-id: Xen developer discussion <xen-devel.lists.xenproject.org>

On 21.06.2021 08:18, Jan Beulich wrote:
> On 18.06.2021 18:32, Andrew Cooper wrote:
>> On 18/06/2021 17:00, 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: Andrew Cooper <andrew.cooper3@xxxxxxxxxx>
>>
>> Really, this ought to be reported by Igor.  He did all the hard work.
> 
> Sure, changed.
> 
>>> --- a/xen/arch/x86/cpu/common.c
>>> +++ b/xen/arch/x86/cpu/common.c
>>> @@ -349,13 +349,17 @@ 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;
>>> +
>>> +           paddr_bits = (eax & 0xff) - ((ebx >> 6) & 0x3f);
>>
>> While I can see the attraction of editing paddr_bits, I think it will
>> break the emulated pagewalk (at least).
>>
>> With SME active, the address space reduction is only physical addresses
>> only, not guest physical.  An HVM guest still needs to see the original
>> paddr_bits, and the emulated pagewalk needs to use this for reserved bit
>> calculations.
>>
>> i.e. under NPT, you can still have a working 2^48 guest physical address
>> space despite the host physical address space is limited to 2^43 by
>> encryption being active.
> 
> Which means we may need to split the variable into paddr_bits
> (calculated as above) and gaddr_bits (left at what paddr_bits has
> been so far). However, isn't that what hap_paddr_bits is already
> for, while for shadow mode it still needs to be the "adjusted" way?
> We'd then simply not fall back to the "adjusted" paddr_bits, but to
> the original one.
> 
> Another aspect I was wondering about is whether
> 
>               if (paddr_bits > PADDR_BITS)
>                       paddr_bits = PADDR_BITS;
> 
> should apply before or after subtracting the value from
> 80000008.EBX.

And of course this was meant to be 8000001F.EBX.

Jan

> I was first inclined to make it the more relaxed
> way (applying before reduction), but then thought I'd first leave
> it as is now, on the basis that the PTE layout doesn't change, and
> hence 52 remains the limit for the full address.
> 
> Jan
> 
> 




 


Rackspace

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