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=-18.7 required=3.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_CR_TRAILER, INCLUDES_PATCH,MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED, USER_AGENT_GIT 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 52806C433FE for ; Tue, 8 Dec 2020 18:27:50 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 2B40423B51 for ; Tue, 8 Dec 2020 18:27:50 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1731051AbgLHS1f (ORCPT ); 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-Google-Smtp-Source: ABdhPJwCvA4V7v/PzB3mEiWSPfELFIBTwlVNQBw2r0gmO8pyFyUjFSsGqQObB9PXeSm+MxptpaeXnA== 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 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=-16.8 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,URIBL_BLOCKED, USER_AGENT_GIT 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 5C62EC4167B for ; Tue, 8 Dec 2020 18:28:12 +0000 (UTC) Received: from merlin.infradead.org (merlin.infradead.org [205.233.59.134]) (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 0E39723B51 for ; Tue, 8 Dec 2020 18:28:12 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 0E39723B51 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=merlin.20170209; h=Sender:Content-Transfer-Encoding: Content-Type:Cc:List-Subscribe:List-Help:List-Post:List-Archive: List-Unsubscribe:List-Id:MIME-Version:References:In-Reply-To:Message-Id:Date: Subject:To:From:Reply-To:Content-ID:Content-Description:Resent-Date: Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Owner; bh=wB7aa7PQCFtUl/BW73SRk32706Ux0IhyYOwa2w+dsGE=; b=MvnOaJEgnw/1OEkVZYpv+lGmT prUm6JmsQnGk9bKBEnpLpELzQTye4JHVl1aV1cpvuF8OFcOwhv53+vNk1mlM+PkIiZdYmibBhTaW5 KJXIIqGb4SQiOjYyH0mYD6+fr59c4QzkkTN0v6pgaHfGf38F/0m4mYlIVQHhuCHYoDN6sOL4LnkKm bTOA7LjEqd/zRs9q3DZcMccG9Iz3QfQxDelvZ7OCXZG3CVLhufcpYGLTmVhBYOaNPi8OYfyTS7szG bY9r+Ze28DwnSiyPv/D3gbrhEUBiY2lHG/qH+FCMFlx83pDjw2fb1F3gSwxCJIPinGt4O+ZP3gMdU Y8SHN5ITg==; Received: from localhost ([::1] helo=merlin.infradead.org) by merlin.infradead.org with esmtp (Exim 4.92.3 #3 (Red Hat Linux)) id 1kmhhV-0001xw-Gr; Tue, 08 Dec 2020 18:27:01 +0000 Received: from mail-pf1-x442.google.com ([2607:f8b0:4864:20::442]) by merlin.infradead.org with esmtps (Exim 4.92.3 #3 (Red Hat Linux)) id 1kmhhQ-0001wR-7b for linux-arm-kernel@lists.infradead.org; Tue, 08 Dec 2020 18:26:57 +0000 Received: by mail-pf1-x442.google.com with SMTP id f9so14082383pfc.11 for ; Tue, 08 Dec 2020 10:26:55 -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=CF4Q1ROSdFZ22aBsgcNCVa2Gbt4yCCsfAKOa+132IK+F+3JokCHJ+uldG+nVlY28js 67jRiJY3x9zfFN7fpLeT+jYAHIia2pQRevQQfa7pHY8vyUWnfVzdYd2LCKptEbMD5mjV +rwlvLqEpwQ9IH5sON1/5slGFQ/KHr3Npaub2Ev6rsFu73YCCLVgU//nJeLNI9a15pBT Tm61K0khnlDQe+vEKtjtcZsy5WI9ZEgDYKXaJwHzBrhKMCTobazJogAbzWlbRblGnUoD k7ZTgfIhN0C7F5b1EkZGM/DcV46HvqwIDe4ssdUWU6U77bj6+Ku0ECGeUToAAe6mcVBD SgIg== X-Gm-Message-State: AOAM532XQCO7Dg7dQe/I+yckEkrKRO7tExHase14m8yoZNZsTlsUJDVv 5IuFz1cxRe7rVwksowbkCMTbw6xtEMNQhhBi X-Google-Smtp-Source: ABdhPJwCvA4V7v/PzB3mEiWSPfELFIBTwlVNQBw2r0gmO8pyFyUjFSsGqQObB9PXeSm+MxptpaeXnA== 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 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 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20201208_132656_369092_7DDB1684 X-CRM114-Status: GOOD ( 16.70 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: linux-kernel@vger.kernel.org, linux-arm-kernel@lists.infradead.org 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 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 _______________________________________________ linux-arm-kernel mailing list linux-arm-kernel@lists.infradead.org http://lists.infradead.org/mailman/listinfo/linux-arm-kernel