Received: by 2002:a25:8b12:0:0:0:0:0 with SMTP id i18csp4903916ybl; Mon, 26 Aug 2019 18:32:46 -0700 (PDT) X-Google-Smtp-Source: APXvYqzRDJPlK+LD3wtGuc1q6fo1ID6OOPuP4+PhRUQmOFXa2H4hjwntLPoS0N5WhafZWitqCB6j X-Received: by 2002:aa7:8c57:: with SMTP id e23mr23961236pfd.48.1566869566724; Mon, 26 Aug 2019 18:32:46 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1566869566; cv=none; d=google.com; s=arc-20160816; b=O5LkZJfgYUqyHHKHcVesawxVLTytmfnpywToa4ViGPIEgmdql8ir/MGfbf2toOHEON +xnPNXBgcQSynFq/U8DsC/I+y325kH3G8PbdU3iTHLOeg9oAW2BpJMlq9nccRNe3M3aJ WEqWZryyZNgWEi7tMDw8/E4C8dp04CM/E0XIrxG6g0a12Dotupwrbd2pF6GkMpD5FQLX LCthu02GHFlNZ6/C5pZGOHONs8Nv6ObPzTBlYQAHs4O6hZcE0GlBRoPWI8cQIkeLWsUN 1vihccL5B8Q1Rf0gNTbVntPwWkBAbDddLqUYPvv9sktNYZ+ippOw3hl7sToX25JbtGpy /ovQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:user-agent:in-reply-to :content-disposition:mime-version:references:message-id:subject:cc :to:from:date:dkim-signature; bh=tnOKZVI2QOtjsx7l6GiMYgVTnUPPJYldd6RePG5ghms=; b=yzCCwLtFB1bUrbCFiUdNJ3WxJgiLacwlBhfdI9dFObfvzyTW3bAUuaDHJVC+A/MjzK 1oyfUeimRIDR8eUwWg25Yr1VpAitdEP1uNOcCKKrXAw8MBjAIy04LZmtQovUX+OL9hoY 1nH2twKLSYVXAw0AhzNE2/tXvV2byOojFzMut2q4YsvZHmJfoeT2ZmUc8FE2twOggVKm gpsbgSTkhWNLd21EB3rn1J3rlPsvgL71P+95SCC0st1Jc9tDoa99zzTUtr8BsQn7vrNR lR2VxjqGyhXqCLlvwaH2NFbRocf/9KNXJ6qgzfviUz/xgH/iNwZr/02fRgbrvcVYEAF+ 7zPw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=vX3rxJJm; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 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. [209.132.180.67]) by mx.google.com with ESMTP id o5si7701162plh.382.2019.08.26.18.32.29; Mon, 26 Aug 2019 18:32:46 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=vX3rxJJm; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 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 S1728473AbfH0Bar (ORCPT + 99 others); Mon, 26 Aug 2019 21:30:47 -0400 Received: from mail-yb1-f194.google.com ([209.85.219.194]:43117 "EHLO mail-yb1-f194.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726257AbfH0Bar (ORCPT ); Mon, 26 Aug 2019 21:30:47 -0400 Received: by mail-yb1-f194.google.com with SMTP id o82so7664909ybg.10 for ; Mon, 26 Aug 2019 18:30:47 -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:user-agent; bh=tnOKZVI2QOtjsx7l6GiMYgVTnUPPJYldd6RePG5ghms=; b=vX3rxJJm953Uw6Onz9/pZS2n4ACF3qqSTizq7x04kl2lFxHfNfTJN627+igH9UdpX7 ARfAlJNXBpkT74h9GXk7w/g0j7vg9mhIc6E6Vopg3H1BMMNM/WzPP2aYXu97V0I66BXQ QV+/peRihYrX5YLimVdSBztjFOMnXSS7TtHjmN0ZnBIYl1QTfs1+aE4DlYE6XU2keRqL 6AaEw1jxtX32qDcEr4s/h3IXvmYag70M4BYKEqXar8hSCueU9WtBT2VCoXAlMPP+deik Gww+apYt9+elDrgII9LHzlSTdl+Yq9AH3PtC4GEiubI5lI5fq87uyzz8psu9UYS++wqa 7wjg== 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:user-agent; bh=tnOKZVI2QOtjsx7l6GiMYgVTnUPPJYldd6RePG5ghms=; b=RvV48p0Qkr28E0ZoXv93328IMFtnsc2URf2zjqrrSG6BMiYw/Q+MmJvhK6YJpUYvxx /JAAb/XLdgYB4NXLLrYmJyoKthh1giytEcmztZISdB1cspqVAzQ0lydoG9Lhm1v0d6qW 7F+QwvqusBk5TbKQRaJ3nSxWpfkCi95/Pgpmm7zUMsZkgUp2ZuUWIf/OFuDL/LLZ8Lvy g3VcrgnUFLRhV/ibxRAoqRIUubPiVb0F5S3CzlBT8l3UbG2cH1p7E83e1YnYkqQ2psP/ jjGRtD4vssxJ0dehdzsdDpGIATbdqK2LX9Yssb5vJFmv9yh8m6cofor1iLstLfljBq18 lYpg== X-Gm-Message-State: APjAAAW3ks3AM7UKxUjgTHo7yb8zmbIjg3Flwvhk6++jfiJyGBCIZxY/ 71ICCUJfE1jMrvDJbv64JbLk1Q== X-Received: by 2002:a25:aa23:: with SMTP id s32mr14370115ybi.198.1566869446653; Mon, 26 Aug 2019 18:30:46 -0700 (PDT) Received: from leoy-ThinkPad-X240s (li1320-244.members.linode.com. [45.79.221.244]) by smtp.gmail.com with ESMTPSA id d191sm3600156ywh.12.2019.08.26.18.30.42 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Mon, 26 Aug 2019 18:30:45 -0700 (PDT) Date: Tue, 27 Aug 2019 09:30:38 +0800 From: Leo Yan To: Mathieu Poirier Cc: suzuki.poulose@arm.com, mike.leach@arm.com, yabinc@google.com, alexander.shishkin@linux.intel.com, linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org Subject: Re: [PATCH v2 2/3] coresight: tmc-etr: Decouple buffer sync and barrier packet insertion Message-ID: <20190827013038.GA4596@leoy-ThinkPad-X240s> References: <20190826194605.3791-1-mathieu.poirier@linaro.org> <20190826194605.3791-3-mathieu.poirier@linaro.org> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20190826194605.3791-3-mathieu.poirier@linaro.org> User-Agent: Mutt/1.9.4 (2018-02-28) Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Mon, Aug 26, 2019 at 01:46:04PM -0600, Mathieu Poirier wrote: > If less space is available in the perf ring buffer than the ETR buffer, > barrier packets inserted in the trace stream by tmc_sync_etr_buf() are > skipped over when the head of the buffer is moved forward, resulting in > traces that can't be decoded. > > This patch decouples the process of syncing ETR buffers and the addition > of barrier packets in order to perform the latter once the offset in the > trace buffer has been properly computed. > > Signed-off-by: Mathieu Poirier > --- > .../hwtracing/coresight/coresight-tmc-etr.c | 18 ++++++++++++------ > 1 file changed, 12 insertions(+), 6 deletions(-) > > diff --git a/drivers/hwtracing/coresight/coresight-tmc-etr.c b/drivers/hwtracing/coresight/coresight-tmc-etr.c > index 4f000a03152e..bae47272de98 100644 > --- a/drivers/hwtracing/coresight/coresight-tmc-etr.c > +++ b/drivers/hwtracing/coresight/coresight-tmc-etr.c > @@ -946,10 +946,6 @@ static void tmc_sync_etr_buf(struct tmc_drvdata *drvdata) > WARN_ON(!etr_buf->ops || !etr_buf->ops->sync); > > etr_buf->ops->sync(etr_buf, rrp, rwp); > - > - /* Insert barrier packets at the beginning, if there was an overflow */ > - if (etr_buf->full) > - tmc_etr_buf_insert_barrier_packet(etr_buf, etr_buf->offset); > } > > static void __tmc_etr_enable_hw(struct tmc_drvdata *drvdata) > @@ -1086,6 +1082,13 @@ static void tmc_etr_sync_sysfs_buf(struct tmc_drvdata *drvdata) > drvdata->sysfs_buf = NULL; > } else { > tmc_sync_etr_buf(drvdata); > + /* > + * Insert barrier packets at the beginning, if there was > + * an overflow. > + */ > + if (etr_buf->full) > + tmc_etr_buf_insert_barrier_packet(etr_buf, > + etr_buf->offset); > } > } > > @@ -1502,11 +1505,16 @@ tmc_update_etr_buffer(struct coresight_device *csdev, > CS_LOCK(drvdata->base); > spin_unlock_irqrestore(&drvdata->spinlock, flags); > > + lost = etr_buf->full; Comparing to the previous version, it drops '|' bitwise operator; seems to me this is more neat :) I think Yabin's testing is more convinced, so I skip to test. FWIW, these three patches look good to me: Reviewed-by: Leo Yan > size = etr_buf->len; > if (!etr_perf->snapshot && size > handle->size) { > size = handle->size; > lost = true; > } > + > + /* Insert barrier packets at the beginning, if there was an overflow */ > + if (lost) > + tmc_etr_buf_insert_barrier_packet(etr_buf, etr_buf->offset); > tmc_etr_sync_perf_buffer(etr_perf, size); > > /* > @@ -1517,8 +1525,6 @@ tmc_update_etr_buffer(struct coresight_device *csdev, > */ > if (etr_perf->snapshot) > handle->head += size; > - > - lost |= etr_buf->full; > out: > /* > * Don't set the TRUNCATED flag in snapshot mode because 1) the > -- > 2.17.1 >