Skip to contentSkip to conversation

checkstack: add riscv support for scripts/checkstack.pl

PATCH In review Wadim Mueller 3 participants 4 messages Jul 13, 2022 – Jul 26, 2022 RISC-V

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 checkstack: add riscv support for scripts/checkstack.pl

scripts/checkstack.pl lacks support for the riscv architecture. Add support to detect "addi sp,sp,-FRAME_SIZE" stack frame generation instruction

---
 scripts/checkstack.pl | 4 ++++
 1 file changed, 4 insertions(+)
scripts/checkstack.pl +4 -0
index d2c38584ece6..d48dfed6d3db 100755
@@ -16,6 +16,7 @@
 #	AArch64, PARISC ports by Kyle McMartin
 #	sparc port by Martin Habets <[email protected]>
 #	ppc64le port by Breno Leitao <[email protected]>
+#	riscv port by Wadim Mueller <[email protected]>
 #
 #	Usage:
 #	objdump -d vmlinux | scripts/checkstack.pl [arch]
@@ -108,6 +109,9 @@ my (@stack, $re, $dre, $sub, $x, $xs, $funcre, $min_stack);
 	} elsif ($arch eq 'sparc' || $arch eq 'sparc64') {
 		# f0019d10:       9d e3 bf 90     save  %sp, -112, %sp
 		$re = qr/.*save.*%sp, -(([0-9]{2}|[3-9])[0-9]{2}), %sp/o;
+	} elsif ($arch =~ /^riscv(64)?$/) {
+		#ffffffff8036e868:	c2010113          	addi	sp,sp,-992
+		$re = qr/.*addi.*sp,sp,-(([0-9]{2}|[3-9])[0-9]{2})/o;
 	} else {
 		print("wrong or unknown architecture \"$arch\"\n");
 		exit
Signature · 1 line
2.25.1
#1 lore raw
Quoted 2 lines · Wadim Mueller

[You don't often get email from [email protected]. Learn why this is important at https://aka.ms/LearnAboutSenderIdentification ]

I feel like you might've been mislead by get_maintainer for this patch. It looks like the maintainer covering this is Masahiro Yamada <[email protected]> (at least he's taken the last few patches for it).

I'll be honest, I don't know how to verify that the output is correct - but I did run it & it does output something that looks sane /shrug

Thanks,
Conor.

Quoted 40 lines

EXTERNAL EMAIL: Do not click links or open attachments unless you know the content is safe

scripts/checkstack.pl lacks support for the riscv architecture. Add support to detect "addi sp,sp,-FRAME_SIZE" stack frame generation instruction

---
 scripts/checkstack.pl | 4 ++++
 1 file changed, 4 insertions(+)
scripts/checkstack.pl +4 -1
index d2c38584ece6..d48dfed6d3db 100755
@@ -16,6 +16,7 @@
 #      AArch64, PARISC ports by Kyle McMartin
 #      sparc port by Martin Habets <[email protected]>
 #      ppc64le port by Breno Leitao <[email protected]>
+#      riscv port by Wadim Mueller <[email protected]>
 #
 #      Usage:
 #      objdump -d vmlinux | scripts/checkstack.pl [arch]
@@ -108,6 +109,9 @@ my (@stack, $re, $dre, $sub, $x, $xs, $funcre, $min_stack);
        } elsif ($arch eq 'sparc' || $arch eq 'sparc64') {
                # f0019d10:       9d e3 bf 90     save  %sp, -112, %sp
                $re = qr/.*save.*%sp, -(([0-9]{2}|[3-9])[0-9]{2}), %sp/o;
+       } elsif ($arch =~ /^riscv(64)?$/) {
+               #ffffffff8036e868:      c2010113                addi    sp,sp,-992
+               $re = qr/.*addi.*sp,sp,-(([0-9]{2}|[3-9])[0-9]{2})/o;
        } else {
                print("wrong or unknown architecture \"$arch\"\n");
                exit
--

2.25.1

_______________________________________________
linux-riscv mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/linux-riscv

#2 lore raw
Quoted 9 lines · On Tue, Jul 26, 2022 at 2:40 AM <[email protected]> wrote:
Quoted 2 lines · Wadim Mueller

[You don't often get email from [email protected]. Learn why this is important at https://aka.ms/LearnAboutSenderIdentification ]

I feel like you might've been mislead by get_maintainer for this patch. It looks like the maintainer covering this is Masahiro Yamada <[email protected]> (at least he's taken the last few patches for it).

I can pick this up.

Applied to linux-kbuild. Thanks.

Quoted 49 lines

I'll be honest, I don't know how to verify that the output is correct - but I did run it & it does output something that looks sane /shrug

Thanks,
Conor.

Quoted 40 lines

EXTERNAL EMAIL: Do not click links or open attachments unless you know the content is safe

scripts/checkstack.pl lacks support for the riscv architecture. Add support to detect "addi sp,sp,-FRAME_SIZE" stack frame generation instruction

---
 scripts/checkstack.pl | 4 ++++
 1 file changed, 4 insertions(+)
scripts/checkstack.pl +4 -1
index d2c38584ece6..d48dfed6d3db 100755
@@ -16,6 +16,7 @@
 #      AArch64, PARISC ports by Kyle McMartin
 #      sparc port by Martin Habets <[email protected]>
 #      ppc64le port by Breno Leitao <[email protected]>
+#      riscv port by Wadim Mueller <[email protected]>
 #
 #      Usage:
 #      objdump -d vmlinux | scripts/checkstack.pl [arch]
@@ -108,6 +109,9 @@ my (@stack, $re, $dre, $sub, $x, $xs, $funcre, $min_stack);
        } elsif ($arch eq 'sparc' || $arch eq 'sparc64') {
                # f0019d10:       9d e3 bf 90     save  %sp, -112, %sp
                $re = qr/.*save.*%sp, -(([0-9]{2}|[3-9])[0-9]{2}), %sp/o;
+       } elsif ($arch =~ /^riscv(64)?$/) {
+               #ffffffff8036e868:      c2010113                addi    sp,sp,-992
+               $re = qr/.*addi.*sp,sp,-(([0-9]{2}|[3-9])[0-9]{2})/o;
        } else {
                print("wrong or unknown architecture \"$arch\"\n");
                exit
--

2.25.1

_______________________________________________
linux-riscv mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/linux-riscv

Signature · 2 lines
Best Regards
Masahiro Yamada
#3 lore raw

Hi Conor, Hi Masahiro,

thank you for your support. Your help is much appreciated.

Best Regards
Wadim

Quoted 71 lines · Masahiro Yamada
Quoted 9 lines · On Tue, Jul 26, 2022 at 2:40 AM <[email protected]> wrote:
Quoted 2 lines · Wadim Mueller

[You don't often get email from [email protected]. Learn why this is important at https://aka.ms/LearnAboutSenderIdentification ]

I feel like you might've been mislead by get_maintainer for this patch. It looks like the maintainer covering this is Masahiro Yamada <[email protected]> (at least he's taken the last few patches for it).

I can pick this up.

Applied to linux-kbuild. Thanks.

Quoted 49 lines

I'll be honest, I don't know how to verify that the output is correct - but I did run it & it does output something that looks sane /shrug

Thanks,
Conor.

Quoted 40 lines

EXTERNAL EMAIL: Do not click links or open attachments unless you know the content is safe

scripts/checkstack.pl lacks support for the riscv architecture. Add support to detect "addi sp,sp,-FRAME_SIZE" stack frame generation instruction

---
 scripts/checkstack.pl | 4 ++++
 1 file changed, 4 insertions(+)
scripts/checkstack.pl +4 -1
index d2c38584ece6..d48dfed6d3db 100755
@@ -16,6 +16,7 @@
 #      AArch64, PARISC ports by Kyle McMartin
 #      sparc port by Martin Habets <[email protected]>
 #      ppc64le port by Breno Leitao <[email protected]>
+#      riscv port by Wadim Mueller <[email protected]>
 #
 #      Usage:
 #      objdump -d vmlinux | scripts/checkstack.pl [arch]
@@ -108,6 +109,9 @@ my (@stack, $re, $dre, $sub, $x, $xs, $funcre, $min_stack);
        } elsif ($arch eq 'sparc' || $arch eq 'sparc64') {
                # f0019d10:       9d e3 bf 90     save  %sp, -112, %sp
                $re = qr/.*save.*%sp, -(([0-9]{2}|[3-9])[0-9]{2}), %sp/o;
+       } elsif ($arch =~ /^riscv(64)?$/) {
+               #ffffffff8036e868:      c2010113                addi    sp,sp,-992
+               $re = qr/.*addi.*sp,sp,-(([0-9]{2}|[3-9])[0-9]{2})/o;
        } else {
                print("wrong or unknown architecture \"$arch\"\n");
                exit
--

2.25.1

_______________________________________________
linux-riscv mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/linux-riscv

Signature · 2 lines
Best Regards
Masahiro Yamada