public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH] markup_oops.pl: fix get "No matching code found" when first line of range is the faulting instruction
@ 2010-01-28  6:58 Hui Zhu
  2010-01-28 18:12 ` Sam Ravnborg
  0 siblings, 1 reply; 6+ messages in thread
From: Hui Zhu @ 2010-01-28  6:58 UTC (permalink / raw)
  To: Andrew Morton, Arjan van de Ven, Sam Ravnborg, ozan,
	Matthew Wilcox, linux-kernel, teawater

Sorry guys, the prev mail for this patch is ugly.
I make a new mail for it.

I got a "No matching code found" when I use markup_oops.pl parse a error in a x8664 module.

cat e.c
#include <linux/version.h>
#include <linux/kernel.h>
#include <linux/module.h>


int init_module(void)
{
	char	*buf = 0;

	buf[0] = 3;

	return 0;
}

void cleanup_module(void)
{
	//char	*buf = 0;

	//buf[0] = 3;
}

MODULE_AUTHOR("Hui Zhu");
MODULE_LICENSE("GPL");


0000000000000000 <init_module>:
init_module():
/home/teawater/study/kernel/stack2core/example/e.c:10
   0:	c6 04 25 00 00 00 00 	movb   $0x3,0x0
   7:	03 
/home/teawater/study/kernel/stack2core/example/e.c:13
   8:	31 c0                	xor    %eax,%eax
   a:	c3                   	retq   
   b:	0f 1f 44 00 00       	nopl   0x0(%rax,%rax,1)

0000000000000010 <cleanup_module>:
cleanup_module():
/home/teawater/study/kernel/stack2core/example/e.c:20
  10:	f3 c3                	repz retq 
  12:	90                   	nop    
  13:	90                   	nop    
Disassembly of section .modinfo:

This is because the faulting instruction "movb   $0x3,0x0" is the first line of the range.

In the markup_oops.pl:
main::(./scripts/markup_oops.pl:245):
245:				if (InRange($1, $target)) {
  DB<2> p $line
ffffffffa001b000:	c6 04 25 00 00 00 00 	movb   $0x3,0x0
  DB<3> p $counter
0

It just set $center in next loop.
So it cannot get the $center.

And even if $center is set to the right value 0.
if ($center == 0) {
	print "No matching code found \n";
	exit;
}

So I make a patch change this part to:
	}
	if ($state == 1) {
And this is another part is not OK too:
if ($center == 0) {
The first line $center will be 0, so I change the default value and decide to:
my $center  = -1;
if ($center == -1) {

Thanks,
Hui

Signed-off-by: Hui Zhu <teawater@gmail.com>

---
 scripts/markup_oops.pl |    7 ++++---
 1 file changed, 4 insertions(+), 3 deletions(-)

--- a/scripts/markup_oops.pl
+++ b/scripts/markup_oops.pl
@@ -214,7 +214,7 @@ if ($module ne "") {
 
 my $counter = 0;
 my $state   = 0;
-my $center  = 0;
+my $center  = -1;
 my @lines;
 my @reglines;
 
@@ -246,7 +246,8 @@ while (<FILE>) {
 				$state = 1;
 			}
 		}
-	} else {
+	}
+	if ($state == 1) {
 		if ($line =~ /^([a-f0-9][a-f0-9][a-f0-9][a-f0-9][a-f0-9][a-f0-9]+)\:/) {
 			my $val = $1;
 			if (!InRange($val, $target)) {
@@ -269,7 +270,7 @@ if ($counter == 0) {
 	exit;
 }
 
-if ($center == 0) {
+if ($center == -1) {
 	print "No matching code found \n";
 	exit;
 }

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [PATCH] markup_oops.pl: fix get "No matching code found" when first line of range is the faulting instruction
  2010-01-28  6:58 [PATCH] markup_oops.pl: fix get "No matching code found" when first line of range is the faulting instruction Hui Zhu
@ 2010-01-28 18:12 ` Sam Ravnborg
  2010-01-29  4:03   ` Hui Zhu
  2010-01-29 13:13   ` Michal Marek
  0 siblings, 2 replies; 6+ messages in thread
From: Sam Ravnborg @ 2010-01-28 18:12 UTC (permalink / raw)
  To: Hui Zhu, Michal Marek
  Cc: Andrew Morton, Arjan van de Ven, ozan, Matthew Wilcox,
	linux-kernel, teawater

On Thu, Jan 28, 2010 at 02:58:02PM +0800, Hui Zhu wrote:
> Sorry guys, the prev mail for this patch is ugly.
> I make a new mail for it.

Random updates to scripts/* historically often go
in via the kbuild tree, so Michal added.

	Sam

[Kept rest of mail so Michal can see it]

>
> I got a "No matching code found" when I use markup_oops.pl parse a error in a x8664 module.
>
> cat e.c
> #include <linux/version.h>
> #include <linux/kernel.h>
> #include <linux/module.h>
>
>
> int init_module(void)
> {
> 	char	*buf = 0;
>
> 	buf[0] = 3;
>
> 	return 0;
> }
>
> void cleanup_module(void)
> {
> 	//char	*buf = 0;
>
> 	//buf[0] = 3;
> }
>
> MODULE_AUTHOR("Hui Zhu");
> MODULE_LICENSE("GPL");
>
>
> 0000000000000000 <init_module>:
> init_module():
> /home/teawater/study/kernel/stack2core/example/e.c:10
>   0:	c6 04 25 00 00 00 00 	movb   $0x3,0x0
>   7:	03 /home/teawater/study/kernel/stack2core/example/e.c:13
>   8:	31 c0                	xor    %eax,%eax
>   a:	c3                   	retq     b:	0f 1f 44 00 00       	nopl   
> 0x0(%rax,%rax,1)
>
> 0000000000000010 <cleanup_module>:
> cleanup_module():
> /home/teawater/study/kernel/stack2core/example/e.c:20
>  10:	f3 c3                	repz retq  12:	90                   	nop     
> 13:	90                   	nop    Disassembly of section .modinfo:
>
> This is because the faulting instruction "movb   $0x3,0x0" is the first line of the range.
>
> In the markup_oops.pl:
> main::(./scripts/markup_oops.pl:245):
> 245:				if (InRange($1, $target)) {
>  DB<2> p $line
> ffffffffa001b000:	c6 04 25 00 00 00 00 	movb   $0x3,0x0
>  DB<3> p $counter
> 0
>
> It just set $center in next loop.
> So it cannot get the $center.
>
> And even if $center is set to the right value 0.
> if ($center == 0) {
> 	print "No matching code found \n";
> 	exit;
> }
>
> So I make a patch change this part to:
> 	}
> 	if ($state == 1) {
> And this is another part is not OK too:
> if ($center == 0) {
> The first line $center will be 0, so I change the default value and decide to:
> my $center  = -1;
> if ($center == -1) {
>
> Thanks,
> Hui
>
> Signed-off-by: Hui Zhu <teawater@gmail.com>
>
> ---
> scripts/markup_oops.pl |    7 ++++---
> 1 file changed, 4 insertions(+), 3 deletions(-)
>
> --- a/scripts/markup_oops.pl
> +++ b/scripts/markup_oops.pl
> @@ -214,7 +214,7 @@ if ($module ne "") {
>
> my $counter = 0;
> my $state   = 0;
> -my $center  = 0;
> +my $center  = -1;
> my @lines;
> my @reglines;
>
> @@ -246,7 +246,8 @@ while (<FILE>) {
> 				$state = 1;
> 			}
> 		}
> -	} else {
> +	}
> +	if ($state == 1) {
> 		if ($line =~ /^([a-f0-9][a-f0-9][a-f0-9][a-f0-9][a-f0-9][a-f0-9]+)\:/) {
> 			my $val = $1;
> 			if (!InRange($val, $target)) {
> @@ -269,7 +270,7 @@ if ($counter == 0) {
> 	exit;
> }
>
> -if ($center == 0) {
> +if ($center == -1) {
> 	print "No matching code found \n";
> 	exit;
> }
>

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [PATCH] markup_oops.pl: fix get "No matching code found" when  first line of range is the faulting instruction
  2010-01-28 18:12 ` Sam Ravnborg
@ 2010-01-29  4:03   ` Hui Zhu
       [not found]     ` <1264739206.10856.8.camel@Joe-Laptop.home>
  2010-01-29 13:13   ` Michal Marek
  1 sibling, 1 reply; 6+ messages in thread
From: Hui Zhu @ 2010-01-29  4:03 UTC (permalink / raw)
  To: Sam Ravnborg
  Cc: Hui Zhu, Michal Marek, Andrew Morton, Arjan van de Ven, ozan,
	Matthew Wilcox, linux-kernel

On Fri, Jan 29, 2010 at 02:12, Sam Ravnborg <sam@ravnborg.org> wrote:
> On Thu, Jan 28, 2010 at 02:58:02PM +0800, Hui Zhu wrote:
>> Sorry guys, the prev mail for this patch is ugly.
>> I make a new mail for it.
>
> Random updates to scripts/* historically often go
> in via the kbuild tree, so Michal added.
>
>        Sam
>
> [Kept rest of mail so Michal can see it]
>
>>

Thanks Sam.  And I make a small patch to make get_script.pl can output
Michal Marek.

Hui

Signed-off-by: Hui Zhu <teawater@gmail.com>
---
 MAINTAINERS |    4 ++++
 1 file changed, 4 insertions(+)

--- a/MAINTAINERS
+++ b/MAINTAINERS
@@ -3086,6 +3086,10 @@ L:	autofs@linux.kernel.org
 S:	Maintained
 F:	fs/autofs4/

+KERNEL SCRIPT
+M:	Michal Marek <mmarek@suse.cz>
+F:	scripts/*
+
 KERNEL BUILD
 M:	Michal Marek <mmarek@suse.cz>
 T:	git git://repo.or.cz/linux-kbuild.git for-next

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [PATCH] markup_oops.pl: fix get "No matching code found" when  first line of range is the faulting instruction
       [not found]     ` <1264739206.10856.8.camel@Joe-Laptop.home>
@ 2010-01-29  5:45       ` Hui Zhu
  2010-01-29 13:31         ` Michal Marek
  0 siblings, 1 reply; 6+ messages in thread
From: Hui Zhu @ 2010-01-29  5:45 UTC (permalink / raw)
  To: Joe Perches, Andrew Morton, David S. Miller, linux-kernel

On Fri, Jan 29, 2010 at 12:26, Joe Perches <joe@perches.com> wrote:
> On Fri, 2010-01-29 at 12:03 +0800, Hui Zhu wrote:
>> On Fri, Jan 29, 2010 at 02:12, Sam Ravnborg <sam@ravnborg.org> wrote:
>> > On Thu, Jan 28, 2010 at 02:58:02PM +0800, Hui Zhu wrote:
>> >> Sorry guys, the prev mail for this patch is ugly.
>> >> I make a new mail for it.
>> >
>> > Random updates to scripts/* historically often go
>> > in via the kbuild tree, so Michal added.
>> >
>> >        Sam
>> >
>> > [Kept rest of mail so Michal can see it]
>> >
>> >>
>>
>> Thanks Sam.  And I make a small patch to make get_script.pl can output
>> Michal Marek.
>>
>> Hui
>>
>> Signed-off-by: Hui Zhu <teawater@gmail.com>
>> ---
>>  MAINTAINERS |    4 ++++
>>  1 file changed, 4 insertions(+)
>>
>> --- a/MAINTAINERS
>> +++ b/MAINTAINERS
>> @@ -3086,6 +3086,10 @@ L:     autofs@linux.kernel.org
>>  S:   Maintained
>>  F:   fs/autofs4/
>>
>> +KERNEL SCRIPT
>> +M:   Michal Marek <mmarek@suse.cz>
>> +F:   scripts/*
>> +
>
> probably not a good idea.
>
> Maybe add
>
> F:      scripts/markup_oops.pl
> F:      scripts/mk*
>
> to KERNEL BUILD
>
>
>

What about this?

Signed-off-by: Hui Zhu <teawater@gmail.com>

---
 MAINTAINERS |    2 ++
 1 file changed, 2 insertions(+)

--- a/MAINTAINERS
+++ b/MAINTAINERS
@@ -3095,6 +3095,8 @@ S:	Maintained
 F:	Documentation/kbuild/
 F:	Makefile
 F:	scripts/Makefile.*
+F:	scripts/markup_oops.pl
+F:	scripts/mk*

 KERNEL JANITORS
 L:	kernel-janitors@vger.kernel.org

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [PATCH] markup_oops.pl: fix get "No matching code found" when first line of range is the faulting instruction
  2010-01-28 18:12 ` Sam Ravnborg
  2010-01-29  4:03   ` Hui Zhu
@ 2010-01-29 13:13   ` Michal Marek
  1 sibling, 0 replies; 6+ messages in thread
From: Michal Marek @ 2010-01-29 13:13 UTC (permalink / raw)
  To: Sam Ravnborg
  Cc: Hui Zhu, Andrew Morton, Arjan van de Ven, ozan, Matthew Wilcox,
	linux-kernel, teawater

Sam Ravnborg napsal(a):
> On Thu, Jan 28, 2010 at 02:58:02PM +0800, Hui Zhu wrote:
>> Sorry guys, the prev mail for this patch is ugly.
>> I make a new mail for it.
> 
> Random updates to scripts/* historically often go
> in via the kbuild tree, so Michal added.

Thanks. I need to improve my filter :).


>> So I make a patch change this part to:
>> 	}
>> 	if ($state == 1) {
>> And this is another part is not OK too:
>> if ($center == 0) {
>> The first line $center will be 0, so I change the default value and decide to:
>> my $center  = -1;
>> if ($center == -1) {

Thanks, applied with a slightly shortened changelog.

Michal

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [PATCH] markup_oops.pl: fix get "No matching code found" when first line of range is the faulting instruction
  2010-01-29  5:45       ` Hui Zhu
@ 2010-01-29 13:31         ` Michal Marek
  0 siblings, 0 replies; 6+ messages in thread
From: Michal Marek @ 2010-01-29 13:31 UTC (permalink / raw)
  To: Hui Zhu; +Cc: Joe Perches, Andrew Morton, David S. Miller, linux-kernel

Hui Zhu napsal(a):
> What about this?
> 
> Signed-off-by: Hui Zhu <teawater@gmail.com>
> 
> ---
>  MAINTAINERS |    2 ++
>  1 file changed, 2 insertions(+)
> 
> --- a/MAINTAINERS
> +++ b/MAINTAINERS
> @@ -3095,6 +3095,8 @@ S:	Maintained
>  F:	Documentation/kbuild/
>  F:	Makefile
>  F:	scripts/Makefile.*
> +F:	scripts/markup_oops.pl
> +F:	scripts/mk*
> 
>  KERNEL JANITORS
>  L:	kernel-janitors@vger.kernel.org

(somehow I was un-CCed again)

I don't know if we really need to mention every single script that has
no "real" maintainer in the kbuild section. As noted by Joe, adding
scripts/* is also not a good idea. scripts/get_maintainer.pl parses
Signed-off-by: lines, so after the first commit, my email should appear
in the output anyway. For people reading the MAINTAINERS file
themselves, what about this one?

Subject: [PATCH] MAINTAINERS: add a few more patterns to kbuild

Also, add a note that "unmaintained" files below scripts/ should go via
the kbuild tree (best current practice).

Signed-off-by: Michal Marek <mmarek@suse.cz>

diff --git a/MAINTAINERS b/MAINTAINERS
index c8f47bf..f0c3e2f 100644
--- a/MAINTAINERS
+++ b/MAINTAINERS
@@ -3088,7 +3088,7 @@ L:        autofs@linux.kernel.org
 S:     Maintained
 F:     fs/autofs4/

-KERNEL BUILD
+KERNEL BUILD + files below scripts/ (unless maintained elsewhere)
 M:     Michal Marek <mmarek@suse.cz>
 T:     git git://repo.or.cz/linux-kbuild.git for-next
 T:     git git://repo.or.cz/linux-kbuild.git for-linus
@@ -3097,6 +3097,9 @@ S:        Maintained
 F:     Documentation/kbuild/
 F:     Makefile
 F:     scripts/Makefile.*
+F:     scripts/basic/
+F:     scripts/mk*
+F:     scripts/package/

 KERNEL JANITORS
 L:     kernel-janitors@vger.kernel.org


^ permalink raw reply related	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2010-01-29 13:31 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2010-01-28  6:58 [PATCH] markup_oops.pl: fix get "No matching code found" when first line of range is the faulting instruction Hui Zhu
2010-01-28 18:12 ` Sam Ravnborg
2010-01-29  4:03   ` Hui Zhu
     [not found]     ` <1264739206.10856.8.camel@Joe-Laptop.home>
2010-01-29  5:45       ` Hui Zhu
2010-01-29 13:31         ` Michal Marek
2010-01-29 13:13   ` Michal Marek

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox