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 X-Spam-Level: X-Spam-Status: No, score=-9.7 required=3.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,INCLUDES_PATCH,MAILING_LIST_MULTI,SPF_HELO_NONE, SPF_PASS,URIBL_BLOCKED autolearn=unavailable autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 92D56C11F66 for ; Wed, 14 Jul 2021 14:01:41 +0000 (UTC) Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 61CFE613C3 for ; Wed, 14 Jul 2021 14:01:41 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 61CFE613C3 Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=kernel.org Authentication-Results: mail.kernel.org; spf=none smtp.mailfrom=linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender: Content-Transfer-Encoding:Content-Type:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:In-Reply-To:MIME-Version:References: Message-ID:Subject:Cc:To:From:Date:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=UveDzgEuHz3nNKlvIwLw96GcK6XxAaoUI/oGpNhvFIo=; b=CWpGNMcs2TI0JD hLYG7jcBMJ7Y0OCaUGusKCQYomKcnVFoM2KVJs/uysbY6oJHdxrJGzikCxSxJFBOB3SSDwFGmJ379 BvpO8lf0Dd7sgwJK9OjPgfXwFmBpysR1ZbhusWbfyphJLvOD/BAnzwkKJ37JOK7nuGj1AlJmfZtDh ao7OlSzd6tjPsIzMy1/9aUZwDIW4tVxai2JdXzsgRsxmG0uHkzRomXu6X95XDEO0ocLcRxN3ZkebW yfTEEPCp12mSQwolcV11W0Szm/IXHjoTtR8TUfqYzroW6PlImbS2GmBky4nebtVNskNWKw5s4H2Xg AmqlNUZgEXMBE3u0UajQ==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.94.2 #2 (Red Hat Linux)) id 1m3fQb-00DlcZ-V3; Wed, 14 Jul 2021 13:59:58 +0000 Received: from desiato.infradead.org ([2001:8b0:10b:1:d65d:64ff:fe57:4e05]) by bombadil.infradead.org with esmtps (Exim 4.94.2 #2 (Red Hat Linux)) id 1m3fQY-00Dlbr-S7 for linux-arm-kernel@bombadil.infradead.org; Wed, 14 Jul 2021 13:59:54 +0000 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=infradead.org; s=desiato.20200630; h=In-Reply-To:Content-Type:MIME-Version: References:Message-ID:Subject:Cc:To:From:Date:Sender:Reply-To: Content-Transfer-Encoding:Content-ID:Content-Description; bh=bXVgoOxkeeMgWgtmUsvpcVHloUI7VJpyUQ1tq9T3atE=; b=odiuS9nXZlhQPs4OyGLkM4Exj6 ziekcdI3zjZrrhalbQn7C+4aEeQD7dU+C1chgJ6JrOzkZhWHW3kScg+FkgS37uIDGfSdNzP5YSXV4 GaP7noZfmUuOZWfx3nFJ7trgH1tJRxRMtlUfNnMm+M9vSpofd7XEdrGQzhyXC9uWT8IhsPlKRb5/E ChRUDN2n1lLm5xhR2hXgfTW8pyJgcvPSsdR4VKacPGuiAArLD2AdAUw1KfkBCV81Zseov48hQhZlz PpHCDFVU4fsSsb1vrwuRqoao3HkLjyzF+Cse9CyiWYlaOq9U7f/f8IDdSbpHHsqgqEyJQkEqlIFfV LPxt5zNw==; Received: from [179.97.37.151] (helo=quaco.ghostprotocols.net) by desiato.infradead.org with esmtpsa (Exim 4.94.2 #2 (Red Hat Linux)) id 1m3fQX-00HV8Z-6h; Wed, 14 Jul 2021 13:59:53 +0000 Received: by quaco.ghostprotocols.net (Postfix, from userid 1000) id 4A6B7403F2; Wed, 14 Jul 2021 10:59:49 -0300 (-03) Date: Wed, 14 Jul 2021 10:59:49 -0300 From: Arnaldo Carvalho de Melo To: "Hunter, Adrian" Cc: Leo Yan , Peter Zijlstra , Ingo Molnar , Mark Rutland , Alexander Shishkin , Jiri Olsa , Namhyung Kim , Thomas Gleixner , Borislav Petkov , "x86@kernel.org" , "H. Peter Anvin" , Mathieu Poirier , Suzuki K Poulose , Mike Leach , "linux-perf-users@vger.kernel.org" , "linux-kernel@vger.kernel.org" , "coresight@lists.linaro.org" , "linux-arm-kernel@lists.infradead.org" Subject: Re: [PATCH v4 10/11] perf env: Set flag for kernel is 64-bit mode Message-ID: References: <20210711104105.505728-1-leo.yan@linaro.org> <20210711104105.505728-11-leo.yan@linaro.org> <20210713150953.GC748506@leoy-ThinkPad-X240s> MIME-Version: 1.0 Content-Disposition: inline In-Reply-To: X-Url: http://acmel.wordpress.com X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org Em Tue, Jul 13, 2021 at 05:31:03PM +0000, Hunter, Adrian escreveu: > > On Mon, Jul 12, 2021 at 03:14:35PM -0300, Arnaldo Carvalho de Melo wrote: > > > Em Sun, Jul 11, 2021 at 06:41:04PM +0800, Leo Yan escreveu: > > > > +++ b/tools/perf/util/env.c > > > > @@ -11,6 +11,7 @@ > > > > #include > > > > #include > > > > +int kernel_is_64_bit; > > > > struct perf_env perf_env; > > > Why can't this be in 'struct perf_env'? > > Good question. I considered to add it in struct perf_env but finally I used this > > way; the reason is this variable "kernel_is_64_bit" is only used during > > recording phase for AUX ring buffer, and don't use it for report. So seems to > > me it's over complexity to add a new field and just wander if it's necessary to > > save this field as new feature in the perf header. > I think we store the arch, so if the "kernel_is_64_bit" calculation depends only on arch > then I guess we don't need a new feature at the moment. So, I wasn't suggesting to add this info to the perf.data file header, just to the in-memory 'struct perf_env'. And also we should avoid unconditionally initializing things that we may never need, please structure it as: static void perf_env__init_kernel_mode(struct perf_env *env) { const char *arch = perf_env__raw_arch(env); if (!strncmp(arch, "x86_64", 6) || !strncmp(arch, "aarch64", 7) || !strncmp(arch, "arm64", 5) || !strncmp(arch, "mips64", 6) || !strncmp(arch, "parisc64", 8) || !strncmp(arch, "riscv64", 7) || !strncmp(arch, "s390x", 5) || !strncmp(arch, "sparc64", 7)) kernel_is_64_bit = 1; else kernel_is_64_bit = 0; } void perf_env__init(struct perf_env *env) { ... env->kernel_is_64_bit = -1; ... } bool perf_env__kernel_is_64_bit(struct perf_env *env) { if (env->kernel_is_64_bit == -1) perf_env__init_kernel_mode(env); return env->kernel_is_64_bit; } One thing in my TODO is to crack down on the tons of initializations perf does unconditionally, last time I looked there are lots :-\ - Arnaldo > > Combining the comment from Adrian in another email, I think it's good to add > > a new field "compat_mode" in the struct perf_env, and this field will be > > initialized in build-record.c. Currently we don't need to save this value into > > the perf file, if later we need to use this value for decoding phase, then we > > can add a new feature item to save "compat_mode" > > into the perf file's header. > > If you have any different idea, please let me know. Thanks! _______________________________________________ linux-arm-kernel mailing list linux-arm-kernel@lists.infradead.org http://lists.infradead.org/mailman/listinfo/linux-arm-kernel