Skip to contentSkip to conversation

checkpatch: add fix option for MISSING_SIGN_OFF

PATCH In review Aditya Srivastava 2 participants 8 messages Nov 10, 2020

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 checkpatch: add fix option for MISSING_SIGN_OFF

Currently checkpatch warns us if there is no 'Signed-off-by' line for the patch.

E.g., running checkpatch on commit 9ac060a708e0 ("leaking_addresses:
Completely remove --version flag") reports this error:

ERROR: Missing Signed-off-by: line(s)

Provide a fix by adding a Signed-off-by line corresponding to the author of the patch before the patch separator line. Also avoid this error for the commits where some typo is present in the sign off.

E.g. for commit 8cde5d5f7361 ("bus: ti-sysc: Detect omap4 type timers for quirk") we get missing sign off as well as bad sign off for:

Here it is probably best to give BAD_SIGN_OFF warning for Non-standard signature and avoid MISSING_SIGN_OFF

---
This patch was made after applying https://lore.kernel.org/linux-kernel-mentees/[email protected]/
and my last changes at https://lore.kernel.org/linux-kernel-mentees/[email protected]/

 scripts/checkpatch.pl | 18 +++++++++++++++---
 1 file changed, 15 insertions(+), 3 deletions(-)
scripts/checkpatch.pl +15 -3
index cb46288127ac..2deffd0c091b 100755
@@ -2404,6 +2404,8 @@ sub process {
 
 	my $last_blank_line = 0;
 	my $last_coalesced_string_linenr = -1;
+	my $patch_separator_linenr = 0;
+	my $non_standard_signature = 0;
 
 	our @report = ();
 	our $cnt_lines = 0;
@@ -2755,6 +2757,10 @@ sub process {
 		if ($line =~ /^---$/) {
 			$has_patch_separator = 1;
 			$in_commit_log = 0;
+			# to add missing sign off line before diff(s)
+			if($patch_separator_linenr == 0) {
+				$patch_separator_linenr = $linenr;
+			}
 		}
 
 # Check if MAINTAINERS is being updated.  If so, there's probably no need to
@@ -2775,6 +2781,9 @@ sub process {
 			if ($sign_off !~ /$signature_tags/) {
 				WARN("BAD_SIGN_OFF",
 				     "Non-standard signature: $sign_off\n" . $herecurr);
+
+				# to avoid missing_sign_off error as it most probably is just a typo
+				$non_standard_signature = 1;
 			}
 			if (defined $space_before && $space_before ne "") {
 				if (WARN("BAD_SIGN_OFF",
@@ -7118,9 +7127,12 @@ sub process {
 		      "Does not appear to be a unified-diff format patch\n");
 	}
 	if ($is_patch && $has_commit_log && $chk_signoff) {
-		if ($signoff == 0) {
-			ERROR("MISSING_SIGN_OFF",
-			      "Missing Signed-off-by: line(s)\n");
+		if ($signoff == 0 && !$non_standard_signature) {
+			if (ERROR("MISSING_SIGN_OFF",
+				  "Missing Signed-off-by: line(s)\n") &&
+			    $fix) {
+				fix_insert_line($patch_separator_linenr - 1, "Signed-off-by: $author");
+			}
 		} elsif ($authorsignoff != 1) {
 			# authorsignoff values:
 			# 0 -> missing sign off
Signature · 6 lines
2.17.1

_______________________________________________
Linux-kernel-mentees mailing list
[email protected]
https://lists.linuxfoundation.org/mailman/listinfo/linux-kernel-mentees
author
#1 lore raw
Quoted 70 lines · Aditya Srivastava

Currently checkpatch warns us if there is no 'Signed-off-by' line for the patch.

E.g., running checkpatch on commit 9ac060a708e0 ("leaking_addresses:
Completely remove --version flag") reports this error:

ERROR: Missing Signed-off-by: line(s)

Provide a fix by adding a Signed-off-by line corresponding to the author of the patch before the patch separator line. Also avoid this error for the commits where some typo is present in the sign off.

E.g. for commit 8cde5d5f7361 ("bus: ti-sysc: Detect omap4 type timers for quirk") we get missing sign off as well as bad sign off for:

Here it is probably best to give BAD_SIGN_OFF warning for Non-standard signature and avoid MISSING_SIGN_OFF

---
This patch was made after applying https://lore.kernel.org/linux-kernel-mentees/[email protected]/
and my last changes at https://lore.kernel.org/linux-kernel-mentees/[email protected]/

 scripts/checkpatch.pl | 18 +++++++++++++++---
 1 file changed, 15 insertions(+), 3 deletions(-)
scripts/checkpatch.pl +9 -2
index cb46288127ac..2deffd0c091b 100755
@@ -2404,6 +2404,8 @@ sub process {
 
 	my $last_blank_line = 0;
 	my $last_coalesced_string_linenr = -1;
+	my $patch_separator_linenr = 0;
+	my $non_standard_signature = 0;
 
 	our @report = ();
 	our $cnt_lines = 0;
@@ -2755,6 +2757,10 @@ sub process {
 		if ($line =~ /^---$/) {
 			$has_patch_separator = 1;
 			$in_commit_log = 0;
+			# to add missing sign off line before diff(s)
+			if($patch_separator_linenr == 0) {
+				$patch_separator_linenr = $linenr;
+			}
 		}
 
 # Check if MAINTAINERS is being updated.  If so, there's probably no need to
@@ -2775,6 +2781,9 @@ sub process {
 			if ($sign_off !~ /$signature_tags/) {
 				WARN("BAD_SIGN_OFF",
 				     "Non-standard signature: $sign_off\n" . $herecurr);
+
+				# to avoid missing_sign_off error as it most probably is just a typo
+				$non_standard_signature = 1;
 			}
 			if (defined $space_before && $space_before ne "") {
 				if (WARN("BAD_SIGN_OFF",
@@ -7118,9 +7127,12 @@ sub process {
 		      "Does not appear to be a unified-diff format patch\n");
 	}
 	if ($is_patch && $has_commit_log && $chk_signoff) {
-		if ($signoff == 0) {
-			ERROR("MISSING_SIGN_OFF",

scripts/checkpatch.pl sub process { · line 7138

Quoted 10 lines
scripts/checkpatch.pl +6 -1
-			      "Missing Signed-off-by: line(s)\n");
+		if ($signoff == 0 && !$non_standard_signature) {
+			if (ERROR("MISSING_SIGN_OFF",
+				  "Missing Signed-off-by: line(s)\n") &&
+			    $fix) {
+				fix_insert_line($patch_separator_linenr - 1, "Signed-off-by: $author");
+			}
 		} elsif ($authorsignoff != 1) {
 			# authorsignoff values:
 			# 0 -> missing sign off

Here I have changed $fixlinenr to $linenr and later reduced $patch_separator_linenr by 1, at the time of inserting the line.

I changed it to go along with the variable name, ie $patch_separator_linenr, earlier it was storing the line number before it.

It produces the same outcome in either way. Verified it on patches as well.

Thanks
Aditya
_______________________________________________
Linux-kernel-mentees mailing list
[email protected]
https://lists.linuxfoundation.org/mailman/listinfo/linux-kernel-mentees

#2 lore raw
In reply to Aditya Srivastava
Quoted 44 lines · Aditya Srivastava

Currently checkpatch warns us if there is no 'Signed-off-by' line for the patch.

E.g., running checkpatch on commit 9ac060a708e0 ("leaking_addresses:
Completely remove --version flag") reports this error:

ERROR: Missing Signed-off-by: line(s)

Provide a fix by adding a Signed-off-by line corresponding to the author of the patch before the patch separator line. Also avoid this error for the commits where some typo is present in the sign off.

E.g. for commit 8cde5d5f7361 ("bus: ti-sysc: Detect omap4 type timers for quirk") we get missing sign off as well as bad sign off for:

Here it is probably best to give BAD_SIGN_OFF warning for Non-standard signature and avoid MISSING_SIGN_OFF

---
This patch was made after applying https://lore.kernel.org/linux-kernel-mentees/[email protected]/
and my last changes at https://lore.kernel.org/linux-kernel-mentees/[email protected]/

 scripts/checkpatch.pl | 18 +++++++++++++++---
 1 file changed, 15 insertions(+), 3 deletions(-)
scripts/checkpatch.pl +2 -0
index cb46288127ac..2deffd0c091b 100755
@@ -2404,6 +2404,8 @@ sub process {
 
        my $last_blank_line = 0;
        my $last_coalesced_string_linenr = -1;
+       my $patch_separator_linenr = 0;
+       my $non_standard_signature = 0;
 
        our @report = ();
        our $cnt_lines = 0;

scripts/checkpatch.pl sub process { · line 2762

Quoted 6 lines
scripts/checkpatch.pl +3 -0
@@ -2755,6 +2757,10 @@ sub process {
                if ($line =~ /^---$/) {
                        $has_patch_separator = 1;
                        $in_commit_log = 0;
+                       # to add missing sign off line before diff(s)
+                       if($patch_separator_linenr == 0) {
+                               $patch_separator_linenr = $linenr;

Well are you sure linenr is correct? (As I wrote, I do not know, but you should know.)

I think you would need to create a patch for testing your feature where multiple things are fixed within the same patch and then check if the fix is added at the right place.

scripts/checkpatch.pl sub process { · line 2786

Quoted 11 lines
scripts/checkpatch.pl +4 -0
+                       }
                }
 
 # Check if MAINTAINERS is being updated.  If so, there's probably no need to
@@ -2775,6 +2781,9 @@ sub process {
                        if ($sign_off !~ /$signature_tags/) {
                                WARN("BAD_SIGN_OFF",
                                     "Non-standard signature: $sign_off\n" . $herecurr);
+
+                               # to avoid missing_sign_off error as it most probably is just a typo
+                               $non_standard_signature = 1;

The variable name now sounds much better.

Quoted 20 lines
scripts/checkpatch.pl +6 -4
                        }
                        if (defined $space_before && $space_before ne "") {
                                if (WARN("BAD_SIGN_OFF",
@@ -7118,9 +7127,12 @@ sub process {
                      "Does not appear to be a unified-diff format patch\n");
        }
        if ($is_patch && $has_commit_log && $chk_signoff) {
-               if ($signoff == 0) {
-                       ERROR("MISSING_SIGN_OFF",
-                             "Missing Signed-off-by: line(s)\n");
+               if ($signoff == 0 && !$non_standard_signature) {
+                       if (ERROR("MISSING_SIGN_OFF",
+                                 "Missing Signed-off-by: line(s)\n") &&
+                           $fix) {
+                               fix_insert_line($patch_separator_linenr - 1, "Signed-off-by: $author");
+                       }
                } elsif ($authorsignoff != 1) {
                        # authorsignoff values:
                        # 0 -> missing sign off
--
Quoted 2 lines

2.17.1

_______________________________________________
Linux-kernel-mentees mailing list
[email protected]
https://lists.linuxfoundation.org/mailman/listinfo/linux-kernel-mentees

author
#3 lore raw
Quoted 55 lines · Lukas Bulwahn
Quoted 44 lines · Aditya Srivastava

Currently checkpatch warns us if there is no 'Signed-off-by' line for the patch.

E.g., running checkpatch on commit 9ac060a708e0 ("leaking_addresses:
Completely remove --version flag") reports this error:

ERROR: Missing Signed-off-by: line(s)

Provide a fix by adding a Signed-off-by line corresponding to the author of the patch before the patch separator line. Also avoid this error for the commits where some typo is present in the sign off.

E.g. for commit 8cde5d5f7361 ("bus: ti-sysc: Detect omap4 type timers for quirk") we get missing sign off as well as bad sign off for:

Here it is probably best to give BAD_SIGN_OFF warning for Non-standard signature and avoid MISSING_SIGN_OFF

---
This patch was made after applying https://lore.kernel.org/linux-kernel-mentees/[email protected]/
and my last changes at https://lore.kernel.org/linux-kernel-mentees/[email protected]/

 scripts/checkpatch.pl | 18 +++++++++++++++---
 1 file changed, 15 insertions(+), 3 deletions(-)
scripts/checkpatch.pl +2 -0
index cb46288127ac..2deffd0c091b 100755
@@ -2404,6 +2404,8 @@ sub process {
 
        my $last_blank_line = 0;
        my $last_coalesced_string_linenr = -1;
+       my $patch_separator_linenr = 0;
+       my $non_standard_signature = 0;
 
        our @report = ();
        our $cnt_lines = 0;

scripts/checkpatch.pl sub process { · line 2762

Quoted 6 lines
scripts/checkpatch.pl +3 -0
@@ -2755,6 +2757,10 @@ sub process {
                if ($line =~ /^---$/) {
                        $has_patch_separator = 1;
                        $in_commit_log = 0;
+                       # to add missing sign off line before diff(s)
+                       if($patch_separator_linenr == 0) {
+                               $patch_separator_linenr = $linenr;

Well are you sure linenr is correct? (As I wrote, I do not know, but you should know.)

Quoted 4 lines

I think you would need to create a patch for testing your feature where multiple things are fixed within the same patch and then check if the fix is added at the right place.

I checked the fix over following patch.

I have modified the patch such that it has co-developed-by as the author(nominal patch author warning, which requires this line to be deleted)

Also 'occuring', which is a typo(where the typo needs to be replaced)

It works as expected.

This is the modified patch I used for testing:

From f68e7927212fa0dbe44c00c144b643c87ab0cf43 Mon Sep 17 00:00:00 2001
From: Michael Ellerman <[email protected]>
Date: Sat, 23 Feb 2019 20:30:50 +1100
Subject: [PATCH] Revert "powerpc/book3s32: Reorder _PAGE_XXX flags to simplify
TLB handling"

This reverts commit 78ca1108b10927b3d068c8da91352b0f4cd01fc5.

It is causing boot failures with qemu mac99 in at least some configurations.occuring

---
 arch/powerpc/include/asm/book3s/32/hash.h | 8 ++++----
 arch/powerpc/kernel/head_32.S             | 5 ++++-
 arch/powerpc/mm/hash_low_32.S             | 6 ++++--
 3 files changed, 12 insertions(+), 7 deletions(-)
(quoted diff) +0 -0

b/arch/powerpc/include/asm/book3s/32/hash.h
index a5907ea4fb40..2a0a467d2985 100644

arch/powerpc/include/asm/book3s/32/hash.h +0 -3
@@ -17,9 +17,9 @@
  * updating the accessed and modified bits in the page table tree.
  */
 
-#define _PAGE_RW	0x001	/* PP = x1: user write access allowed */
-#define _PAGE_USER	0x002	/* PP = 1x: usermode access allowed */
-#define _PAGE_HASHPTE	0x004	/* software: hash_page has made an HPTE

for this pte */
+#define _PAGE_PRESENT 0x001 /* software: pte contains a translation */
+#define _PAGE_HASHPTE 0x002 /* hash_page has made an HPTE for this pte */
+#define _PAGE_USER 0x004 /* usermode access allowed */
#define _PAGE_GUARDED 0x008 /* G: prohibit speculative access */
#define _PAGE_COHERENT 0x010 /* M: enforce memory coherence (SMP
systems) */
#define _PAGE_NO_CACHE 0x020 /* I: cache inhibit */
@@ -27,7 +27,7 @@
#define _PAGE_DIRTY 0x080 /* C: page changed */
#define _PAGE_ACCESSED 0x100 /* R: page referenced */
#define _PAGE_EXEC 0x200 /* software: exec allowed */
-#define _PAGE_PRESENT 0x400 /* software: pte contains a translation */
+#define _PAGE_RW 0x400 /* software: user write access allowed */
#define _PAGE_SPECIAL 0x800 /* software: Special page */

#ifdef CONFIG_PTE_64BIT

arch/powerpc/kernel/head_32.S +4 -1
index e7a5b312a7db..fdb587c96a80 100644
@@ -522,6 +522,7 @@ InstructionTLBMiss:
 	andc.	r1,r1,r0		/* check access & ~permission */
 	bne-	InstructionAddressInvalid /* return if access not permitted */
 	/* Convert linux-style PTE to low word of PPC-style PTE */
+	rlwimi	r0,r0,32-1,30,30	/* _PAGE_USER -> PP msb */
 	ori	r1, r1, 0xe05		/* clear out reserved bits */
 	andc	r1, r0, r1		/* PP = user? 2 : 0 */
 BEGIN_FTR_SECTION
@@ -589,7 +590,8 @@ DataLoadTLBMiss:
 	 * we would need to update the pte atomically with lwarx/stwcx.
 	 */
 	/* Convert linux-style PTE to low word of PPC-style PTE */
-	rlwinm	r1, r0, 0, 31, 31	/* _PAGE_RW -> PP lsb */
+	rlwinm	r1,r0,32-10,31,31	/* _PAGE_RW -> PP lsb */
+	rlwimi	r0,r0,32-1,30,30	/* _PAGE_USER -> PP msb */
 	rlwimi	r0,r0,32-1,31,31	/* _PAGE_USER -> PP lsb */
 	ori	r1,r1,0xe04		/* clear out reserved bits */
 	andc	r1,r0,r1		/* PP = user? rw? 2: 3: 0 */
@@ -668,6 +670,7 @@ DataStoreTLBMiss:
 	 * we would need to update the pte atomically with lwarx/stwcx.
 	 */
 	/* Convert linux-style PTE to low word of PPC-style PTE */
+	rlwimi	r0,r0,32-1,30,30	/* _PAGE_USER -> PP msb */
 	li	r1,0xe05		/* clear out reserved bits & PP lsb */
 	andc	r1,r0,r1		/* PP = user? 2: 0 */
 BEGIN_FTR_SECTION
arch/powerpc/mm/hash_low_32.S +4 -2
index f4294edeca9d..d94fef524ef5 100644
@@ -310,9 +310,11 @@ Hash_msk = (((1 << Hash_bits) - 1) * 64)
 
 _GLOBAL(create_hpte)
 	/* Convert linux-style PTE (r5) to low word of PPC-style PTE (r8) */
+	rlwinm	r8,r5,32-10,31,31	/* _PAGE_RW -> PP lsb */
 	rlwinm	r0,r5,32-7,31,31	/* _PAGE_DIRTY -> PP lsb */
-	and	r8, r5, r0		/* writable if _RW & _DIRTY */
-	rlwimi	r5, r5, 32 - 1, 31, 31	/* _PAGE_USER -> PP lsb */
+	and	r8,r8,r0		/* writable if _RW & _DIRTY */
+	rlwimi	r5,r5,32-1,30,30	/* _PAGE_USER -> PP msb */
+	rlwimi	r5,r5,32-2,31,31	/* _PAGE_USER -> PP lsb */
 	ori	r8,r8,0xe04		/* clear out reserved bits */
 	andc	r8,r5,r8		/* PP = user? (rw&dirty? 2: 3): 0 */
 BEGIN_FTR_SECTION
Signature · 9 lines
2.17.1


Thanks
Aditya
_______________________________________________
Linux-kernel-mentees mailing list
[email protected]
https://lists.linuxfoundation.org/mailman/listinfo/linux-kernel-mentees
#4 lore raw
Quoted 64 lines · Aditya
Quoted 55 lines · Lukas Bulwahn
Quoted 44 lines · Aditya Srivastava

Currently checkpatch warns us if there is no 'Signed-off-by' line for the patch.

E.g., running checkpatch on commit 9ac060a708e0 ("leaking_addresses:
Completely remove --version flag") reports this error:

ERROR: Missing Signed-off-by: line(s)

Provide a fix by adding a Signed-off-by line corresponding to the author of the patch before the patch separator line. Also avoid this error for the commits where some typo is present in the sign off.

E.g. for commit 8cde5d5f7361 ("bus: ti-sysc: Detect omap4 type timers for quirk") we get missing sign off as well as bad sign off for:

Here it is probably best to give BAD_SIGN_OFF warning for Non-standard signature and avoid MISSING_SIGN_OFF

---
This patch was made after applying https://lore.kernel.org/linux-kernel-mentees/[email protected]/
and my last changes at https://lore.kernel.org/linux-kernel-mentees/[email protected]/

 scripts/checkpatch.pl | 18 +++++++++++++++---
 1 file changed, 15 insertions(+), 3 deletions(-)
scripts/checkpatch.pl +2 -0
index cb46288127ac..2deffd0c091b 100755
@@ -2404,6 +2404,8 @@ sub process {
 
        my $last_blank_line = 0;
        my $last_coalesced_string_linenr = -1;
+       my $patch_separator_linenr = 0;
+       my $non_standard_signature = 0;
 
        our @report = ();
        our $cnt_lines = 0;

scripts/checkpatch.pl sub process { · line 2762

Quoted 6 lines
scripts/checkpatch.pl +3 -0
@@ -2755,6 +2757,10 @@ sub process {
                if ($line =~ /^---$/) {
                        $has_patch_separator = 1;
                        $in_commit_log = 0;
+                       # to add missing sign off line before diff(s)
+                       if($patch_separator_linenr == 0) {
+                               $patch_separator_linenr = $linenr;

Well are you sure linenr is correct? (As I wrote, I do not know, but you should know.)

Quoted 4 lines

I think you would need to create a patch for testing your feature where multiple things are fixed within the same patch and then check if the fix is added at the right place.

I checked the fix over following patch.

Quoted 8 lines

I have modified the patch such that it has co-developed-by as the author(nominal patch author warning, which requires this line to be deleted)

Also 'occuring', which is a typo(where the typo needs to be replaced)

It works as expected.

Well to really check if it works as expected, you need to have a test patch where a fix adds multiple lines into the fixed patch before the line you try to record.

Then, fixlinenr and linenr are probably more than just 1 line apart, but really multiple lines apart and only if you record the right variable it really works.

Other than that, it is all good.

Lukas

Quoted 101 lines

This is the modified patch I used for testing:

From f68e7927212fa0dbe44c00c144b643c87ab0cf43 Mon Sep 17 00:00:00 2001
From: Michael Ellerman <[email protected]>
Date: Sat, 23 Feb 2019 20:30:50 +1100
Subject: [PATCH] Revert "powerpc/book3s32: Reorder _PAGE_XXX flags to simplify
TLB handling"

This reverts commit 78ca1108b10927b3d068c8da91352b0f4cd01fc5.

It is causing boot failures with qemu mac99 in at least some configurations.occuring

---
 arch/powerpc/include/asm/book3s/32/hash.h | 8 ++++----
 arch/powerpc/kernel/head_32.S             | 5 ++++-
 arch/powerpc/mm/hash_low_32.S             | 6 ++++--
 3 files changed, 12 insertions(+), 7 deletions(-)
arch/powerpc/include/asm/book3s/32/hash.h +0 -3
index a5907ea4fb40..2a0a467d2985 100644
@@ -17,9 +17,9 @@
  * updating the accessed and modified bits in the page table tree.
  */
 
-#define _PAGE_RW       0x001   /* PP = x1: user write access allowed */
-#define _PAGE_USER     0x002   /* PP = 1x: usermode access allowed */
-#define _PAGE_HASHPTE  0x004   /* software: hash_page has made an HPTE

for this pte */

arch/powerpc/include/asm/book3s/32/hash.h +3 -0
+#define _PAGE_PRESENT  0x001   /* software: pte contains a translation */
+#define _PAGE_HASHPTE  0x002   /* hash_page has made an HPTE for this pte */
+#define _PAGE_USER     0x004   /* usermode access allowed */
 #define _PAGE_GUARDED  0x008   /* G: prohibit speculative access */
 #define _PAGE_COHERENT 0x010   /* M: enforce memory coherence (SMP

systems) */
#define _PAGE_NO_CACHE 0x020 /* I: cache inhibit */

arch/powerpc/include/asm/book3s/32/hash.h +1 -1
@@ -27,7 +27,7 @@
 #define _PAGE_DIRTY    0x080   /* C: page changed */
 #define _PAGE_ACCESSED 0x100   /* R: page referenced */
 #define _PAGE_EXEC     0x200   /* software: exec allowed */
-#define _PAGE_PRESENT  0x400   /* software: pte contains a translation */
+#define _PAGE_RW       0x400   /* software: user write access allowed */
 #define _PAGE_SPECIAL  0x800   /* software: Special page */
 
 #ifdef CONFIG_PTE_64BIT
arch/powerpc/kernel/head_32.S +4 -1
index e7a5b312a7db..fdb587c96a80 100644
@@ -522,6 +522,7 @@ InstructionTLBMiss:
        andc.   r1,r1,r0                /* check access & ~permission */
        bne-    InstructionAddressInvalid /* return if access not permitted */
        /* Convert linux-style PTE to low word of PPC-style PTE */
+       rlwimi  r0,r0,32-1,30,30        /* _PAGE_USER -> PP msb */
        ori     r1, r1, 0xe05           /* clear out reserved bits */
        andc    r1, r0, r1              /* PP = user? 2 : 0 */
 BEGIN_FTR_SECTION
@@ -589,7 +590,8 @@ DataLoadTLBMiss:
         * we would need to update the pte atomically with lwarx/stwcx.
         */
        /* Convert linux-style PTE to low word of PPC-style PTE */
-       rlwinm  r1, r0, 0, 31, 31       /* _PAGE_RW -> PP lsb */
+       rlwinm  r1,r0,32-10,31,31       /* _PAGE_RW -> PP lsb */
+       rlwimi  r0,r0,32-1,30,30        /* _PAGE_USER -> PP msb */
        rlwimi  r0,r0,32-1,31,31        /* _PAGE_USER -> PP lsb */
        ori     r1,r1,0xe04             /* clear out reserved bits */
        andc    r1,r0,r1                /* PP = user? rw? 2: 3: 0 */
@@ -668,6 +670,7 @@ DataStoreTLBMiss:
         * we would need to update the pte atomically with lwarx/stwcx.
         */
        /* Convert linux-style PTE to low word of PPC-style PTE */
+       rlwimi  r0,r0,32-1,30,30        /* _PAGE_USER -> PP msb */
        li      r1,0xe05                /* clear out reserved bits & PP lsb */
        andc    r1,r0,r1                /* PP = user? 2: 0 */
 BEGIN_FTR_SECTION
arch/powerpc/mm/hash_low_32.S +4 -3
index f4294edeca9d..d94fef524ef5 100644
@@ -310,9 +310,11 @@ Hash_msk = (((1 << Hash_bits) - 1) * 64)
 
 _GLOBAL(create_hpte)
        /* Convert linux-style PTE (r5) to low word of PPC-style PTE (r8) */
+       rlwinm  r8,r5,32-10,31,31       /* _PAGE_RW -> PP lsb */
        rlwinm  r0,r5,32-7,31,31        /* _PAGE_DIRTY -> PP lsb */
-       and     r8, r5, r0              /* writable if _RW & _DIRTY */
-       rlwimi  r5, r5, 32 - 1, 31, 31  /* _PAGE_USER -> PP lsb */
+       and     r8,r8,r0                /* writable if _RW & _DIRTY */
+       rlwimi  r5,r5,32-1,30,30        /* _PAGE_USER -> PP msb */
+       rlwimi  r5,r5,32-2,31,31        /* _PAGE_USER -> PP lsb */
        ori     r8,r8,0xe04             /* clear out reserved bits */
        andc    r8,r5,r8                /* PP = user? (rw&dirty? 2: 3): 0 */
 BEGIN_FTR_SECTION
--

2.17.1

Quoted 2 lines

Thanks
Aditya

_______________________________________________
Linux-kernel-mentees mailing list
[email protected]
https://lists.linuxfoundation.org/mailman/listinfo/linux-kernel-mentees

author
#5 lore raw
Quoted 74 lines · Lukas Bulwahn
Quoted 64 lines · Aditya
Quoted 55 lines · Lukas Bulwahn
Quoted 44 lines · Aditya Srivastava

Currently checkpatch warns us if there is no 'Signed-off-by' line for the patch.

E.g., running checkpatch on commit 9ac060a708e0 ("leaking_addresses:
Completely remove --version flag") reports this error:

ERROR: Missing Signed-off-by: line(s)

Provide a fix by adding a Signed-off-by line corresponding to the author of the patch before the patch separator line. Also avoid this error for the commits where some typo is present in the sign off.

E.g. for commit 8cde5d5f7361 ("bus: ti-sysc: Detect omap4 type timers for quirk") we get missing sign off as well as bad sign off for:

Here it is probably best to give BAD_SIGN_OFF warning for Non-standard signature and avoid MISSING_SIGN_OFF

---
This patch was made after applying https://lore.kernel.org/linux-kernel-mentees/[email protected]/
and my last changes at https://lore.kernel.org/linux-kernel-mentees/[email protected]/

 scripts/checkpatch.pl | 18 +++++++++++++++---
 1 file changed, 15 insertions(+), 3 deletions(-)
scripts/checkpatch.pl +2 -0
index cb46288127ac..2deffd0c091b 100755
@@ -2404,6 +2404,8 @@ sub process {
 
        my $last_blank_line = 0;
        my $last_coalesced_string_linenr = -1;
+       my $patch_separator_linenr = 0;
+       my $non_standard_signature = 0;
 
        our @report = ();
        our $cnt_lines = 0;

scripts/checkpatch.pl sub process { · line 2762

Quoted 6 lines
scripts/checkpatch.pl +3 -0
@@ -2755,6 +2757,10 @@ sub process {
                if ($line =~ /^---$/) {
                        $has_patch_separator = 1;
                        $in_commit_log = 0;
+                       # to add missing sign off line before diff(s)
+                       if($patch_separator_linenr == 0) {
+                               $patch_separator_linenr = $linenr;

Well are you sure linenr is correct? (As I wrote, I do not know, but you should know.)

Quoted 4 lines

I think you would need to create a patch for testing your feature where multiple things are fixed within the same patch and then check if the fix is added at the right place.

I checked the fix over following patch.

Quoted 8 lines

I have modified the patch such that it has co-developed-by as the author(nominal patch author warning, which requires this line to be deleted)

Also 'occuring', which is a typo(where the typo needs to be replaced)

It works as expected.

Quoted 8 lines

Well to really check if it works as expected, you need to have a test patch where a fix adds multiple lines into the fixed patch before the line you try to record.

Then, fixlinenr and linenr are probably more than just 1 line apart, but really multiple lines apart and only if you record the right variable it really works.

Actually we currently don't have any new line insertion fixes for lines above patch separator.
So, I modified checkpatch a bit to insert (instead of delete) for co-developed-by.
ie here:

if (WARN("BAD_SIGN_OFF",
"Co-developed-by: should not be used to attribute nominal patch
author '$author'\n" . "$here\n" . $rawline) &&

    $fix) {

- fix_delete_line($fixlinenr, $rawline);
+ fix_insert_line($fixlinenr, $rawline);
}

When repeated a few times and removing signed-off-by, this provided an experience of inserting multiple lines before signed-off-by (as for each co-developed-by, it is inserting a new co-developed-by)

With this as well, the fix was working as expected, ie, got this after some iterations of removing signed-off-by and keeping co-developed-by:

...
It is causing boot failures with qemu mac99 in at least some configurations.occurring

---
 arch/powerpc/include/asm/book3s/32/hash.h | 8 ++++----

Aditya

Quoted 4 lines

Other than that, it is all good.

Lukas

_______________________________________________
Linux-kernel-mentees mailing list
[email protected]
https://lists.linuxfoundation.org/mailman/listinfo/linux-kernel-mentees

#6 lore raw
Quoted 131 lines · Aditya
Quoted 4 lines · Lukas Bulwahn
Quoted 3 lines · Aditya
Quoted 1 line · Lukas Bulwahn

On Tue, Nov 10, 2020 at 2:06 PM Aditya Srivastava <

Quoted 10 lines · [email protected]> wrote:
Quoted 10 lines
Quoted 10 lines
Quoted 10 lines

Currently checkpatch warns us if there is no 'Signed-off-by' line for the patch.

E.g., running checkpatch on commit 9ac060a708e0 ("leaking_addresses:
Completely remove --version flag") reports this error:

ERROR: Missing Signed-off-by: line(s)

Provide a fix by adding a Signed-off-by line corresponding to the

author

Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line

of the patch before the patch separator line. Also avoid this error

for

Quoted 7 lines
Quoted 7 lines
Quoted 7 lines
Quoted 7 lines

the commits where some typo is present in the sign off.

E.g. for commit 8cde5d5f7361 ("bus: ti-sysc: Detect omap4 type timers for quirk") we get missing sign off as well as bad sign off for:

Quoted 7 lines
Quoted 7 lines
Quoted 7 lines
Quoted 7 lines

Here it is probably best to give BAD_SIGN_OFF warning for Non-standard signature and avoid MISSING_SIGN_OFF

---
This patch was made after applying

https://lore.kernel.org/linux-kernel-mentees/[email protected]/

Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line

and my last changes at

https://lore.kernel.org/linux-kernel-mentees/[email protected]/

Quoted 44 lines
Quoted 35 lines
Quoted 28 lines
Quoted 18 lines
 scripts/checkpatch.pl | 18 +++++++++++++++---
 1 file changed, 15 insertions(+), 3 deletions(-)
scripts/checkpatch.pl +2 -0
index cb46288127ac..2deffd0c091b 100755
@@ -2404,6 +2404,8 @@ sub process {
 
        my $last_blank_line = 0;
        my $last_coalesced_string_linenr = -1;
+       my $patch_separator_linenr = 0;
+       my $non_standard_signature = 0;
 
        our @report = ();
        our $cnt_lines = 0;

scripts/checkpatch.pl sub process { · line 2762

Quoted 6 lines
scripts/checkpatch.pl +3 -0
@@ -2755,6 +2757,10 @@ sub process {
                if ($line =~ /^---$/) {
                        $has_patch_separator = 1;
                        $in_commit_log = 0;
+                       # to add missing sign off line before diff(s)
+                       if($patch_separator_linenr == 0) {
+                               $patch_separator_linenr = $linenr;

Well are you sure linenr is correct? (As I wrote, I do not know, but you should know.)

Quoted 4 lines

I think you would need to create a patch for testing your feature where multiple things are fixed within the same patch and then check if the fix is added at the right place.

I checked the fix over following patch.

Quoted 8 lines

I have modified the patch such that it has co-developed-by as the author(nominal patch author warning, which requires this line to be deleted)

Also 'occuring', which is a typo(where the typo needs to be replaced)

It works as expected.

Quoted 8 lines

Well to really check if it works as expected, you need to have a test patch where a fix adds multiple lines into the fixed patch before the line you try to record.

Then, fixlinenr and linenr are probably more than just 1 line apart, but really multiple lines apart and only if you record the right variable it really works.

Actually we currently don't have any new line insertion fixes for lines above patch separator.
So, I modified checkpatch a bit to insert (instead of delete) for co-developed-by.
ie here:

if (WARN("BAD_SIGN_OFF",
"Co-developed-by: should not be used to attribute nominal patch
author '$author'\n" . "$here\n" . $rawline) &&

    $fix) {
(quoted diff) +1 -1
-       fix_delete_line($fixlinenr, $rawline);
+       fix_insert_line($fixlinenr, $rawline);

}

When repeated a few times and removing signed-off-by, this provided an experience of inserting multiple lines before signed-off-by (as for each co-developed-by, it is inserting a new co-developed-by)

With this as well, the fix was working as expected, ie, got this after some iterations of removing signed-off-by and keeping co-developed-by:

...
It is causing boot failures with qemu mac99 in at least some configurations.occurring

Quoted 4 lines
---
 arch/powerpc/include/asm/book3s/32/hash.h | 8 ++++----

I did not look into the details. If you are 100% sure that your patch is right, let us send it to Joe and the mailing list.

I think next a fix for bad sign-off that corrects those obvious typos would be nice as well.

Lukas

Quoted 8 lines

Aditya

Quoted 4 lines

Other than that, it is all good.

Lukas

_______________________________________________
Linux-kernel-mentees mailing list
[email protected]
https://lists.linuxfoundation.org/mailman/listinfo/linux-kernel-mentees

author
#7 lore raw
Quoted 138 lines · Lukas Bulwahn
Quoted 131 lines · Aditya
Quoted 4 lines · Lukas Bulwahn
Quoted 3 lines · Aditya
Quoted 1 line · Lukas Bulwahn

On Tue, Nov 10, 2020 at 2:06 PM Aditya Srivastava <

Quoted 10 lines · [email protected]> wrote:
Quoted 10 lines
Quoted 10 lines
Quoted 10 lines

Currently checkpatch warns us if there is no 'Signed-off-by' line for the patch.

E.g., running checkpatch on commit 9ac060a708e0 ("leaking_addresses:
Completely remove --version flag") reports this error:

ERROR: Missing Signed-off-by: line(s)

Provide a fix by adding a Signed-off-by line corresponding to the

author

Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line

of the patch before the patch separator line. Also avoid this error

for

Quoted 7 lines
Quoted 7 lines
Quoted 7 lines
Quoted 7 lines

the commits where some typo is present in the sign off.

E.g. for commit 8cde5d5f7361 ("bus: ti-sysc: Detect omap4 type timers for quirk") we get missing sign off as well as bad sign off for:

Quoted 7 lines
Quoted 7 lines
Quoted 7 lines
Quoted 7 lines

Here it is probably best to give BAD_SIGN_OFF warning for Non-standard signature and avoid MISSING_SIGN_OFF

---
This patch was made after applying

https://lore.kernel.org/linux-kernel-mentees/[email protected]/

Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line

and my last changes at

https://lore.kernel.org/linux-kernel-mentees/[email protected]/

Quoted 44 lines
Quoted 35 lines
Quoted 28 lines
Quoted 18 lines
 scripts/checkpatch.pl | 18 +++++++++++++++---
 1 file changed, 15 insertions(+), 3 deletions(-)
scripts/checkpatch.pl +2 -0
index cb46288127ac..2deffd0c091b 100755
@@ -2404,6 +2404,8 @@ sub process {
 
        my $last_blank_line = 0;
        my $last_coalesced_string_linenr = -1;
+       my $patch_separator_linenr = 0;
+       my $non_standard_signature = 0;
 
        our @report = ();
        our $cnt_lines = 0;

scripts/checkpatch.pl sub process { · line 2762

Quoted 6 lines
scripts/checkpatch.pl +3 -0
@@ -2755,6 +2757,10 @@ sub process {
                if ($line =~ /^---$/) {
                        $has_patch_separator = 1;
                        $in_commit_log = 0;
+                       # to add missing sign off line before diff(s)
+                       if($patch_separator_linenr == 0) {
+                               $patch_separator_linenr = $linenr;

Well are you sure linenr is correct? (As I wrote, I do not know, but you should know.)

Quoted 4 lines

I think you would need to create a patch for testing your feature where multiple things are fixed within the same patch and then check if the fix is added at the right place.

I checked the fix over following patch.

Quoted 8 lines

I have modified the patch such that it has co-developed-by as the author(nominal patch author warning, which requires this line to be deleted)

Also 'occuring', which is a typo(where the typo needs to be replaced)

It works as expected.

Quoted 8 lines

Well to really check if it works as expected, you need to have a test patch where a fix adds multiple lines into the fixed patch before the line you try to record.

Then, fixlinenr and linenr are probably more than just 1 line apart, but really multiple lines apart and only if you record the right variable it really works.

Actually we currently don't have any new line insertion fixes for lines above patch separator.
So, I modified checkpatch a bit to insert (instead of delete) for co-developed-by.
ie here:

if (WARN("BAD_SIGN_OFF",
"Co-developed-by: should not be used to attribute nominal patch
author '$author'\n" . "$here\n" . $rawline) &&

    $fix) {
(quoted diff) +1 -1
-       fix_delete_line($fixlinenr, $rawline);
+       fix_insert_line($fixlinenr, $rawline);

}

When repeated a few times and removing signed-off-by, this provided an experience of inserting multiple lines before signed-off-by (as for each co-developed-by, it is inserting a new co-developed-by)

With this as well, the fix was working as expected, ie, got this after some iterations of removing signed-off-by and keeping co-developed-by:

...
It is causing boot failures with qemu mac99 in at least some configurations.occurring

Quoted 4 lines
---
 arch/powerpc/include/asm/book3s/32/hash.h | 8 ++++----
Quoted 3 lines

I did not look into the details. If you are 100% sure that your patch is right, let us send it to Joe and the mailing list.

Yes, on the basis of observations, it seems to be working correctly. Sending out the patch :)

Quoted 2 lines

I think next a fix for bad sign-off that corrects those obvious typos would be nice as well.

Sure.

Thanks
Aditya
_______________________________________________
Linux-kernel-mentees mailing list
[email protected]
https://lists.linuxfoundation.org/mailman/listinfo/linux-kernel-mentees