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

[XEN][PATCH v7 13/19] asm/smp.h: Fix circular dependency for device_tree.h and rwlock.h


  • To: <xen-devel@xxxxxxxxxxxxxxxxxxxx>
  • From: Vikram Garhwal <vikram.garhwal@xxxxxxx>
  • Date: Thu, 1 Jun 2023 17:48:18 -0700
  • 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
  • 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=cw3ZgAJufScS/YkBvxCBzP/nR/M5kVzAUuLpS4HefHs=; b=KscL3NRo1r76NTawraKYvZ8y8qLHIA8/tZAqJFqGCTuIs2vZR+BmHd8KYJt0npWP2ti+pmG2O/h4dU7QnRaJQzdrZb/VSsoZSHI2f7/BRNV0PG3mowPorYfj5s1XEOfAgvycMFwB9kKgARBY0SYREIsai9PfM+BNWXKCYvEn2qyL3TwT23ZY0n65vXxz+oi5M/+1QWBPtarY8L5qYtJ6YotKNcHj/jpjy4uFn8/RezFPlERGYCvMJ4HT/rV8N+PpDyBHjyPJD9sEBQ4him02LEarHIgGO4jB+xBJ/YzgZprJHfkNkAhtyaGmdYyt0eTWHaOuLriqVWaHNtbuYzd2kw==
  • Arc-seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=YP37zK1MTTnTIgBCY2xm9N1z2hnqLOVeWBQM1RnZhlDCKqm7YLOUoMJhQqDtKJ+oeoVU6UaidbwiqIeNkx73m7sBSp0v7mKYjSoArwukXZTyq9Q4I8+W4VOC7NQP1HbR3RKMS3BPhNrnnXWTkgH2lNFiL16DMCfyUcXbyCduLT6ocZsxZSQ+hngFKs6eO/tLC+LkzFLNYWGagsPYvm4IrEb/otucI4jrpwTdX0KzhaacwNKLflfk46s0lCsDHmqMqXMTxp9QHV22/+2VccM6ZXmrymxet/D0vAqKMlqRFPbwRP3F8yN+2yozDyNC56adV3qF93LZRLmgznhNRYlgEQ==
  • Cc: <michal.orzel@xxxxxxx>, <sstabellini@xxxxxxxxxx>, <vikram.garhwal@xxxxxxx>, <jbeulich@xxxxxxxx>, Julien Grall <julien@xxxxxxx>, Bertrand Marquis <bertrand.marquis@xxxxxxx>, Volodymyr Babchuk <Volodymyr_Babchuk@xxxxxxxx>
  • Delivery-date: Fri, 02 Jun 2023 00:49:15 +0000
  • List-id: Xen developer discussion <xen-devel.lists.xenproject.org>

Dynamic programming ops will modify the dt_host and there might be other
function which are browsing the dt_host at the same time. To avoid the race
conditions, adding rwlock for browsing the dt_host. But adding rwlock in
device_tree.h causes following circular dependency:
    device_tree.h->rwlock.h->smp.h->asm/smp.h->device_tree.h

To fix this, removed the "#include <xen/device_tree.h> and forward declared
"struct dt_device_node".

Signed-off-by: Vikram Garhwal <vikram.garhwal@xxxxxxx>
Reviewed-by: Henry Wang <Henry.Wang@xxxxxxx>
Reviewed-by: Michal Orzel <michal.orzel@xxxxxxx>
---
 xen/arch/arm/include/asm/smp.h | 3 ++-
 xen/arch/arm/smpboot.c         | 1 +
 2 files changed, 3 insertions(+), 1 deletion(-)

diff --git a/xen/arch/arm/include/asm/smp.h b/xen/arch/arm/include/asm/smp.h
index a37ca55bff..b12949ba8a 100644
--- a/xen/arch/arm/include/asm/smp.h
+++ b/xen/arch/arm/include/asm/smp.h
@@ -3,13 +3,14 @@
 
 #ifndef __ASSEMBLY__
 #include <xen/cpumask.h>
-#include <xen/device_tree.h>
 #include <asm/current.h>
 #endif
 
 DECLARE_PER_CPU(cpumask_var_t, cpu_sibling_mask);
 DECLARE_PER_CPU(cpumask_var_t, cpu_core_mask);
 
+struct dt_device_node;
+
 #define cpu_is_offline(cpu) unlikely(!cpu_online(cpu))
 
 #define smp_processor_id() get_processor_id()
diff --git a/xen/arch/arm/smpboot.c b/xen/arch/arm/smpboot.c
index e107b86b7b..eeb76cd551 100644
--- a/xen/arch/arm/smpboot.c
+++ b/xen/arch/arm/smpboot.c
@@ -10,6 +10,7 @@
 #include <xen/cpu.h>
 #include <xen/cpumask.h>
 #include <xen/delay.h>
+#include <xen/device_tree.h>
 #include <xen/domain_page.h>
 #include <xen/errno.h>
 #include <xen/init.h>
-- 
2.17.1




 


Rackspace

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