Received: by 2002:a05:6a10:1287:0:0:0:0 with SMTP id d7csp3989428pxv; Mon, 19 Jul 2021 13:47:42 -0700 (PDT) X-Google-Smtp-Source: ABdhPJxVSY6wNISisFeH8+ZnqV23dH7n8KufVhvrj8Sy6cPlULjSvK7Zs2dEVQs6Pr1984u0XBGi X-Received: by 2002:a17:906:38c8:: with SMTP id r8mr28901974ejd.172.1626727662481; Mon, 19 Jul 2021 13:47:42 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1626727662; cv=none; d=google.com; s=arc-20160816; b=QSWNIbaQUt0bRkqf74GmyL5MlWFkwdDrvwq7v5fC9GNfPiI9LiHi3XhV16W2kAMNTW 3RQ6xbZhT0w6DCt58laxhYoGX+37Vi0TP3w5ycV7gaPp5GmGmSLxjxN+H48fh/UpE0EN AhPXiCBPJaiCe3cO9sk7bwnILXX13ZRIIS1HWCkM/xQX77423CBP12Pmpk6vhebOLJIJ ZxZ89cL1iFj2U0dZ566Pwpe8StjvamD2GkaeveYuTEqzmKDI0X0VOn3YhHJQuK7BWFyY N7NbqjDju+7TbIkmrgbvWWJsgQ4PoUcEl5S+9ui92HXlPIxH2Tk0omWsGA4EAksaWK8w x1Yg== 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=aJC6T1mr3FGK6VqXqqxg5TyKpiauehuu55lXlzMhFnA=; b=Pei43rEObISo2T842eErrra4NLvQ9QBjACDRxoqnw/XjLpiwqwW22/UqM1wTiEp9d9 +PPaIoa00kZM3dGaEffG50KbhQyDH+8AYi2IPI2lq8PzpXdAy62rJZCOYqO+Ib6yru7G RLTQz4pwE4YFy/a9nTI4NeEynPEly0TsuiPDpUg2K7oU8i6BznVRFl+o52l8fAZJd2Ll h1v5U1kVFC5KhOCLaOjAJvY6ZCZJxUpNfOVtFp7PdXMi+fZJwAoSkwVy1UIVVelXfF6P N6nuUwne6M6nRkTFkqDc0HJR96MquDwGeOOePqWO8SNOWjJbJx9oW+LiP0Naz+xjuqDB HSvQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=NNKlQu8J; 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 r23si16557272edy.230.2021.07.19.13.47.19; Mon, 19 Jul 2021 13:47:42 -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=NNKlQu8J; 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 S1386241AbhGST1I (ORCPT + 99 others); Mon, 19 Jul 2021 15:27:08 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:41432 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1385387AbhGSS6i (ORCPT ); Mon, 19 Jul 2021 14:58:38 -0400 Received: from mail-pj1-x102b.google.com (mail-pj1-x102b.google.com [IPv6:2607:f8b0:4864:20::102b]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 9F576C0613E3 for ; Mon, 19 Jul 2021 12:30:01 -0700 (PDT) Received: by mail-pj1-x102b.google.com with SMTP id o3-20020a17090a6783b0290173ce472b8aso273543pjj.2 for ; Mon, 19 Jul 2021 12:37:56 -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=aJC6T1mr3FGK6VqXqqxg5TyKpiauehuu55lXlzMhFnA=; b=NNKlQu8JwjSEDoWa8NuqtgLa1KcftHc9HZPFjLFddHljAkmyao2v2BRSn7PUg2holy t6upJGhs7E8TUCsiwXfdEreLoml1zao10eTQ7lG7n383nurGN3bzlcwbmLdT5aEEBv6Z sCVn1EMKL9zEuESFYr7pF0kfijHTOmJHiqoFebNF30aLpa2iwFnDpVlEhQkCK5g1xm/T 52TBbbxMdE7l/JUelVkS8I7a6uEF5dviruC9JjioqtOqjP05GEE08URhkXL4naCWNmMU pWy/WE/hiZ0YzoU3qs2lwLfB8WLFqHum1bwwGBYNaONDsTXqpXKCJij2wqKXfl7Iyebe wPdQ== 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=aJC6T1mr3FGK6VqXqqxg5TyKpiauehuu55lXlzMhFnA=; b=oIC47+jPfqpdAreS42maLnzzKUhOh2QnvnoakhO/ry/So623LvKOcSImZQSgMvVVmg 7id14NYYMlmyisOcpJJ2vsKeOaaPRI1wtCmNhVvPz/hId3xrDjny1qvWR5DNxMVJcF1a bk/F6AbiB4+rkld3pk0YoyOiMKWgV1YdpPhqI4KznZ9BQJuwjgctLqfN4cU76JrnGrs7 JtofZ8xetlmwqT0aFQSyubKFe/V+65BiQTAGaU4w2+hhHZVicDZ8AjRLM6wfk+7LgM8d J2dNtBoQ8Qezpywm0c/TRUWLr/NdPUsaNTXsjYfzzqwqItbYi3VJLg1wFggJP20e+g4j K0OA== X-Gm-Message-State: AOAM533s3LKzV+t2WyKUBuJdppPeIU15oDSJc5XG0oBJsyLQK1rcEDkV OvuoPiF4CIf2kncKA8D6eGOb5Q== X-Received: by 2002:a17:902:b210:b029:11a:bf7b:1a83 with SMTP id t16-20020a170902b210b029011abf7b1a83mr20462143plr.84.1626723475799; Mon, 19 Jul 2021 12:37:55 -0700 (PDT) Received: from p14s (S0106889e681aac74.cg.shawcable.net. [68.147.0.187]) by smtp.gmail.com with ESMTPSA id g17sm7810842pgi.70.2021.07.19.12.37.54 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 19 Jul 2021 12:37:55 -0700 (PDT) Date: Mon, 19 Jul 2021 13:37:52 -0600 From: Mathieu Poirier To: James Clark Cc: acme@kernel.org, coresight@lists.linaro.org, leo.yan@linaro.org, al.grant@arm.com, branislav.rankov@arm.com, suzuki.poulose@arm.com, anshuman.khandual@arm.com, Mike Leach , Mark Rutland , Alexander Shishkin , Jiri Olsa , Namhyung Kim , John Garry , Will Deacon , linux-arm-kernel@lists.infradead.org, linux-perf-users@vger.kernel.org, linux-kernel@vger.kernel.org Subject: Re: [PATCH 1/6] perf cs-etm: Refactor initialisation of kernel start address Message-ID: <20210719193752.GB2255168@p14s> References: <20210713154008.29656-1-james.clark@arm.com> <20210713154008.29656-2-james.clark@arm.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20210713154008.29656-2-james.clark@arm.com> Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Tue, Jul 13, 2021 at 04:40:03PM +0100, James Clark wrote: > The kernel start address is already cached in the machine struct once it > is initialised, so storing it in the cs_etm struct is unnecessary. > > It also depends on kernel maps being available to be initialised. > Therefore cs_etm__setup_queues() isn't an appropriate place to call it > because it could be called before processing starts. It would be better > to initialise it at the point when it is needed, then we can be sure > that all the necessary maps are available. Also by calling > machine__kernel_start() multiple times it can be initialised at some > point, even if it failed to initialise previously due to missing maps. > > In a later commit cs_etm__setup_queues() will be moved which is the > motivation for this change. > > Signed-off-by: James Clark Reviewed-by: Mathieu Poirier > --- > tools/perf/util/cs-etm.c | 6 +----- > 1 file changed, 1 insertion(+), 5 deletions(-) > > diff --git a/tools/perf/util/cs-etm.c b/tools/perf/util/cs-etm.c > index bc1f64873c8f..4c69ef391f60 100644 > --- a/tools/perf/util/cs-etm.c > +++ b/tools/perf/util/cs-etm.c > @@ -62,7 +62,6 @@ struct cs_etm_auxtrace { > u64 instructions_sample_period; > u64 instructions_id; > u64 **metadata; > - u64 kernel_start; > unsigned int pmu_type; > }; > > @@ -691,7 +690,7 @@ static u8 cs_etm__cpu_mode(struct cs_etm_queue *etmq, u64 address) > > machine = etmq->etm->machine; > > - if (address >= etmq->etm->kernel_start) { > + if (address >= machine__kernel_start(machine)) { > if (machine__is_host(machine)) > return PERF_RECORD_MISC_KERNEL; > else > @@ -901,9 +900,6 @@ static int cs_etm__setup_queues(struct cs_etm_auxtrace *etm) > unsigned int i; > int ret; > > - if (!etm->kernel_start) > - etm->kernel_start = machine__kernel_start(etm->machine); > - > for (i = 0; i < etm->queues.nr_queues; i++) { > ret = cs_etm__setup_queue(etm, &etm->queues.queue_array[i], i); > if (ret) > -- > 2.28.0 >