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=-15.2 required=3.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_CR_TRAILER, INCLUDES_PATCH,MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS autolearn=ham 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 1BBD3C07E95 for ; Mon, 19 Jul 2021 19:41:39 +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 CB09B6113B for ; Mon, 19 Jul 2021 19:41:38 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org CB09B6113B Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=linaro.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=mS5Kmpq3YhA6oc7nNcoD3xRxRlQN9aLjrjoi5aPuBsk=; b=kfaN8PGHQfrLGP uAjwtaGOghp2EYDsloBozFHS+TJIbmyx1d0+7ikCxJJyasZmF+yo7YsyH9QTjrPVgb+qXbgu1WiNw /id4r9+PLpDD7PUJgndexuWr0hqoo9t4qrZH+DwFMKNymovCXKs+zMv03n9MEhtOpni/8WJ7bkm83 6dVbFT4XdoRs2QdF6iGLA/aM5PseIIWqoopFnZfm+nSmhLRu9D74VC3fxOw14XF11jdX1kmYKfiWG fRUgxNEvP7Kxjux7Fhj/cgUi9wG1RIVaQHWU9H1HenAWEBBrS/awnkt4xAtgYvIRHGu6IvO2o/XVy rjCO+G8o3FiICNalg3Mg==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.94.2 #2 (Red Hat Linux)) id 1m5Z6T-00B84n-Em; Mon, 19 Jul 2021 19:39:02 +0000 Received: from mail-pg1-x533.google.com ([2607:f8b0:4864:20::533]) by bombadil.infradead.org with esmtps (Exim 4.94.2 #2 (Red Hat Linux)) id 1m5Z5t-00B7v5-8B for linux-arm-kernel@lists.infradead.org; Mon, 19 Jul 2021 19:38:26 +0000 Received: by mail-pg1-x533.google.com with SMTP id 62so20160456pgf.1 for ; Mon, 19 Jul 2021 12:38:24 -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=IeosqyxZlkBHUUEoKqwVxM/isG0gC3YMq8teSxiBUHY=; b=RX/yDidJamxqLcAAsTSeOznvtLBzErsJdlhHPV3vFKEil91YBw1hVk53DDTU8eLLdN BwgE49ZC3yGr1s0d9vRjv+vsQYuSLX47B9lyb8SFd8BebKeu/Hatxudc3xkMEkUYJMYa pOrDTVu2rMtlV9T1kbgQKZ3j75oO4WJKeGlIXLkjHrXom5DMFTx5MX7bUm/8D9r0aBTt WSKVe4XjMgGZINj7UxmWM/KsFapbKhBr5S4WUsVrQfQTqvUN+LfG7UbfyY0K8cb22Twj 0dvt8WrBObyXG8lreYnrwzAAgXAQ2ECPRdXj81U119/+7a/slz7W1VvB2H/uPof6u7+D zIZA== 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=IeosqyxZlkBHUUEoKqwVxM/isG0gC3YMq8teSxiBUHY=; b=AgTsn4iFwIZMoDKAxYwHGgFFE8qboqKHCdKWLgxI4rBQQopZaerdOv3pJSV/MQBTf6 EtZXc4sCTXDy88kd/pOemd5j9ZqMBIOY9IJy9adjMsT1AD8DT1u7zghsNG7QJX/LJobW wdqnbm9Ih45GpbyR6UDu1SbBEPWcGyXWSIjzJ1A/pZ2twFW7ZmRYEeT2QQrvPaF+SEqu XMFkiSz3qixy2APN+2cTaCGEU1uLAl5grA9u0Udn/U59x80YeNIJzxUpdqFC0+tGpZer mv60Gn0dngN7yG0FO/1FV3dAOKH65HNDpXrrHApwQTPvj9yIDk/jiBvVurw/WwDGlqsA cDRw== X-Gm-Message-State: AOAM531pBd1CgO+rqTxghcP5C0bOjjBxrj/3Br26oIOrcq6ar38F5vhz SI3dsSjQtiNd/2z8/nFoBCvHdg== X-Google-Smtp-Source: ABdhPJz0F/gSV8rMzQotOiv22Mztp5lFpf4O6is+gp5LUg/869qeRCFfT+aqAP3WavnjyRbe72C05Q== X-Received: by 2002:aa7:97a3:0:b029:341:36e5:61d0 with SMTP id d3-20020aa797a30000b029034136e561d0mr11899341pfq.8.1626723504497; Mon, 19 Jul 2021 12:38:24 -0700 (PDT) Received: from p14s (S0106889e681aac74.cg.shawcable.net. [68.147.0.187]) by smtp.gmail.com with ESMTPSA id m19sm21046578pfa.135.2021.07.19.12.38.22 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 19 Jul 2021 12:38:23 -0700 (PDT) Date: Mon, 19 Jul 2021 13:38:21 -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 2/6] perf cs-etm: Split setup and timestamp search functions Message-ID: <20210719193821.GC2255168@p14s> References: <20210713154008.29656-1-james.clark@arm.com> <20210713154008.29656-3-james.clark@arm.com> MIME-Version: 1.0 Content-Disposition: inline In-Reply-To: <20210713154008.29656-3-james.clark@arm.com> X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20210719_123825_375733_4C3DF311 X-CRM114-Status: GOOD ( 30.61 ) 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 On Tue, Jul 13, 2021 at 04:40:04PM +0100, James Clark wrote: > This refactoring has some benefits: > * Decoding is done to find the timestamp. If we want to print errors > when maps aren't available, then doing it from cs_etm__setup_queue() > may cause warnings to be printed. > * The cs_etm__setup_queue() flow is shared between timed and timeless > modes, so it needs to be guarded by an if statement which can now > be removed. > * Allows moving the setup queues function earlier. > * If data was piped in, then not all queues would be filled so it > wouldn't have worked properly anyway. Now it waits for flush so > data in all queues will be available. > > The motivation for this is to decouple setup functions with ones that > involve decoding. That way we can move the setup function earlier when > the formatted/unformatted trace information is available. > > Signed-off-by: James Clark > --- > tools/perf/util/cs-etm.c | 41 ++++++++++++++++++++++++++++------------ > 1 file changed, 29 insertions(+), 12 deletions(-) Reviewed-by: Mathieu Poirier > > diff --git a/tools/perf/util/cs-etm.c b/tools/perf/util/cs-etm.c > index 4c69ef391f60..426e99c07ca9 100644 > --- a/tools/perf/util/cs-etm.c > +++ b/tools/perf/util/cs-etm.c > @@ -809,29 +809,32 @@ static int cs_etm__setup_queue(struct cs_etm_auxtrace *etm, > struct auxtrace_queue *queue, > unsigned int queue_nr) > { > - int ret = 0; > - unsigned int cs_queue_nr; > - u8 trace_chan_id; > - u64 cs_timestamp; > struct cs_etm_queue *etmq = queue->priv; > > if (list_empty(&queue->head) || etmq) > - goto out; > + return 0; > > etmq = cs_etm__alloc_queue(etm); > > - if (!etmq) { > - ret = -ENOMEM; > - goto out; > - } > + if (!etmq) > + return -ENOMEM; > > queue->priv = etmq; > etmq->etm = etm; > etmq->queue_nr = queue_nr; > etmq->offset = 0; > > - if (etm->timeless_decoding) > - goto out; > + return 0; > +} > + > +static int cs_etm__queue_first_cs_timestamp(struct cs_etm_auxtrace *etm, > + struct cs_etm_queue *etmq, > + unsigned int queue_nr) > +{ > + int ret = 0; > + unsigned int cs_queue_nr; > + u8 trace_chan_id; > + u64 cs_timestamp; > > /* > * We are under a CPU-wide trace scenario. As such we need to know > @@ -2218,13 +2221,27 @@ static int cs_etm__process_timeless_queues(struct cs_etm_auxtrace *etm, > static int cs_etm__process_queues(struct cs_etm_auxtrace *etm) > { > int ret = 0; > - unsigned int cs_queue_nr, queue_nr; > + unsigned int cs_queue_nr, queue_nr, i; > u8 trace_chan_id; > u64 cs_timestamp; > struct auxtrace_queue *queue; > struct cs_etm_queue *etmq; > struct cs_etm_traceid_queue *tidq; > > + /* > + * Pre-populate the heap with one entry from each queue so that we can > + * start processing in time order across all queues. > + */ > + for (i = 0; i < etm->queues.nr_queues; i++) { > + etmq = etm->queues.queue_array[i].priv; > + if (!etmq) > + continue; > + > + ret = cs_etm__queue_first_cs_timestamp(etm, etmq, i); > + if (ret) > + return ret; > + } > + > while (1) { > if (!etm->heap.heap_cnt) > goto out; > -- > 2.28.0 > _______________________________________________ linux-arm-kernel mailing list linux-arm-kernel@lists.infradead.org http://lists.infradead.org/mailman/listinfo/linux-arm-kernel