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

[XEN][PATCH v9 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: Fri, 18 Aug 2023 17:28:44 -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=zbvEFTy0SN7hLXU1211NeYzv59Rers6Gren3/qiNJHg=; b=nPLc5ySIBkM4rnzFRBzLfL+VJY7Zr9p4evkGRR8mvMEbPgpj8SRUb9S5gtaoC+vWwfhs2vwcpsWxbC9qvDo0zDPqZeNIVDJzoEPj7YvOHzBvWtdcGFn7dmz4Z5xmpvOALXUNx3JqLd2jKsu/ygIAI13DuQ0hUTDJRR65kWL5JQH4AESQCyqY1ueWltsCDQKrz9eXarTB/dg9LjL2+IugQYWSt3GMWW7ldH4Po1Bc4KFHM8O8V4q5orfukeC5lE5OY2PHAdhgCIGk2OudsqfY64+tTOcRqBs79fOLoIadW+QJdGO+UertB672rexHT+vIg0zwr1cmtf3VCaBYyCchcg==
  • Arc-seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=n9QpzAX86QxnQp1df+PAZWOOhRNKD/SWA9p0HQPiRsEQbtpcZkEJLfejX4iWlfPriTAPjnhcZlv8wUjV/QfZ0vBp94SPXQyvIZkEfEpwOrJWCu/SN5ij2SdfhglA0wjc9bCaoxZ/2XeC5n5ct/q/YBTbM8bvC2wdcUNjHCF5DD2xciruDTBBlcBVFKVcXp9Eo2tMFGYuVvvTGN7fuMo1Jq84ujuCDiOdv5trOOGs+8Q9g1/mMHhluEjRKna/w+1hPfa2Wt+8FuERg3fZxPsoyFFlRMiHSsAp+0bsfXeUsUNskfE55EFELZJ/6WWR62NY4UVxA7kvqp7zYxDUJbj3EA==
  • 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: Sat, 19 Aug 2023 00:29:25 +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, we will need to add a rwlock to protect access to the dt_host.
However, 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>

---
    Changes from v7:
        Move struct dt_device_node declaration just above arch_cpu_init().
---
---
 xen/arch/arm/include/asm/smp.h | 4 +++-
 xen/arch/arm/smpboot.c         | 1 +
 2 files changed, 4 insertions(+), 1 deletion(-)

diff --git a/xen/arch/arm/include/asm/smp.h b/xen/arch/arm/include/asm/smp.h
index a37ca55bff..4fabdf5310 100644
--- a/xen/arch/arm/include/asm/smp.h
+++ b/xen/arch/arm/include/asm/smp.h
@@ -3,7 +3,6 @@
 
 #ifndef __ASSEMBLY__
 #include <xen/cpumask.h>
-#include <xen/device_tree.h>
 #include <asm/current.h>
 #endif
 
@@ -23,6 +22,9 @@ DECLARE_PER_CPU(cpumask_var_t, cpu_core_mask);
 extern void noreturn stop_cpu(void);
 
 extern int arch_smp_init(void);
+
+struct dt_device_node;
+
 extern int arch_cpu_init(int cpu, struct dt_device_node *dn);
 extern int arch_cpu_up(int cpu);
 extern void arch_cpu_up_finish(void);
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®.