[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [XEN][RFC PATCH v4 10/16] asm/smp.h: move cpu related function to asm/cpu.h
- To: Vikram Garhwal <vikram.garhwal@xxxxxxx>, xen-devel@xxxxxxxxxxxxxxxxxxxx
- From: Julien Grall <julien@xxxxxxx>
- Date: Wed, 7 Dec 2022 16:28:22 +0000
- Cc: sstabellini@xxxxxxxxxx, Luca.Fancellu@xxxxxxx, Bertrand Marquis <bertrand.marquis@xxxxxxx>, Volodymyr Babchuk <Volodymyr_Babchuk@xxxxxxxx>, Andrew Cooper <andrew.cooper3@xxxxxxxxxx>, George Dunlap <george.dunlap@xxxxxxxxxx>, Jan Beulich <jbeulich@xxxxxxxx>, Wei Liu <wl@xxxxxxx>
- Delivery-date: Wed, 07 Dec 2022 16:28:41 +0000
- List-id: Xen developer discussion <xen-devel.lists.xenproject.org>
Hi Vikram,
On 07/12/2022 06:18, 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
Inside arch/arm/include/asm/smp.h, there is one function which needs
device_tree.h, moved the cpu related function to a new file:
arch/arm/include/asm/cpu.h
Given there is only one function, I don't really see the benefits of
splitting smp.h and then adding #ifdef CONFIG_ARM in the common code.
Instead, it would be better if we don't include device_tree.h in the
header but in the c files that need to call arch_cpu_init() and forward
declare dt_device_node.
Another potential approach is to move out the percpu_rwlock helpers in a
separate header. The advantage with this approach is we would reduce the
number of definition included everywhere (there are not many use of the
percpu rwlock).
Cheers,
--
Julien Grall
|