Received: by 2002:a05:6a10:f347:0:0:0:0 with SMTP id d7csp3382799pxu; Tue, 8 Dec 2020 10:30:06 -0800 (PST) X-Google-Smtp-Source: ABdhPJx/hcozV5W4VUCNtMvfKJKDSnLII7btoF3qJqIs905mZn3r+JeUvFt3T5B9RfV24sWDC4p7 X-Received: by 2002:a17:906:fa12:: with SMTP id lo18mr24872587ejb.354.1607452206390; Tue, 08 Dec 2020 10:30:06 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1607452206; cv=none; d=google.com; s=arc-20160816; b=Hgj/Sfjh6qD1LuFpUaIFdpOiw2vtjVMxBUHjF6kiIKmEtoWK7CEykZJBZAcOXktXPN grxi13r2OSababT1CR9AS4vc+Gz36eTtmQn3APfiitASJ0nlEYoEZN5oxTz1XouQERzo E6ti36KX0pv/g/J5HoyGQ3nmfvuSYsd2iuf3K7zxMStdL0UHcU9R6+6gagpP0BAscW+n aQeBPGTuwvIglHPm1ehMEBJlBM1lurdsFUNoisKp2QSVkoG2G953jT/XkvMeXS9G0rEd eI8gznAoGMeujts5QH3zQqy5R3RJ5roAk5SkVvmphapr1LYM1C8TRxFfwhZXbuCCDjmK P88Q== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=T7D2HqY1JKxrM7aJb3nroXXXqA1ZMjjPluN2mhdyvKo=; b=C+EpEZvv9y4pTVHhfTKVLaS/vue1BodEP9lgkrcvu/8wVagXX0kJWYh8YClPcIH4Bl AoJdDc3BCGXsBzBXpxlru80IS4KIfivi8tmcwwfT5qSgKSBF+r2UVfZpY2wN9v4bbgDq ttmgpvHde5P9zTqEGH9n/S3apA9yz26h3rv/wCv+01SRds6YMAVJoiwbA7PQFYdTSuw7 uLYNwWlHvVFTC844b8cZe4HdMiZAMDR6GjatI03FVQ4CdvH3ZE5iAVk1OfROghxvBc6y zGNcPpfqqvV+RglbemBvTfmBuYbAF3oJO1S1MfOgWSQlbKtjXZZCHGc73GNeJARkO3iC E8OA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=QbTqa4XV; 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 f12si8725083edx.584.2020.12.08.10.29.39; Tue, 08 Dec 2020 10:30:06 -0800 (PST) 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=QbTqa4XV; 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 S1731047AbgLHS1f (ORCPT + 99 others); Tue, 8 Dec 2020 13:27:35 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:46268 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1730231AbgLHS1e (ORCPT ); Tue, 8 Dec 2020 13:27:34 -0500 Received: from mail-pf1-x444.google.com (mail-pf1-x444.google.com [IPv6:2607:f8b0:4864:20::444]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 963D8C061794 for ; Tue, 8 Dec 2020 10:26:54 -0800 (PST) Received: by mail-pf1-x444.google.com with SMTP id 131so14662602pfb.9 for ; Tue, 08 Dec 2020 10:26:54 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=T7D2HqY1JKxrM7aJb3nroXXXqA1ZMjjPluN2mhdyvKo=; b=QbTqa4XVzzXAdXNpa304Il124Uo61WdscqLgPT4RvN2oBSw7XMUcdFchGwydvmOHK8 wFHFTYFgneEDnFusai3K1pwLCEyy4idPwbG7Oc5fI9A2yg1VCATK90PA3ehXaDSs0WzA gGWIZj7KGgLwxqHhjBaiKYNy9PIj/lxZUOI9eoR1NyU2UdncGw+TsX5UQR8Khh8As9VI ro/Pa3KOJNYa7/4mSXEG07SATh67bSz4azEr/QWA4WRm3rh8UnTWIbxzpYpD6wTxIyn9 CJ0yvGgKp3u/fe9Hcy+/ex5Pwr4S21x39f/H/c2678qPzCCqUEujGGbQGqpyvCQz5L/G +7Dg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=T7D2HqY1JKxrM7aJb3nroXXXqA1ZMjjPluN2mhdyvKo=; b=XW49Y2xx46uMMrYWc+WlcOoPsuK+WEfNzg3GzrbGk1NFNyE93QSxm+qflJNcfGZxfr UUMbia7DbbUQYqTY7jqrHLb740EVGfNrB0R785f/Y0uWlZo6ZrIpQyuFTSu1dpTgW8CJ NvffFqR94merrTTrT2KNM5DSi+4Io1RNDrukjWKvzSgp0qEuGVg0Vi89xCZWyITHuHMH sWtiymS7oqLUmwABpFHp9wG0dCJkoC//h4w/Y5TI9QYA/thZyNaPf/MF5kxkoSNvXTNB JSDEmQt3pVFxqv7AvE/sEeaA3odnLUr3jpsPboMTkilHN0YX0XQQMKfBCrvYy2M/8e3F 83EQ== X-Gm-Message-State: AOAM5328wML026OZFY6N9oqeQMCOeHA88ChKLTV66PYDv1Nq8YUf9vCW mQ67Y9X5DudUW/GgxL8y8hRbkQ== X-Received: by 2002:a17:90b:204:: with SMTP id fy4mr5374684pjb.57.1607452014185; Tue, 08 Dec 2020 10:26:54 -0800 (PST) Received: from xps15.cg.shawcable.net (S0106889e681aac74.cg.shawcable.net. [68.147.0.187]) by smtp.gmail.com with ESMTPSA id nm6sm3966801pjb.25.2020.12.08.10.26.53 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 08 Dec 2020 10:26:53 -0800 (PST) From: Mathieu Poirier To: gregkh@linuxfoundation.org Cc: linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org Subject: [PATCH 1/3] coresight: tmc-etr: Fix barrier packet insertion for perf buffer Date: Tue, 8 Dec 2020 11:26:49 -0700 Message-Id: <20201208182651.1597945-2-mathieu.poirier@linaro.org> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20201208182651.1597945-1-mathieu.poirier@linaro.org> References: <20201208182651.1597945-1-mathieu.poirier@linaro.org> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Suzuki K Poulose When the ETR is used in perf mode with a larger buffer (configured via sysfs or the default size of 1M) than the perf aux buffer size, we end up inserting the barrier packet at the wrong offset, while moving the offset forward. i.e, instead of the "new moved offset", we insert it at the current hardware buffer offset. These packets will not be visible as they are never copied and could lead to corruption in the trace decoding side, as the decoder is not aware that it needs to reset the decoding. Fixes: ec13c78d7b45 ("coresight: tmc-etr: Add barrier packets when moving offset forward") Reported-by: Al Grant Tested-by: Mike Leach Cc: Mathieu Poirier Cc: stable@vger.kernel.org Signed-off-by: Suzuki K Poulose Signed-off-by: Mathieu Poirier --- drivers/hwtracing/coresight/coresight-tmc-etr.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/hwtracing/coresight/coresight-tmc-etr.c b/drivers/hwtracing/coresight/coresight-tmc-etr.c index a31a4d7ae25e..bf5230e39c5b 100644 --- a/drivers/hwtracing/coresight/coresight-tmc-etr.c +++ b/drivers/hwtracing/coresight/coresight-tmc-etr.c @@ -1552,7 +1552,7 @@ tmc_update_etr_buffer(struct coresight_device *csdev, /* 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_buf_insert_barrier_packet(etr_buf, offset); tmc_etr_sync_perf_buffer(etr_perf, offset, size); /* -- 2.25.1