LinuxPPC-Dev Archive on lore.kernel.org
 help / color / mirror / Atom feed
From: Amit Machhiwal <amachhiw@linux.ibm.com>
To: Nikhil Kumar Singh <nikhilks@linux.ibm.com>
Cc: Mukesh Kumar Chaurasiya <mkchauras@gmail.com>,
	linuxppc-dev@lists.ozlabs.org, linux-kernel@vger.kernel.org,
	maddy@linux.ibm.com, mpe@ellerman.id.au, npiggin@gmail.com,
	chleroy@kernel.org, adityag@linux.ibm.com, mahesh@linux.ibm.com
Subject: Re: [PATCH v2] powerpc/64s: Clarify copy_and_flush() cache sync loop comment
Date: Fri, 17 Jul 2026 17:25:42 +0530	[thread overview]
Message-ID: <20260717171540.f81e62f3-71-amachhiw@linux.ibm.com> (raw)
In-Reply-To: <b5f97f5b-4a17-46f7-8830-a9c4c121f0c4@linux.ibm.com>

On 2026/07/09 11:40 AM, Nikhil Kumar Singh wrote:
> Hi Mukesh,
> 
> Ideally, checkpatch should take care of this, I see no checkpatch errors.

That is because the default $max_line_length is set to 100 columns in
checkpatch.pl scripts. The kernel coding style document recommends 80,
but checkpatch enforces 100 unless you pass --max-line-length=80
explicitly.

  my $max_line_length = 100;

You will see the warnings being reported when you run the script as:

  ❯ scripts/checkpatch.pl ./v2_20260706_nikhilks_powerpc_64s_clarify_copy_and_flush_cache_sync_loop_comment.mbx --max-line-length=80
  WARNING: line length of 82 exceeds 80 columns
  #44: FILE: arch/powerpc/kernel/head_64.S:716:
  +4:	li	r0,8			/* r0 is the number of 8-byte words	*/
  [...]
  
  total: 0 errors, 12 warnings, 26 lines checked

I agree with Mukesh here and I think the comment should be fixed to fit
within 80 column width limit as staying within 80 columns is certainly
still preferred.

Thanks,
Amit

> 
> ```
> ./scripts/checkpatch.pl
> v2-0001-powerpc-64s-Clarify-copy_and_flush-cache-sync-loo.patch
> total: 0 errors, 0 warnings, 26 lines checked
> 
> v2-0001-powerpc-64s-Clarify-copy_and_flush-cache-sync-loo.patch has no
> obvious style problems and is ready for submission.
> ```
> 
> Thanks
> ~ Nikhil
> 
> On 07/07/26 12:48, Nikhil Kumar Singh wrote:
> > Hi Mukesh,
> > 
> > Thanks for reviewing the patch and for the suggestion.
> > I'd prefer to keep the current alignment as I find it a bit more
> > readable.
> > 
> > Thanks,
> > ~ Nikhil
> > 
> > On 07/07/26 11:08, Mukesh Kumar Chaurasiya wrote:
> > > On Mon, Jul 06, 2026 at 01:57:08PM +0530, Nikhil Kumar Singh wrote:
> > > > The value loaded into r0 in copy_and_flush() represents the number of
> > > > 8-byte words processed between cache synchronization operations.
> > > > 
> > > > The existing comment refers to cache line size, which can make
> > > > it appear
> > > > that the value is a cache line size in bytes rather than a loop count.
> > > > Clarify the comment to explain that the loop processes 8 words
> > > > (64 bytes)
> > > > per cache synchronization iteration, and that increasing the
> > > > value would
> > > > skip cache maintenance for intermediate cache lines.
> > > > 
> > > > This is a comment-only change with no functional impact.
> > > > 
> > > > Signed-off-by: Nikhil Kumar Singh <nikhilks@linux.ibm.com>
> > > > ---
> > > >   arch/powerpc/kernel/head_64.S | 20 ++++++++++++--------
> > > >   1 file changed, 12 insertions(+), 8 deletions(-)
> > > > 
> > > > diff --git a/arch/powerpc/kernel/head_64.S
> > > > b/arch/powerpc/kernel/head_64.S
> > > > index 63432a33ec49..a54f6f979173 100644
> > > > --- a/arch/powerpc/kernel/head_64.S
> > > > +++ b/arch/powerpc/kernel/head_64.S
> > > > @@ -713,14 +713,18 @@ p_end: .8byte _end - copy_to_here
> > > >   _GLOBAL(copy_and_flush)
> > > >       addi    r5,r5,-8
> > > >       addi    r6,r6,-8
> > > > -4:    li    r0,8            /* Use the smallest common    */
> > > > -                    /* denominator cache line    */
> > > > -                    /* size.  This results in    */
> > > > -                    /* extra cache line flushes    */
> > > > -                    /* but operation is correct.    */
> > > > -                    /* Can't get cache line size    */
> > > > -                    /* from NACA as it is being    */
> > > > -                    /* moved too.            */
> > > > +4:    li    r0,8            /* r0 is the number of 8-byte words    */
> > > > +                    /* to copy per cache sync iteration. */
> > > > +                    /* 8 words * 8 bytes = 64 bytes. 64B is    */
> > > > +                    /* the current default cache line size.    */
> > > > +                    /* This is a loop count, not a byte    */
> > > > +                    /* count. Increasing it may skip    */
> > > > +                    /* dcbst/icbi for lines in between and */
> > > > +                    /* leave stale instructions in icache. */
> > > > +                    /* This results in extra cache line    */
> > > > +                    /* flushes but operation is correct. */
> > > > +                    /* Can't get cache line size from NACA */
> > > > +                    /* as it is being moved too.        */
> > > The comment looks fine. But the alignement of the comment is still
> > > different from earlier. Keep the alignment same as earlier, it looks a
> > > little nicer.
> > > 
> > > Regards,
> > > Mukesh
> > > >         mtctr    r0            /* put # words/line in ctr    */
> > > >   3:    addi    r6,r6,8            /* copy a cache line */
> > > > -- 
> > > > 2.43.5
> > > > 


  parent reply	other threads:[~2026-07-17 11:55 UTC|newest]

Thread overview: 14+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-07-01 18:27 [PATCH] powerpc/64s: Clarify copy_and_flush() cache sync loop comment Nikhil Kumar Singh
2026-07-01 18:38 ` Aditya Gupta
2026-07-02  5:28 ` Mukesh Kumar Chaurasiya
2026-07-06  8:27 ` [PATCH v2] " Nikhil Kumar Singh
2026-07-07  5:38   ` Mukesh Kumar Chaurasiya
2026-07-07  7:18     ` Nikhil Kumar Singh
2026-07-07  7:24       ` Mukesh Kumar Chaurasiya
2026-07-07  7:32         ` Nikhil Kumar Singh
2026-07-09  6:10       ` Nikhil Kumar Singh
2026-07-09  8:32         ` Mukesh Kumar Chaurasiya
2026-07-17 11:55         ` Amit Machhiwal [this message]
2026-07-17  6:40   ` Aditya Gupta
2026-07-17 14:52   ` Mahesh J Salgaonkar
2026-07-14 10:30 ` [PATCH] " Mahesh J Salgaonkar

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=20260717171540.f81e62f3-71-amachhiw@linux.ibm.com \
    --to=amachhiw@linux.ibm.com \
    --cc=adityag@linux.ibm.com \
    --cc=chleroy@kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linuxppc-dev@lists.ozlabs.org \
    --cc=maddy@linux.ibm.com \
    --cc=mahesh@linux.ibm.com \
    --cc=mkchauras@gmail.com \
    --cc=mpe@ellerman.id.au \
    --cc=nikhilks@linux.ibm.com \
    --cc=npiggin@gmail.com \
    /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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox