[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [PATCH v5 04/14] vpci: cancel pending map/unmap on vpci removal
- To: Oleksandr Andrushchenko <andr2000@xxxxxxxxx>
- From: Jan Beulich <jbeulich@xxxxxxxx>
- Date: Wed, 12 Jan 2022 16:27:30 +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=JWFdSE24icpcZTDwVntd3e1oBj5Dp4X5/YgJhl8hgqo=; b=mVszAjEOPJIpg+NvzjZsfmTNNYtVRMc71EU7WL8bg64aQhReJgRK4ruc0VvsUDe0agQT7u92JJoRab1SRBvqoexDZGtqmePqFMWqUyygj0ixmCDNggRezPjYY4mJxRQfgpw5+NGJ5Ai3K4BB7TasHUpwwhMmQlZyxEMZI4Pbgj+T1jFLwPQtH84NR1ZBEfaEv46Qi1LDTNTJ8i482O8KJH9AhRvH6F4TjdAtsgmNPD6okQmgZDSFc5fYhlzx0iMe+WB5Ta7afE+p2xGGzhDQlxEalayCnbqLej6b14vIr8bqCTSJ9wtKO5XroqlOQBInjF4JmxiQYUe9gJX3/GJ7Uw==
- Arc-seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=Qd/aGnLaqz48bqZegufWTkFY7m8+O8PJM/HQHvH3sASPijuBi4tUBdDDTM+f8WeTk7lx9xQuOIo816/2QUs2WQBVRL2K8VRK067aJhDQfjPlQEf00Rzxh85glMNdzuMbiNMzB2D4VbgBkcAaimv5wPBQA8z6M21SGhSHaTIY5M8EeCXPTyy1tSpfxJLvnDP73zKfcLcPu6cDE90+0qd6YWfiiyPG4WOlyMEXvIKxlAm5yw818N2jC147TUUMlse5WXOUO7X9++TfOuIe83JuuG8vGIUvvkcFXP4Bf2WQw42wRj78WX8BX9ICkUryhVYIPh8GvSDV4194z5yG1Bqafg==
- Authentication-results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=suse.com;
- Cc: julien@xxxxxxx, sstabellini@xxxxxxxxxx, oleksandr_tyshchenko@xxxxxxxx, volodymyr_babchuk@xxxxxxxx, Artem_Mygaiev@xxxxxxxx, roger.pau@xxxxxxxxxx, andrew.cooper3@xxxxxxxxxx, george.dunlap@xxxxxxxxxx, paul@xxxxxxx, bertrand.marquis@xxxxxxx, rahul.singh@xxxxxxx, Oleksandr Andrushchenko <oleksandr_andrushchenko@xxxxxxxx>, xen-devel@xxxxxxxxxxxxxxxxxxxx
- Delivery-date: Wed, 12 Jan 2022 15:27:45 +0000
- List-id: Xen developer discussion <xen-devel.lists.xenproject.org>
On 25.11.2021 12:02, Oleksandr Andrushchenko wrote:
> From: Oleksandr Andrushchenko <oleksandr_andrushchenko@xxxxxxxx>
>
> When a vPCI is removed for a PCI device it is possible that we have
> scheduled a delayed work for map/unmap operations for that device.
> For example, the following scenario can illustrate the problem:
>
> pci_physdev_op
> pci_add_device
> init_bars -> modify_bars -> defer_map ->
> raise_softirq(SCHEDULE_SOFTIRQ)
> iommu_add_device <- FAILS
> vpci_remove_device -> xfree(pdev->vpci)
>
> leave_hypervisor_to_guest
> vpci_process_pending: v->vpci.mem != NULL; v->vpci.pdev->vpci == NULL
>
> For the hardware domain we continue execution as the worse that
> could happen is that MMIO mappings are left in place when the
> device has been deassigned.
>
> For unprivileged domains that get a failure in the middle of a vPCI
> {un}map operation we need to destroy them, as we don't know in which
> state the p2m is. This can only happen in vpci_process_pending for
> DomUs as they won't be allowed to call pci_add_device.
>
> Signed-off-by: Oleksandr Andrushchenko <oleksandr_andrushchenko@xxxxxxxx>
>
> ---
> Cc: Roger Pau Monné <roger.pau@xxxxxxxxxx>
> ---
> Since v4:
> - crash guest domain if map/unmap operation didn't succeed
> - re-work vpci cancel work to cancel work on all vCPUs
> - use new locking scheme with pdev->vpci_lock
> New in v4
>
> Fixes: 86dbcf6e30cb ("vpci: cancel pending map/unmap on vpci removal")
What is this about?
Jan
|