Message ID | 20230411191636.26926-12-vikram.garhwal@amd.com (mailing list archive) |
---|---|
State | Superseded |
Headers | show |
Series | dynamic node programming using overlay dtbo | expand |
Hi Vikram, > -----Original Message----- > Subject: [XEN][PATCH v5 11/17] asm/smp.h: Fix circular dependency for > device_tree.h and rwlock.h > > 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@amd.com> Reviewed-by: Henry Wang <Henry.Wang@arm.com> Kind regards, Henry
Hi Vikram, On 11/04/2023 21:16, Vikram Garhwal wrote: > > > 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@amd.com> > --- > 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 8133d5c295..afe6129276 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 412ae22869..336a7d418b 100644 > --- a/xen/arch/arm/smpboot.c > +++ b/xen/arch/arm/smpboot.c > @@ -11,6 +11,7 @@ > #include <xen/cpumask.h> > #include <xen/delay.h> > #include <xen/domain_page.h> > +#include <xen/device_tree.h> Headers should be listed in alphabetical order, so device_tree.h goes before domain_page.h Other than that: Reviewed-by: Michal Orzel <michal.orzel@amd.com> ~Michal
diff --git a/xen/arch/arm/include/asm/smp.h b/xen/arch/arm/include/asm/smp.h index 8133d5c295..afe6129276 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 412ae22869..336a7d418b 100644 --- a/xen/arch/arm/smpboot.c +++ b/xen/arch/arm/smpboot.c @@ -11,6 +11,7 @@ #include <xen/cpumask.h> #include <xen/delay.h> #include <xen/domain_page.h> +#include <xen/device_tree.h> #include <xen/errno.h> #include <xen/init.h> #include <xen/mm.h>
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@amd.com> --- xen/arch/arm/include/asm/smp.h | 3 ++- xen/arch/arm/smpboot.c | 1 + 2 files changed, 3 insertions(+), 1 deletion(-)