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

Re: [PATCH v4 09/23] libxl: remove unnecessary check from libxl__device_pci_add()


  • To: Paul Durrant <paul@xxxxxxx>, "xen-devel@xxxxxxxxxxxxxxxxxxxx" <xen-devel@xxxxxxxxxxxxxxxxxxxx>
  • From: Oleksandr Andrushchenko <Oleksandr_Andrushchenko@xxxxxxxx>
  • Date: Tue, 1 Dec 2020 13:51:44 +0000
  • Accept-language: en-US
  • Arc-authentication-results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=epam.com; dmarc=pass action=none header.from=epam.com; dkim=pass header.d=epam.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-SenderADCheck; bh=I7qEdFB+pb+3svKUzZSDr8+LbJ22z5hJ/xL4rLhctZU=; b=JkcnQ1MODOtSNuke69c3Pu5Idya7TgW7Z4bh3VmU+h4K4O3AoFGB2JLxWj9iRcC/GUAj0e8mS09DW6zyWa2/gZgTHN5QXDsYMFB+2Wyfjjv/fzDnhvf4Chkqkra64BFdhVRYgST8xnfz9tFZ1qyI+tPS7Khs+WKlBwodl2T8mMhXPUdp1+U42xFQbv/AmqF7J3J1wnYz1hna9T+/mVe6CxWHWdo7rmqYAT053x4Sn6dZcSZkZoeLYXfEX6wjczoKtg8r/AcY8jGgtj22ZigNbkPrKoylt+k26uCtA2DUVyqgj6okPujG93rRikgmz010pGiZmusYqvcEdwjThDcgLQ==
  • Arc-seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=dCOD3VQvecmyZ+jjaTMENwYLljYQm4sgm+tlMPmOoMpibBZTeXNy5BbHjSVQax/BA9OfMyRQtFuMqwa7JdGZtC0olbXq6B6sF31MlJECD+n8P/H6sDKwxQc9oDCJrORjhKhVP9Xstj9q9Prd1Yqcyu3KVJ2vVjUv6RhDPacKSiLMqYOlUk+iq0C+FJ4cZUVLD7I80eNAxYUBm9fm1wf9zv3I5+y3TPhKVHoIiKWrxs4TCBR+g559dOfpLO0dnYXnjycEtfFfjW1LCYv258PLckMs17pHZLh47BVgB4NY5py8YYIc77z7bVKaO/rzydf83knASv7DuqB6FL/M5jE7ag==
  • Authentication-results: xen.org; dkim=none (message not signed) header.d=none;xen.org; dmarc=none action=none header.from=epam.com;
  • Cc: Paul Durrant <pdurrant@xxxxxxxxxx>, Ian Jackson <iwj@xxxxxxxxxxxxxx>, Wei Liu <wl@xxxxxxx>
  • Delivery-date: Tue, 01 Dec 2020 13:51:56 +0000
  • List-id: Xen developer discussion <xen-devel.lists.xenproject.org>
  • Thread-index: AQHWx+kbix++NRxo5UGrslXglzQVrA==
  • Thread-topic: [PATCH v4 09/23] libxl: remove unnecessary check from libxl__device_pci_add()

Hi, Paul!

On 11/24/20 10:01 AM, Paul Durrant wrote:
> From: Paul Durrant <pdurrant@xxxxxxxxxx>
>
> The code currently checks explicitly whether the device is already assigned,
> but this is actually unnecessary as assigned devices do not form part of
> the list returned by libxl_device_pci_assignable_list() and hence the
> libxl_pci_assignable() test would have already failed.
>
> Signed-off-by: Paul Durrant <pdurrant@xxxxxxxxxx>

Reviewed-by: Oleksandr Andrushchenko <oleksandr_andrushchenko@xxxxxxxx>

Thank you,

Oleksandr

> ---
> Cc: Ian Jackson <iwj@xxxxxxxxxxxxxx>
> Cc: Wei Liu <wl@xxxxxxx>
> ---
>   tools/libs/light/libxl_pci.c | 16 +---------------
>   1 file changed, 1 insertion(+), 15 deletions(-)
>
> diff --git a/tools/libs/light/libxl_pci.c b/tools/libs/light/libxl_pci.c
> index a5d5d2e78b..ec101f255f 100644
> --- a/tools/libs/light/libxl_pci.c
> +++ b/tools/libs/light/libxl_pci.c
> @@ -1555,8 +1555,7 @@ void libxl__device_pci_add(libxl__egc *egc, uint32_t 
> domid,
>   {
>       STATE_AO_GC(aodev->ao);
>       libxl_ctx *ctx = libxl__gc_owner(gc);
> -    libxl_device_pci *assigned;
> -    int num_assigned, rc;
> +    int rc;
>       int stubdomid = 0;
>       pci_add_state *pas;
>   
> @@ -1595,19 +1594,6 @@ void libxl__device_pci_add(libxl__egc *egc, uint32_t 
> domid,
>           goto out;
>       }
>   
> -    rc = get_all_assigned_devices(gc, &assigned, &num_assigned);
> -    if ( rc ) {
> -        LOGD(ERROR, domid,
> -             "cannot determine if device is assigned, refusing to continue");
> -        goto out;
> -    }
> -    if ( is_pci_in_array(assigned, num_assigned, pci->domain,
> -                         pci->bus, pci->dev, pci->func) ) {
> -        LOGD(ERROR, domid, "PCI device already attached to a domain");
> -        rc = ERROR_FAIL;
> -        goto out;
> -    }
> -
>       libxl__device_pci_reset(gc, pci->domain, pci->bus, pci->dev, pci->func);
>   
>       stubdomid = libxl_get_stubdom_id(ctx, domid);

 


Rackspace

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