Received: by 2002:a05:6a10:f347:0:0:0:0 with SMTP id d7csp9261599pxu; Mon, 28 Dec 2020 10:43:56 -0800 (PST) X-Google-Smtp-Source: ABdhPJyVBWeMMXUT/IOmA2YGf17r+Ui4vtEY+iJvSUaeqdgGAbf4zGhOSs6cx/qINGesYyuyw8ai X-Received: by 2002:a50:e846:: with SMTP id k6mr43915470edn.245.1609181036116; Mon, 28 Dec 2020 10:43:56 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1609181036; cv=none; d=google.com; s=arc-20160816; b=jsQMC6atT+6wLDdQZUoqa3nqjsWegqbCGt24Vqoh/tlqS7qh6qFian6bYBTPtuU7jL ay2g7jyZqGebwTF24xwdiFyRXcoOcbjgC/MZd0ILsby7twJUGzBOZt9pXPPWfKOWEWcH 2aKZ48c0acFYfZ25gEDt5KOMYvThcAnd6muEwx7cDo0CL8icftNQzOyBOVxLwtiad2Jx JUUu5STA/VoylfsMQg3cmrcoPMkM2gR6Qlmvv0hsApE1+CAQHmKSylHpF5uwiejSd9xY WeTSYaDDyrsr6GXrV9cttF/gTgvrXp5Wp0EBom4FjO/tOXQa8xDf2DfH5OGahWiq5mJV Fc/Q== 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 :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=Q4riUdBLU1RibQWNSqe1gsHHwcNU/y/h9HeRx5gB8+g=; b=zsOrmh6oPoRz6hXoFXzpZTgaKRbAyqf3xNjw/1MKl865vLtqoine9YyiQIlzPON17Y TRNApEmiLIHReTkr2ht9EvI6xfLBCB8cf9fU56BxbzAkomx7eGWC/BJKeeSMhwtyukIB altiu0BXEa2yAY+zLa+qbFf8kDZpbtW03opsm+1tg4KyhzBloNZvr4A3b1CbKJL2RusN 3rG9l5kyX7pk0fRaRhVYkLlM2ULyzaEqD9dCyqZrtvwRQABsB+rXTHfpyUXEPwWrbyd7 81MijDUVUDHKb+sNAq0B5CeqxCkBLXCCfFWS6zX1v8M0QUQAXthopimhgzhsutVPkEbL REiw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=qd8uHsFE; 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=linuxfoundation.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id gb36si18902494ejc.696.2020.12.28.10.43.34; Mon, 28 Dec 2020 10:43:56 -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=@linuxfoundation.org header.s=korg header.b=qd8uHsFE; 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=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2403938AbgL1Nkf (ORCPT + 99 others); Mon, 28 Dec 2020 08:40:35 -0500 Received: from mail.kernel.org ([198.145.29.99]:40752 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S2403922AbgL1Nkd (ORCPT ); Mon, 28 Dec 2020 08:40:33 -0500 Received: by mail.kernel.org (Postfix) with ESMTPSA id 3546122472; Mon, 28 Dec 2020 13:39:52 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1609162792; bh=9AveZ90NTvNgrW35by+X/NMIQhtS9w+XJqObNv3Jv8w=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=qd8uHsFEIjTXPnaavy0vBccyc42XQcZvZ8Z2LdeEODPoFKKvILceSvRm+PtIYzi6v vFATD2vlectejK1xgeYgifPH5ZGEv+mne13bQqcrRuhmvidmg14Tf9B4iq04+pjtBN 3lnIx01Al83mqLTmd6ujV1HtRR7ImZ1rBB5KHWhc= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Mathieu Poirier , Al Grant , Mike Leach , Suzuki K Poulose Subject: [PATCH 5.4 063/453] coresight: tmc-etr: Fix barrier packet insertion for perf buffer Date: Mon, 28 Dec 2020 13:44:59 +0100 Message-Id: <20201228124940.278097060@linuxfoundation.org> X-Mailer: git-send-email 2.29.2 In-Reply-To: <20201228124937.240114599@linuxfoundation.org> References: <20201228124937.240114599@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Suzuki K Poulose commit 83be0b84fe846edf0c722fefe225482d5f0d7395 upstream. 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") Cc: Mathieu Poirier Cc: stable@vger.kernel.org Reported-by: Al Grant Tested-by: Mike Leach Signed-off-by: Suzuki K Poulose Signed-off-by: Mathieu Poirier Link: https://lore.kernel.org/r/20201208182651.1597945-2-mathieu.poirier@linaro.org Signed-off-by: Greg Kroah-Hartman --- drivers/hwtracing/coresight/coresight-tmc-etr.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) --- a/drivers/hwtracing/coresight/coresight-tmc-etr.c +++ b/drivers/hwtracing/coresight/coresight-tmc-etr.c @@ -1535,7 +1535,7 @@ tmc_update_etr_buffer(struct coresight_d /* 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); /*