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

Re: [PATCH v2] pci/ats: do not allow broken devices to be assigned to guests


  • To: Roger Pau Monné <roger.pau@xxxxxxxxxx>
  • From: Jan Beulich <jbeulich@xxxxxxxx>
  • Date: Fri, 25 Feb 2022 09:50:03 +0100
  • 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=364jzE8FU/zdW/4zgsvrrBay0I6lxHePDd7eK5ROF9g=; b=ZrVWzNbWO5feOK65K6r7JoABBmJAAXV5tEouIO2ITJdsAE/4W35QMzCdE/iRmdTY2C2Wl4xvtSddbcoB5kVjvVwlo3ui62/DTCdYA15rdjuLvVm5hij7pnHduzqfLzigVVayrjZ74UYGRGdIbt0dFxO6c6o62Fyr2jOwN5Z/tbRhzmSaIJ+d0ZsBGdr2ou5bYVbwbCdOKE390MngosQ1ZqQONQUN7EFc6SG47b72C6KGNFFlatVabVJtGHZRPjuWj80S0sdRZMoDzb3QPkZbsV127cKEHs5RT5sEVnyCrCYtsWOr5q0qLmAB3O71bP7LtUQD7C4YzNFCjyX7ildwMQ==
  • Arc-seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=WE+LCd3+9P+eWXKoMKBSglQblRap+3I4Lme/BLI6OvtBqOLoBxCGXmPP1a9TSA+ycRbwqyT7Yo0qBLhTJE2gHNcRbvFR5OpTQtjT8YlMEw5DQNUnz+SRnxb3AmhvVEe8FhbSv+B264ZHowQIqqa7mr+Tpb7zC7Dzia2fnZGuZp9e/KohzVhWG70AGrg8rUUNtpOHG+pUWKT13ChfZiHRHBYEwLjZKYMHpRHnGMk8rk+Cay+CRUVgChDRGXJkmXTlGlwycMYsC7btHfszILtlFL0HTGkju+W9hFUa3HjmK6gerLpE8fiSV/YrPrzQ7FXzHY4VDLF1SIUp3fJUrcr3ig==
  • Authentication-results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=suse.com;
  • Cc: Paul Durrant <paul@xxxxxxx>, Andrew Cooper <andrew.cooper3@xxxxxxxxxx>, George Dunlap <george.dunlap@xxxxxxxxxx>, Julien Grall <julien@xxxxxxx>, Stefano Stabellini <sstabellini@xxxxxxxxxx>, Wei Liu <wl@xxxxxxx>, Kevin Tian <kevin.tian@xxxxxxxxx>, Oleksandr Andrushchenko <andr2000@xxxxxxxxx>, xen-devel@xxxxxxxxxxxxxxxxxxxx
  • Delivery-date: Fri, 25 Feb 2022 08:50:12 +0000
  • List-id: Xen developer discussion <xen-devel.lists.xenproject.org>

On 25.02.2022 09:41, Roger Pau Monné wrote:
> On Thu, Feb 24, 2022 at 05:43:13PM +0100, Jan Beulich wrote:
>> On 24.02.2022 17:37, Roger Pau Monne wrote:
>>> Introduce a new field to mark devices as broken: having it set
>>> prevents the device from being assigned to guests. Use the field in
>>> order to mark ATS devices that have failed a flush as broken, thus
>>> preventing them to be assigned to any guest.
>>>
>>> This allows the device IOMMU context entry to be cleaned up properly,
>>> as calling _pci_hide_device will just change the ownership of the
>>> device, but the IOMMU context entry of the device would be left as-is.
>>> It would also leak a Domain ID, as removing the device from it's
>>> previous owner will allow releasing the DID used by the device without
>>> having cleaned up the context entry.
>>
>> This DID aspect is VT-d specific, isn't it? I'd be inclined to ask to
>> make this explicit (which could be done while committing if no other
>> need for a v3 arises).
> 
> Indeed. AMD doesn't use iommu_dev_iotlb_flush_timeout so the function
> is VT-d specific.

But perhaps wrongly so. Which is why I'd prefer to ...

> What about using:
> 
> "Introduce a new field to mark devices as broken: having it set
> prevents the device from being assigned to guests. Use the field in
> order to mark ATS devices that have failed a flush when using VT-d as
> broken, thus preventing them to be assigned to any guest.

... omit VT-d here (i.e. leave this paragraph as you had it before),
but ...

> This allows the device IOMMU context entry to be cleaned up properly,
> as calling _pci_hide_device will just change the ownership of the
> device, but the IOMMU context entry of the device would be left as-is.
> It would also leak a VT-d Domain ID if using one, as removing the
> device from it's previous owner will allow releasing the IOMMU DID
> used by the device without having cleaned up the context entry."

... use this as replacement.

Jan




 


Rackspace

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