All of lore.kernel.org
 help / color / mirror / Atom feed
From: Mark Rutland <mark.rutland@arm.com>
To: Anshuman Khandual <anshuman.khandual@arm.com>
Cc: Puranjay Mohan <puranjay@kernel.org>,
	Catalin Marinas <catalin.marinas@arm.com>,
	Will Deacon <will@kernel.org>, Sumit Garg <sumit.garg@linaro.org>,
	Stephen Boyd <swboyd@chromium.org>,
	Douglas Anderson <dianders@chromium.org>,
	"Peter Zijlstra (Intel)" <peterz@infradead.org>,
	Thomas Gleixner <tglx@linutronix.de>,
	linux-arm-kernel@lists.infradead.org,
	linux-kernel@vger.kernel.org, bpf@vger.kernel.org,
	puranjay12@gmail.com
Subject: Re: [PATCH v2 1/2] arm64/arch_timer: include <linux/percpu.h>
Date: Fri, 3 May 2024 16:21:06 +0100	[thread overview]
Message-ID: <ZjUA4vRP_kLmCF6L@FVFF77S0Q05N> (raw)
In-Reply-To: <7008cd0c-5b65-4289-9015-434cbe3d7e21@arm.com>

On Fri, May 03, 2024 at 02:37:45PM +0530, Anshuman Khandual wrote:
> 
> 
> On 5/2/24 18:04, Puranjay Mohan wrote:
> > arch_timer.h includes linux/smp.h to use DEFINE_PER_CPU() and it works
> > because smp.h includes percpu.h. The next commit will remove percpu.h
> > from smp.h and it will break this usage.
> > 
> > Explicitly include percpu.h and remove smp.h
> 
> But this particular change does not seem to be necessary for changing
> raw_smp_processor_id() as current_thread_info()->cpu being done in the
> later patch ? You might still leave header <asm/percpu.h> inclusion in
> arch/arm64/include/asm/smp.h while dropping the per cpu cpu_number ?

Why would that be preferable?

The general rule is that if a file uses something explicitly, it should include
the relevant header directly rather than something that happens to transitively
include that header.

We made a mistake and included the wrong header in commit:

  6acc71ccac7187fc ("arm64: arch_timer: Allows a CPU-specific erratum to only affect a subset of CPUs")

... so we should fix that regardless of the next patch.

The point of the next patch is to effectively revert commit:

  57c82954e77fa12c ("arm64: make cpu number a percpu variable")

... and reverting that means we should stop including <asm/percpu.h> from
<asm/smp.h>; anything depending on that is already doing something wrong, and
leaving the include there only serves to paper over bugs.

Mark.

> 
> > 
> > Signed-off-by: Puranjay Mohan <puranjay@kernel.org>
> > ---
> >  arch/arm64/include/asm/arch_timer.h | 2 +-
> >  1 file changed, 1 insertion(+), 1 deletion(-)
> > 
> > diff --git a/arch/arm64/include/asm/arch_timer.h b/arch/arm64/include/asm/arch_timer.h
> > index 934c658ee947..f5794d50f51d 100644
> > --- a/arch/arm64/include/asm/arch_timer.h
> > +++ b/arch/arm64/include/asm/arch_timer.h
> > @@ -15,7 +15,7 @@
> >  #include <linux/bug.h>
> >  #include <linux/init.h>
> >  #include <linux/jump_label.h>
> > -#include <linux/smp.h>
> > +#include <linux/percpu.h>
> >  #include <linux/types.h>
> >  
> >  #include <clocksource/arm_arch_timer.h>

WARNING: multiple messages have this Message-ID (diff)
From: Mark Rutland <mark.rutland@arm.com>
To: Anshuman Khandual <anshuman.khandual@arm.com>
Cc: Puranjay Mohan <puranjay@kernel.org>,
	Catalin Marinas <catalin.marinas@arm.com>,
	Will Deacon <will@kernel.org>, Sumit Garg <sumit.garg@linaro.org>,
	Stephen Boyd <swboyd@chromium.org>,
	Douglas Anderson <dianders@chromium.org>,
	"Peter Zijlstra (Intel)" <peterz@infradead.org>,
	Thomas Gleixner <tglx@linutronix.de>,
	linux-arm-kernel@lists.infradead.org,
	linux-kernel@vger.kernel.org, bpf@vger.kernel.org,
	puranjay12@gmail.com
Subject: Re: [PATCH v2 1/2] arm64/arch_timer: include <linux/percpu.h>
Date: Fri, 3 May 2024 16:21:06 +0100	[thread overview]
Message-ID: <ZjUA4vRP_kLmCF6L@FVFF77S0Q05N> (raw)
In-Reply-To: <7008cd0c-5b65-4289-9015-434cbe3d7e21@arm.com>

On Fri, May 03, 2024 at 02:37:45PM +0530, Anshuman Khandual wrote:
> 
> 
> On 5/2/24 18:04, Puranjay Mohan wrote:
> > arch_timer.h includes linux/smp.h to use DEFINE_PER_CPU() and it works
> > because smp.h includes percpu.h. The next commit will remove percpu.h
> > from smp.h and it will break this usage.
> > 
> > Explicitly include percpu.h and remove smp.h
> 
> But this particular change does not seem to be necessary for changing
> raw_smp_processor_id() as current_thread_info()->cpu being done in the
> later patch ? You might still leave header <asm/percpu.h> inclusion in
> arch/arm64/include/asm/smp.h while dropping the per cpu cpu_number ?

Why would that be preferable?

The general rule is that if a file uses something explicitly, it should include
the relevant header directly rather than something that happens to transitively
include that header.

We made a mistake and included the wrong header in commit:

  6acc71ccac7187fc ("arm64: arch_timer: Allows a CPU-specific erratum to only affect a subset of CPUs")

... so we should fix that regardless of the next patch.

The point of the next patch is to effectively revert commit:

  57c82954e77fa12c ("arm64: make cpu number a percpu variable")

... and reverting that means we should stop including <asm/percpu.h> from
<asm/smp.h>; anything depending on that is already doing something wrong, and
leaving the include there only serves to paper over bugs.

Mark.

> 
> > 
> > Signed-off-by: Puranjay Mohan <puranjay@kernel.org>
> > ---
> >  arch/arm64/include/asm/arch_timer.h | 2 +-
> >  1 file changed, 1 insertion(+), 1 deletion(-)
> > 
> > diff --git a/arch/arm64/include/asm/arch_timer.h b/arch/arm64/include/asm/arch_timer.h
> > index 934c658ee947..f5794d50f51d 100644
> > --- a/arch/arm64/include/asm/arch_timer.h
> > +++ b/arch/arm64/include/asm/arch_timer.h
> > @@ -15,7 +15,7 @@
> >  #include <linux/bug.h>
> >  #include <linux/init.h>
> >  #include <linux/jump_label.h>
> > -#include <linux/smp.h>
> > +#include <linux/percpu.h>
> >  #include <linux/types.h>
> >  
> >  #include <clocksource/arm_arch_timer.h>

_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

  parent reply	other threads:[~2024-05-03 15:21 UTC|newest]

Thread overview: 22+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-05-02 12:34 [PATCH v2 1/2] arm64/arch_timer: include <linux/percpu.h> Puranjay Mohan
2024-05-02 12:34 ` Puranjay Mohan
2024-05-02 12:34 ` [PATCH v2 2/2] arm64: implement raw_smp_processor_id() using thread_info Puranjay Mohan
2024-05-02 12:34   ` Puranjay Mohan
2024-05-03  9:14   ` Anshuman Khandual
2024-05-03  9:14     ` Anshuman Khandual
2024-05-03 15:30   ` Mark Rutland
2024-05-03 15:30     ` Mark Rutland
2024-05-06  6:57   ` Anshuman Khandual
2024-05-06  6:57     ` Anshuman Khandual
2024-05-03  9:07 ` [PATCH v2 1/2] arm64/arch_timer: include <linux/percpu.h> Anshuman Khandual
2024-05-03  9:07   ` Anshuman Khandual
2024-05-03  9:44   ` Puranjay Mohan
2024-05-03  9:44     ` Puranjay Mohan
2024-05-06  6:10     ` Anshuman Khandual
2024-05-06  6:10       ` Anshuman Khandual
2024-05-03 15:21   ` Mark Rutland [this message]
2024-05-03 15:21     ` Mark Rutland
2024-05-03 15:14 ` Mark Rutland
2024-05-03 15:14   ` Mark Rutland
2024-05-06  6:55 ` Anshuman Khandual
2024-05-06  6:55   ` Anshuman Khandual

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=ZjUA4vRP_kLmCF6L@FVFF77S0Q05N \
    --to=mark.rutland@arm.com \
    --cc=anshuman.khandual@arm.com \
    --cc=bpf@vger.kernel.org \
    --cc=catalin.marinas@arm.com \
    --cc=dianders@chromium.org \
    --cc=linux-arm-kernel@lists.infradead.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=peterz@infradead.org \
    --cc=puranjay12@gmail.com \
    --cc=puranjay@kernel.org \
    --cc=sumit.garg@linaro.org \
    --cc=swboyd@chromium.org \
    --cc=tglx@linutronix.de \
    --cc=will@kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.