Received: by 2002:a05:6a10:1287:0:0:0:0 with SMTP id d7csp1139015pxv; Fri, 23 Jul 2021 00:14:33 -0700 (PDT) X-Google-Smtp-Source: ABdhPJyFLKo7H3YHVKdNx+tjvjvvRQA+YQZGMxyUKc9zt2kzl0D23hRDRPmkbX5Bm10GZSxV5Dx5 X-Received: by 2002:a17:906:1156:: with SMTP id i22mr3517969eja.167.1627024472960; Fri, 23 Jul 2021 00:14:32 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1627024472; cv=none; d=google.com; s=arc-20160816; b=v+tirSb63nbDDQe5EG/ZLuYD4cw1Rl5bgUjf2OBCpMy9PfkWLYERfYi94XrrwNGkHa Q2w0dmG9t7D7N0gomiVMI+ZnY74lEVpaqiXrwCf9MALXoBp9jJs3KSjlhDt6ipG8OnKg A7fdnTEqFxvT/bFtAdMZ4gSvYUq/MjXgfG7tZ7bBGWKoqe/xmTNCfihBQGmbKHiFV6qT YRFXP3HBxlsS1LxBzJpeobOCjI+5Hsw4FMObog5yBgEhQwuNggvjNMIR1pUiFQLA6ybT 7Hdvats58GafIFvAZ/3dNFJAc6CnVbd8/rC6ryWByASIbjrMzNJBLvlX1by5qp3pp6kB VSew== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:in-reply-to:content-disposition:mime-version :references:message-id:subject:cc:to:from:date:dkim-signature; bh=B4pG5X92n/pg5azzZDZyLdDsyeHis75paHHHy3/0sK4=; b=BHFY+1h8FZyrNfBdFZ3x7bccCRIveqya7yW/qu4bES36mZomFwXDwIYmnaxtp+VYDH M7xHoQMcj+F9r9yipInAqe5nBlMOl6FFjgxe7mFAZVyJIBLgKWjLobg9Ti2rcdkqbnve c82NQBuBfbbsHnPchoHWrzyzy/mGzzM4bsvUADUi8Tpv4KV09LgXtI1mgB/sVR9vnRy9 x3a2FVWapA8zV2FMw9/7l3N44nNiAvl+OnyfHJGQaJLvQKUSsPypsQOTkYGJhMUffM2E AdhCKHJLLeMdHxzQ1xc5X69L0JWBscHSJjv4IoyAA2iuOJ831vp7OIfQuJJMdPUBkzwt Oytw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b="hDXynN/M"; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id x23si34239199eds.52.2021.07.23.00.14.09; Fri, 23 Jul 2021 00:14:32 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b="hDXynN/M"; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S234276AbhGWGbg (ORCPT + 99 others); Fri, 23 Jul 2021 02:31:36 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:47002 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S234268AbhGWGbe (ORCPT ); Fri, 23 Jul 2021 02:31:34 -0400 Received: from mail-pl1-x62c.google.com (mail-pl1-x62c.google.com [IPv6:2607:f8b0:4864:20::62c]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 184D4C061575 for ; Fri, 23 Jul 2021 00:12:08 -0700 (PDT) Received: by mail-pl1-x62c.google.com with SMTP id f1so2194917plt.7 for ; Fri, 23 Jul 2021 00:12:08 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=date:from:to:cc:subject:message-id:references:mime-version :content-disposition:in-reply-to; bh=B4pG5X92n/pg5azzZDZyLdDsyeHis75paHHHy3/0sK4=; b=hDXynN/MXkoVdK5vfUN2Uq+JsGwfyDkLpdp9vKKyIZm1j7wl6RFjzSJ/U1poKmWBHd ZYHPH/xXHmDteW3YISF2z7Mgt74TEiTPFNcJZRszGwUaTphtOpNPQLKsGrF8GTM/t0bS pUOfFK8dvYQb2CcA0htsXpnXHt3FANpN663kNeyiXFEjhQfffDzCB14WfhLNDskhUghH qSnQ4yYZnKfVntehKgfLOb715qs+npc+DvHBgHcBO3AlneM6E712OA2q/YRaUxdyOLuc 5zpSXpaH9aGM6yQ+imbqvzevn8Y+CJxMhDCpqKLM/w7QIgBWSuXNrE7V3GnRAkRoyo0P IiHA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:date:from:to:cc:subject:message-id:references :mime-version:content-disposition:in-reply-to; bh=B4pG5X92n/pg5azzZDZyLdDsyeHis75paHHHy3/0sK4=; b=lrndnrBcGaNooFMs9K/3Bthn97/tKGq9PJBsD1UdyyboPc3uUgsisAP7ZfIQFxGNEP C1mokz/dEc3I9vMuQRMF6TFZq02zJaAj2GuUSd+apaoj3tkyWD9MUzL2L5gpGjfsaKb4 a31/p29guzFyA9QCvl05+8IzmYAhDcEFfW7okHRRPeaN4mDE4ro0HYdQq6d/UYFoVeNM YiWcMRFDg5WDO8Z4IvC3ZK2vQ7hTY0NS5VtJiENCnnfkfYkepRNqjXIWwelxHNwjHS86 /Cxj45mOQma0WwoxzRByejSbVpA3kmHX9s++5F65fHvEM01L9MkDAkgw/bmlCGqi/EXK ua/w== X-Gm-Message-State: AOAM533zfKdJAf1w29Jn2oEt3bIFaXbG85dEI6e/jvGP1q/0cD3Beu0E 6Tgw5FuYuB+cTmZ6KMolvnL/vQ== X-Received: by 2002:aa7:95a4:0:b029:332:f4e1:1dac with SMTP id a4-20020aa795a40000b0290332f4e11dacmr3154708pfk.34.1627024327574; Fri, 23 Jul 2021 00:12:07 -0700 (PDT) Received: from leoy-ThinkPad-X240s ([202.155.204.36]) by smtp.gmail.com with ESMTPSA id z24sm4971018pju.55.2021.07.23.00.12.02 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 23 Jul 2021 00:12:06 -0700 (PDT) Date: Fri, 23 Jul 2021 15:11:59 +0800 From: Leo Yan To: Arnaldo Carvalho de Melo Cc: "Hunter, Adrian" , 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: <20210723071159.GF179035@leoy-ThinkPad-X240s> 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-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Hi Arnaldo, On Wed, Jul 14, 2021 at 11:00:44AM -0300, Arnaldo Carvalho de Melo wrote: [...] > > 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; > > } Thanks a lot for the suggestion; this is much clear for me, will spin new patch set by following it. Sorry for slow response due to my bandwidth was occupied by a task in hand. Thanks, Leo