All of lore.kernel.org
 help / color / mirror / Atom feed
From: Arnaldo Carvalho de Melo <acme@kernel.org>
To: Yanteng Si <siyanteng@loongson.cn>
Cc: mingo@redhat.com, peterz@infradead.org, mark.rutland@arm.com,
	alexander.shishkin@linux.intel.com, jolsa@kernel.org,
	namhyung@kernel.org, irogers@google.com, adrian.hunter@intel.com,
	chenhuacai@kernel.org, linux-perf-users@vger.kernel.org,
	loongson-kernel@lists.loongnix.cn, loongarch@lists.linux.dev
Subject: Re: [PATCH v1 1/2] perf/trace: Fix mmap_flags for archs use generic mman.h
Date: Tue, 22 Aug 2023 15:02:54 -0300	[thread overview]
Message-ID: <ZOT4Tuc6JGrbDqFW@kernel.org> (raw)
In-Reply-To: <03ddc1c0e01518df63aac88e561cd0ec3c1e0028.1692694595.git.siyanteng@loongson.cn>

Em Tue, Aug 22, 2023 at 05:32:06PM +0800, Yanteng Si escreveu:
> 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>
> ---
>  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")

Humm, wouldn't this be simpler without that extra subshell? Like this:

diff --git a/tools/perf/trace/beauty/mmap_flags.sh b/tools/perf/trace/beauty/mmap_flags.sh
index 3022597c8c178f21..0ac1886a83b5aceb 100755
--- a/tools/perf/trace/beauty/mmap_flags.sh
+++ b/tools/perf/trace/beauty/mmap_flags.sh
@@ -19,6 +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:]]*.*'
+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"	| \

  reply	other threads:[~2023-08-22 18:03 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-08-22  9:32 [PATCH v1 0/2] tools/perf: Add loongarch cpuinfo and fix build warning Yanteng Si
2023-08-22  9:32 ` [PATCH v1 1/2] perf/trace: Fix mmap_flags for archs use generic mman.h Yanteng Si
2023-08-22 18:02   ` Arnaldo Carvalho de Melo [this message]
2023-08-23  7:11     ` Yanteng Si
2023-08-23 11:36       ` Arnaldo Carvalho de Melo
2023-08-24  2:22         ` Yanteng Si
2023-08-24 13:33           ` Arnaldo Carvalho de Melo
2023-08-22  9:32 ` [PATCH v1 2/2] perf/tools: Allow to use cpuinfo on loongarch Yanteng Si
2023-08-22 17:50   ` Arnaldo Carvalho de Melo
2023-08-23  7:11     ` Yanteng Si
2023-08-22 15:10 ` [PATCH v1 0/2] tools/perf: Add loongarch cpuinfo and fix build warning Huacai Chen

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=ZOT4Tuc6JGrbDqFW@kernel.org \
    --to=acme@kernel.org \
    --cc=adrian.hunter@intel.com \
    --cc=alexander.shishkin@linux.intel.com \
    --cc=chenhuacai@kernel.org \
    --cc=irogers@google.com \
    --cc=jolsa@kernel.org \
    --cc=linux-perf-users@vger.kernel.org \
    --cc=loongarch@lists.linux.dev \
    --cc=loongson-kernel@lists.loongnix.cn \
    --cc=mark.rutland@arm.com \
    --cc=mingo@redhat.com \
    --cc=namhyung@kernel.org \
    --cc=peterz@infradead.org \
    --cc=siyanteng@loongson.cn \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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.