From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from lists.xenproject.org (lists.xenproject.org [192.237.175.120]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id E2659C7EE23 for ; Mon, 5 Jun 2023 19:46:41 +0000 (UTC) Received: from list by lists.xenproject.org with outflank-mailman.543897.849258 (Exim 4.92) (envelope-from ) id 1q6G9m-0000fe-7M; Mon, 05 Jun 2023 19:46:22 +0000 X-Outflank-Mailman: Message body and most headers restored to incoming version Received: by outflank-mailman (output) from mailman id 543897.849258; Mon, 05 Jun 2023 19:46:22 +0000 Received: from localhost ([127.0.0.1] helo=lists.xenproject.org) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1q6G9m-0000fX-4n; Mon, 05 Jun 2023 19:46:22 +0000 Received: by outflank-mailman (input) for mailman id 543897; Mon, 05 Jun 2023 19:46:21 +0000 Received: from mail.xenproject.org ([104.130.215.37]) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1q6G9l-0000fQ-5g for xen-devel@lists.xenproject.org; Mon, 05 Jun 2023 19:46:21 +0000 Received: from xenbits.xenproject.org ([104.239.192.120]) by mail.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1q6G9k-0004WV-JM; Mon, 05 Jun 2023 19:46:20 +0000 Received: from gw1.octic.net ([88.97.20.152] helo=[10.0.1.102]) by xenbits.xenproject.org with esmtpsa (TLS1.3:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.92) (envelope-from ) id 1q6G9k-00024K-Ds; Mon, 05 Jun 2023 19:46:20 +0000 X-BeenThere: xen-devel@lists.xenproject.org List-Id: Xen developer discussion List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Errors-To: xen-devel-bounces@lists.xenproject.org Precedence: list Sender: "Xen-devel" DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org; s=20200302mail; h=Content-Transfer-Encoding:Content-Type:In-Reply-To:From: References:Cc:To:Subject:MIME-Version:Date:Message-ID; bh=P3r5vagAfkT2yE3C7r0zsu4z7Yq/yat9S7mvlTE1vUg=; b=G3sNxw/Ex7d5dm3xHt6bT9CXIG 4jY+4znkTza4QWnKAdKa+amrqVKVhTwcxgnvDjtMU28msW7wF9M2egVpYRBNHGSoAuuH7k07AkDIm SQ3CigQWfDjTUHwqtHiiSsYgO5tAQbSKKcCIRxflzYbgvAtx1UAe9bbEpgHxja0w65Gk=; Message-ID: <49641d70-9540-1072-d496-772e83a555e4@xen.org> Date: Mon, 5 Jun 2023 20:46:17 +0100 MIME-Version: 1.0 User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.15; rv:102.0) Gecko/20100101 Thunderbird/102.10.1 Subject: Re: [XEN][PATCH v7 13/19] asm/smp.h: Fix circular dependency for device_tree.h and rwlock.h To: Vikram Garhwal , xen-devel@lists.xenproject.org Cc: michal.orzel@amd.com, sstabellini@kernel.org, jbeulich@suse.com, Bertrand Marquis , Volodymyr Babchuk References: <20230602004824.20731-1-vikram.garhwal@amd.com> <20230602004824.20731-14-vikram.garhwal@amd.com> From: Julien Grall In-Reply-To: <20230602004824.20731-14-vikram.garhwal@amd.com> Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit Hi, On 02/06/2023 01:48, 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. Reading this sentence, it sounds like you are adding the rwlock in this patch. However, this is not the case. Also, the rwlock is not only for browsing but also add new node. So how about ", we will need to add a rwlock to protect access to 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 and forward declared > "struct dt_device_node". > > Signed-off-by: Vikram Garhwal > Reviewed-by: Henry Wang > Reviewed-by: Michal Orzel > --- > 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 a37ca55bff..b12949ba8a 100644 > --- a/xen/arch/arm/include/asm/smp.h > +++ b/xen/arch/arm/include/asm/smp.h > @@ -3,13 +3,14 @@ > > #ifndef __ASSEMBLY__ > #include > -#include > #include > #endif > > DECLARE_PER_CPU(cpumask_var_t, cpu_sibling_mask); > DECLARE_PER_CPU(cpumask_var_t, cpu_core_mask); > > +struct dt_device_node; Can you add the declaration just above arch_cpu_init()? This will make clearer why the forward declaration is necessary. > + > #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 e107b86b7b..eeb76cd551 100644 > --- a/xen/arch/arm/smpboot.c > +++ b/xen/arch/arm/smpboot.c > @@ -10,6 +10,7 @@ > #include > #include > #include > +#include > #include > #include > #include Cheers, -- Julien Grall