[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: Roger Pau Monné <roger.pau@xxxxxxxxxx>
  • From: Jan Beulich <jbeulich@xxxxxxxx>
  • Date: Mon, 18 Oct 2021 15:14:44 +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-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=1nir/CDbgke2ctiiAkaR7d30Y01lJbfttAFYzVvKImo=; b=F3xeVj2mDD3Dmw/4EL4ROb3juoCxpB+4HrtxSGeXsBfb3pZz+pQnzd220x0BOnAwmdhRfaiN6Ffjep/VgqURr88cn99efYY34GDe5nfKtOhXwxI9CcOUl/HbQQ79dApcsrwQvMbEVxFLWdZLYwOD5cHbZNIx+qiuqS5aEdz3lZF+7rciwS3lZ8JTQalQJeeBxSJnSLlysFHoqJMDV4M+sg6cvHVsRV5Ok1vBj17vGFZ4Mv/6n6Oas+q3fR/GtRtr8nm51q0MZFF8rs1UaEV9fXp+ogE5rg1XLOdQvFht9RfFmIQ5zWPZfyueoHwyqyAveVdxPL0JO5aQsWyjZ/zYOw==
  • Arc-seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=iJ5wqfB9lhIgyaeHKmtHp1m+HMHWWpnWx3qi396XeoQIW/fc0+q2YVy0Vbwliz3MxL0bOJsoe3UA8+5PwzQaEpiUaRY86wC4M8LxAX3tdwrKoFGspeXJZPsCkzSZuqo8w9Oa+9azdwlVRjbXfoMq/GiBIE8/NaX5OC2CBrKUO+v7M3W+QlJaOJ2D4WiJTDAmZwz7bdsNEav1ouKTMAzOonDsnjLAG2Pif6IhxQ03BIkhnkTAWTada6GiWTx1N4JzO9scd6/ijfGnnTzTjSVMkaysJY9zmwZsZr7thRvH+FJVUO7zlkLGvbm2oI6zL1k7NAy/5CYEjmMJxlrRRJPfZw==
  • Authentication-results: xen.org; dkim=none (message not signed) header.d=none;xen.org; dmarc=none action=none header.from=suse.com;
  • Cc: Andrew Cooper <andrew.cooper3@xxxxxxxxxx>, "xen-devel@xxxxxxxxxxxxxxxxxxxx" <xen-devel@xxxxxxxxxxxxxxxxxxxx>, Wei Liu <wl@xxxxxxx>
  • Delivery-date: Mon, 18 Oct 2021 13:14:53 +0000
  • List-id: Xen developer discussion <xen-devel.lists.xenproject.org>

On 18.10.2021 15:10, Roger Pau Monné wrote:
> 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.

Okay, I'll leave it as is then. If we decide otherwise, we always
can make an incremental change. Thanks for the feedback!

Jan




 


Rackspace

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