All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH 0/2] perf tools: Modify mksyscalltbl
@ 2023-05-23 10:22 Tiezhu Yang
  2023-05-23 10:22 ` [PATCH 1/2] perf arm64: Handle __NR3264_ prefixed syscall number Tiezhu Yang
  2023-05-23 10:22 ` [PATCH 2/2] perf LoongArch: Simplify mksyscalltbl Tiezhu Yang
  0 siblings, 2 replies; 9+ messages in thread
From: Tiezhu Yang @ 2023-05-23 10:22 UTC (permalink / raw)
  To: Peter Zijlstra, Ingo Molnar, Arnaldo Carvalho de Melo,
	Mark Rutland, Alexander Shishkin, Jiri Olsa, Namhyung Kim,
	Ian Rogers, Adrian Hunter
  Cc: Hans-Peter Nilsson, Leo Yan, linux-perf-users, linux-kernel,
	loongarch, loongson-kernel

Tiezhu Yang (2):
  perf arm64: Handle __NR3264_ prefixed syscall number
  perf LoongArch: Simplify mksyscalltbl

 tools/perf/arch/arm64/entry/syscalls/mksyscalltbl  |  7 +++--
 .../arch/loongarch/entry/syscalls/mksyscalltbl     | 32 ++++++----------------
 2 files changed, 12 insertions(+), 27 deletions(-)

-- 
2.1.0


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

* [PATCH 1/2] perf arm64: Handle __NR3264_ prefixed syscall number
  2023-05-23 10:22 [PATCH 0/2] perf tools: Modify mksyscalltbl Tiezhu Yang
@ 2023-05-23 10:22 ` Tiezhu Yang
  2023-05-23 12:31   ` Alexander Kapshuk
  2023-05-23 10:22 ` [PATCH 2/2] perf LoongArch: Simplify mksyscalltbl Tiezhu Yang
  1 sibling, 1 reply; 9+ messages in thread
From: Tiezhu Yang @ 2023-05-23 10:22 UTC (permalink / raw)
  To: Peter Zijlstra, Ingo Molnar, Arnaldo Carvalho de Melo,
	Mark Rutland, Alexander Shishkin, Jiri Olsa, Namhyung Kim,
	Ian Rogers, Adrian Hunter
  Cc: Hans-Peter Nilsson, Leo Yan, linux-perf-users, linux-kernel,
	loongarch, loongson-kernel

After commit 9854e7ad35fe ("perf arm64: Simplify mksyscalltbl"),
in the generated syscall table file syscalls.c, there exist some
__NR3264_ prefixed syscall numbers such as [__NR3264_ftruncate],
it looks like not so good, just do some small filter operations
to handle __NR3264_ prefixed syscall number as a digital number.

Without this patch:

  [__NR3264_ftruncate] = "ftruncate",

With this patch:

  [46] = "ftruncate",

Signed-off-by: Tiezhu Yang <yangtiezhu@loongson.cn>
---
 tools/perf/arch/arm64/entry/syscalls/mksyscalltbl | 7 ++++---
 1 file changed, 4 insertions(+), 3 deletions(-)

diff --git a/tools/perf/arch/arm64/entry/syscalls/mksyscalltbl b/tools/perf/arch/arm64/entry/syscalls/mksyscalltbl
index 22cdf91..59ab7939 100755
--- a/tools/perf/arch/arm64/entry/syscalls/mksyscalltbl
+++ b/tools/perf/arch/arm64/entry/syscalls/mksyscalltbl
@@ -39,7 +39,8 @@ create_table()
 	echo "};"
 }
 
-$gcc -E -dM -x c -I $incpath/include/uapi $input \
-	|sed -ne 's/^#define __NR_//p' \
-	|sort -t' ' -k2 -n	       \
+$gcc -E -dM -x c -I $incpath/include/uapi $input		\
+	|awk '{if ($2~"__NR" && $3 !~"__NR3264_") {print}}'	\
+	|sed -ne 's/^#define __NR_//p;s/^#define __NR3264_//p'	\
+	|sort -t' ' -k2 -n					\
 	|create_table
-- 
2.1.0


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

* [PATCH 2/2] perf LoongArch: Simplify mksyscalltbl
  2023-05-23 10:22 [PATCH 0/2] perf tools: Modify mksyscalltbl Tiezhu Yang
  2023-05-23 10:22 ` [PATCH 1/2] perf arm64: Handle __NR3264_ prefixed syscall number Tiezhu Yang
@ 2023-05-23 10:22 ` Tiezhu Yang
  2023-05-27  1:55   ` Leo Yan
  1 sibling, 1 reply; 9+ messages in thread
From: Tiezhu Yang @ 2023-05-23 10:22 UTC (permalink / raw)
  To: Peter Zijlstra, Ingo Molnar, Arnaldo Carvalho de Melo,
	Mark Rutland, Alexander Shishkin, Jiri Olsa, Namhyung Kim,
	Ian Rogers, Adrian Hunter
  Cc: Hans-Peter Nilsson, Leo Yan, linux-perf-users, linux-kernel,
	loongarch, loongson-kernel

In order to print the numerical entries of the syscall table,
there is no need to call the host compiler to build and then
run a program, this can be done directly by the shell script.

This is similar with commit 9854e7ad35fe ("perf arm64: Simplify
mksyscalltbl").

Signed-off-by: Tiezhu Yang <yangtiezhu@loongson.cn>
---
 .../arch/loongarch/entry/syscalls/mksyscalltbl     | 32 ++++++----------------
 1 file changed, 8 insertions(+), 24 deletions(-)

diff --git a/tools/perf/arch/loongarch/entry/syscalls/mksyscalltbl b/tools/perf/arch/loongarch/entry/syscalls/mksyscalltbl
index c52156f..d7d97d5 100755
--- a/tools/perf/arch/loongarch/entry/syscalls/mksyscalltbl
+++ b/tools/perf/arch/loongarch/entry/syscalls/mksyscalltbl
@@ -22,40 +22,24 @@ create_table_from_c()
 {
 	local sc nr last_sc
 
-	create_table_exe=`mktemp ${TMPDIR:-/tmp}/create-table-XXXXXX`
-
-	{
-
-	cat <<-_EoHEADER
-		#include <stdio.h>
-		#include "$input"
-		int main(int argc, char *argv[])
-		{
-	_EoHEADER
-
 	while read sc nr; do
-		printf "%s\n" "	printf(\"\\t[%d] = \\\"$sc\\\",\\n\", $nr);"
-		last_sc=$nr
+		printf "%s\n" "	[$nr] = \"$sc\","
+		last_sc=$sc
 	done
 
-	printf "%s\n" "	printf(\"#define SYSCALLTBL_LOONGARCH_MAX_ID %d\\n\", $last_sc);"
-	printf "}\n"
-
-	} | $hostcc -I $incpath/include/uapi -o $create_table_exe -x c -
-
-	$create_table_exe
-
-	rm -f $create_table_exe
+	printf "%s\n" "#define SYSCALLTBL_LOONGARCH_MAX_ID __NR_$last_sc"
 }
 
 create_table()
 {
+	echo "#include \"$input\""
 	echo "static const char *syscalltbl_loongarch[] = {"
 	create_table_from_c
 	echo "};"
 }
 
-$gcc -E -dM -x c  -I $incpath/include/uapi $input	       \
-	|sed -ne 's/^#define __NR_//p' \
-	|sort -t' ' -k2 -n \
+$gcc -E -dM -x c -I $incpath/include/uapi $input		\
+	|awk '{if ($2~"__NR" && $3 !~"__NR3264_") {print}}'	\
+	|sed -ne 's/^#define __NR_//p;s/^#define __NR3264_//p'	\
+	|sort -t' ' -k2 -n					\
 	|create_table
-- 
2.1.0


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

* Re: [PATCH 1/2] perf arm64: Handle __NR3264_ prefixed syscall number
  2023-05-23 10:22 ` [PATCH 1/2] perf arm64: Handle __NR3264_ prefixed syscall number Tiezhu Yang
@ 2023-05-23 12:31   ` Alexander Kapshuk
  2023-05-24  3:19     ` Tiezhu Yang
  0 siblings, 1 reply; 9+ messages in thread
From: Alexander Kapshuk @ 2023-05-23 12:31 UTC (permalink / raw)
  To: Tiezhu Yang
  Cc: Peter Zijlstra, Ingo Molnar, Arnaldo Carvalho de Melo,
	Mark Rutland, Alexander Shishkin, Jiri Olsa, Namhyung Kim,
	Ian Rogers, Adrian Hunter, Hans-Peter Nilsson, Leo Yan,
	linux-perf-users, linux-kernel, loongarch, loongson-kernel

On Tue, May 23, 2023 at 1:22 PM Tiezhu Yang <yangtiezhu@loongson.cn> wrote:
>
> After commit 9854e7ad35fe ("perf arm64: Simplify mksyscalltbl"),
> in the generated syscall table file syscalls.c, there exist some
> __NR3264_ prefixed syscall numbers such as [__NR3264_ftruncate],
> it looks like not so good, just do some small filter operations
> to handle __NR3264_ prefixed syscall number as a digital number.
>
> Without this patch:
>
>   [__NR3264_ftruncate] = "ftruncate",
>
> With this patch:
>
>   [46] = "ftruncate",
>
> Signed-off-by: Tiezhu Yang <yangtiezhu@loongson.cn>
> ---
>  tools/perf/arch/arm64/entry/syscalls/mksyscalltbl | 7 ++++---
>  1 file changed, 4 insertions(+), 3 deletions(-)
>
> diff --git a/tools/perf/arch/arm64/entry/syscalls/mksyscalltbl b/tools/perf/arch/arm64/entry/syscalls/mksyscalltbl
> index 22cdf91..59ab7939 100755
> --- a/tools/perf/arch/arm64/entry/syscalls/mksyscalltbl
> +++ b/tools/perf/arch/arm64/entry/syscalls/mksyscalltbl
> @@ -39,7 +39,8 @@ create_table()
>         echo "};"
>  }
>
> -$gcc -E -dM -x c -I $incpath/include/uapi $input \
> -       |sed -ne 's/^#define __NR_//p' \
> -       |sort -t' ' -k2 -n             \
> +$gcc -E -dM -x c -I $incpath/include/uapi $input               \
> +       |awk '{if ($2~"__NR" && $3 !~"__NR3264_") {print}}'     \
> +       |sed -ne 's/^#define __NR_//p;s/^#define __NR3264_//p'  \
> +       |sort -t' ' -k2 -n                                      \
>         |create_table
> --
> 2.1.0
>

As an aside, the awk + sed + sort parts of the command line may be
reduced to the following awk script, if desired:
awk '$2 ~ "__NR" && $3 !~ "__NR3264_" {
        sub("^#define __NR_", "")
        sub("^#define __NR3264_", "")
        print | "sort -k2 -n"
}'

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

* Re: [PATCH 1/2] perf arm64: Handle __NR3264_ prefixed syscall number
  2023-05-23 12:31   ` Alexander Kapshuk
@ 2023-05-24  3:19     ` Tiezhu Yang
  2023-05-24  6:43       ` Alexander Kapshuk
  0 siblings, 1 reply; 9+ messages in thread
From: Tiezhu Yang @ 2023-05-24  3:19 UTC (permalink / raw)
  To: Alexander Kapshuk
  Cc: Peter Zijlstra, Ingo Molnar, Arnaldo Carvalho de Melo,
	Mark Rutland, Alexander Shishkin, Jiri Olsa, Namhyung Kim,
	Ian Rogers, Adrian Hunter, Hans-Peter Nilsson, Leo Yan,
	linux-perf-users, linux-kernel, loongarch, loongson-kernel



On 05/23/2023 08:31 PM, Alexander Kapshuk wrote:
> On Tue, May 23, 2023 at 1:22 PM Tiezhu Yang <yangtiezhu@loongson.cn> wrote:
>>
>> After commit 9854e7ad35fe ("perf arm64: Simplify mksyscalltbl"),
>> in the generated syscall table file syscalls.c, there exist some
>> __NR3264_ prefixed syscall numbers such as [__NR3264_ftruncate],
>> it looks like not so good, just do some small filter operations
>> to handle __NR3264_ prefixed syscall number as a digital number.
>>
>> Without this patch:
>>
>>   [__NR3264_ftruncate] = "ftruncate",
>>
>> With this patch:
>>
>>   [46] = "ftruncate",
>>
>> Signed-off-by: Tiezhu Yang <yangtiezhu@loongson.cn>
>> ---
>>  tools/perf/arch/arm64/entry/syscalls/mksyscalltbl | 7 ++++---
>>  1 file changed, 4 insertions(+), 3 deletions(-)
>>
>> diff --git a/tools/perf/arch/arm64/entry/syscalls/mksyscalltbl b/tools/perf/arch/arm64/entry/syscalls/mksyscalltbl
>> index 22cdf91..59ab7939 100755
>> --- a/tools/perf/arch/arm64/entry/syscalls/mksyscalltbl
>> +++ b/tools/perf/arch/arm64/entry/syscalls/mksyscalltbl
>> @@ -39,7 +39,8 @@ create_table()
>>         echo "};"
>>  }
>>
>> -$gcc -E -dM -x c -I $incpath/include/uapi $input \
>> -       |sed -ne 's/^#define __NR_//p' \
>> -       |sort -t' ' -k2 -n             \
>> +$gcc -E -dM -x c -I $incpath/include/uapi $input               \
>> +       |awk '{if ($2~"__NR" && $3 !~"__NR3264_") {print}}'     \
>> +       |sed -ne 's/^#define __NR_//p;s/^#define __NR3264_//p'  \
>> +       |sort -t' ' -k2 -n                                      \
>>         |create_table
>> --
>> 2.1.0
>>
>
> As an aside, the awk + sed + sort parts of the command line may be
> reduced to the following awk script, if desired:
> awk '$2 ~ "__NR" && $3 !~ "__NR3264_" {
>         sub("^#define __NR_", "")
>         sub("^#define __NR3264_", "")
>         print | "sort -k2 -n"
> }'
>

Hi Alexander,

Thanks, it seems more simple and works well as expected.
Let us wait for more review comments before respin.

If no any objections, I will send v2 with the following
changes based on the current patch in the next week.

-$gcc -E -dM -x c -I $incpath/include/uapi $input               \
-       |awk '{if ($2~"__NR" && $3 !~"__NR3264_") {print}}'     \
-       |sed -ne 's/^#define __NR_//p;s/^#define __NR3264_//p'  \
-       |sort -t' ' -k2 -n                                      \
+$gcc -E -dM -x c -I $incpath/include/uapi $input \
+       |awk '$2 ~ "__NR" && $3 !~ "__NR3264_" {
+               sub("^#define __NR_", "")
+               sub("^#define __NR3264_", "")
+               print | "sort -k2 -n"}' \
         |create_table

Thanks,
Tiezhu


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

* Re: [PATCH 1/2] perf arm64: Handle __NR3264_ prefixed syscall number
  2023-05-24  3:19     ` Tiezhu Yang
@ 2023-05-24  6:43       ` Alexander Kapshuk
  2023-05-24  7:18         ` Tiezhu Yang
  0 siblings, 1 reply; 9+ messages in thread
From: Alexander Kapshuk @ 2023-05-24  6:43 UTC (permalink / raw)
  To: Tiezhu Yang
  Cc: Peter Zijlstra, Ingo Molnar, Arnaldo Carvalho de Melo,
	Mark Rutland, Alexander Shishkin, Jiri Olsa, Namhyung Kim,
	Ian Rogers, Adrian Hunter, Hans-Peter Nilsson, Leo Yan,
	linux-perf-users, linux-kernel, loongarch, loongson-kernel

On Wed, May 24, 2023 at 6:19 AM Tiezhu Yang <yangtiezhu@loongson.cn> wrote:
>
>
>
> On 05/23/2023 08:31 PM, Alexander Kapshuk wrote:
> > On Tue, May 23, 2023 at 1:22 PM Tiezhu Yang <yangtiezhu@loongson.cn> wrote:
> >>
> >> After commit 9854e7ad35fe ("perf arm64: Simplify mksyscalltbl"),
> >> in the generated syscall table file syscalls.c, there exist some
> >> __NR3264_ prefixed syscall numbers such as [__NR3264_ftruncate],
> >> it looks like not so good, just do some small filter operations
> >> to handle __NR3264_ prefixed syscall number as a digital number.
> >>
> >> Without this patch:
> >>
> >>   [__NR3264_ftruncate] = "ftruncate",
> >>
> >> With this patch:
> >>
> >>   [46] = "ftruncate",
> >>
> >> Signed-off-by: Tiezhu Yang <yangtiezhu@loongson.cn>
> >> ---
> >>  tools/perf/arch/arm64/entry/syscalls/mksyscalltbl | 7 ++++---
> >>  1 file changed, 4 insertions(+), 3 deletions(-)
> >>
> >> diff --git a/tools/perf/arch/arm64/entry/syscalls/mksyscalltbl b/tools/perf/arch/arm64/entry/syscalls/mksyscalltbl
> >> index 22cdf91..59ab7939 100755
> >> --- a/tools/perf/arch/arm64/entry/syscalls/mksyscalltbl
> >> +++ b/tools/perf/arch/arm64/entry/syscalls/mksyscalltbl
> >> @@ -39,7 +39,8 @@ create_table()
> >>         echo "};"
> >>  }
> >>
> >> -$gcc -E -dM -x c -I $incpath/include/uapi $input \
> >> -       |sed -ne 's/^#define __NR_//p' \
> >> -       |sort -t' ' -k2 -n             \
> >> +$gcc -E -dM -x c -I $incpath/include/uapi $input               \
> >> +       |awk '{if ($2~"__NR" && $3 !~"__NR3264_") {print}}'     \
> >> +       |sed -ne 's/^#define __NR_//p;s/^#define __NR3264_//p'  \
> >> +       |sort -t' ' -k2 -n                                      \
> >>         |create_table
> >> --
> >> 2.1.0
> >>
> >
> > As an aside, the awk + sed + sort parts of the command line may be
> > reduced to the following awk script, if desired:
> > awk '$2 ~ "__NR" && $3 !~ "__NR3264_" {
> >         sub("^#define __NR_", "")
> >         sub("^#define __NR3264_", "")
> >         print | "sort -k2 -n"
> > }'
> >
>
> Hi Alexander,
>
> Thanks, it seems more simple and works well as expected.
> Let us wait for more review comments before respin.
>
> If no any objections, I will send v2 with the following
> changes based on the current patch in the next week.
>
> -$gcc -E -dM -x c -I $incpath/include/uapi $input               \
> -       |awk '{if ($2~"__NR" && $3 !~"__NR3264_") {print}}'     \
> -       |sed -ne 's/^#define __NR_//p;s/^#define __NR3264_//p'  \
> -       |sort -t' ' -k2 -n                                      \
> +$gcc -E -dM -x c -I $incpath/include/uapi $input \
> +       |awk '$2 ~ "__NR" && $3 !~ "__NR3264_" {
> +               sub("^#define __NR_", "")
> +               sub("^#define __NR3264_", "")
> +               print | "sort -k2 -n"}' \
>          |create_table
>
> Thanks,
> Tiezhu
>

Hi Tiezhu,

Thanks for your prompt feedback.
It was merely a suggestion entirely subject to your discretion.

If no other patterns are anticipated to be processed by the sub
routines, they may be combined into a single sub routine like so:
awk '$2 ~ "__NR" && $3 !~ "__NR3264_" {
        sub("^#define __NR(3264)?_", "")
        print | "sort -k2 -n"
}'

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

* Re: [PATCH 1/2] perf arm64: Handle __NR3264_ prefixed syscall number
  2023-05-24  6:43       ` Alexander Kapshuk
@ 2023-05-24  7:18         ` Tiezhu Yang
  2023-05-27  1:43           ` Leo Yan
  0 siblings, 1 reply; 9+ messages in thread
From: Tiezhu Yang @ 2023-05-24  7:18 UTC (permalink / raw)
  To: Alexander Kapshuk
  Cc: Peter Zijlstra, Ingo Molnar, Arnaldo Carvalho de Melo,
	Mark Rutland, Alexander Shishkin, Jiri Olsa, Namhyung Kim,
	Ian Rogers, Adrian Hunter, Hans-Peter Nilsson, Leo Yan,
	linux-perf-users, linux-kernel, loongarch, loongson-kernel



On 05/24/2023 02:43 PM, Alexander Kapshuk wrote:
> On Wed, May 24, 2023 at 6:19 AM Tiezhu Yang <yangtiezhu@loongson.cn> wrote:
>>
>>
>>
>> On 05/23/2023 08:31 PM, Alexander Kapshuk wrote:
>>> On Tue, May 23, 2023 at 1:22 PM Tiezhu Yang <yangtiezhu@loongson.cn> wrote:
>>>>
>>>> After commit 9854e7ad35fe ("perf arm64: Simplify mksyscalltbl"),
>>>> in the generated syscall table file syscalls.c, there exist some
>>>> __NR3264_ prefixed syscall numbers such as [__NR3264_ftruncate],
>>>> it looks like not so good, just do some small filter operations
>>>> to handle __NR3264_ prefixed syscall number as a digital number.
>>>>
>>>> Without this patch:
>>>>
>>>>   [__NR3264_ftruncate] = "ftruncate",
>>>>
>>>> With this patch:
>>>>
>>>>   [46] = "ftruncate",
>>>>
>>>> Signed-off-by: Tiezhu Yang <yangtiezhu@loongson.cn>
>>>> ---
>>>>  tools/perf/arch/arm64/entry/syscalls/mksyscalltbl | 7 ++++---
>>>>  1 file changed, 4 insertions(+), 3 deletions(-)
>>>>
>>>> diff --git a/tools/perf/arch/arm64/entry/syscalls/mksyscalltbl b/tools/perf/arch/arm64/entry/syscalls/mksyscalltbl
>>>> index 22cdf91..59ab7939 100755
>>>> --- a/tools/perf/arch/arm64/entry/syscalls/mksyscalltbl
>>>> +++ b/tools/perf/arch/arm64/entry/syscalls/mksyscalltbl
>>>> @@ -39,7 +39,8 @@ create_table()
>>>>         echo "};"
>>>>  }
>>>>
>>>> -$gcc -E -dM -x c -I $incpath/include/uapi $input \
>>>> -       |sed -ne 's/^#define __NR_//p' \
>>>> -       |sort -t' ' -k2 -n             \
>>>> +$gcc -E -dM -x c -I $incpath/include/uapi $input               \
>>>> +       |awk '{if ($2~"__NR" && $3 !~"__NR3264_") {print}}'     \
>>>> +       |sed -ne 's/^#define __NR_//p;s/^#define __NR3264_//p'  \
>>>> +       |sort -t' ' -k2 -n                                      \
>>>>         |create_table
>>>> --
>>>> 2.1.0
>>>>
>>>
>>> As an aside, the awk + sed + sort parts of the command line may be
>>> reduced to the following awk script, if desired:
>>> awk '$2 ~ "__NR" && $3 !~ "__NR3264_" {
>>>         sub("^#define __NR_", "")
>>>         sub("^#define __NR3264_", "")
>>>         print | "sort -k2 -n"
>>> }'
>>>
>>
>> Hi Alexander,
>>
>> Thanks, it seems more simple and works well as expected.
>> Let us wait for more review comments before respin.
>>
>> If no any objections, I will send v2 with the following
>> changes based on the current patch in the next week.
>>
>> -$gcc -E -dM -x c -I $incpath/include/uapi $input               \
>> -       |awk '{if ($2~"__NR" && $3 !~"__NR3264_") {print}}'     \
>> -       |sed -ne 's/^#define __NR_//p;s/^#define __NR3264_//p'  \
>> -       |sort -t' ' -k2 -n                                      \
>> +$gcc -E -dM -x c -I $incpath/include/uapi $input \
>> +       |awk '$2 ~ "__NR" && $3 !~ "__NR3264_" {
>> +               sub("^#define __NR_", "")
>> +               sub("^#define __NR3264_", "")
>> +               print | "sort -k2 -n"}' \
>>          |create_table
>>
>> Thanks,
>> Tiezhu
>>
>
> Hi Tiezhu,
>
> Thanks for your prompt feedback.
> It was merely a suggestion entirely subject to your discretion.
>
> If no other patterns are anticipated to be processed by the sub

Yes, there are only 2 patterns such as "__NR_" and "__NR3264_",
I confirmed that in include/uapi/asm-generic/unistd.h.

> routines, they may be combined into a single sub routine like so:
> awk '$2 ~ "__NR" && $3 !~ "__NR3264_" {
>         sub("^#define __NR(3264)?_", "")
>         print | "sort -k2 -n"
> }'

Thanks again, I tested the above code, it also works well and
looks better, I will modify the code as you suggested in v2.

Thanks,
Tiezhu


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

* Re: [PATCH 1/2] perf arm64: Handle __NR3264_ prefixed syscall number
  2023-05-24  7:18         ` Tiezhu Yang
@ 2023-05-27  1:43           ` Leo Yan
  0 siblings, 0 replies; 9+ messages in thread
From: Leo Yan @ 2023-05-27  1:43 UTC (permalink / raw)
  To: Tiezhu Yang
  Cc: Alexander Kapshuk, Peter Zijlstra, Ingo Molnar,
	Arnaldo Carvalho de Melo, Mark Rutland, Alexander Shishkin,
	Jiri Olsa, Namhyung Kim, Ian Rogers, Adrian Hunter,
	Hans-Peter Nilsson, linux-perf-users, linux-kernel, loongarch,
	loongson-kernel

On Wed, May 24, 2023 at 03:18:28PM +0800, Tiezhu Yang wrote:
> On 05/24/2023 02:43 PM, Alexander Kapshuk wrote:

[...]

> Yes, there are only 2 patterns such as "__NR_" and "__NR3264_",
> I confirmed that in include/uapi/asm-generic/unistd.h.
>
> > routines, they may be combined into a single sub routine like so:
> > awk '$2 ~ "__NR" && $3 !~ "__NR3264_" {
> >         sub("^#define __NR(3264)?_", "")
> >         print | "sort -k2 -n"
> > }'

Thanks for improving this, Tiezhu and Alexander.

The format between '[46]' and '[__NR3264_ftruncate]' has changed back
and forth for several times due to various reasons ;)

Above change is a good improvement for me and I tested at my side
with below commands:

  $ aarch64-linux-gnu-gcc -E -dM -x c -I tools/include/uapi/ \
    tools/include/uapi/asm-generic/unistd.h \
    | awk '$2 ~ "__NR" && $3 !~ "__NR3264_" { sub("^#define
__NR(3264)?_", ""); print | "sort -k2 -n"}'

The result looks good to me.  You are welcome to add my review tag:

Reviewed-by: Leo Yan <leo.yan@linaro.org>

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

* Re: [PATCH 2/2] perf LoongArch: Simplify mksyscalltbl
  2023-05-23 10:22 ` [PATCH 2/2] perf LoongArch: Simplify mksyscalltbl Tiezhu Yang
@ 2023-05-27  1:55   ` Leo Yan
  0 siblings, 0 replies; 9+ messages in thread
From: Leo Yan @ 2023-05-27  1:55 UTC (permalink / raw)
  To: Tiezhu Yang
  Cc: Peter Zijlstra, Ingo Molnar, Arnaldo Carvalho de Melo,
	Mark Rutland, Alexander Shishkin, Jiri Olsa, Namhyung Kim,
	Ian Rogers, Adrian Hunter, Hans-Peter Nilsson, linux-perf-users,
	linux-kernel, loongarch, loongson-kernel

On Tue, May 23, 2023 at 06:22:07PM +0800, Tiezhu Yang wrote:
> In order to print the numerical entries of the syscall table,
> there is no need to call the host compiler to build and then
> run a program, this can be done directly by the shell script.
> 
> This is similar with commit 9854e7ad35fe ("perf arm64: Simplify
> mksyscalltbl").
> 
> Signed-off-by: Tiezhu Yang <yangtiezhu@loongson.cn>
> ---
>  .../arch/loongarch/entry/syscalls/mksyscalltbl     | 32 ++++++----------------
>  1 file changed, 8 insertions(+), 24 deletions(-)
> 
> diff --git a/tools/perf/arch/loongarch/entry/syscalls/mksyscalltbl b/tools/perf/arch/loongarch/entry/syscalls/mksyscalltbl
> index c52156f..d7d97d5 100755
> --- a/tools/perf/arch/loongarch/entry/syscalls/mksyscalltbl
> +++ b/tools/perf/arch/loongarch/entry/syscalls/mksyscalltbl
> @@ -22,40 +22,24 @@ create_table_from_c()

Nitpick: since this patch tries to remove the temporary C program and
simply use shell to generate syscall table, to avoid confusion, it's
good to update the function name from create_table_from_c() to
create_sc_table().

I know Arm64's mksyscalltbl has the same issue, we can use a separate
patch to address it.

Otherwise, this patch LGTM:

Reviewed-by: Leo Yan <leo.yan@linaro.org>

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

end of thread, other threads:[~2023-05-27  1:55 UTC | newest]

Thread overview: 9+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-05-23 10:22 [PATCH 0/2] perf tools: Modify mksyscalltbl Tiezhu Yang
2023-05-23 10:22 ` [PATCH 1/2] perf arm64: Handle __NR3264_ prefixed syscall number Tiezhu Yang
2023-05-23 12:31   ` Alexander Kapshuk
2023-05-24  3:19     ` Tiezhu Yang
2023-05-24  6:43       ` Alexander Kapshuk
2023-05-24  7:18         ` Tiezhu Yang
2023-05-27  1:43           ` Leo Yan
2023-05-23 10:22 ` [PATCH 2/2] perf LoongArch: Simplify mksyscalltbl Tiezhu Yang
2023-05-27  1:55   ` Leo Yan

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.