From patchwork Mon Dec 28 12:44:59 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Greg KH X-Patchwork-Id: 352651 Delivered-To: patch@linaro.org Received: by 2002:a02:85a7:0:0:0:0:0 with SMTP id d36csp9756451jai; Mon, 28 Dec 2020 05:44:26 -0800 (PST) X-Google-Smtp-Source: ABdhPJxihe9sBAWYO9D3BY6KozYoLOxpYvvRsQcAB/M9X0bxc34bGHiGZ+Y9Iovdvb4crcKueIVG X-Received: by 2002:a17:906:f153:: with SMTP id gw19mr42575479ejb.272.1609163066171; Mon, 28 Dec 2020 05:44:26 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1609163066; cv=none; d=google.com; s=arc-20160816; b=GIoMWjFU82988SwiYsciu+J+VuwHOJfAGP9IwXFYLvHwtLZ1eMlTWf4T393LaG1gmF WV/3yGxN37Hc9F7eH7LL/CeCORr9nGD09z09z2/Bah1gIV9WQZbeol7UWjoYzIL4t0l3 ZDG/f5pmioPL1fgPlW39ZNI5JR9WS6Ax554WNWM/1vSlgIdID2PI+CXwrOYDXUBbSQ0J sGuRAS/YfRC1FMk8nEZZFMNznUvcnVHPvD1k20NIJVXEkOg8Lr7n05FO0SBqY4L822ga x3YfXxVtgPRqThOaWVO57FMvkn42wSqwQmdzIUGJJmA4I7Tf2dNhBegHOgtUUcq3m6u7 4yBA== 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=ftRxBkU01EFd7QBJlWteMcAoGD7Noa+NILOUp2A/NVA0QD7CjkWFcS5tKXInH6N7u3 /Q0OXEgZHGC0BBhk+5oBZgCf6uK6zdjTDDkrMFwF/vYqVOOodYVcLf0M3OSI/J4k5eFS neSDIFF15BjcDFW3/8l2EXW5C5CuKLWk1+Gwr29eBQjkok+GKX5QsQHG3NDnUapo9dfP WUGzaluzeCaR1Ktc3l+9qmOMN7GEPZpv0VyhWuiKdJI6tE0jCx4iEVmaR5itGrgzqUeS F23d21ripbiip6E0nrdQVcnr5PbE6hazeYCNXlcf2x9UxPMSWIbFZ0xeVVA9myup1+DB TcAA== 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 stable-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=stable-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 v25si18990776ejx.201.2020.12.28.05.44.26; Mon, 28 Dec 2020 05:44:26 -0800 (PST) Received-SPF: pass (google.com: domain of stable-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 stable-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=stable-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 S2403929AbgL1Nke (ORCPT + 14 others); Mon, 28 Dec 2020 08:40:34 -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 Precedence: bulk List-ID: X-Mailing-List: stable@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); /*