powerpc/64s: Clarify copy_and_flush() cache sync loop comment
PATCH 1/1 powerpc/64s: Clarify copy_and_flush() cache sync loop comment
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.
--- arch/powerpc/kernel/head_64.S | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-)
arch/powerpc/kernel/head_64.S +8 -8
@@ -713,14 +713,14 @@ 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 will skip */ + /* dcbst/icbi for lines in between and */ + /* leave stale instructions in icache. */ mtctr r0 /* put # words/line in ctr */ 3: addi r6,r6,8 /* copy a cache line */
Signature · 1 line
2.43.5
Quoted 30 lines · Nikhil Kumar Singh
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 <[email protected]>--- arch/powerpc/kernel/head_64.S | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-)arch/powerpc/kernel/head_64.S +0
-6@@ -713,14 +713,14 @@ 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 */
arch/powerpc/kernel/head_64.S p_end: .8byte _end - copy_to_here · line 723
Quoted 10 lines
arch/powerpc/kernel/head_64.S +8
-2- /* 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 will skip */ + /* dcbst/icbi for lines in between and */ + /* leave stale instructions in icache. */
Looks good to me, previous comment stating cache line size may make it look like r0 is number of bytes being copied which isn't the case when the code is read. Hence:
Thanks,
- Aditya G
Quoted 3 lines
arch/powerpc/kernel/head_64.S +0
-0mtctr r0 /* put # words/line in ctr */ 3: addi r6,r6,8 /* copy a cache line */
Quoted 31 lines · Nikhil Kumar Singh
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 <[email protected]>--- arch/powerpc/kernel/head_64.S | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-)arch/powerpc/kernel/head_64.S +0
-7@@ -713,14 +713,14 @@ 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 */
arch/powerpc/kernel/head_64.S p_end: .8byte _end - copy_to_here · line 724
Quoted 10 lines
arch/powerpc/kernel/head_64.S +8
-1- /* 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 will skip */ + /* dcbst/icbi for lines in between and */ + /* leave stale instructions in icache. */
You dropped 2 pieces of information here, That we can't use NACA and that we are doing an extra cache line flush(atleast in case of P10).
Also use tab instead of spaces before commment close per line "*/" can you keep the last character aligned to rest of the file. It looks little nicer.
Regards,
Mukesh
Quoted 5 lines
arch/powerpc/kernel/head_64.S +0
-0mtctr r0 /* put # words/line in ctr */ 3: addi r6,r6,8 /* copy a cache line */Signature · 1 line
2.43.5
PATCH v2 1/1 powerpc/64s: Clarify copy_and_flush() cache sync loop comment
In reply to Nikhil Kumar SinghThe 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.
--- arch/powerpc/kernel/head_64.S | 20 ++++++++++++-------- 1 file changed, 12 insertions(+), 8 deletions(-)
arch/powerpc/kernel/head_64.S +12 -8
@@ -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. */ mtctr r0 /* put # words/line in ctr */ 3: addi r6,r6,8 /* copy a cache line */
Signature · 1 line
2.43.5
Quoted 34 lines · Nikhil Kumar Singh
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 <[email protected]>--- arch/powerpc/kernel/head_64.S | 20 ++++++++++++-------- 1 file changed, 12 insertions(+), 8 deletions(-)arch/powerpc/kernel/head_64.S +2
-8@@ -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. */
arch/powerpc/kernel/head_64.S p_end: .8byte _end - copy_to_here · line 727
Quoted 10 lines
arch/powerpc/kernel/head_64.S +10
-0+ /* 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
Quoted 6 lines
arch/powerpc/kernel/head_64.S +0
-0mtctr r0 /* put # words/line in ctr */ 3: addi r6,r6,8 /* copy a cache line */Signature · 1 line
2.43.5
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
Quoted 57 lines · Mukesh Kumar Chaurasiya
Quoted 34 lines · Nikhil Kumar Singh
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 <[email protected]>--- arch/powerpc/kernel/head_64.S | 20 ++++++++++++-------- 1 file changed, 12 insertions(+), 8 deletions(-)arch/powerpc/kernel/head_64.S +2
-8@@ -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. */arch/powerpc/kernel/head_64.S p_end: .8byte _end - copy_to_here · line 727
Quoted 10 lines
arch/powerpc/kernel/head_64.S +10
-0+ /* 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,
MukeshQuoted 6 lines
arch/powerpc/kernel/head_64.S +0
-0mtctr r0 /* put # words/line in ctr */ 3: addi r6,r6,8 /* copy a cache line */Signature · 1 line
2.43.5
Quoted 8 lines · Nikhil Kumar Singh
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
There is a reason we keep the character limit to 80 chars. Please go through these coding guidelines.
https://docs.kernel.org/process/coding-style.html
Regards,
Mukesh
Quoted 58 lines · Mukesh Kumar Chaurasiya
Quoted 56 lines · Nikhil Kumar Singh
Quoted 34 lines
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 <[email protected]>--- arch/powerpc/kernel/head_64.S | 20 ++++++++++++-------- 1 file changed, 12 insertions(+), 8 deletions(-)arch/powerpc/kernel/head_64.S +2
-8@@ -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. */arch/powerpc/kernel/head_64.S p_end: .8byte _end - copy_to_here · line 727
Quoted 10 lines
arch/powerpc/kernel/head_64.S +10
-0+ /* 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,
MukeshQuoted 5 lines
arch/powerpc/kernel/head_64.S +0
-0mtctr r0 /* put # words/line in ctr */ 3: addi r6,r6,8 /* copy a cache line */Signature · 1 line
2.43.5
Hi Mukesh,
Thanks for the clarification, sorry I missed that part. I'll update the comment to follow the 80-column limit and keep the alignment consistent in the next revision.
Thanks,
~ Nikhil
Quoted 74 lines · Mukesh Kumar Chaurasiya
Quoted 8 lines · Nikhil Kumar Singh
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,
~ NikhilThere is a reason we keep the character limit to 80 chars. Please go through these coding guidelines.
https://docs.kernel.org/process/coding-style.html
Regards,
MukeshQuoted 57 lines · Mukesh Kumar Chaurasiya
Quoted 56 lines · Nikhil Kumar Singh
Quoted 34 lines
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 <[email protected]>--- arch/powerpc/kernel/head_64.S | 20 ++++++++++++-------- 1 file changed, 12 insertions(+), 8 deletions(-)arch/powerpc/kernel/head_64.S +2
-8@@ -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. */arch/powerpc/kernel/head_64.S p_end: .8byte _end - copy_to_here · line 727
Quoted 10 lines
arch/powerpc/kernel/head_64.S +10
-0+ /* 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,
MukeshQuoted 5 lines
arch/powerpc/kernel/head_64.S +0
-0mtctr r0 /* put # words/line in ctr */ 3: addi r6,r6,8 /* copy a cache line */Signature · 1 line
2.43.5
Hi Mukesh,
Ideally, checkpatch should take care of this, I see no checkpatch errors.
``` ./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
Quoted 65 lines · Nikhil Kumar Singh
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,
~ NikhilQuoted 56 lines · Mukesh Kumar Chaurasiya
Quoted 36 lines · Nikhil Kumar Singh
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 <[email protected]>---
arch/powerpc/kernel/head_64.S| 20 ++++++++++++--------1 file changed, 12 insertions(+), 8 deletions(-)arch/powerpc/kernel/head_64.S +0
-0@@ -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. */Quoted 8 lines
+ /* 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,
MukeshQuoted 5 lines
mtctr r0 /* put # words/line in ctr */ 3: addi r6,r6,8 /* copy a cache line */
Signature · 1 line
2.43.5
Quoted 13 lines · Nikhil Kumar Singh
Hi Mukesh,
Ideally, checkpatch should take care of this, I see no checkpatch errors.
``` ./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. ```
Quoted 3 lines
Thanks
~ Nikhil
I am saying it looks nicer and easy to read for everyone if they are aligned. If you think it's not readable with the 80 char limit, put the whole comment before the function start. That will also makes it a little nicer. Right now it's getting wrapped around and it's difficult to read.
Regards,
Mukesh
Quoted 71 lines · Nikhil Kumar Singh
Quoted 70 lines
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,
~ NikhilQuoted 60 lines · Mukesh Kumar Chaurasiya
Quoted 40 lines · Nikhil Kumar Singh
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 <[email protected]>---
arch/powerpc/kernel/head_64.S| 20 ++++++++++++--------1 file changed, 12 insertions(+), 8 deletions(-)arch/powerpc/kernel/head_64.S +0
-0@@ -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. */Quoted 8 lines
+ /* 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,
MukeshQuoted 5 lines
mtctr r0 /* put # words/line in ctr */ 3: addi r6,r6,8 /* copy a cache line */
Signature · 1 line
2.43.5
Quoted 3 lines · Nikhil Kumar Singh
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
Quoted 84 lines
``` ./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
~ NikhilQuoted 70 lines · Nikhil Kumar Singh
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,
~ NikhilQuoted 60 lines · Mukesh Kumar Chaurasiya
Quoted 40 lines · Nikhil Kumar Singh
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 <[email protected]>---
arch/powerpc/kernel/head_64.S| 20 ++++++++++++--------1 file changed, 12 insertions(+), 8 deletions(-)arch/powerpc/kernel/head_64.S +0
-0@@ -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. */Quoted 8 lines
+ /* 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,
MukeshQuoted 5 lines
mtctr r0 /* put # words/line in ctr */ 3: addi r6,r6,8 /* copy a cache line */
Signature · 1 line
2.43.5
Quoted 37 lines · Nikhil Kumar Singh
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 <[email protected]>--- arch/powerpc/kernel/head_64.S | 20 ++++++++++++-------- 1 file changed, 12 insertions(+), 8 deletions(-)arch/powerpc/kernel/head_64.S +5
-8@@ -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 */
arch/powerpc/kernel/head_64.S p_end: .8byte _end - copy_to_here · line 730
Quoted 10 lines
arch/powerpc/kernel/head_64.S +7
-0+ /* 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. */ mtctr r0 /* put # words/line in ctr */ 3: addi r6,r6,8 /* copy a cache line */
Makes sense. Feel free to keep the rb.
Thanks,
- Aditya G
Quoted 34 lines · Nikhil Kumar Singh
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 <[email protected]>--- arch/powerpc/kernel/head_64.S | 20 ++++++++++++-------- 1 file changed, 12 insertions(+), 8 deletions(-)arch/powerpc/kernel/head_64.S +2
-8@@ -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. */
arch/powerpc/kernel/head_64.S p_end: .8byte _end - copy_to_here · line 727
Quoted 10 lines
arch/powerpc/kernel/head_64.S +10
-0+ /* 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. */
Looks good to me. The previous comment was misleading which makes one to think r0 as cache line size which is not the case.
Thanks,
-Mahesh.
Quoted 10 lines · Nikhil Kumar Singh
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.
[...]
Applied to powerpc/next.
[1/1] powerpc/64s: Clarify copy_and_flush() cache sync loop comment
https://git.kernel.org/powerpc/c/76ea1257924f64521f708db91c99014ce7249bbf
cheers
Quoted 30 lines · Nikhil Kumar Singh
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 <[email protected]>--- arch/powerpc/kernel/head_64.S | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-)arch/powerpc/kernel/head_64.S +0
-6@@ -713,14 +713,14 @@ 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 */
arch/powerpc/kernel/head_64.S p_end: .8byte _end - copy_to_here · line 723
Quoted 10 lines
arch/powerpc/kernel/head_64.S +8
-2- /* 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 will skip */ + /* dcbst/icbi for lines in between and */ + /* leave stale instructions in icache. */
Looks good to me. The previous comment was misleading which makes one to think r0 as cache line size which is not the case.
Thanks,
-Mahesh.