linux-perf-users.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH v3 0/3] tools/perf: Add loongarch cpuinfo and fix build warning
@ 2023-08-26  9:39 Yanteng Si
  2023-08-26  9:40 ` [PATCH v3 1/3] perf/tools: Allow to use cpuinfo on LoongArch Yanteng Si
                   ` (2 more replies)
  0 siblings, 3 replies; 6+ messages in thread
From: Yanteng Si @ 2023-08-26  9:39 UTC (permalink / raw)
  To: acme
  Cc: Yanteng Si, mingo, peterz, mark.rutland, alexander.shishkin,
	jolsa, namhyung, irogers, adrian.hunter, chenhuacai,
	linux-perf-users, loongson-kernel, loongarch

v3:
* Using strcasest() correctly.
* Picking Huacai's Acked tag, I seem to have lost it in the last version.

v2:
* Switch to strcasestr().
* Use "test -f" instead of "[-f FILE]".

v1:
* LoongArch and riscv don't have tools/arch/xxxxx/include/uapi/asm/mman.h,
  let's modify the detection rules.
* Allow to use cpuinfo on loongarch.

Yanteng Si (3):
  perf/tools: Allow to use cpuinfo on LoongArch
  perf/trace: Fix mmap_flags for archs use generic mman.h
  perf/trace: Use "test -f" instead of "[-f FILE]"

 tools/perf/trace/beauty/mmap_flags.sh | 7 +++++--
 tools/perf/trace/beauty/mmap_prot.sh  | 5 +++--
 tools/perf/util/header.c              | 2 ++
 tools/perf/util/svghelper.c           | 2 +-
 4 files changed, 11 insertions(+), 5 deletions(-)

-- 
2.31.4


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

* [PATCH v3 1/3] perf/tools: Allow to use cpuinfo on LoongArch
  2023-08-26  9:39 [PATCH v3 0/3] tools/perf: Add loongarch cpuinfo and fix build warning Yanteng Si
@ 2023-08-26  9:40 ` Yanteng Si
  2023-08-26  9:40 ` [PATCH v3 2/3] perf/trace: Fix mmap_flags for archs use generic mman.h Yanteng Si
  2023-08-26  9:40 ` [PATCH v3 3/3] perf/trace: Use "test -f" instead of "[-f FILE]" Yanteng Si
  2 siblings, 0 replies; 6+ messages in thread
From: Yanteng Si @ 2023-08-26  9:40 UTC (permalink / raw)
  To: acme
  Cc: Yanteng Si, mingo, peterz, mark.rutland, alexander.shishkin,
	jolsa, namhyung, irogers, adrian.hunter, chenhuacai,
	linux-perf-users, loongson-kernel, loongarch, Huacai Chen

Define these macros so that the CPU name can be displayed
when running perf report and perf timechart.

Signed-off-by: Yanteng Si <siyanteng@loongson.cn>
Acked-by: Huacai Chen <chenhuacai@loongson.cn>
---
 tools/perf/util/header.c    | 2 ++
 tools/perf/util/svghelper.c | 2 +-
 2 files changed, 3 insertions(+), 1 deletion(-)

diff --git a/tools/perf/util/header.c b/tools/perf/util/header.c
index 52fbf526fe74..c6e19192bd28 100644
--- a/tools/perf/util/header.c
+++ b/tools/perf/util/header.c
@@ -456,6 +456,8 @@ static int write_cpudesc(struct feat_fd *ff,
 #define CPUINFO_PROC	{ "Processor", }
 #elif defined(__xtensa__)
 #define CPUINFO_PROC	{ "core ID", }
+#elif defined(__loongarch__)
+#define CPUINFO_PROC	{ "Model Name", }
 #else
 #define CPUINFO_PROC	{ "model name", }
 #endif
diff --git a/tools/perf/util/svghelper.c b/tools/perf/util/svghelper.c
index 5c62d3118c41..2e141126b0d6 100644
--- a/tools/perf/util/svghelper.c
+++ b/tools/perf/util/svghelper.c
@@ -331,7 +331,7 @@ static char *cpu_model(void)
 	file = fopen("/proc/cpuinfo", "r");
 	if (file) {
 		while (fgets(buf, 255, file)) {
-			if (strstr(buf, "model name")) {
+			if (strcasestr(buf, "model Name")) {
 				strlcpy(cpu_m, &buf[13], 255);
 				break;
 			}
-- 
2.31.4


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

* [PATCH v3 2/3] perf/trace: Fix mmap_flags for archs use generic mman.h
  2023-08-26  9:39 [PATCH v3 0/3] tools/perf: Add loongarch cpuinfo and fix build warning Yanteng Si
  2023-08-26  9:40 ` [PATCH v3 1/3] perf/tools: Allow to use cpuinfo on LoongArch Yanteng Si
@ 2023-08-26  9:40 ` Yanteng Si
  2023-08-26  9:40 ` [PATCH v3 3/3] perf/trace: Use "test -f" instead of "[-f FILE]" Yanteng Si
  2 siblings, 0 replies; 6+ messages in thread
From: Yanteng Si @ 2023-08-26  9:40 UTC (permalink / raw)
  To: acme
  Cc: Yanteng Si, mingo, peterz, mark.rutland, alexander.shishkin,
	jolsa, namhyung, irogers, adrian.hunter, chenhuacai,
	linux-perf-users, loongson-kernel, loongarch, Huacai Chen

Silence this warning:

grep: /root/linux-next/tools/arch/xxxxx/include/uapi/asm//mman.h:
No such file or directory

Signed-off-by: Yanteng Si <siyanteng@loongson.cn>
Acked-by: Huacai Chen <chenhuacai@loongson.cn>
---
 tools/perf/trace/beauty/mmap_flags.sh | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/tools/perf/trace/beauty/mmap_flags.sh b/tools/perf/trace/beauty/mmap_flags.sh
index 3022597c8c17..d035b29fc5ec 100755
--- a/tools/perf/trace/beauty/mmap_flags.sh
+++ b/tools/perf/trace/beauty/mmap_flags.sh
@@ -19,7 +19,7 @@ arch_mman=${arch_header_dir}/mman.h
 
 printf "static const char *mmap_flags[] = {\n"
 regex='^[[:space:]]*#[[:space:]]*define[[:space:]]+MAP_([[:alnum:]_]+)[[:space:]]+(0x[[:xdigit:]]+)[[:space:]]*.*'
-grep -E -q $regex ${arch_mman} && \
+([ -f ${arch_mman} ] && grep -E -q $regex ${arch_mman}) && \
 (grep -E $regex ${arch_mman} | \
 	sed -r "s/$regex/\2 \1 \1 \1 \2/g"	| \
 	xargs printf "\t[ilog2(%s) + 1] = \"%s\",\n#ifndef MAP_%s\n#define MAP_%s %s\n#endif\n")
-- 
2.31.4


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

* [PATCH v3 3/3] perf/trace: Use "test -f" instead of "[-f FILE]"
  2023-08-26  9:39 [PATCH v3 0/3] tools/perf: Add loongarch cpuinfo and fix build warning Yanteng Si
  2023-08-26  9:40 ` [PATCH v3 1/3] perf/tools: Allow to use cpuinfo on LoongArch Yanteng Si
  2023-08-26  9:40 ` [PATCH v3 2/3] perf/trace: Fix mmap_flags for archs use generic mman.h Yanteng Si
@ 2023-08-26  9:40 ` Yanteng Si
  2023-08-26  9:49   ` Xi Ruoyao
  2 siblings, 1 reply; 6+ messages in thread
From: Yanteng Si @ 2023-08-26  9:40 UTC (permalink / raw)
  To: acme
  Cc: Yanteng Si, mingo, peterz, mark.rutland, alexander.shishkin,
	jolsa, namhyung, irogers, adrian.hunter, chenhuacai,
	linux-perf-users, loongson-kernel, loongarch

It will be simpler without that extra subshell, so
let's use "test -f".

Signed-off-by: Yanteng Si <siyanteng@loongson.cn>
---
 tools/perf/trace/beauty/mmap_flags.sh | 9 ++++++---
 tools/perf/trace/beauty/mmap_prot.sh  | 5 +++--
 2 files changed, 9 insertions(+), 5 deletions(-)

diff --git a/tools/perf/trace/beauty/mmap_flags.sh b/tools/perf/trace/beauty/mmap_flags.sh
index d035b29fc5ec..6ecdb3c5a99e 100755
--- a/tools/perf/trace/beauty/mmap_flags.sh
+++ b/tools/perf/trace/beauty/mmap_flags.sh
@@ -19,7 +19,8 @@ arch_mman=${arch_header_dir}/mman.h
 
 printf "static const char *mmap_flags[] = {\n"
 regex='^[[:space:]]*#[[:space:]]*define[[:space:]]+MAP_([[:alnum:]_]+)[[:space:]]+(0x[[:xdigit:]]+)[[:space:]]*.*'
-([ -f ${arch_mman} ] && grep -E -q $regex ${arch_mman}) && \
+test -f ${arch_mman} && \
+grep -E -q $regex ${arch_mman} && \
 (grep -E $regex ${arch_mman} | \
 	sed -r "s/$regex/\2 \1 \1 \1 \2/g"	| \
 	xargs printf "\t[ilog2(%s) + 1] = \"%s\",\n#ifndef MAP_%s\n#define MAP_%s %s\n#endif\n")
@@ -28,12 +29,14 @@ grep -E -q $regex ${linux_mman} && \
 	grep -E -vw 'MAP_(UNINITIALIZED|TYPE|SHARED_VALIDATE)' | \
 	sed -r "s/$regex/\2 \1 \1 \1 \2/g" | \
 	xargs printf "\t[ilog2(%s) + 1] = \"%s\",\n#ifndef MAP_%s\n#define MAP_%s %s\n#endif\n")
-([ ! -f ${arch_mman} ] || grep -E -q '#[[:space:]]*include[[:space:]]+.*uapi/asm-generic/mman.*' ${arch_mman}) &&
+( ! test -f ${arch_mman} || \
+grep -E -q '#[[:space:]]*include[[:space:]]+.*uapi/asm-generic/mman.*' ${arch_mman}) &&
 (grep -E $regex ${header_dir}/mman-common.h | \
 	grep -E -vw 'MAP_(UNINITIALIZED|TYPE|SHARED_VALIDATE)' | \
 	sed -r "s/$regex/\2 \1 \1 \1 \2/g"	| \
 	xargs printf "\t[ilog2(%s) + 1] = \"%s\",\n#ifndef MAP_%s\n#define MAP_%s %s\n#endif\n")
-([ ! -f ${arch_mman} ] || grep -E -q '#[[:space:]]*include[[:space:]]+.*uapi/asm-generic/mman.h>.*' ${arch_mman}) &&
+( ! test -f ${arch_mman} || \
+grep -E -q '#[[:space:]]*include[[:space:]]+.*uapi/asm-generic/mman.h>.*' ${arch_mman}) &&
 (grep -E $regex ${header_dir}/mman.h | \
 	sed -r "s/$regex/\2 \1 \1 \1 \2/g"	| \
 	xargs printf "\t[ilog2(%s) + 1] = \"%s\",\n#ifndef MAP_%s\n#define MAP_%s %s\n#endif\n")
diff --git a/tools/perf/trace/beauty/mmap_prot.sh b/tools/perf/trace/beauty/mmap_prot.sh
index 49e8c865214b..4436fcd6e861 100755
--- a/tools/perf/trace/beauty/mmap_prot.sh
+++ b/tools/perf/trace/beauty/mmap_prot.sh
@@ -17,12 +17,13 @@ prefix="PROT"
 
 printf "static const char *mmap_prot[] = {\n"
 regex=`printf '^[[:space:]]*#[[:space:]]*define[[:space:]]+%s_([[:alnum:]_]+)[[:space:]]+(0x[[:xdigit:]]+)[[:space:]]*.*' ${prefix}`
-([ ! -f ${arch_mman} ] || grep -E -q '#[[:space:]]*include[[:space:]]+.*uapi/asm-generic/mman.*' ${arch_mman}) &&
+( ! test -f ${arch_mman} \
+|| grep -E -q '#[[:space:]]*include[[:space:]]+.*uapi/asm-generic/mman.*' ${arch_mman}) &&
 (grep -E $regex ${common_mman} | \
 	grep -E -vw PROT_NONE | \
 	sed -r "s/$regex/\2 \1 \1 \1 \2/g"	| \
 	xargs printf "\t[ilog2(%s) + 1] = \"%s\",\n#ifndef ${prefix}_%s\n#define ${prefix}_%s %s\n#endif\n")
-[ -f ${arch_mman} ] && grep -E -q $regex ${arch_mman} &&
+test -f ${arch_mman} && grep -E -q $regex ${arch_mman} &&
 (grep -E $regex ${arch_mman} | \
 	grep -E -vw PROT_NONE | \
 	sed -r "s/$regex/\2 \1 \1 \1 \2/g"	| \
-- 
2.31.4


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

* Re: [PATCH v3 3/3] perf/trace: Use "test -f" instead of "[-f FILE]"
  2023-08-26  9:40 ` [PATCH v3 3/3] perf/trace: Use "test -f" instead of "[-f FILE]" Yanteng Si
@ 2023-08-26  9:49   ` Xi Ruoyao
  2023-08-28  2:42     ` Yanteng Si
  0 siblings, 1 reply; 6+ messages in thread
From: Xi Ruoyao @ 2023-08-26  9:49 UTC (permalink / raw)
  To: Yanteng Si, acme
  Cc: mingo, peterz, mark.rutland, alexander.shishkin, jolsa, namhyung,
	irogers, adrian.hunter, chenhuacai, linux-perf-users,
	loongson-kernel, loongarch

On Sat, 2023-08-26 at 17:40 +0800, Yanteng Si wrote:
> It will be simpler without that extra subshell, so
> let's use "test -f".

Sorry for duplicated reply (I replied to v2 minutes ago), but I cannot
understand this sentence.  [ ... ] has nothing to do with subshell, it's
just a syntax variant of "test".

> Signed-off-by: Yanteng Si <siyanteng@loongson.cn>
> ---
>  tools/perf/trace/beauty/mmap_flags.sh | 9 ++++++---
>  tools/perf/trace/beauty/mmap_prot.sh  | 5 +++--
>  2 files changed, 9 insertions(+), 5 deletions(-)
> 
> diff --git a/tools/perf/trace/beauty/mmap_flags.sh
> b/tools/perf/trace/beauty/mmap_flags.sh
> index d035b29fc5ec..6ecdb3c5a99e 100755
> --- a/tools/perf/trace/beauty/mmap_flags.sh
> +++ b/tools/perf/trace/beauty/mmap_flags.sh
> @@ -19,7 +19,8 @@ arch_mman=${arch_header_dir}/mman.h
>  
>  printf "static const char *mmap_flags[] = {\n"
>  regex='^[[:space:]]*#[[:space:]]*define[[:space:]]+MAP_([[:alnum:]_]+
> )[[:space:]]+(0x[[:xdigit:]]+)[[:space:]]*.*'
> -([ -f ${arch_mman} ] && grep -E -q $regex ${arch_mman}) && \
> +test -f ${arch_mman} && \
> +grep -E -q $regex ${arch_mman} && \
>  (grep -E $regex ${arch_mman} | \
>         sed -r "s/$regex/\2 \1 \1 \1 \2/g"      | \
>         xargs printf "\t[ilog2(%s) + 1] = \"%s\",\n#ifndef
> MAP_%s\n#define MAP_%s %s\n#endif\n")
> @@ -28,12 +29,14 @@ grep -E -q $regex ${linux_mman} && \
>         grep -E -vw 'MAP_(UNINITIALIZED|TYPE|SHARED_VALIDATE)' | \
>         sed -r "s/$regex/\2 \1 \1 \1 \2/g" | \
>         xargs printf "\t[ilog2(%s) + 1] = \"%s\",\n#ifndef
> MAP_%s\n#define MAP_%s %s\n#endif\n")
> -([ ! -f ${arch_mman} ] || grep -E -q
> '#[[:space:]]*include[[:space:]]+.*uapi/asm-generic/mman.*'
> ${arch_mman}) &&
> +( ! test -f ${arch_mman} || \
> +grep -E -q '#[[:space:]]*include[[:space:]]+.*uapi/asm-
> generic/mman.*' ${arch_mman}) &&
>  (grep -E $regex ${header_dir}/mman-common.h | \
>         grep -E -vw 'MAP_(UNINITIALIZED|TYPE|SHARED_VALIDATE)' | \
>         sed -r "s/$regex/\2 \1 \1 \1 \2/g"      | \
>         xargs printf "\t[ilog2(%s) + 1] = \"%s\",\n#ifndef
> MAP_%s\n#define MAP_%s %s\n#endif\n")
> -([ ! -f ${arch_mman} ] || grep -E -q
> '#[[:space:]]*include[[:space:]]+.*uapi/asm-generic/mman.h>.*'
> ${arch_mman}) &&
> +( ! test -f ${arch_mman} || \
> +grep -E -q '#[[:space:]]*include[[:space:]]+.*uapi/asm-
> generic/mman.h>.*' ${arch_mman}) &&
>  (grep -E $regex ${header_dir}/mman.h | \
>         sed -r "s/$regex/\2 \1 \1 \1 \2/g"      | \
>         xargs printf "\t[ilog2(%s) + 1] = \"%s\",\n#ifndef
> MAP_%s\n#define MAP_%s %s\n#endif\n")
> diff --git a/tools/perf/trace/beauty/mmap_prot.sh
> b/tools/perf/trace/beauty/mmap_prot.sh
> index 49e8c865214b..4436fcd6e861 100755
> --- a/tools/perf/trace/beauty/mmap_prot.sh
> +++ b/tools/perf/trace/beauty/mmap_prot.sh
> @@ -17,12 +17,13 @@ prefix="PROT"
>  
>  printf "static const char *mmap_prot[] = {\n"
>  regex=`printf
> '^[[:space:]]*#[[:space:]]*define[[:space:]]+%s_([[:alnum:]_]+)[[:spac
> e:]]+(0x[[:xdigit:]]+)[[:space:]]*.*' ${prefix}`
> -([ ! -f ${arch_mman} ] || grep -E -q
> '#[[:space:]]*include[[:space:]]+.*uapi/asm-generic/mman.*'
> ${arch_mman}) &&
> +( ! test -f ${arch_mman} \
> +|| grep -E -q '#[[:space:]]*include[[:space:]]+.*uapi/asm-
> generic/mman.*' ${arch_mman}) &&
>  (grep -E $regex ${common_mman} | \
>         grep -E -vw PROT_NONE | \
>         sed -r "s/$regex/\2 \1 \1 \1 \2/g"      | \
>         xargs printf "\t[ilog2(%s) + 1] = \"%s\",\n#ifndef
> ${prefix}_%s\n#define ${prefix}_%s %s\n#endif\n")
> -[ -f ${arch_mman} ] && grep -E -q $regex ${arch_mman} &&
> +test -f ${arch_mman} && grep -E -q $regex ${arch_mman} &&
>  (grep -E $regex ${arch_mman} | \
>         grep -E -vw PROT_NONE | \
>         sed -r "s/$regex/\2 \1 \1 \1 \2/g"      | \

-- 
Xi Ruoyao <xry111@xry111.site>
School of Aerospace Science and Technology, Xidian University

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

* Re: [PATCH v3 3/3] perf/trace: Use "test -f" instead of "[-f FILE]"
  2023-08-26  9:49   ` Xi Ruoyao
@ 2023-08-28  2:42     ` Yanteng Si
  0 siblings, 0 replies; 6+ messages in thread
From: Yanteng Si @ 2023-08-28  2:42 UTC (permalink / raw)
  To: Xi Ruoyao, acme
  Cc: mingo, peterz, mark.rutland, alexander.shishkin, jolsa, namhyung,
	irogers, adrian.hunter, chenhuacai, linux-perf-users,
	loongson-kernel, loongarch


在 2023/8/26 17:49, Xi Ruoyao 写道:
> On Sat, 2023-08-26 at 17:40 +0800, Yanteng Si wrote:
>> It will be simpler without that extra subshell, so
>> let's use "test -f".
> Sorry for duplicated reply (I replied to v2 minutes ago), but I cannot
> understand this sentence.  [ ... ] has nothing to do with subshell, it's
> just a syntax variant of "test".
>
Sorry, I mean is that "[" is part of the shell builtin test (and a 
synonym for it),

  not a link to the external command /usr/bin/test.

Using the "test" is simpler because it avoids a lot of "[]".


I'm going to write that in v4, agree?


Thanks,

Yanteng

>> Signed-off-by: Yanteng Si <siyanteng@loongson.cn>
>> ---
>>   tools/perf/trace/beauty/mmap_flags.sh | 9 ++++++---
>>   tools/perf/trace/beauty/mmap_prot.sh  | 5 +++--
>>   2 files changed, 9 insertions(+), 5 deletions(-)
>>
>> diff --git a/tools/perf/trace/beauty/mmap_flags.sh
>> b/tools/perf/trace/beauty/mmap_flags.sh
>> index d035b29fc5ec..6ecdb3c5a99e 100755
>> --- a/tools/perf/trace/beauty/mmap_flags.sh
>> +++ b/tools/perf/trace/beauty/mmap_flags.sh
>> @@ -19,7 +19,8 @@ arch_mman=${arch_header_dir}/mman.h
>>   
>>   printf "static const char *mmap_flags[] = {\n"
>>   regex='^[[:space:]]*#[[:space:]]*define[[:space:]]+MAP_([[:alnum:]_]+
>> )[[:space:]]+(0x[[:xdigit:]]+)[[:space:]]*.*'
>> -([ -f ${arch_mman} ] && grep -E -q $regex ${arch_mman}) && \
>> +test -f ${arch_mman} && \
>> +grep -E -q $regex ${arch_mman} && \
>>   (grep -E $regex ${arch_mman} | \
>>          sed -r "s/$regex/\2 \1 \1 \1 \2/g"      | \
>>          xargs printf "\t[ilog2(%s) + 1] = \"%s\",\n#ifndef
>> MAP_%s\n#define MAP_%s %s\n#endif\n")
>> @@ -28,12 +29,14 @@ grep -E -q $regex ${linux_mman} && \
>>          grep -E -vw 'MAP_(UNINITIALIZED|TYPE|SHARED_VALIDATE)' | \
>>          sed -r "s/$regex/\2 \1 \1 \1 \2/g" | \
>>          xargs printf "\t[ilog2(%s) + 1] = \"%s\",\n#ifndef
>> MAP_%s\n#define MAP_%s %s\n#endif\n")
>> -([ ! -f ${arch_mman} ] || grep -E -q
>> '#[[:space:]]*include[[:space:]]+.*uapi/asm-generic/mman.*'
>> ${arch_mman}) &&
>> +( ! test -f ${arch_mman} || \
>> +grep -E -q '#[[:space:]]*include[[:space:]]+.*uapi/asm-
>> generic/mman.*' ${arch_mman}) &&
>>   (grep -E $regex ${header_dir}/mman-common.h | \
>>          grep -E -vw 'MAP_(UNINITIALIZED|TYPE|SHARED_VALIDATE)' | \
>>          sed -r "s/$regex/\2 \1 \1 \1 \2/g"      | \
>>          xargs printf "\t[ilog2(%s) + 1] = \"%s\",\n#ifndef
>> MAP_%s\n#define MAP_%s %s\n#endif\n")
>> -([ ! -f ${arch_mman} ] || grep -E -q
>> '#[[:space:]]*include[[:space:]]+.*uapi/asm-generic/mman.h>.*'
>> ${arch_mman}) &&
>> +( ! test -f ${arch_mman} || \
>> +grep -E -q '#[[:space:]]*include[[:space:]]+.*uapi/asm-
>> generic/mman.h>.*' ${arch_mman}) &&
>>   (grep -E $regex ${header_dir}/mman.h | \
>>          sed -r "s/$regex/\2 \1 \1 \1 \2/g"      | \
>>          xargs printf "\t[ilog2(%s) + 1] = \"%s\",\n#ifndef
>> MAP_%s\n#define MAP_%s %s\n#endif\n")
>> diff --git a/tools/perf/trace/beauty/mmap_prot.sh
>> b/tools/perf/trace/beauty/mmap_prot.sh
>> index 49e8c865214b..4436fcd6e861 100755
>> --- a/tools/perf/trace/beauty/mmap_prot.sh
>> +++ b/tools/perf/trace/beauty/mmap_prot.sh
>> @@ -17,12 +17,13 @@ prefix="PROT"
>>   
>>   printf "static const char *mmap_prot[] = {\n"
>>   regex=`printf
>> '^[[:space:]]*#[[:space:]]*define[[:space:]]+%s_([[:alnum:]_]+)[[:spac
>> e:]]+(0x[[:xdigit:]]+)[[:space:]]*.*' ${prefix}`
>> -([ ! -f ${arch_mman} ] || grep -E -q
>> '#[[:space:]]*include[[:space:]]+.*uapi/asm-generic/mman.*'
>> ${arch_mman}) &&
>> +( ! test -f ${arch_mman} \
>> +|| grep -E -q '#[[:space:]]*include[[:space:]]+.*uapi/asm-
>> generic/mman.*' ${arch_mman}) &&
>>   (grep -E $regex ${common_mman} | \
>>          grep -E -vw PROT_NONE | \
>>          sed -r "s/$regex/\2 \1 \1 \1 \2/g"      | \
>>          xargs printf "\t[ilog2(%s) + 1] = \"%s\",\n#ifndef
>> ${prefix}_%s\n#define ${prefix}_%s %s\n#endif\n")
>> -[ -f ${arch_mman} ] && grep -E -q $regex ${arch_mman} &&
>> +test -f ${arch_mman} && grep -E -q $regex ${arch_mman} &&
>>   (grep -E $regex ${arch_mman} | \
>>          grep -E -vw PROT_NONE | \
>>          sed -r "s/$regex/\2 \1 \1 \1 \2/g"      | \


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

end of thread, other threads:[~2023-08-28  2:43 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2023-08-26  9:39 [PATCH v3 0/3] tools/perf: Add loongarch cpuinfo and fix build warning Yanteng Si
2023-08-26  9:40 ` [PATCH v3 1/3] perf/tools: Allow to use cpuinfo on LoongArch Yanteng Si
2023-08-26  9:40 ` [PATCH v3 2/3] perf/trace: Fix mmap_flags for archs use generic mman.h Yanteng Si
2023-08-26  9:40 ` [PATCH v3 3/3] perf/trace: Use "test -f" instead of "[-f FILE]" Yanteng Si
2023-08-26  9:49   ` Xi Ruoyao
2023-08-28  2:42     ` Yanteng Si

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).