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

[XEN][PATCH v8 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: Wed, 16 Aug 2023 17:39:41 -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=kr0/WPGXrWX+5troHsezseknnebqb++eWnynezqYXcuHy45cyEivUfZ6PVV97dTZkoGureKLf1PXjUnFUebfwsNDgyc6d5UTAC/5dVRsoO29n7K478AGAt1cD+fjo+fhQxF3XY9zHS45fTDD06j4FHRKeJWw0X9IXimzowGVGkt4bgH7fbA0o+HWdtdkPPSLmB88zkWM9UjbrH1mlyFeELrt7+z9IUadc5MsFNeSEznFG8b+1x94Kx/YqAOooQenOkK2DESNpw5mSPUXXwAN/f0/Wd9BylyI5HTziaSPJ8/tLJ24/73usm/NrjVSu3HGI1iRud/SDMiteLaU9vgSPA==
  • Arc-seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=iOOUjvCMsKxWmuQ+eP0zb4yRO8q30D0X2fubeaLSsvNHDe8Qls2gd11lpbI6WioB1NVDDn59Yb5/HYBgfp65i04hEMZX0MZwoNzEp+hwnvD0iqw5ambYYAb1GD2pgmcJC3+yi0uHnB1ZRzBTC0nrnI69Une+hH3KvYA/x/bGIoOF00ZLuY1e/e9TgT9nQHqwnozIbqivy+MjCATN0fy9ZHONVEk+A6P9w/wN2jb4tFZJpJTEH6BGmmvOZvHgHph22QVz2SWWHHHDXDh48yJN7sPdI0leOVgMJSN9Yx2wj7bKlM69AlsBwXVklJWansRiy+zA5QyBCpDL8dS6Y1FnqQ==
  • Cc: <michal.orzel@xxxxxxx>, <sstabellini@xxxxxxxxxx>, <vikram.garhwal@xxxxxxx>, Julien Grall <julien@xxxxxxx>, Bertrand Marquis <bertrand.marquis@xxxxxxx>, Volodymyr Babchuk <Volodymyr_Babchuk@xxxxxxxx>
  • Delivery-date: Thu, 17 Aug 2023 00:50:30 +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®.