From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 1FBDDC6FA8F for ; Thu, 24 Aug 2023 13:34:40 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229893AbjHXNeJ (ORCPT ); Thu, 24 Aug 2023 09:34:09 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:44598 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S237216AbjHXNdj (ORCPT ); Thu, 24 Aug 2023 09:33:39 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [IPv6:2604:1380:4641:c500::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id CC77519B3 for ; Thu, 24 Aug 2023 06:33:13 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id 6183B6573D for ; Thu, 24 Aug 2023 13:33:13 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 8FD63C433C8; Thu, 24 Aug 2023 13:33:12 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1692883992; bh=FP1acNfQmTZ7NjY1vwzgDhNQP+i8/znogMYIqAux0QI=; h=Date:From:To:Cc:Subject:References:In-Reply-To:From; b=N28J/j+qPJ6Zpb5huvQ02SCdVbPVk3KPQByBmN9CpkwVMC3pswzrX1jtmAiWw0OEB +uH1FN3d19tET3mZ/EcaJh4GTnKjz5Bw75Moog168RUXsz+cORtEi6lQZTpdmoConE O9FondeKCoPaghibjNiu87RCElctMbqIhA7C1D8r4l1cgvIZWEzZujefyjQQYUsYG2 E853ew7wUIBp1E797xfQ1bU+UIhiGX6T6UaAtm+0FsdBHk3E95w/363xyOQFV2K0+A ptWOCEdTHQHRs9bX7BQYJEoswFxO8r5Hi8rONN+a1hPdDn/enHXlGetBvaviVzvd/j dtaLLht87KFVA== Received: by quaco.ghostprotocols.net (Postfix, from userid 1000) id 069DF40722; Thu, 24 Aug 2023 10:33:09 -0300 (-03) Date: Thu, 24 Aug 2023 10:33:09 -0300 From: Arnaldo Carvalho de Melo To: Yanteng Si 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 Message-ID: References: <03ddc1c0e01518df63aac88e561cd0ec3c1e0028.1692694595.git.siyanteng@loongson.cn> <8ead439a-63aa-434e-9d1e-3b1b05b6347b@loongson.cn> <51632871-2e84-4c53-b4c0-647aea5c49dc@loongson.cn> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline Content-Transfer-Encoding: 8bit In-Reply-To: <51632871-2e84-4c53-b4c0-647aea5c49dc@loongson.cn> X-Url: http://acmel.wordpress.com Precedence: bulk List-ID: X-Mailing-List: linux-perf-users@vger.kernel.org Em Thu, Aug 24, 2023 at 10:22:57AM +0800, Yanteng Si escreveu: > > 在 2023/8/23 19:36, Arnaldo Carvalho de Melo 写道: > > Em Wed, Aug 23, 2023 at 03:11:01PM +0800, Yanteng Si escreveu: > > > 在 2023/8/23 02:02, Arnaldo Carvalho de Melo 写道: > > > > 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 > > > > > --- > > > > > 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} && \ > > > The following lines have already used the [ ! -f ${arch_mman}, so let's stay > > > consistent? > > Well, we can make it consistent by simplifying the other places where > > the long, equivalent test is being done, which I think is the way to go, > > agreed? > > I agree, but this is not suitable to be done in the fix patch, I will split > it out and make a new patch. Sure, send the one with the fix, already using the simple form, then convert the rest to the simpler form. Thanks, - Arnaldo