From patchwork Tue Oct 8 14:10:24 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Oleksandr Grytsov X-Patchwork-Id: 11179667 Return-Path: Received: from mail.kernel.org (pdx-korg-mail-1.web.codeaurora.org [172.30.200.123]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 5863515AB for ; Tue, 8 Oct 2019 14:12:02 +0000 (UTC) Received: from lists.xenproject.org (lists.xenproject.org [192.237.175.120]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 347772064A for ; Tue, 8 Oct 2019 14:12:02 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=fail reason="signature verification failed" (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="CIXl+xvN" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 347772064A Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=gmail.com Authentication-Results: mail.kernel.org; spf=none smtp.mailfrom=xen-devel-bounces@lists.xenproject.org Received: from localhost ([127.0.0.1] helo=lists.xenproject.org) by lists.xenproject.org with esmtp (Exim 4.89) (envelope-from ) id 1iHqCK-0006wL-PH; Tue, 08 Oct 2019 14:10:44 +0000 Received: from us1-rack-iad1.inumbo.com ([172.99.69.81]) by lists.xenproject.org with esmtp (Exim 4.89) (envelope-from ) id 1iHqCJ-0006vz-4o for xen-devel@lists.xenproject.org; Tue, 08 Oct 2019 14:10:43 +0000 X-Inumbo-ID: 644177d8-e9d5-11e9-96dc-bc764e2007e4 Received: from mail-lj1-x242.google.com (unknown [2a00:1450:4864:20::242]) by us1-rack-iad1.inumbo.com (Halon) with ESMTPS id 644177d8-e9d5-11e9-96dc-bc764e2007e4; Tue, 08 Oct 2019 14:10:33 +0000 (UTC) Received: by mail-lj1-x242.google.com with SMTP id m7so17723651lji.2 for ; Tue, 08 Oct 2019 07:10:33 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=8cB5iex11iqVqDmJdNxCcGJEmCz5fLgF2Tp7Bx104WI=; b=CIXl+xvNvz41+yj3i1UYt7xrv3F7Yy2UtVAD29K2Ob6DxVuKOwl7TTQ6hXhWISLbJK 7AwskGMLjcxyUrvNwTB8ytAe1FUCXqlMXOdjRExpmSil9Q7buBgahfUb3olJkhmRThYW PPgtyFJaFyFuN5CUJzebz6F95Ch98el+u3S6t4gz1BLFdQwNabb2Qo8DFaN1D6zIkfW8 AcjNF+RCz8uSlO8nezzFDYXjwrpuh8/xJObpT8B9ga6QhU4lsAdAa72r5PxZNMTzEHUu 6nTPTCXQz3xHlzU/+CKd2wmECHssvKlaSpnRpfUbH4d7tE9wSbGzgMQ04JBMp8sJGPDi NsGA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=8cB5iex11iqVqDmJdNxCcGJEmCz5fLgF2Tp7Bx104WI=; b=e9u1fTH+HVjujmKR7kQXxkNALfNiCpzpkqs7q2SWrL+DOkYLwNTkS7d5n5RlknVoxz J90d9gFLwi0pBlNqztq/Q21taPY78+bEy/kmJpt3zVhBYTwkptKGjBIdwAEBRlTOW6qo lt98r1A3YLLM7pJGMRoNf3WMsKif5ixSPF2XEs5wXPqyHcMfSuT9Ixa6DXMlA1ZbEZ6M Q8pTkFUQDq5wUzFyyydWhD+tjxeWfdte617dqvIat4ls47xtR02GdIcsgtk4HqwNvfTX Cs5z+JLtrcXoBJPvFfOhGSrOFSBlsZs2qpSXo8ppsAASXDGNd0QJ4iJE0qKsbT5C4TQc 1DKQ== X-Gm-Message-State: APjAAAWdOR2p8XsPSaZ3Xhzt64dFvBDHr9P2JbaX9bUDJcaJpXNZwE6j iOaoHDXetJe9gpvXLQ5r9iRjgl61NHo= X-Google-Smtp-Source: APXvYqx3olnVYwO9LIS+6/+MUJykG7EFYX6ORNtmVabgCPKFVPIxQ+RICrmYikRh3SHQdHwb491k8g== X-Received: by 2002:a2e:504f:: with SMTP id v15mr22919371ljd.67.1570543832359; Tue, 08 Oct 2019 07:10:32 -0700 (PDT) Received: from al1-pc.kyiv.epam.com (ll-74.141.223.85.sovam.net.ua. [85.223.141.74]) by smtp.gmail.com with ESMTPSA id z20sm4937764ljk.63.2019.10.08.07.10.31 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 08 Oct 2019 07:10:31 -0700 (PDT) From: Oleksandr Grytsov To: xen-devel@lists.xenproject.org Date: Tue, 8 Oct 2019 17:10:24 +0300 Message-Id: <20191008141024.10885-3-al1img@gmail.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20191008141024.10885-1-al1img@gmail.com> References: <20191008141024.10885-1-al1img@gmail.com> Subject: [Xen-devel] [PATCH v1 2/2] libxl: add removing XS backend path for PV devices on domain destroy X-BeenThere: xen-devel@lists.xenproject.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: Xen developer discussion List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Cc: Oleksandr Grytsov , ian.jackson@eu.citrix.com, wl@xen.org MIME-Version: 1.0 Errors-To: xen-devel-bounces@lists.xenproject.org Sender: "Xen-devel" From: Oleksandr Grytsov Currently backend path is remove for specific devices: VBD, VIF, QDISK. This commit adds removing backend path for: VDISPL, VSND, VINPUT. Signed-off-by: Oleksandr Grytsov --- tools/libxl/libxl_device.c | 14 +++++--------- 1 file changed, 5 insertions(+), 9 deletions(-) diff --git a/tools/libxl/libxl_device.c b/tools/libxl/libxl_device.c index 1402b61a81..8ce70661e5 100644 --- a/tools/libxl/libxl_device.c +++ b/tools/libxl/libxl_device.c @@ -1477,7 +1477,7 @@ typedef struct libxl__ddomain_device { */ typedef struct libxl__ddomain_guest { uint32_t domid; - int num_vifs, num_vbds, num_qdisks; + int num_qdisks; LIBXL_SLIST_HEAD(, struct libxl__ddomain_device) devices; LIBXL_SLIST_ENTRY(struct libxl__ddomain_guest) next; } libxl__ddomain_guest; @@ -1530,8 +1530,7 @@ static void check_and_maybe_remove_guest(libxl__gc *gc, { assert(ddomain); - if (dguest != NULL && - dguest->num_vifs + dguest->num_vbds + dguest->num_qdisks == 0) { + if (dguest != NULL && LIBXL_SLIST_FIRST(&dguest->devices) == NULL) { LIBXL_SLIST_REMOVE(&ddomain->guests, dguest, libxl__ddomain_guest, next); LOGD(DEBUG, dguest->domid, "Removed domain from the list of active guests"); @@ -1573,9 +1572,6 @@ static int add_device(libxl__egc *egc, libxl__ao *ao, switch(dev->backend_kind) { case LIBXL__DEVICE_KIND_VBD: case LIBXL__DEVICE_KIND_VIF: - if (dev->backend_kind == LIBXL__DEVICE_KIND_VBD) dguest->num_vbds++; - if (dev->backend_kind == LIBXL__DEVICE_KIND_VIF) dguest->num_vifs++; - GCNEW(aodev); libxl__prepare_ao_device(ao, aodev); /* @@ -1619,11 +1615,11 @@ static int remove_device(libxl__egc *egc, libxl__ao *ao, int rc = 0; switch(ddev->dev->backend_kind) { + case LIBXL__DEVICE_KIND_VDISPL: + case LIBXL__DEVICE_KIND_VSND: + case LIBXL__DEVICE_KIND_VINPUT: case LIBXL__DEVICE_KIND_VBD: case LIBXL__DEVICE_KIND_VIF: - if (dev->backend_kind == LIBXL__DEVICE_KIND_VBD) dguest->num_vbds--; - if (dev->backend_kind == LIBXL__DEVICE_KIND_VIF) dguest->num_vifs--; - GCNEW(aodev); libxl__prepare_ao_device(ao, aodev); /*