[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: Julien Grall <julien@xxxxxxx>, xen-devel@xxxxxxxxxxxxxxxxxxxx
  • From: Vikram Garhwal <vikram.garhwal@xxxxxxx>
  • Date: Wed, 7 Dec 2022 11:39:27 -0800
  • Arc-authentication-results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=amd.com; dmarc=pass action=none header.from=amd.com; dkim=pass header.d=amd.com; 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=Cle5Buqi8EAK/iXeHAAT+ZnQsRZuKEFr1CgDAmdunvc=; b=Z3yNffW9tdTMTfDDEbqlqKZa1SC3RlyNmerBYZ38IFikYHtSMNzt+jAOi2tNqL14dF2R3mpZL5xsYPlcOT+smEEctARfBIx+wm5/TynKLoPq/LWM0X3qhYSaOxiuLBVn2IYOVfxV4xXuY3S8cd6R9VzRJPbRGTMZ+bERNzzNlRrSxl9Y3sjYVpnd5zyLqpD4M0+te+amVzh/RuAbrpa/F82jNDXTxMuIc7G/icTlPP15wW+4up0K/eMGMyoN8fY8d+T18wkVBhzFMW0ZK2CzQOcoJHp2xU15YV63jsiCwWZbwci/EoSZ0G6G9WBqiUd4jQEOB0zpzBun9uQ/IWTu4A==
  • Arc-seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=b+APP9YtAW6I6MDtyk2DlLNTupR6bhXiDw+hbqfH0pg18F6E9CTLEWblQVITMUp46Y9IK/t4DF2Cr6b3eruMCWuNeD9myXgllSsc+MOefO3A0+ezJelj30oVx3ca0cs+zfXVuAN4QprOsP3xjtgFhl0kaon6BjHqv5XM4eneEWXSGu43+P406OKp62g0QQk4lq4vLWjh/aGIX7HUBvdU1i64ki5IB5PVCO+Z+goo7352qLGKrDj9uvAQJAPAzjmxW+pT79Mf3eTJs6tDuQDG1wmX1qO1nbe+I+vs4nodPbNKvjOSixIHyWQAb+bcdZp5riK7NYCDrHMk7lFakZPqWA==
  • Authentication-results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=amd.com;
  • 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 19:39:51 +0000
  • List-id: Xen developer discussion <xen-devel.lists.xenproject.org>

Hi Julien

On 12/7/22 8:28 AM, Julien Grall wrote:
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.

This was my initial approach also and there were less changes(compare to my v4) but then though someone might have issues with forward declaration of dt_device_node in smp.h.

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).

Will check this option.

Thank you suggestions!


Cheers,




 


Rackspace

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