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

Re: [PATCH 2/5] xen/vpci: make BAR mapping more resilient for the hardware domain


  • To: Roger Pau Monné <roger.pau@xxxxxxxxxx>
  • From: Stewart Hildebrand <stewart.hildebrand@xxxxxxx>
  • Date: Wed, 20 Aug 2025 14:32:48 -0400
  • Arc-authentication-results: i=1; mx.microsoft.com 1; spf=pass (sender ip is 165.204.84.17) smtp.rcpttodomain=citrix.com smtp.mailfrom=amd.com; dmarc=pass (p=quarantine sp=quarantine pct=100) action=none header.from=amd.com; dkim=none (message not signed); arc=none (0)
  • Arc-message-signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector10001; 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=/NgI6/QAGcQLG5GR+/UestV8rbSuNATaGqSMOGwCvrE=; b=LHin1GSElLWzGjThixruPxKa0hHAQfNPHNLNhGfvXuFigOv0ugAdon0ubovD1/oz+2Lx96ac6g2UJkvuQc99Rl2VuWvZe/A5isDM08yhqsozhkCcz9+R+uICJxsIj5wNokBdYNpK3tPS9zZUMeZU6hRjyiKarpuJ7BELwQ38Z62ULVgLx4LKH7t9KyFctZtMs36dnMG2+zV4QkVpvlaCXmg2TthBgO0F8adxmwf1DxUsCpE7+jb14VVz/9eBSxzgJWle513C7ViYQaqyupPhSlRj4uHJ1zpghdBMAPo567vS/TO9j/t3xNnW45DnNyY/aQ4r8U8YkDy6TleuS1zFXA==
  • Arc-seal: i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none; b=HgrDCB+QedkDFO0arpUeO8NRDeJzruT8Ad0ZFfNWiAH6orMmPVeI7p4aTTsZ9/mcFcKt6Id5vgausLQ08lNdJFe+85Tiz/CwlcwGf+PbYV+pM0yUY8wpHqmqE9Zcvr+e5VVlvDsItwD/J4Y6M7OafACuy52nEk/x/dIzc3hh2401xpRqDhj4RjOEX2L0uzozEP+ixK8+J/E/MtI/LSPEXH+XdPPFww7ActAGUUpq01QGL/Ha6Yd79ScOJiKY1wBSSQxNzb9Q72sApF01KJr8lot6nvyL/GBFHaHvxDwiCszczt3burMDmEC5c3xlpz9K2Oqst0v3PoXgB2LtHCfw3A==
  • Cc: <xen-devel@xxxxxxxxxxxxxxxxxxxx>, <Jiqian.Chen@xxxxxxx>, <jbeulich@xxxxxxxx>
  • Delivery-date: Wed, 20 Aug 2025 18:33:08 +0000
  • List-id: Xen developer discussion <xen-devel.lists.xenproject.org>

On 8/18/25 03:42, Roger Pau Monné wrote:
> On Fri, Aug 15, 2025 at 02:53:35PM -0400, Stewart Hildebrand wrote:
>> On 8/14/25 12:03, Roger Pau Monne wrote:
>>> The logic in map_range() will bubble up failures to the upper layer, which
>>> will result in any remaining regions being skip, and for the non-hardware
>>> domain case the owner domain of the device would be destroyed.  However for
>>> the hardware domain the intent is to continue execution, hopping the
>>> failure to modify the p2m could be worked around by the hardware domain.
>>>
>>> To accomplish that in a better way, ignore failures and skip the range in
>>> that case, possibly continuing to map further ranges.
>>>
>>> Since the error path in vpci_process_pending() should only be used by domUs
>>> now, and it will unconditionally end up calling domain_crash(), simplify
>>> it: there's no need to cleanup if the domain will be destroyed.
>>>
>>> No functional change for domUs intended.
>>>
>>> Signed-off-by: Roger Pau Monné <roger.pau@xxxxxxxxxx>
>>> ---
>>>  xen/drivers/vpci/header.c | 51 +++++++++++++++++++++------------------
>>>  1 file changed, 28 insertions(+), 23 deletions(-)
>>>
>>> diff --git a/xen/drivers/vpci/header.c b/xen/drivers/vpci/header.c
>>> index b9756b364300..1035dcca242d 100644
>>> --- a/xen/drivers/vpci/header.c
>>> +++ b/xen/drivers/vpci/header.c

<snip>

>>> @@ -213,28 +224,22 @@ bool vpci_process_pending(struct vcpu *v)
>>>              return true;
>>>          }
>>>  
>>> -        if ( rc )
>>> +        if ( rc && !is_hardware_domain(v->domain) )
>>>          {
>>> -            spin_lock(&pdev->vpci->lock);
>>> -            /* Disable memory decoding unconditionally on failure. */
>>> -            modify_decoding(pdev, v->vpci.cmd & ~PCI_COMMAND_MEMORY,
>>> -                            false);
>>
>> This path could be taken for either map or unmap. Do we still want to disable
>> memory decoding in case of unmap?
> 
> Does it make an effective difference?  For the hardware domain we
> should never get here, and for domUs the domain will be destroyed, so
> disabling memory decoding is not helpful?

Since the domU will be destroyed, the PCI device will get assigned back to hwdom
or put into quarantine. In case of quarantine, it shouldn't matter. In case of
assignment back to hwdom, I think by keeping memory decoding enabled it could
potentially trigger additional p2m operations.

In any case, I don't have a strong opinion on disabling memory decoding vs not,
but I think the commit message ought to mention something about it.



 


Rackspace

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