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 45B97C07E9A for ; Wed, 14 Jul 2021 14:03:53 +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 0092D613C3 for ; Wed, 14 Jul 2021 14:03:52 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 0092D613C3 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=pOWYu+zdzBQSj6tBODscbiGUMx++A4rVW2qyXD/oY9E=; b=i1aK6lFeTSREjH nKzTAFpwd4L6EfQTvAcAr8w5kpImdeZiiDG8wmwoZQGngLEnYwdUg9XkJCx6eFWPgoFkGxh0ATlJB t3Ob+aJJXU2gBYN4q1r9YBwt2YBUT18SP7l+/0+SMwdS5GEqpqQoMZM41FQ8Mz+8/vLSijWI2jGZF tPZFm5Sfp8++e+saFGTWNhZlnX4Iv9cROes1cGPrWT98Hl860vQ8701QoDN60n2tbBq+JrepCuBHU /YtM2pKMtkoUGRAsXEqX+YHbSeZIOtpiR3z87C+meuK0HD2tgvlPCvZ4iRTsOMZB3MwaR9Ljko+vC UPxnamicmAPpadOCOnyg==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.94.2 #2 (Red Hat Linux)) id 1m3fSb-00DmHw-13; Wed, 14 Jul 2021 14:02:02 +0000 Received: from casper.infradead.org ([2001:8b0:10b:1236::1]) by bombadil.infradead.org with esmtps (Exim 4.94.2 #2 (Red Hat Linux)) id 1m3fS6-00Dm3o-PN for linux-arm-kernel@bombadil.infradead.org; Wed, 14 Jul 2021 14:01:30 +0000 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=infradead.org; s=casper.20170209; 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=qRPGNtzJWzOGXpSJPvpdCNRGRgva7qAtz0cCiCc6Zao=; b=I+APzSOdxNBecEOgX2p55m14vA 8bzvySPZj3TOuoTpXkJZpiNHLwgJobY8IH+xQ6Et/m30HdVE3SAAY0TzeQhsQXcIMu5BcqXP4CsD9 7iGokHfg47XfIZng0lOa7iRmYCBmlJUG3Ns8GF9lL++HpckFp6Pr7vAl7CWiX4BcP3yEhwU2EcpzL R8efZkqiZe+22aBY3n1B4NpJlyHk2TRCmMLyvhb24iK3BeggN0WFIdDUUkPQxoj5inAoXK7sNtt1V 7dT/1mrmuYHrAO7S+vfH9HhxRX8X70XGuWPcjYbJBQx5P7zSwJZ7jaTT8p6zxLS2ODHIPZVHfy71g Ap+2wSWw==; Received: from [179.97.37.151] (helo=quaco.ghostprotocols.net) by casper.infradead.org with esmtpsa (Exim 4.94.2 #2 (Red Hat Linux)) id 1m3fRP-002GUB-BG; Wed, 14 Jul 2021 14:01:00 +0000 Received: by quaco.ghostprotocols.net (Postfix, from userid 1000) id 76DA2403F2; Wed, 14 Jul 2021 11:00:44 -0300 (-03) Date: Wed, 14 Jul 2021 11:00:44 -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 Wed, Jul 14, 2021 at 10:59:49AM -0300, Arnaldo Carvalho de Melo escreveu: > 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: Oops, forgot these: > 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; env->kernel_is_64_bit = 1; > else > kernel_is_64_bit = 0; env->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! -- - Arnaldo _______________________________________________ linux-arm-kernel mailing list linux-arm-kernel@lists.infradead.org http://lists.infradead.org/mailman/listinfo/linux-arm-kernel