From patchwork Tue Sep 24 23:39:30 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ilkka Koskinen X-Patchwork-Id: 13811393 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 8C857CF9C69 for ; Tue, 24 Sep 2024 23:41:32 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender:List-Subscribe:List-Help :List-Post:List-Archive:List-Unsubscribe:List-Id:MIME-Version:Content-Type: Content-Transfer-Encoding:Message-ID:Date:Subject:Cc:To:From:Reply-To: Content-ID:Content-Description:Resent-Date:Resent-From:Resent-Sender: Resent-To:Resent-Cc:Resent-Message-ID:In-Reply-To:References:List-Owner; bh=wYfHtq99ybCfWIaUuCw30Xkvjx0GsyzDqazqNcMg0Gs=; b=QDaQWjlTXsTAw8zd6m8BC8ZHg4 XVZe1Af8AVWAFFOV+U4kkNnBkDo5GBxAMOEkZ2kPHQ2RcBsCRxBCIwTvVAxM0/T4xqU3MUxxx0D/W YGwc3+uGOiDk1R8Bpx7inbSEuJIb8eOHDopamTJSWI3hv9LNeb8Y3OsL0JYsfdXtRRrTs3LjjAIVb WBzjXgLaFWM6DQHJm1WtvBn9mOrMii4xGpHGjUGhOWDpGsI2TGALeM6STMaTg9qH5snFeKJkuVh2x OKaXw4UrQiUc8HCGN2PUyXqmR1ln2VfmlUoUMU434QGNHzpKxkRtwAJABPRWIbbxSe7EG6Nw3vE0L FSBHvpag==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.98 #2 (Red Hat Linux)) id 1stF9k-00000003aGV-33I3; Tue, 24 Sep 2024 23:41:20 +0000 Received: from mail-centralusazlp170100005.outbound.protection.outlook.com ([2a01:111:f403:c111::5] helo=DM1PR04CU001.outbound.protection.outlook.com) by bombadil.infradead.org with esmtps (Exim 4.98 #2 (Red Hat Linux)) id 1stF8b-00000003a9E-2V61 for linux-arm-kernel@lists.infradead.org; Tue, 24 Sep 2024 23:40:11 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none; b=TXJXJ3VmlBPsbZkMH+wu9TVvwlfNlM0w3b1Xi0Q8DIf/nenx2iYkohXPztSmjvY5BHvgUyeYt5mLy9d1JpU8HXs7b7Mzgxo7dZ0CKdsL54KiPoz+FffsfUJnU3fojfRviY3dNjt+G/QYwU+2LLUlhIOTpZ3Ba858L2sP0mXfBzKuj6za/YfaD6LnCKazRscABuplkWw/1AKf5Xk2YuArrDq8iJkoNh0xh4v9LavntN1V7iX6q7O+Q6PVsX4Ha8UdCJpWIB3g9f4tC/5Aex6xLGu/Vv9hu4x5fNNoQrwpyw1VGML/cBxd22HvK2DN72UGA1PM2Ztv1OvHVl6zDCHjpQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector10001; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=wYfHtq99ybCfWIaUuCw30Xkvjx0GsyzDqazqNcMg0Gs=; b=h+l5sPXU9WClsHHH3xhr5qUatCVAyXRMVvS9Q7+9xYW/jqbNW8s7igr4IEksC6JTfg+o7R5mpnPCThjy3bQ+7eHOOqsK/8UCC4tR3ytDGgJj4VPCAN1ITYElbatK0yXMJCOuxI77YAQIT5ZeVJ66+TIgIzjSwxr7/DNNRJZRWvrWYgdqYY7xAynLnP7Qn+bPONJxKVqDqUlfqTyulfoRJ+E8TDOlHbqH6s14z9Qh3AG9Ra/lhL+h4P6xJnMXtFbc+O6Bvv7YQg+wUUjsLRThncQHXnk5HFuAf56Dx2cBY2Sa9oE4FySTBMrc1KLLkfHpXxByF0x6C9fC/gBcBAfQWg== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=os.amperecomputing.com; dmarc=pass action=none header.from=os.amperecomputing.com; dkim=pass header.d=os.amperecomputing.com; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=os.amperecomputing.com; s=selector2; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=wYfHtq99ybCfWIaUuCw30Xkvjx0GsyzDqazqNcMg0Gs=; b=VwZI05cWDIpEayCYCMuq51HR7UZyBHKKO2JMtmvsuhtxySeVXYey3MspBg5Kyo/0IgN4Bl+8UCD/b8a0WolHJGpviTSrs4hHlXmLxp4YFuC9z2D8mem6ABLBqKnEnJj8khLPAo5KZKHYal899jOzGS5DJVQSCdFczAVQO8eB1wk= Authentication-Results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=os.amperecomputing.com; Received: from MW4PR01MB6228.prod.exchangelabs.com (2603:10b6:303:76::7) by BY1PR01MB8922.prod.exchangelabs.com (2603:10b6:a03:5b6::9) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7982.27; Tue, 24 Sep 2024 23:39:52 +0000 Received: from MW4PR01MB6228.prod.exchangelabs.com ([fe80::13ba:df5b:8558:8bba]) by MW4PR01MB6228.prod.exchangelabs.com ([fe80::13ba:df5b:8558:8bba%7]) with mapi id 15.20.7982.022; Tue, 24 Sep 2024 23:39:52 +0000 From: Ilkka Koskinen To: James Clark , John Garry , Will Deacon , Mike Leach , Leo Yan , Suzuki K Poulose , Peter Zijlstra , Ingo Molnar , Arnaldo Carvalho de Melo , Namhyung Kim , Mark Rutland , Alexander Shishkin , Jiri Olsa , Ian Rogers , Adrian Hunter , "Liang, Kan" Cc: linux-arm-kernel@lists.infradead.org, coresight@lists.linaro.org, linux-perf-users@vger.kernel.org, linux-kernel@vger.kernel.org, Ilkka Koskinen Subject: [PATCH] perf: cs-etm: Fix the assert() to handle captured and unprocessed cpu trace Date: Tue, 24 Sep 2024 16:39:30 -0700 Message-ID: <20240924233930.5193-1-ilkka@os.amperecomputing.com> X-Mailer: git-send-email 2.42.0 X-ClientProxiedBy: CH0PR03CA0249.namprd03.prod.outlook.com (2603:10b6:610:e5::14) To MW4PR01MB6228.prod.exchangelabs.com (2603:10b6:303:76::7) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: MW4PR01MB6228:EE_|BY1PR01MB8922:EE_ X-MS-Office365-Filtering-Correlation-Id: 423c77f3-25fe-43eb-c879-08dcdcf23006 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0;ARA:13230040|1800799024|366016|7416014|52116014|376014|38350700014|921020; X-Microsoft-Antispam-Message-Info: odJzWoEp+WE9Kjl4UjyxgCIuWcqKKLvrvMAswzDMPjHBFqCiPMguHOT8k2n2M41DFpUGm9Uy2PQ8C3hENr9EjTT6u8pxIpqefEpPr4z6clGyrgbaR+R41zY1yAF7mz1BR6xHHmCm7/0Kpx9gLTxmyFEVg0traYvJqw8J3F46+9NeNI/FbtNURE8k3+55OB80iBDFgk7rk865q+EArP+St9x9XQT9mpjkNqQBwomA6o/C/NHEL4cnqytE81wR/9IlPgCSatLx/7vvsDSPdzDbbUupcYUO8XC9q3iZJOf+rwz0jBH3q5wtSxMw6BMKu0Px+1HsyO69uQbq/SgfIyzMu8a3VLpVQ1vodZdl8/Uy0VYtrr1IvBq9V57SIecfMFf09k9+Qrio6XXDffrNYnrkgd2fRymKYwudCmKnImO5H0rJha+w+CHK0m1c66H3R3nmDlEJIhpD0obWsP/ScGkBfsFl2CUqBOBXlyD/jPlAHODPL5+rrNNlAJiiG0PKt83twJdwu7wectxstN6psVir87DOMeD0q5R2Dp3BR8DYjDfQOJvHjbxlM8mdA1E4ynHMTRcWtRt4SJJE4/twI6+DsOUKuzqN12txL/McmruVIlK+1XCfQnv4Rw2l6u5hgypmm8idWcohiiwuIBw4Gf+/9/DUPxL+jNWD19ZOWve8XW1JBkYQM1iLWMNQDYVMEDjL6miAh0vEhWXaY3Chiv3+BuJAXRh03fOopRa/WmR/KZ5w76tHlSE3zbLiYCOlYs9i7gV3ZRMEE8Eirgqile+NC57Rd77lbcoU0+DN0nO5WZtPvLmmSkqaMfJvnsARzJ1Nnl+6TxAhdAWILifzl/FwjDsjs6/KDa06T3oPiAuy+IG7txSDWq4QIAZIY6nhnFUIB6K3hU7oYir/787/GX0ikNMEPD8z+CD03mw0KD+OKwpBXVVABg5ualY8odG2UrGvDXzwoSx/CPlJ1Hxu+LHRoSj8LtyKtPfEODVG2XJrVoML07rFRRXSyzRjk0Na+o7ocM3a19qXpusjDywNg6Cshf1EN5UXFz0JLQhr8U/laTSoixviNmwYr/hdJn2qGNf72yzv/LCXVfNFuF07+IBFbVpU3K4HC7hARNAGzdm0jq+hx+qejOho3HfOArvb7aOzN4L0lYLDPyRqGEhcfW1bwkJ6YJwkioH9rDlh10fwFY2+BubiinLHzfk5Px98Udg7jd6zl4dVsYXyyNpVZ317iRAOVNMq+W5LgehJPL5jZGYwlgdbBeyFTD1oRPaRh0wNwx4udzNEyZzSUjDv6oVI7Aa6BgX6NC8v0ofheOeoh7wQfhApj/jOaHgkpffnJSsJMMgKnE9BWXLH8xVtlInZYM8ftqyeVBoptATNx+BG3OOi6bifQxiCyCOxbrUUxICs+PI9CEnI+EhN5+xYPlIjAIEJuQ67owC91fTuBc85dkk= X-Forefront-Antispam-Report: CIP:255.255.255.255;CTRY:;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:MW4PR01MB6228.prod.exchangelabs.com;PTR:;CAT:NONE;SFS:(13230040)(1800799024)(366016)(7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CL+gW/fbv2/4fXn1o9fmsLbj7mpdZkbYQzAA00V7vm7suR+QIwypwrq3wffC3cqMDcNysQjrqChq307GhuOe6OSvzFMg3Bqjvn5yfCWWO/bK9x4cL7XcPiF0nQxfZGYwWsl+jTuFEVaCeTtIxL5+zLIsCbZ4cMQ+MAzX00aSttoo37ULmzMLHJmlmHcDk8fFqnX3vanUvjr5SFYDkCAtmRpuDHVvrmfuXCccRg8HvDFgdh7keO8ethABV5ngmvikEQMxuNDCvJ8c8+VRqtnhKqBBAC4uySl83aLK/fhUa+ZHZS2ypBRh/zUcN75wNc3E2+qhoxgOBZBALsGwlFLW767hnup4AKkemxwZhPoxhYu2OA0Aa8b2fGwAKHpxTpiOYjy/VO3u7TN2hLpDSU3tvUU6807M54PX6a09X64whJZ8w7+hK6bZl3XaALlvlqHIPamKM4EUIUlXQqSicKqg7Cssju53br6OL5XLa21sp37kCgoyxSjpg9GrDtJXRxrqZidgH8N2o4Oiv+WnYw1WgQSr0bfwkCuPqJjTcpiy+73PmjlkCyaEvCh59pvgBR/+xC78tPir06Jb2mB/fLOjU36Hl5SS5XVrXEV1TMtgGZs2B0Bu9gHutRMEd4iK+E+G6Kedt50B8D73rPMrFy2kpCgppL5XIS4= X-OriginatorOrg: os.amperecomputing.com X-MS-Exchange-CrossTenant-Network-Message-Id: 423c77f3-25fe-43eb-c879-08dcdcf23006 X-MS-Exchange-CrossTenant-AuthSource: MW4PR01MB6228.prod.exchangelabs.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 24 Sep 2024 23:39:52.7423 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: 3bc2b170-fd94-476d-b0ce-4229bdc904a7 X-MS-Exchange-CrossTenant-MailboxType: HOSTED X-MS-Exchange-CrossTenant-UserPrincipalName: NwcZ8NqpamIz11zXykQfP/0/cQ/7e7Cfld7dRN1lpAP/3JjJvZNke7yz1fcViphz/5ZVGJR2SJjSOzIB0Y0ebJdrjZGSq2OaZM4yCcoZ/94zCeWOonIPbQiCa3/7nv+3 X-MS-Exchange-Transport-CrossTenantHeadersStamped: BY1PR01MB8922 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20240924_164009_697398_B0356FEF X-CRM114-Status: GOOD ( 14.50 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org If one builds perf with DEBUG=1, captures data on multiple CPUs and finally runs 'perf report -C ' for only one of the cpus, assert() aborts the program. This happens because there are empty queues with format set. This patch changes the condition to abort only if a queue is not empty and if the format is unset. $ make -C tools/perf DEBUG=1 CORESIGHT=1 CSLIBS=/usr/lib CSINCLUDES=/usr/include install $ perf record -o kcore --kcore -e cs_etm/timestamp/k -s -C 0-1 dd if=/dev/zero of=/dev/null bs=1M count=1 $ perf report --input kcore/data --vmlinux=/home/ikoskine/projects/linux/vmlinux -C 1 Aborted (core dumped) Fixes: 57880a7966be ("perf: cs-etm: Allocate queues for all CPUs") Signed-off-by: Ilkka Koskinen Reviewed-by: James Clark --- tools/perf/util/cs-etm.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tools/perf/util/cs-etm.c b/tools/perf/util/cs-etm.c index 90f32f327b9b..40f047baef81 100644 --- a/tools/perf/util/cs-etm.c +++ b/tools/perf/util/cs-etm.c @@ -3323,7 +3323,7 @@ static int cs_etm__create_decoders(struct cs_etm_auxtrace *etm) * Don't create decoders for empty queues, mainly because * etmq->format is unknown for empty queues. */ - assert(empty == (etmq->format == UNSET)); + assert(empty || etmq->format != UNSET); if (empty) continue;