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

Re: [PATCH v2 1/1] xen/pci: Install vpci handlers on x86 and fix exit path


  • To: Bertrand Marquis <Bertrand.Marquis@xxxxxxx>
  • From: Jan Beulich <jbeulich@xxxxxxxx>
  • Date: Wed, 20 Oct 2021 11:21:03 +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=3azQUSj5yepMktjk7EyDu/U6Qk7BV3LRMNQ74C5EkA0=; b=AyVyBitdVBi+XhMYVOpPMjYqn68WpsKAE7slyYDb0tl9P/CGNtEFMds67BHj8N57dH0ybJBBrhw4Gjo41/F+pkl57cndHXm0Gm+3exrsisAeHg/j4X7rwvPIYhSLDo0r2f230JCsac85gY5f9sdtDDOXVlqgpI6tYb1fbie4z2F6+VFBAWn6feNdtqV+Yhv+0Czs0V8xNgqW34FKAc174zxvZu++oi23f7oBjhs6FqrlOOQQZhFVRL0Qxv501V4+yJMPNGEYm64VoxZjDn1TpeFQVs2nmn1X/WxCrw/OVzJiMXmmUML/1DDZhHrZfndr7+xrg/FFtIzDckH3DFcu6w==
  • Arc-seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=VGcXYMwFlV8I3Fsxrhk/PQXmvQgcTwtxb2eEckLwx6nHo197Euwd3ookFES04rW6oEqwJ3ulRdpH1M6xwnOEbpJAIRSZZcws7cNOugQvGA1alD2evLD3cipuN+Bl1D3E6Xm3SswAmHgDzhVzEaGr+WsmSxy902+HZt6rj5lZKuqUUlEZJ72jZPifw7Xv2qjahMFpeOiSJNaSViyG1oQYBDft+OI1LAx6pEVBzWcDbbl17YbnH76YX0AixelQULfPthA1LLZYWXIb2p76eaFyLzwRvR8SnOqN86VAqn33DpDqAB1CPiK5H0yHwPflGb5z+fDeYjJyiR06AnHdlorwNg==
  • Authentication-results: xen.org; dkim=none (message not signed) header.d=none;xen.org; dmarc=none action=none header.from=suse.com;
  • Cc: Roger Pau Monné <roger.pau@xxxxxxxxxx>, "xen-devel@xxxxxxxxxxxxxxxxxxxx" <xen-devel@xxxxxxxxxxxxxxxxxxxx>, "iwj@xxxxxxxxxxxxxx" <iwj@xxxxxxxxxxxxxx>, "Oleksandr_Andrushchenko@xxxxxxxx" <Oleksandr_Andrushchenko@xxxxxxxx>, Stefano Stabellini <sstabellini@xxxxxxxxxx>, Julien Grall <julien@xxxxxxx>, Volodymyr Babchuk <Volodymyr_Babchuk@xxxxxxxx>, Andrew Cooper <andrew.cooper3@xxxxxxxxxx>, Wei Liu <wl@xxxxxxx>, Paul Durrant <paul@xxxxxxx>
  • Delivery-date: Wed, 20 Oct 2021 09:21:18 +0000
  • List-id: Xen developer discussion <xen-devel.lists.xenproject.org>

On 20.10.2021 10:39, Bertrand Marquis wrote:
>> On 20 Oct 2021, at 09:34, Jan Beulich <jbeulich@xxxxxxxx> wrote:
>> On 20.10.2021 10:27, Roger Pau Monné wrote:
>>> On Tue, Oct 19, 2021 at 05:08:28PM +0100, Bertrand Marquis wrote:
>>>> --- a/xen/drivers/passthrough/pci.c
>>>> +++ b/xen/drivers/passthrough/pci.c
>>>> @@ -756,10 +756,9 @@ int pci_add_device(u16 seg, u8 bus, u8 devfn,
>>>>     if ( !pdev->domain )
>>>>     {
>>>>         pdev->domain = hardware_domain;
>>>> -#ifdef CONFIG_ARM
>>>>         /*
>>>> -         * On ARM PCI devices discovery will be done by Dom0. Add vpci 
>>>> handler
>>>> -         * when Dom0 inform XEN to add the PCI devices in XEN.
>>>> +         * For devices not discovered by Xen during boot, add vPCI 
>>>> handlers
>>>> +         * when Dom0 first informs Xen about such devices.
>>>>          */
>>>>         ret = vpci_add_handlers(pdev);
>>>>         if ( ret )
>>>
>>> Sorry to be a pain, but I think this placement of the call to
>>> vpci_add_handlers is bogus and should instead be done strictly after
>>> the device has been added to the hardware_domain->pdev_list list.
>>>
>>> Otherwise the loop over domain->pdev_list (for_each_pdev) in
>>> modify_bars won't be able to find the device and hit the assert below
>>> it. That can happen in vpci_add_handlers as it will call init_bars
>>> which in turn will call into modify_bars if memory decoding is enabled
>>> for the device.
>>
>> Oh, good point. And I should have thought of this myself, given that
>> I did hit that ASSERT() recently with a hidden device. FTAOD I think
>> this means that the list addition will need to move up (and then
>> would need undoing on the error path(s)).
> 
> Agree, I just need to make sure that calling iommu_add_device is not
> impacted by this. It is probably not but a confirmation would be good.

Like Roger, I'm unaware of any issue there. It would be odd anyway for
that (or about anything) to have a "is [not] on list" check. And the
set of list iterations is pretty limited iirc.

Jan




 


Rackspace

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