From patchwork Sat Sep 28 14:20:34 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?q?Marek_Marczykowski-G=C3=B3recki?= X-Patchwork-Id: 11165413 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 CA9BB912 for ; Sat, 28 Sep 2019 14:22:31 +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 9DEA720880 for ; Sat, 28 Sep 2019 14:22:31 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=fail reason="signature verification failed" (2048-bit key) header.d=messagingengine.com header.i=@messagingengine.com header.b="EJcRl8RJ" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 9DEA720880 Authentication-Results: mail.kernel.org; dmarc=none (p=none dis=none) header.from=invisiblethingslab.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 1iEDb1-0003ij-5A; Sat, 28 Sep 2019 14:21:15 +0000 Received: from all-amaz-eas1.inumbo.com ([34.197.232.57] helo=us1-amaz-eas2.inumbo.com) by lists.xenproject.org with esmtp (Exim 4.89) (envelope-from ) id 1iEDaz-0003iJ-MN for xen-devel@lists.xenproject.org; Sat, 28 Sep 2019 14:21:13 +0000 X-Inumbo-ID: 39665e8e-e1fb-11e9-969b-12813bfff9fa Received: from out5-smtp.messagingengine.com (unknown [66.111.4.29]) by localhost (Halon) with ESMTPS id 39665e8e-e1fb-11e9-969b-12813bfff9fa; Sat, 28 Sep 2019 14:21:12 +0000 (UTC) Received: from compute7.internal (compute7.nyi.internal [10.202.2.47]) by mailout.nyi.internal (Postfix) with ESMTP id 8EDA820A34; Sat, 28 Sep 2019 10:21:12 -0400 (EDT) Received: from mailfrontend2 ([10.202.2.163]) by compute7.internal (MEProxy); Sat, 28 Sep 2019 10:21:12 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d= messagingengine.com; h=cc:content-transfer-encoding:content-type :date:from:in-reply-to:message-id:mime-version:references :subject:to:x-me-proxy:x-me-proxy:x-me-sender:x-me-sender :x-sasl-enc; s=fm3; bh=ibdft5z05fi+deOTQfoWvYpaHLXDhNtQVvDJtCVld ek=; b=EJcRl8RJQcWWC0vMTt+Tx14LvkuG14LrlIEOFuy8DJsHYdbZ8fG2q2aLg H6aDJ/1LJP2q9qjtxugq8ttode4FnxPwveU2XHTDDOE/EC7o7LJ3OtreXIp7vpYs qkB9FLpgDPorNCjR/RLdDSe+55aoyaReO+oD5cq9FYY+q5aXjg9TX5Nbh4o+CN7V EvvwrNe4d+v53F9TbjdtuAIVs6gAPNk/qKQrIecIhDNMLgkKkM+MxBuTo9pbwqQ/ y7kXI0tLpGpRUFk5tTQmswiEQWjLChPvbLaEBJe76h3BNFA6kkgPgJUmvjuePW2Y KKkhSaDWUoTl3XYgAJed7ZGFUykow== X-ME-Sender: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgedufedrfeekgdejgecutefuodetggdotefrodftvf curfhrohhfihhlvgemucfhrghsthforghilhdpqfgfvfdpuffrtefokffrpgfnqfghnecu uegrihhlohhuthemuceftddtnecusecvtfgvtghiphhivghnthhsucdlqddutddtmdenuc fjughrpefhvffufffkofgjfhggtgfgsehtkeertdertdejnecuhfhrohhmpeforghrvghk ucforghrtgiihihkohifshhkihdqifpkrhgvtghkihcuoehmrghrmhgrrhgvkhesihhnvh hishhisghlvghthhhinhhgshhlrggsrdgtohhmqeenucfkphepledurdeihedrfeegrdef feenucfrrghrrghmpehmrghilhhfrhhomhepmhgrrhhmrghrvghksehinhhvihhsihgslh gvthhhihhnghhslhgrsgdrtghomhenucevlhhushhtvghrufhiiigvpedt X-ME-Proxy: Received: from localhost.localdomain (ip5b412221.dynamic.kabel-deutschland.de [91.65.34.33]) by mail.messagingengine.com (Postfix) with ESMTPA id 9BFE3D6005E; Sat, 28 Sep 2019 10:21:11 -0400 (EDT) From: =?utf-8?q?Marek_Marczykowski-G=C3=B3recki?= To: xen-devel@lists.xenproject.org Date: Sat, 28 Sep 2019 16:20:34 +0200 Message-Id: <9a61b361c46b5b1082ef47ac6aa25f8b5db7646b.1569680095.git-series.marmarek@invisiblethingslab.com> X-Mailer: git-send-email 2.20.1 In-Reply-To: References: MIME-Version: 1.0 Subject: [Xen-devel] [PATCH v8 1/4] libxl: fix cold plugged PCI device with stubdomain 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: Anthony PERARD , Ian Jackson , =?utf-8?q?Marek_Marczykowski-G?= =?utf-8?q?=C3=B3recki?= , Wei Liu Errors-To: xen-devel-bounces@lists.xenproject.org Sender: "Xen-devel" When libxl__device_pci_add() is called, stubdomain is already running, even when still constructing the target domain. Previously, do_pci_add() was called with 'starting' hardcoded to false, but now do_pci_add() shares 'starting' flag in pci_add_state for both target domain and stubdomain. Fix this by resetting (local) 'starting' to false in pci_add_dm_done() (previously part of do_pci_add()) when handling stubdomain, regardless of pas->starting value. Fixes: 11db56f9a6 (libxl_pci: Use libxl__ao_device with libxl__device_pci_add) Signed-off-by: Marek Marczykowski-Górecki Reviewed-by: Anthony PERARD --- tools/libxl/libxl_pci.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/tools/libxl/libxl_pci.c b/tools/libxl/libxl_pci.c index 4725817..2edff64 100644 --- a/tools/libxl/libxl_pci.c +++ b/tools/libxl/libxl_pci.c @@ -1300,6 +1300,10 @@ static void pci_add_dm_done(libxl__egc *egc, if (rc) goto out; + /* stubdomain is always running by now, even at create time */ + if (isstubdom) + starting = false; + sysfs_path = GCSPRINTF(SYSFS_PCI_DEV"/"PCI_BDF"/resource", pcidev->domain, pcidev->bus, pcidev->dev, pcidev->func); f = fopen(sysfs_path, "r"); @@ -1559,7 +1563,6 @@ void libxl__device_pci_add(libxl__egc *egc, uint32_t domid, GCNEW(pcidev_s); libxl_device_pci_init(pcidev_s); libxl_device_pci_copy(CTX, pcidev_s, pcidev); - /* stubdomain is always running by now, even at create time */ pas->callback = device_pci_add_stubdom_done; do_pci_add(egc, stubdomid, pcidev_s, pas); /* must be last */ return;