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

[PATCH] tests/vpci: fix unit tests after locking change


  • To: <xen-devel@xxxxxxxxxxxxxxxxxxxx>
  • From: Stewart Hildebrand <stewart.hildebrand@xxxxxxx>
  • Date: Tue, 27 Feb 2024 09:57:43 -0500
  • Arc-authentication-results: i=1; mx.microsoft.com 1; spf=pass (sender ip is 165.204.84.17) smtp.rcpttodomain=lists.xenproject.org smtp.mailfrom=amd.com; dmarc=pass (p=quarantine sp=quarantine pct=100) action=none header.from=amd.com; dkim=none (message not signed); arc=none (0)
  • 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=vvj0LEigc/XintbNW+DN4Ey7AN3YiDC/XrVKTpDiUTE=; b=ZZVk1eUn5Jtsd7tFfcd4v+q8zJVmzhzGzYfW8AmlwxhkcwKvZ/Cq21PinAH30leIyHVwIiMOv2mZtJSzJ/0FJQoAXcqmM6w73mh69IncBQvhlmFFJlDoeRigrQ6sDQwxrZFYr3CnCSOcQk+a/LMfhd7wtQuco8+yRgHwR+6WHe3fRgX7dp8vqzFN6E+yNQKAaAV5u89p5Qx3+jc/dEB1h6ZdSGho8i9eeDSWzsTOiufS7FOguFBYd1SVPABD6clR07yiZkM78oDXIzk9BSobXp32oWO9CHhaLo+kz67psGzQjiUlZEnaMS8K3Cv70a1AJCeg7aipq1v/X3DETUfnEw==
  • Arc-seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=HGFri9EeGhHjGxvxu7ykHF97PigITRmmPBRvXXJL7LIKm2Yahor9SoN8OaXgtCpDg6GeqvlLPMS0B+Ll5vWiZNsEPDRi+ddnMZQEVYGl1kjjXp2VWoyp/vySOD7lSfPO+X6ZO+cf+cr2YvAqcvCIMYfmbFBWyOvBRKG1IKWoRKWjBRHrmxlTTCPwuo5JcY/KYYeexxi8syeGssyFEp9XIgm+15R2D3A0itCz9n97za/KeMAKu7xrmWWJUI5ZN0fQumeAU9PHy8JSh7KSGYsbvirGhXNQYKnIjeYeGSq1YNpT3jaEYJqgTnermod52umtzf0kZYY9g+DwY7VFrhItrw==
  • Cc: Stewart Hildebrand <stewart.hildebrand@xxxxxxx>, Roger Pau Monné <roger.pau@xxxxxxxxxx>, Wei Liu <wl@xxxxxxx>, Anthony PERARD <anthony.perard@xxxxxxxxxx>, Andrew Cooper <andrew.cooper3@xxxxxxxxxx>
  • Delivery-date: Tue, 27 Feb 2024 14:58:00 +0000
  • List-id: Xen developer discussion <xen-devel.lists.xenproject.org>

The recent vPCI locking broke the vPCI unit tests. Fix it to unblock CI.

Fixes: 4f78438b45e2 ("vpci: use per-domain PCI lock to protect vpci structure")
Reported-by: Andrew Cooper <andrew.cooper3@xxxxxxxxxx>
Signed-off-by: Stewart Hildebrand <stewart.hildebrand@xxxxxxx>
---
 tools/tests/vpci/emul.h | 9 ++++++++-
 tools/tests/vpci/main.c | 2 +-
 2 files changed, 9 insertions(+), 2 deletions(-)

diff --git a/tools/tests/vpci/emul.h b/tools/tests/vpci/emul.h
index 3c2f66a18f13..da446bba86b4 100644
--- a/tools/tests/vpci/emul.h
+++ b/tools/tests/vpci/emul.h
@@ -37,7 +37,10 @@
 
 #include "list.h"
 
+typedef bool rwlock_t;
+
 struct domain {
+    rwlock_t pci_lock;
 };
 
 struct pci_dev {
@@ -46,7 +49,7 @@ struct pci_dev {
 
 struct vcpu
 {
-    const struct domain *domain;
+    struct domain *domain;
 };
 
 extern const struct vcpu *current;
@@ -56,6 +59,10 @@ typedef bool spinlock_t;
 #define spin_lock_init(l) (*(l) = false)
 #define spin_lock(l) (*(l) = true)
 #define spin_unlock(l) (*(l) = false)
+#define read_lock(l) (*(l) = true)
+#define read_unlock(l) (*(l) = false)
+#define write_lock(l) (*(l) = true)
+#define write_unlock(l) (*(l) = false)
 
 typedef union {
     uint32_t sbdf;
diff --git a/tools/tests/vpci/main.c b/tools/tests/vpci/main.c
index 64d4552936c7..33223db3eb77 100644
--- a/tools/tests/vpci/main.c
+++ b/tools/tests/vpci/main.c
@@ -21,7 +21,7 @@
 /* Single vcpu (current), and single domain with a single PCI device. */
 static struct vpci vpci;
 
-const static struct domain d;
+static struct domain d;
 
 const struct pci_dev test_pdev = {
     .vpci = &vpci,

base-commit: 576528a2a742069af203e90c613c5c93e23c9755
-- 
2.43.2




 


Rackspace

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