linux-perf-users.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] tools/perf/tests: Fix objdump in Object code reading test to look for all sections
@ 2023-07-04  5:03 Athira Rajeev
  2023-07-05 18:12 ` Namhyung Kim
  0 siblings, 1 reply; 2+ messages in thread
From: Athira Rajeev @ 2023-07-04  5:03 UTC (permalink / raw)
  To: acme, jolsa, ak
  Cc: namhyung, irogers, james.clark, mpe, linux-perf-users,
	linuxppc-dev, maddy, rnsastry, kjain, disgoel, Athira Rajeev

Object code reading test fails intermittently with below logs:

   Reading object code for memory address: 0xc008000001dd34fc
   File is: /lib/modules/6.3.0-rc7+/kernel/fs/xfs/xfs.ko
   On file address is: 0x11359c
   Objdump command is: objdump -z -d --start-address=0x1134fc --stop-address=0x11357c /lib/modules/6.3.0-rc7+/kernel/fs/xfs/xfs.ko
   objdump read too few bytes: 128
   test child finished with -1
   ---- end ----
   Object code reading: FAILED!

This issue happens ramdomly depending on the sample ip
captured during the test run. In some cases, the same ip falls
in the xfs module. The test does an objdump on the xfs.ko file and
compares it with the dump from the dso that perf captures. But
since the range of ip address falls in debug info section, it fails
to find the address range with objdump. Fix the objdump option so
as to disasseble all sections to check the address range.

Signed-off-by: Athira Rajeev <atrajeev@linux.vnet.ibm.com>
---
 tools/perf/tests/code-reading.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/tools/perf/tests/code-reading.c b/tools/perf/tests/code-reading.c
index ed3815163d1b..02132478856a 100644
--- a/tools/perf/tests/code-reading.c
+++ b/tools/perf/tests/code-reading.c
@@ -184,7 +184,7 @@ static int read_via_objdump(const char *filename, u64 addr, void *buf,
 	FILE *f;
 	int ret;
 
-	fmt = "%s -z -d --start-address=0x%"PRIx64" --stop-address=0x%"PRIx64" %s";
+	fmt = "%s -z -D --start-address=0x%"PRIx64" --stop-address=0x%"PRIx64" %s";
 	ret = snprintf(cmd, sizeof(cmd), fmt, "objdump", addr, addr + len,
 		       filename);
 	if (ret <= 0 || (size_t)ret >= sizeof(cmd))
-- 
2.35.3


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

* Re: [PATCH] tools/perf/tests: Fix objdump in Object code reading test to look for all sections
  2023-07-04  5:03 [PATCH] tools/perf/tests: Fix objdump in Object code reading test to look for all sections Athira Rajeev
@ 2023-07-05 18:12 ` Namhyung Kim
  0 siblings, 0 replies; 2+ messages in thread
From: Namhyung Kim @ 2023-07-05 18:12 UTC (permalink / raw)
  To: Athira Rajeev
  Cc: acme, jolsa, ak, irogers, james.clark, mpe, linux-perf-users,
	linuxppc-dev, maddy, rnsastry, kjain, disgoel

On Mon, Jul 3, 2023 at 10:04 PM Athira Rajeev
<atrajeev@linux.vnet.ibm.com> wrote:
>
> Object code reading test fails intermittently with below logs:
>
>    Reading object code for memory address: 0xc008000001dd34fc
>    File is: /lib/modules/6.3.0-rc7+/kernel/fs/xfs/xfs.ko
>    On file address is: 0x11359c
>    Objdump command is: objdump -z -d --start-address=0x1134fc --stop-address=0x11357c /lib/modules/6.3.0-rc7+/kernel/fs/xfs/xfs.ko
>    objdump read too few bytes: 128
>    test child finished with -1
>    ---- end ----
>    Object code reading: FAILED!
>
> This issue happens ramdomly depending on the sample ip
> captured during the test run. In some cases, the same ip falls
> in the xfs module. The test does an objdump on the xfs.ko file and
> compares it with the dump from the dso that perf captures. But
> since the range of ip address falls in debug info section, it fails

This is strange.  Why did it fall into the debug section?

Thanks,
Namhyung


> to find the address range with objdump. Fix the objdump option so
> as to disasseble all sections to check the address range.
>
> Signed-off-by: Athira Rajeev <atrajeev@linux.vnet.ibm.com>
> ---
>  tools/perf/tests/code-reading.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/tools/perf/tests/code-reading.c b/tools/perf/tests/code-reading.c
> index ed3815163d1b..02132478856a 100644
> --- a/tools/perf/tests/code-reading.c
> +++ b/tools/perf/tests/code-reading.c
> @@ -184,7 +184,7 @@ static int read_via_objdump(const char *filename, u64 addr, void *buf,
>         FILE *f;
>         int ret;
>
> -       fmt = "%s -z -d --start-address=0x%"PRIx64" --stop-address=0x%"PRIx64" %s";
> +       fmt = "%s -z -D --start-address=0x%"PRIx64" --stop-address=0x%"PRIx64" %s";
>         ret = snprintf(cmd, sizeof(cmd), fmt, "objdump", addr, addr + len,
>                        filename);
>         if (ret <= 0 || (size_t)ret >= sizeof(cmd))
> --
> 2.35.3
>

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

end of thread, other threads:[~2023-07-05 18:12 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2023-07-04  5:03 [PATCH] tools/perf/tests: Fix objdump in Object code reading test to look for all sections Athira Rajeev
2023-07-05 18:12 ` Namhyung Kim

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).