All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] recordmcount: arm64: replace the ignored mcount call into nop
@ 2015-10-28  8:04 ` Li Bin
  0 siblings, 0 replies; 20+ messages in thread
From: Li Bin @ 2015-10-28  8:04 UTC (permalink / raw)
  To: catalin.marinas, will.deacon, rostedt, takahiro.akashi
  Cc: linux-kernel, linux-arm-kernel, guohanjun, dingtianhong,
	huawei.libin, zhouchengming1

By now, the recordmcount only records the function that in
following sections:
.text/.ref.text/.sched.text/.spinlock.text/.irqentry.text/
.kprobes.text/.text.unlikely

For the function that not in these sections, the call mcount
will be in place and not be replaced when kernel boot up. And
it will bring performance overhead, such as do_mem_abort (in
.exception.text section). This patch make the call mcount to
nop for this case in recordmcount.

Signed-off-by: Li Bin <huawei.libin@huawei.com>
---
 scripts/recordmcount.c | 23 ++++++++++++++++++++++-
 1 file changed, 22 insertions(+), 1 deletion(-)

diff --git a/scripts/recordmcount.c b/scripts/recordmcount.c
index 3d1984e..f697226 100644
--- a/scripts/recordmcount.c
+++ b/scripts/recordmcount.c
@@ -42,6 +42,7 @@
 
 #ifndef EM_AARCH64
 #define EM_AARCH64	183
+#define R_AARCH64_NONE		0
 #define R_AARCH64_ABS64	257
 #endif
 
@@ -160,6 +161,21 @@ static int make_nop_x86(void *map, size_t const offset)
 	return 0;
 }
 
+static unsigned char ideal_nop4_arm64[4] = {0x1f, 0x20, 0x03, 0xd5};
+static int make_nop_arm64(void *map, size_t const offset)
+{
+	uint32_t *ptr;
+
+	ptr = map + offset;
+	if (*ptr != 0x94000000)
+		return -1;
+
+	/* Convert to nop */
+	ulseek(fd_map, offset, SEEK_SET);
+	uwrite(fd_map, ideal_nop, 4);
+	return 0;
+}
+
 /*
  * Get the whole file as a programming convenience in order to avoid
  * malloc+lseek+read+free of many pieces.  If successful, then mmap
@@ -353,7 +369,12 @@ do_file(char const *const fname)
 			 altmcount = "__gnu_mcount_nc";
 			 break;
 	case EM_AARCH64:
-			 reltype = R_AARCH64_ABS64; gpfx = '_'; break;
+			reltype = R_AARCH64_ABS64;
+			make_nop = make_nop_arm64;
+			rel_type_nop = R_AARCH64_NONE;
+			ideal_nop = ideal_nop4_arm64;
+			gpfx = '_';
+			break;
 	case EM_IA_64:	 reltype = R_IA64_IMM64;   gpfx = '_'; break;
 	case EM_METAG:	 reltype = R_METAG_ADDR32;
 			 altmcount = "_mcount_wrapper";
-- 
1.7.12.4


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

* [PATCH] recordmcount: arm64: replace the ignored mcount call into nop
@ 2015-10-28  8:04 ` Li Bin
  0 siblings, 0 replies; 20+ messages in thread
From: Li Bin @ 2015-10-28  8:04 UTC (permalink / raw)
  To: linux-arm-kernel

By now, the recordmcount only records the function that in
following sections:
.text/.ref.text/.sched.text/.spinlock.text/.irqentry.text/
.kprobes.text/.text.unlikely

For the function that not in these sections, the call mcount
will be in place and not be replaced when kernel boot up. And
it will bring performance overhead, such as do_mem_abort (in
.exception.text section). This patch make the call mcount to
nop for this case in recordmcount.

Signed-off-by: Li Bin <huawei.libin@huawei.com>
---
 scripts/recordmcount.c | 23 ++++++++++++++++++++++-
 1 file changed, 22 insertions(+), 1 deletion(-)

diff --git a/scripts/recordmcount.c b/scripts/recordmcount.c
index 3d1984e..f697226 100644
--- a/scripts/recordmcount.c
+++ b/scripts/recordmcount.c
@@ -42,6 +42,7 @@
 
 #ifndef EM_AARCH64
 #define EM_AARCH64	183
+#define R_AARCH64_NONE		0
 #define R_AARCH64_ABS64	257
 #endif
 
@@ -160,6 +161,21 @@ static int make_nop_x86(void *map, size_t const offset)
 	return 0;
 }
 
+static unsigned char ideal_nop4_arm64[4] = {0x1f, 0x20, 0x03, 0xd5};
+static int make_nop_arm64(void *map, size_t const offset)
+{
+	uint32_t *ptr;
+
+	ptr = map + offset;
+	if (*ptr != 0x94000000)
+		return -1;
+
+	/* Convert to nop */
+	ulseek(fd_map, offset, SEEK_SET);
+	uwrite(fd_map, ideal_nop, 4);
+	return 0;
+}
+
 /*
  * Get the whole file as a programming convenience in order to avoid
  * malloc+lseek+read+free of many pieces.  If successful, then mmap
@@ -353,7 +369,12 @@ do_file(char const *const fname)
 			 altmcount = "__gnu_mcount_nc";
 			 break;
 	case EM_AARCH64:
-			 reltype = R_AARCH64_ABS64; gpfx = '_'; break;
+			reltype = R_AARCH64_ABS64;
+			make_nop = make_nop_arm64;
+			rel_type_nop = R_AARCH64_NONE;
+			ideal_nop = ideal_nop4_arm64;
+			gpfx = '_';
+			break;
 	case EM_IA_64:	 reltype = R_IA64_IMM64;   gpfx = '_'; break;
 	case EM_METAG:	 reltype = R_METAG_ADDR32;
 			 altmcount = "_mcount_wrapper";
-- 
1.7.12.4

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

* Re: [PATCH] recordmcount: arm64: replace the ignored mcount call into nop
  2015-10-28  8:04 ` Li Bin
@ 2015-10-28  8:16   ` Steven Rostedt
  -1 siblings, 0 replies; 20+ messages in thread
From: Steven Rostedt @ 2015-10-28  8:16 UTC (permalink / raw)
  To: Li Bin
  Cc: catalin.marinas, will.deacon, takahiro.akashi, linux-kernel,
	linux-arm-kernel, guohanjun, dingtianhong, zhouchengming1

On Wed, 28 Oct 2015 16:04:05 +0800
Li Bin <huawei.libin@huawei.com> wrote:

> By now, the recordmcount only records the function that in
> following sections:
> .text/.ref.text/.sched.text/.spinlock.text/.irqentry.text/
> .kprobes.text/.text.unlikely
> 
> For the function that not in these sections, the call mcount
> will be in place and not be replaced when kernel boot up. And
> it will bring performance overhead, such as do_mem_abort (in
> .exception.text section). This patch make the call mcount to
> nop for this case in recordmcount.

I can take this in my tree with an Ack from the ARM64 maintainers.

-- Steve

> 
> Signed-off-by: Li Bin <huawei.libin@huawei.com>
> ---
>  scripts/recordmcount.c | 23 ++++++++++++++++++++++-
>  1 file changed, 22 insertions(+), 1 deletion(-)
> 
> diff --git a/scripts/recordmcount.c b/scripts/recordmcount.c
> index 3d1984e..f697226 100644
> --- a/scripts/recordmcount.c
> +++ b/scripts/recordmcount.c
> @@ -42,6 +42,7 @@
>  
>  #ifndef EM_AARCH64
>  #define EM_AARCH64	183
> +#define R_AARCH64_NONE		0
>  #define R_AARCH64_ABS64	257
>  #endif
>  
> @@ -160,6 +161,21 @@ static int make_nop_x86(void *map, size_t const offset)
>  	return 0;
>  }
>  
> +static unsigned char ideal_nop4_arm64[4] = {0x1f, 0x20, 0x03, 0xd5};
> +static int make_nop_arm64(void *map, size_t const offset)
> +{
> +	uint32_t *ptr;
> +
> +	ptr = map + offset;
> +	if (*ptr != 0x94000000)
> +		return -1;
> +
> +	/* Convert to nop */
> +	ulseek(fd_map, offset, SEEK_SET);
> +	uwrite(fd_map, ideal_nop, 4);
> +	return 0;
> +}
> +
>  /*
>   * Get the whole file as a programming convenience in order to avoid
>   * malloc+lseek+read+free of many pieces.  If successful, then mmap
> @@ -353,7 +369,12 @@ do_file(char const *const fname)
>  			 altmcount = "__gnu_mcount_nc";
>  			 break;
>  	case EM_AARCH64:
> -			 reltype = R_AARCH64_ABS64; gpfx = '_'; break;
> +			reltype = R_AARCH64_ABS64;
> +			make_nop = make_nop_arm64;
> +			rel_type_nop = R_AARCH64_NONE;
> +			ideal_nop = ideal_nop4_arm64;
> +			gpfx = '_';
> +			break;
>  	case EM_IA_64:	 reltype = R_IA64_IMM64;   gpfx = '_'; break;
>  	case EM_METAG:	 reltype = R_METAG_ADDR32;
>  			 altmcount = "_mcount_wrapper";


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

* [PATCH] recordmcount: arm64: replace the ignored mcount call into nop
@ 2015-10-28  8:16   ` Steven Rostedt
  0 siblings, 0 replies; 20+ messages in thread
From: Steven Rostedt @ 2015-10-28  8:16 UTC (permalink / raw)
  To: linux-arm-kernel

On Wed, 28 Oct 2015 16:04:05 +0800
Li Bin <huawei.libin@huawei.com> wrote:

> By now, the recordmcount only records the function that in
> following sections:
> .text/.ref.text/.sched.text/.spinlock.text/.irqentry.text/
> .kprobes.text/.text.unlikely
> 
> For the function that not in these sections, the call mcount
> will be in place and not be replaced when kernel boot up. And
> it will bring performance overhead, such as do_mem_abort (in
> .exception.text section). This patch make the call mcount to
> nop for this case in recordmcount.

I can take this in my tree with an Ack from the ARM64 maintainers.

-- Steve

> 
> Signed-off-by: Li Bin <huawei.libin@huawei.com>
> ---
>  scripts/recordmcount.c | 23 ++++++++++++++++++++++-
>  1 file changed, 22 insertions(+), 1 deletion(-)
> 
> diff --git a/scripts/recordmcount.c b/scripts/recordmcount.c
> index 3d1984e..f697226 100644
> --- a/scripts/recordmcount.c
> +++ b/scripts/recordmcount.c
> @@ -42,6 +42,7 @@
>  
>  #ifndef EM_AARCH64
>  #define EM_AARCH64	183
> +#define R_AARCH64_NONE		0
>  #define R_AARCH64_ABS64	257
>  #endif
>  
> @@ -160,6 +161,21 @@ static int make_nop_x86(void *map, size_t const offset)
>  	return 0;
>  }
>  
> +static unsigned char ideal_nop4_arm64[4] = {0x1f, 0x20, 0x03, 0xd5};
> +static int make_nop_arm64(void *map, size_t const offset)
> +{
> +	uint32_t *ptr;
> +
> +	ptr = map + offset;
> +	if (*ptr != 0x94000000)
> +		return -1;
> +
> +	/* Convert to nop */
> +	ulseek(fd_map, offset, SEEK_SET);
> +	uwrite(fd_map, ideal_nop, 4);
> +	return 0;
> +}
> +
>  /*
>   * Get the whole file as a programming convenience in order to avoid
>   * malloc+lseek+read+free of many pieces.  If successful, then mmap
> @@ -353,7 +369,12 @@ do_file(char const *const fname)
>  			 altmcount = "__gnu_mcount_nc";
>  			 break;
>  	case EM_AARCH64:
> -			 reltype = R_AARCH64_ABS64; gpfx = '_'; break;
> +			reltype = R_AARCH64_ABS64;
> +			make_nop = make_nop_arm64;
> +			rel_type_nop = R_AARCH64_NONE;
> +			ideal_nop = ideal_nop4_arm64;
> +			gpfx = '_';
> +			break;
>  	case EM_IA_64:	 reltype = R_IA64_IMM64;   gpfx = '_'; break;
>  	case EM_METAG:	 reltype = R_METAG_ADDR32;
>  			 altmcount = "_mcount_wrapper";

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

* Re: [PATCH] recordmcount: arm64: replace the ignored mcount call into nop
  2015-10-28  8:16   ` Steven Rostedt
@ 2015-10-28 11:58     ` Will Deacon
  -1 siblings, 0 replies; 20+ messages in thread
From: Will Deacon @ 2015-10-28 11:58 UTC (permalink / raw)
  To: Steven Rostedt
  Cc: Li Bin, catalin.marinas, takahiro.akashi, linux-kernel,
	linux-arm-kernel, guohanjun, dingtianhong, zhouchengming1

On Wed, Oct 28, 2015 at 04:16:19AM -0400, Steven Rostedt wrote:
> On Wed, 28 Oct 2015 16:04:05 +0800
> Li Bin <huawei.libin@huawei.com> wrote:
> 
> > By now, the recordmcount only records the function that in
> > following sections:
> > .text/.ref.text/.sched.text/.spinlock.text/.irqentry.text/
> > .kprobes.text/.text.unlikely
> > 
> > For the function that not in these sections, the call mcount
> > will be in place and not be replaced when kernel boot up. And
> > it will bring performance overhead, such as do_mem_abort (in
> > .exception.text section). This patch make the call mcount to
> > nop for this case in recordmcount.
> 
> I can take this in my tree with an Ack from the ARM64 maintainers.

Looks like it does what it says on the tin:

  Acked-by: Will Deacon <will.deacon@arm.com>

Will

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

* [PATCH] recordmcount: arm64: replace the ignored mcount call into nop
@ 2015-10-28 11:58     ` Will Deacon
  0 siblings, 0 replies; 20+ messages in thread
From: Will Deacon @ 2015-10-28 11:58 UTC (permalink / raw)
  To: linux-arm-kernel

On Wed, Oct 28, 2015 at 04:16:19AM -0400, Steven Rostedt wrote:
> On Wed, 28 Oct 2015 16:04:05 +0800
> Li Bin <huawei.libin@huawei.com> wrote:
> 
> > By now, the recordmcount only records the function that in
> > following sections:
> > .text/.ref.text/.sched.text/.spinlock.text/.irqentry.text/
> > .kprobes.text/.text.unlikely
> > 
> > For the function that not in these sections, the call mcount
> > will be in place and not be replaced when kernel boot up. And
> > it will bring performance overhead, such as do_mem_abort (in
> > .exception.text section). This patch make the call mcount to
> > nop for this case in recordmcount.
> 
> I can take this in my tree with an Ack from the ARM64 maintainers.

Looks like it does what it says on the tin:

  Acked-by: Will Deacon <will.deacon@arm.com>

Will

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

* Re: [PATCH] recordmcount: arm64: replace the ignored mcount call into nop
  2015-10-28 11:58     ` Will Deacon
@ 2015-10-29  5:43       ` AKASHI Takahiro
  -1 siblings, 0 replies; 20+ messages in thread
From: AKASHI Takahiro @ 2015-10-29  5:43 UTC (permalink / raw)
  To: Will Deacon, Steven Rostedt
  Cc: Li Bin, catalin.marinas, linux-kernel, linux-arm-kernel,
	guohanjun, dingtianhong, zhouchengming1

On 10/28/2015 08:58 PM, Will Deacon wrote:
> On Wed, Oct 28, 2015 at 04:16:19AM -0400, Steven Rostedt wrote:
>> On Wed, 28 Oct 2015 16:04:05 +0800
>> Li Bin <huawei.libin@huawei.com> wrote:
>>
>>> By now, the recordmcount only records the function that in
>>> following sections:
>>> .text/.ref.text/.sched.text/.spinlock.text/.irqentry.text/
>>> .kprobes.text/.text.unlikely
>>>
>>> For the function that not in these sections, the call mcount
>>> will be in place and not be replaced when kernel boot up. And
>>> it will bring performance overhead, such as do_mem_abort (in
>>> .exception.text section). This patch make the call mcount to
>>> nop for this case in recordmcount.

The patch itself is fine (it might be a good idea to describe
what 0x94000000 means though), but
I'm wondering whether we have any reason to exclude .exception.text
from tracing.
In my understandings, this attribute (.exception.text) is utilized
solely for pretty printing in dump_backtrace().

Thanks,
-Takahiro AKASHI

>> I can take this in my tree with an Ack from the ARM64 maintainers.
>
> Looks like it does what it says on the tin:
>
>    Acked-by: Will Deacon <will.deacon@arm.com>
>
> Will
>

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

* [PATCH] recordmcount: arm64: replace the ignored mcount call into nop
@ 2015-10-29  5:43       ` AKASHI Takahiro
  0 siblings, 0 replies; 20+ messages in thread
From: AKASHI Takahiro @ 2015-10-29  5:43 UTC (permalink / raw)
  To: linux-arm-kernel

On 10/28/2015 08:58 PM, Will Deacon wrote:
> On Wed, Oct 28, 2015 at 04:16:19AM -0400, Steven Rostedt wrote:
>> On Wed, 28 Oct 2015 16:04:05 +0800
>> Li Bin <huawei.libin@huawei.com> wrote:
>>
>>> By now, the recordmcount only records the function that in
>>> following sections:
>>> .text/.ref.text/.sched.text/.spinlock.text/.irqentry.text/
>>> .kprobes.text/.text.unlikely
>>>
>>> For the function that not in these sections, the call mcount
>>> will be in place and not be replaced when kernel boot up. And
>>> it will bring performance overhead, such as do_mem_abort (in
>>> .exception.text section). This patch make the call mcount to
>>> nop for this case in recordmcount.

The patch itself is fine (it might be a good idea to describe
what 0x94000000 means though), but
I'm wondering whether we have any reason to exclude .exception.text
from tracing.
In my understandings, this attribute (.exception.text) is utilized
solely for pretty printing in dump_backtrace().

Thanks,
-Takahiro AKASHI

>> I can take this in my tree with an Ack from the ARM64 maintainers.
>
> Looks like it does what it says on the tin:
>
>    Acked-by: Will Deacon <will.deacon@arm.com>
>
> Will
>

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

* Re: [PATCH] recordmcount: arm64: replace the ignored mcount call into nop
  2015-10-28  8:04 ` Li Bin
@ 2015-10-29 13:35   ` kbuild test robot
  -1 siblings, 0 replies; 20+ messages in thread
From: kbuild test robot @ 2015-10-29 13:35 UTC (permalink / raw)
  To: Li Bin
  Cc: kbuild-all, catalin.marinas, will.deacon, rostedt,
	takahiro.akashi, linux-kernel, linux-arm-kernel, guohanjun,
	dingtianhong, huawei.libin, zhouchengming1

[-- Attachment #1: Type: text/plain, Size: 984 bytes --]

Hi Li,

[auto build test ERROR on arm64/for-next/core -- if it's inappropriate base, please suggest rules for selecting the more suitable base]

url:    https://github.com/0day-ci/linux/commits/Li-Bin/recordmcount-arm64-replace-the-ignored-mcount-call-into-nop/20151028-160846
config: arm64-allmodconfig (attached as .config)
reproduce:
        wget https://git.kernel.org/cgit/linux/kernel/git/wfg/lkp-tests.git/plain/sbin/make.cross -O ~/bin/make.cross
        chmod +x ~/bin/make.cross
        # save the attached .config to linux build tree
        make.cross ARCH=arm64 

All errors (new ones prefixed by >>):

>> /bin/bash: line 1: 117734 Segmentation fault      ./scripts/recordmcount "arch/arm64/kernel/traps.o"
--
>> /bin/bash: line 1: 113824 Segmentation fault      ./scripts/recordmcount "arch/arm64/mm/fault.o"

---
0-DAY kernel test infrastructure                Open Source Technology Center
https://lists.01.org/pipermail/kbuild-all                   Intel Corporation

[-- Attachment #2: .config.gz --]
[-- Type: application/octet-stream, Size: 45574 bytes --]

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

* [PATCH] recordmcount: arm64: replace the ignored mcount call into nop
@ 2015-10-29 13:35   ` kbuild test robot
  0 siblings, 0 replies; 20+ messages in thread
From: kbuild test robot @ 2015-10-29 13:35 UTC (permalink / raw)
  To: linux-arm-kernel

Hi Li,

[auto build test ERROR on arm64/for-next/core -- if it's inappropriate base, please suggest rules for selecting the more suitable base]

url:    https://github.com/0day-ci/linux/commits/Li-Bin/recordmcount-arm64-replace-the-ignored-mcount-call-into-nop/20151028-160846
config: arm64-allmodconfig (attached as .config)
reproduce:
        wget https://git.kernel.org/cgit/linux/kernel/git/wfg/lkp-tests.git/plain/sbin/make.cross -O ~/bin/make.cross
        chmod +x ~/bin/make.cross
        # save the attached .config to linux build tree
        make.cross ARCH=arm64 

All errors (new ones prefixed by >>):

>> /bin/bash: line 1: 117734 Segmentation fault      ./scripts/recordmcount "arch/arm64/kernel/traps.o"
--
>> /bin/bash: line 1: 113824 Segmentation fault      ./scripts/recordmcount "arch/arm64/mm/fault.o"

---
0-DAY kernel test infrastructure                Open Source Technology Center
https://lists.01.org/pipermail/kbuild-all                   Intel Corporation
-------------- next part --------------
A non-text attachment was scrubbed...
Name: .config.gz
Type: application/octet-stream
Size: 45574 bytes
Desc: not available
URL: <http://lists.infradead.org/pipermail/linux-arm-kernel/attachments/20151029/469c95e2/attachment-0001.obj>

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

* Re: [PATCH] recordmcount: arm64: replace the ignored mcount call into nop
  2015-10-29 13:35   ` kbuild test robot
@ 2015-10-29 15:09     ` Will Deacon
  -1 siblings, 0 replies; 20+ messages in thread
From: Will Deacon @ 2015-10-29 15:09 UTC (permalink / raw)
  To: kbuild test robot
  Cc: Li Bin, kbuild-all, catalin.marinas, rostedt, takahiro.akashi,
	linux-kernel, linux-arm-kernel, guohanjun, dingtianhong,
	zhouchengming1

On Thu, Oct 29, 2015 at 09:35:42PM +0800, kbuild test robot wrote:
> [auto build test ERROR on arm64/for-next/core -- if it's inappropriate base, please suggest rules for selecting the more suitable base]
> 
> url:    https://github.com/0day-ci/linux/commits/Li-Bin/recordmcount-arm64-replace-the-ignored-mcount-call-into-nop/20151028-160846
> config: arm64-allmodconfig (attached as .config)
> reproduce:
>         wget https://git.kernel.org/cgit/linux/kernel/git/wfg/lkp-tests.git/plain/sbin/make.cross -O ~/bin/make.cross
>         chmod +x ~/bin/make.cross
>         # save the attached .config to linux build tree
>         make.cross ARCH=arm64 
> 
> All errors (new ones prefixed by >>):
> 
> >> /bin/bash: line 1: 117734 Segmentation fault      ./scripts/recordmcount "arch/arm64/kernel/traps.o"
> --
> >> /bin/bash: line 1: 113824 Segmentation fault      ./scripts/recordmcount "arch/arm64/mm/fault.o"

I can reproduce this locally with an allmodconfig build. The offset
parameter to make_nop_arm64 is nuts:

  Program received signal SIGSEGV, Segmentation fault.
  make_nop_arm64 (map=0x7ffff7fef000, offset=2600547309829750784) at scripts/recordmcount.c:170
  170		if (*ptr != 0x94000000)

Both shdr->sh_offset (0x17000000000000) and relp->r_offset (0x2400000000000000)
look dodgy in the caller.

Li, can you take a look please?

Will

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

* [PATCH] recordmcount: arm64: replace the ignored mcount call into nop
@ 2015-10-29 15:09     ` Will Deacon
  0 siblings, 0 replies; 20+ messages in thread
From: Will Deacon @ 2015-10-29 15:09 UTC (permalink / raw)
  To: linux-arm-kernel

On Thu, Oct 29, 2015 at 09:35:42PM +0800, kbuild test robot wrote:
> [auto build test ERROR on arm64/for-next/core -- if it's inappropriate base, please suggest rules for selecting the more suitable base]
> 
> url:    https://github.com/0day-ci/linux/commits/Li-Bin/recordmcount-arm64-replace-the-ignored-mcount-call-into-nop/20151028-160846
> config: arm64-allmodconfig (attached as .config)
> reproduce:
>         wget https://git.kernel.org/cgit/linux/kernel/git/wfg/lkp-tests.git/plain/sbin/make.cross -O ~/bin/make.cross
>         chmod +x ~/bin/make.cross
>         # save the attached .config to linux build tree
>         make.cross ARCH=arm64 
> 
> All errors (new ones prefixed by >>):
> 
> >> /bin/bash: line 1: 117734 Segmentation fault      ./scripts/recordmcount "arch/arm64/kernel/traps.o"
> --
> >> /bin/bash: line 1: 113824 Segmentation fault      ./scripts/recordmcount "arch/arm64/mm/fault.o"

I can reproduce this locally with an allmodconfig build. The offset
parameter to make_nop_arm64 is nuts:

  Program received signal SIGSEGV, Segmentation fault.
  make_nop_arm64 (map=0x7ffff7fef000, offset=2600547309829750784) at scripts/recordmcount.c:170
  170		if (*ptr != 0x94000000)

Both shdr->sh_offset (0x17000000000000) and relp->r_offset (0x2400000000000000)
look dodgy in the caller.

Li, can you take a look please?

Will

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

* Re: [PATCH] recordmcount: arm64: replace the ignored mcount call into nop
  2015-10-29 15:09     ` Will Deacon
@ 2015-10-30  6:00       ` libin
  -1 siblings, 0 replies; 20+ messages in thread
From: libin @ 2015-10-30  6:00 UTC (permalink / raw)
  To: Will Deacon, kbuild test robot
  Cc: kbuild-all, catalin.marinas, rostedt, takahiro.akashi,
	linux-kernel, linux-arm-kernel, guohanjun, dingtianhong,
	zhouchengming1



在 2015/10/29 23:09, Will Deacon 写道:
> On Thu, Oct 29, 2015 at 09:35:42PM +0800, kbuild test robot wrote:
>> [auto build test ERROR on arm64/for-next/core -- if it's inappropriate base, please suggest rules for selecting the more suitable base]
>>
>> url:    https://github.com/0day-ci/linux/commits/Li-Bin/recordmcount-arm64-replace-the-ignored-mcount-call-into-nop/20151028-160846
>> config: arm64-allmodconfig (attached as .config)
>> reproduce:
>>         wget https://git.kernel.org/cgit/linux/kernel/git/wfg/lkp-tests.git/plain/sbin/make.cross -O ~/bin/make.cross
>>         chmod +x ~/bin/make.cross
>>         # save the attached .config to linux build tree
>>         make.cross ARCH=arm64 
>>
>> All errors (new ones prefixed by >>):
>>
>>>> /bin/bash: line 1: 117734 Segmentation fault      ./scripts/recordmcount "arch/arm64/kernel/traps.o"
>> --
>>>> /bin/bash: line 1: 113824 Segmentation fault      ./scripts/recordmcount "arch/arm64/mm/fault.o"
> 
> I can reproduce this locally with an allmodconfig build. The offset
> parameter to make_nop_arm64 is nuts:
> 
>   Program received signal SIGSEGV, Segmentation fault.
>   make_nop_arm64 (map=0x7ffff7fef000, offset=2600547309829750784) at scripts/recordmcount.c:170
>   170		if (*ptr != 0x94000000)
> 
> Both shdr->sh_offset (0x17000000000000) and relp->r_offset (0x2400000000000000)
> look dodgy in the caller.
> 

The allmodconfig configs the CONFIG_CPU_BIG_ENDIAN, and the test system is little eddian, so
it triggers the error.

It is a bug in nop_mcount:
...
if (mcountsym == Elf_r_sym(relp) && !is_fake_mcount(relp)) {
        if (make_nop) {
                ret = make_nop((void *)ehdr, shdr->sh_offset + relp->r_offset);
        }
...

shdr->sh_offset and welp->r_offset should handle endianness properly as _w(shdr->sh_offset)/
_w(relp->r_offset). I will post a patchset including this patch soon.

Thanks,

Li Bin

> Li, can you take a look please?
> 
> Will
> 
> .
> 


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

* [PATCH] recordmcount: arm64: replace the ignored mcount call into nop
@ 2015-10-30  6:00       ` libin
  0 siblings, 0 replies; 20+ messages in thread
From: libin @ 2015-10-30  6:00 UTC (permalink / raw)
  To: linux-arm-kernel



? 2015/10/29 23:09, Will Deacon ??:
> On Thu, Oct 29, 2015 at 09:35:42PM +0800, kbuild test robot wrote:
>> [auto build test ERROR on arm64/for-next/core -- if it's inappropriate base, please suggest rules for selecting the more suitable base]
>>
>> url:    https://github.com/0day-ci/linux/commits/Li-Bin/recordmcount-arm64-replace-the-ignored-mcount-call-into-nop/20151028-160846
>> config: arm64-allmodconfig (attached as .config)
>> reproduce:
>>         wget https://git.kernel.org/cgit/linux/kernel/git/wfg/lkp-tests.git/plain/sbin/make.cross -O ~/bin/make.cross
>>         chmod +x ~/bin/make.cross
>>         # save the attached .config to linux build tree
>>         make.cross ARCH=arm64 
>>
>> All errors (new ones prefixed by >>):
>>
>>>> /bin/bash: line 1: 117734 Segmentation fault      ./scripts/recordmcount "arch/arm64/kernel/traps.o"
>> --
>>>> /bin/bash: line 1: 113824 Segmentation fault      ./scripts/recordmcount "arch/arm64/mm/fault.o"
> 
> I can reproduce this locally with an allmodconfig build. The offset
> parameter to make_nop_arm64 is nuts:
> 
>   Program received signal SIGSEGV, Segmentation fault.
>   make_nop_arm64 (map=0x7ffff7fef000, offset=2600547309829750784) at scripts/recordmcount.c:170
>   170		if (*ptr != 0x94000000)
> 
> Both shdr->sh_offset (0x17000000000000) and relp->r_offset (0x2400000000000000)
> look dodgy in the caller.
> 

The allmodconfig configs the CONFIG_CPU_BIG_ENDIAN, and the test system is little eddian, so
it triggers the error.

It is a bug in nop_mcount:
...
if (mcountsym == Elf_r_sym(relp) && !is_fake_mcount(relp)) {
        if (make_nop) {
                ret = make_nop((void *)ehdr, shdr->sh_offset + relp->r_offset);
        }
...

shdr->sh_offset and welp->r_offset should handle endianness properly as _w(shdr->sh_offset)/
_w(relp->r_offset). I will post a patchset including this patch soon.

Thanks,

Li Bin

> Li, can you take a look please?
> 
> Will
> 
> .
> 

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

* Re: [PATCH] recordmcount: arm64: replace the ignored mcount call into nop
  2015-10-30  6:00       ` libin
@ 2015-11-02 18:26         ` Steven Rostedt
  -1 siblings, 0 replies; 20+ messages in thread
From: Steven Rostedt @ 2015-11-02 18:26 UTC (permalink / raw)
  To: libin
  Cc: Will Deacon, kbuild test robot, kbuild-all, catalin.marinas,
	takahiro.akashi, linux-kernel, linux-arm-kernel, guohanjun,
	dingtianhong, zhouchengming1

On Fri, 30 Oct 2015 14:00:28 +0800
libin <huawei.libin@huawei.com> wrote:

> It is a bug in nop_mcount:
> ...
> if (mcountsym == Elf_r_sym(relp) && !is_fake_mcount(relp)) {
>         if (make_nop) {
>                 ret = make_nop((void *)ehdr, shdr->sh_offset + relp->r_offset);
>         }
> ...
> 
> shdr->sh_offset and welp->r_offset should handle endianness properly as _w(shdr->sh_offset)/
> _w(relp->r_offset). I will post a patchset including this patch soon.
> 

Has this been fixed yet?

-- Steve

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

* [PATCH] recordmcount: arm64: replace the ignored mcount call into nop
@ 2015-11-02 18:26         ` Steven Rostedt
  0 siblings, 0 replies; 20+ messages in thread
From: Steven Rostedt @ 2015-11-02 18:26 UTC (permalink / raw)
  To: linux-arm-kernel

On Fri, 30 Oct 2015 14:00:28 +0800
libin <huawei.libin@huawei.com> wrote:

> It is a bug in nop_mcount:
> ...
> if (mcountsym == Elf_r_sym(relp) && !is_fake_mcount(relp)) {
>         if (make_nop) {
>                 ret = make_nop((void *)ehdr, shdr->sh_offset + relp->r_offset);
>         }
> ...
> 
> shdr->sh_offset and welp->r_offset should handle endianness properly as _w(shdr->sh_offset)/
> _w(relp->r_offset). I will post a patchset including this patch soon.
> 

Has this been fixed yet?

-- Steve

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

* Re: [PATCH] recordmcount: arm64: replace the ignored mcount call into nop
  2015-11-02 18:26         ` Steven Rostedt
@ 2015-11-02 18:28           ` Will Deacon
  -1 siblings, 0 replies; 20+ messages in thread
From: Will Deacon @ 2015-11-02 18:28 UTC (permalink / raw)
  To: Steven Rostedt
  Cc: libin, kbuild test robot, kbuild-all, catalin.marinas,
	takahiro.akashi, linux-kernel, linux-arm-kernel, guohanjun,
	dingtianhong, zhouchengming1

On Mon, Nov 02, 2015 at 01:26:08PM -0500, Steven Rostedt wrote:
> On Fri, 30 Oct 2015 14:00:28 +0800
> libin <huawei.libin@huawei.com> wrote:
> 
> > It is a bug in nop_mcount:
> > ...
> > if (mcountsym == Elf_r_sym(relp) && !is_fake_mcount(relp)) {
> >         if (make_nop) {
> >                 ret = make_nop((void *)ehdr, shdr->sh_offset + relp->r_offset);
> >         }
> > ...
> > 
> > shdr->sh_offset and welp->r_offset should handle endianness properly as _w(shdr->sh_offset)/
> > _w(relp->r_offset). I will post a patchset including this patch soon.
> > 
> 
> Has this been fixed yet?

  http://lkml.kernel.org/r/1446193864-24593-1-git-send-email-huawei.libin@huawei.com

I see you're playing "chase the patches" at the moment ;)

Will

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

* [PATCH] recordmcount: arm64: replace the ignored mcount call into nop
@ 2015-11-02 18:28           ` Will Deacon
  0 siblings, 0 replies; 20+ messages in thread
From: Will Deacon @ 2015-11-02 18:28 UTC (permalink / raw)
  To: linux-arm-kernel

On Mon, Nov 02, 2015 at 01:26:08PM -0500, Steven Rostedt wrote:
> On Fri, 30 Oct 2015 14:00:28 +0800
> libin <huawei.libin@huawei.com> wrote:
> 
> > It is a bug in nop_mcount:
> > ...
> > if (mcountsym == Elf_r_sym(relp) && !is_fake_mcount(relp)) {
> >         if (make_nop) {
> >                 ret = make_nop((void *)ehdr, shdr->sh_offset + relp->r_offset);
> >         }
> > ...
> > 
> > shdr->sh_offset and welp->r_offset should handle endianness properly as _w(shdr->sh_offset)/
> > _w(relp->r_offset). I will post a patchset including this patch soon.
> > 
> 
> Has this been fixed yet?

  http://lkml.kernel.org/r/1446193864-24593-1-git-send-email-huawei.libin at huawei.com

I see you're playing "chase the patches" at the moment ;)

Will

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

* Re: [PATCH] recordmcount: arm64: replace the ignored mcount call into nop
  2015-11-02 18:28           ` Will Deacon
@ 2015-11-02 19:34             ` Steven Rostedt
  -1 siblings, 0 replies; 20+ messages in thread
From: Steven Rostedt @ 2015-11-02 19:34 UTC (permalink / raw)
  To: Will Deacon
  Cc: libin, kbuild test robot, kbuild-all, catalin.marinas,
	takahiro.akashi, linux-kernel, linux-arm-kernel, guohanjun,
	dingtianhong, zhouchengming1

On Mon, 2 Nov 2015 18:28:37 +0000
Will Deacon <will.deacon@arm.com> wrote:

> I see you're playing "chase the patches" at the moment ;)
> 

Why yes I am!

Trying to grab last minute patches from my INBOX (or they could be old
patches that I just missed), before kicking off my 12 hour test suite.

-- Steve

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

* [PATCH] recordmcount: arm64: replace the ignored mcount call into nop
@ 2015-11-02 19:34             ` Steven Rostedt
  0 siblings, 0 replies; 20+ messages in thread
From: Steven Rostedt @ 2015-11-02 19:34 UTC (permalink / raw)
  To: linux-arm-kernel

On Mon, 2 Nov 2015 18:28:37 +0000
Will Deacon <will.deacon@arm.com> wrote:

> I see you're playing "chase the patches" at the moment ;)
> 

Why yes I am!

Trying to grab last minute patches from my INBOX (or they could be old
patches that I just missed), before kicking off my 12 hour test suite.

-- Steve

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

end of thread, other threads:[~2015-11-02 19:34 UTC | newest]

Thread overview: 20+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2015-10-28  8:04 [PATCH] recordmcount: arm64: replace the ignored mcount call into nop Li Bin
2015-10-28  8:04 ` Li Bin
2015-10-28  8:16 ` Steven Rostedt
2015-10-28  8:16   ` Steven Rostedt
2015-10-28 11:58   ` Will Deacon
2015-10-28 11:58     ` Will Deacon
2015-10-29  5:43     ` AKASHI Takahiro
2015-10-29  5:43       ` AKASHI Takahiro
2015-10-29 13:35 ` kbuild test robot
2015-10-29 13:35   ` kbuild test robot
2015-10-29 15:09   ` Will Deacon
2015-10-29 15:09     ` Will Deacon
2015-10-30  6:00     ` libin
2015-10-30  6:00       ` libin
2015-11-02 18:26       ` Steven Rostedt
2015-11-02 18:26         ` Steven Rostedt
2015-11-02 18:28         ` Will Deacon
2015-11-02 18:28           ` Will Deacon
2015-11-02 19:34           ` Steven Rostedt
2015-11-02 19:34             ` Steven Rostedt

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.