From patchwork Thu Nov 7 16:07:18 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Deepak Surti X-Patchwork-Id: 13866715 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 26F17D43374 for ; Thu, 7 Nov 2024 16:15:54 +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:Content-Type: Content-Transfer-Encoding:MIME-Version:References:In-Reply-To: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:List-Owner; bh=jTitNezrnDKbgE4kBBdKx2gTtn2o1x8IwApXxf94/gk=; b=TQb/CLDMDnZZoEANnT9Tl7emP0 x03yUbv194lruHnPJvWi28HROoUQik0WupP0WibQN1Qg3gOX7oeB/FaYkgCKyMfI53ZG3VXDvvATs y3mbFX/++rUOV8ILz1ZBMay81HWokSqZs3u03k+dw3/M7n9Bf5pQ3gzeJXyEH1w330tLJMCgOjESD jGmKbGur+lsvOp3AHLAcrSLk+LBkUK2r63PFBKxowNHO7c9lyBo+VNMznmGXLedCCXju8WFWB9y38 tifSK4do2F2LHAuBVZirrNTcF/G8IAuk4BqSGTZxQW7x5yeAAqvQUPcdnBgpLCPnYWRP1JFhkO11M 5QYlOCMw==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.98 #2 (Red Hat Linux)) id 1t95Aa-00000007aES-2NPB; Thu, 07 Nov 2024 16:15:40 +0000 Received: from mail-db8eur05on20618.outbound.protection.outlook.com ([2a01:111:f403:2614::618] helo=EUR05-DB8-obe.outbound.protection.outlook.com) by bombadil.infradead.org with esmtps (Exim 4.98 #2 (Red Hat Linux)) id 1t953U-00000007Y9R-476h for linux-arm-kernel@lists.infradead.org; Thu, 07 Nov 2024 16:08:22 +0000 ARC-Seal: i=2; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=pass; b=icAplWHCnxI8MvEbxLCtrkeT4CGCtXwtNrCIadMiBeuTO64T8h7nQ8xtH8Ov4Cm0BrjleAwC4QsCLIt2NtKMe22NajqpNiVtSYGaA2zd5GtyMDkGcp0dBK9MUvZGGVkQUGbOyBk++RivSZUwQENZaIbrHSJldECf+CMgpQWf1tRX17FMzB/EMuH4VlPsZGvB6uqYLZDk00QxhOtxkBzY+eYRBMjn7pr2RvrH0VL/WEOgZ4s51zKACNS0CimVVIY9TXDkp4K9A59PGsh+x1b1Yo7htpeN5GpSY0ng6kHQqDzPzX/vCVw9bu0OYWZKE6Vg0RhQiGmLYq32HciiptlXzw== ARC-Message-Signature: i=2; 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=jTitNezrnDKbgE4kBBdKx2gTtn2o1x8IwApXxf94/gk=; b=tJgxY/hR6CeyBQRVV9O29avRXoNzh6ojIk+4XbQXtA6tSI+2KmM+FQDdsV5dz3y6uo+EAwU3UY/j5wlrfFx6UutY+pqmCOYRDDgj9URE5DBewR87Tyvg7Vrufrc4GKibHmvimiosL4RuG1s1g+qsUy8Ff1936BOmmPgu9gpCYw9BSVB9POEdI6KyRPjMrWqTxxGhb2x0PIXx5oHSNzneuqJSoH1BYBx/rGN7CMfcDnhzpZSEBgLSYvUO4faL/VTdIK11mZV1CNNa0qclC3FEt9zG94IDrnDdN+mS/lB4iMolzJwDjMw5ua8ql6tEL0+CdvpFGnVk3dpD4WicyJP6Pw== ARC-Authentication-Results: i=2; mx.microsoft.com 1; spf=pass (sender ip is 63.35.35.123) smtp.rcpttodomain=lists.infradead.org smtp.mailfrom=arm.com; dmarc=pass (p=none sp=none pct=100) action=none header.from=arm.com; dkim=pass (signature was verified) header.d=arm.com; arc=pass (0 oda=1 ltdi=1 spf=[1,1,smtp.mailfrom=arm.com] dmarc=[1,1,header.from=arm.com]) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=arm.com; s=selector1; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=jTitNezrnDKbgE4kBBdKx2gTtn2o1x8IwApXxf94/gk=; b=GIetak0DFGL4s5lrIHEdhqQ2oqS5QQpf6WAjdnBJkRcLgp2vmnDe4vTQDB4IWa8FxAhpw6ZR2XvlnNNeU6xnXa0pL09HfxU2r89Kh1oZI+8tZUFkQyGIqNyGp74b5BWKSpI0HMf00fZtB3k6EbzgM/nTPTOm9UI/hgrJOQSvOv4= Received: from DU2PR04CA0296.eurprd04.prod.outlook.com (2603:10a6:10:28c::31) by DU2PR08MB10230.eurprd08.prod.outlook.com (2603:10a6:10:46e::18) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.8114.31; Thu, 7 Nov 2024 16:08:16 +0000 Received: from DB1PEPF000509F6.eurprd02.prod.outlook.com (2603:10a6:10:28c:cafe::9a) by DU2PR04CA0296.outlook.office365.com (2603:10a6:10:28c::31) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.8137.20 via Frontend Transport; Thu, 7 Nov 2024 16:08:15 +0000 X-MS-Exchange-Authentication-Results: spf=pass (sender IP is 63.35.35.123) smtp.mailfrom=arm.com; dkim=pass (signature was verified) header.d=arm.com;dmarc=pass action=none header.from=arm.com; Received-SPF: Pass (protection.outlook.com: domain of arm.com designates 63.35.35.123 as permitted sender) receiver=protection.outlook.com; client-ip=63.35.35.123; helo=64aa7808-outbound-1.mta.getcheckrecipient.com; pr=C Received: from 64aa7808-outbound-1.mta.getcheckrecipient.com (63.35.35.123) by DB1PEPF000509F6.mail.protection.outlook.com (10.167.242.152) with Microsoft SMTP Server (version=TLS1_3, cipher=TLS_AES_256_GCM_SHA384) id 15.20.8137.17 via Frontend Transport; Thu, 7 Nov 2024 16:08:14 +0000 Received: ("Tessian outbound 373849c2df5a:v490"); Thu, 07 Nov 2024 16:08:14 +0000 X-CheckRecipientChecked: true X-CR-MTA-CID: 667e1c8edd42b742 X-TessianGatewayMetadata: EK41TypnulX21YfZgfSD2ZsOnd+9H62c03T5EixXfD4zsHHccOw2Ewj+ENOSRXKBTWL2cpkxiVuEsAD1W2T1t1RIer9IwrNt1vN928t32WXnpbn6C0qjljJY8C9Wd4NydvT7O70mbrqGQGppcvvmEtFpUzv89bqSwnBrmXR4Ogc= X-CR-MTA-TID: 64aa7808 Received: from Ld9aed62b4560.1 by 64aa7808-outbound-1.mta.getcheckrecipient.com id A8BD3BC4-F6FA-43B3-B59F-6D7AC9E7A79C.1; Thu, 07 Nov 2024 16:08:07 +0000 Received: from EUR03-VI1-obe.outbound.protection.outlook.com by 64aa7808-outbound-1.mta.getcheckrecipient.com with ESMTPS id Ld9aed62b4560.1 (version=TLSv1.3 cipher=TLS_AES_256_GCM_SHA384); Thu, 07 Nov 2024 16:08:07 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none; b=pO+0xw+1iHYmxHhVIVHfMOLSFzgBe5Ap9duYY/9B/2ixTbU4eEqOJGFEg+uq8XPbQJuxu2BBYFy2DSvTYQ4R26cLZeZaZ92Dj8NKnCPqPtN+VGmT/XbBKUFhW1rDWLKERn0L72KDwxFJjpiX46x+KfOFQoN3o+KgN5ytCOQujrx37H8Mx9iSS9EiRZRea2jbgO1wjo8SO/TfMK9X7s2OnLLL229EdSzNDPqqAbjA9j34nQM9aGqlJMBdF+yCF2q5tpc52VyTFCwIV+24eCqGMGngRT7M0AyQ8D/vvI9NldEWtf00RgfvNI9YJqJah4K4f40nAV4676IUNip148mp5A== 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=jTitNezrnDKbgE4kBBdKx2gTtn2o1x8IwApXxf94/gk=; b=OvsS6nbNa9xlNCr9C6jBrwUdbY1SCjs9dwudsRxTK3N9n/yDr4ZIMt/D8fgPupq/+7Knf08OMqonLz25Esll6SAma0v39gv1bia7JMNuyZqnpZPEhjOfxWob7pvSFATmuubDQxyugYqsQiKOW/Shc+55v2Mn11p9dTNyZCZ2mHi6m5uXve7ioOs2Dtl8G/PAfYu+h0kzS/El7+cUgkSQNOo5wvdbuKrIyawSFSF2KW3n1d/5PZKNo6UJHon8CEGaViWwd7fz3Ooh9jPTxHqtORIfJdN7eQAdI/P4dyeFvYTkdo9tK47icwz/eqeIxGjFQjvEd70Uwf/z6hnQ/EfPLQ== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass (sender ip is 40.67.248.234) smtp.rcpttodomain=infradead.org smtp.mailfrom=arm.com; dmarc=pass (p=none sp=none pct=100) action=none header.from=arm.com; dkim=none (message not signed); arc=none (0) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=arm.com; s=selector1; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=jTitNezrnDKbgE4kBBdKx2gTtn2o1x8IwApXxf94/gk=; b=GIetak0DFGL4s5lrIHEdhqQ2oqS5QQpf6WAjdnBJkRcLgp2vmnDe4vTQDB4IWa8FxAhpw6ZR2XvlnNNeU6xnXa0pL09HfxU2r89Kh1oZI+8tZUFkQyGIqNyGp74b5BWKSpI0HMf00fZtB3k6EbzgM/nTPTOm9UI/hgrJOQSvOv4= Received: from AM0PR03CA0025.eurprd03.prod.outlook.com (2603:10a6:208:14::38) by DB9PR08MB9539.eurprd08.prod.outlook.com (2603:10a6:10:453::12) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.8137.19; Thu, 7 Nov 2024 16:08:00 +0000 Received: from AMS0EPF0000019C.eurprd05.prod.outlook.com (2603:10a6:208:14:cafe::f6) by AM0PR03CA0025.outlook.office365.com (2603:10a6:208:14::38) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.8137.19 via Frontend Transport; Thu, 7 Nov 2024 16:08:00 +0000 X-MS-Exchange-Authentication-Results: spf=pass (sender IP is 40.67.248.234) smtp.mailfrom=arm.com; dkim=none (message not signed) header.d=none;dmarc=pass action=none header.from=arm.com; Received-SPF: Pass (protection.outlook.com: domain of arm.com designates 40.67.248.234 as permitted sender) receiver=protection.outlook.com; client-ip=40.67.248.234; helo=nebula.arm.com; pr=C Received: from nebula.arm.com (40.67.248.234) by AMS0EPF0000019C.mail.protection.outlook.com (10.167.16.248) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.20.8137.17 via Frontend Transport; Thu, 7 Nov 2024 16:08:00 +0000 Received: from AZ-NEU-EX05.Arm.com (10.240.25.133) by AZ-NEU-EX03.Arm.com (10.251.24.31) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2507.39; Thu, 7 Nov 2024 16:07:41 +0000 Received: from AZ-NEU-EX04.Arm.com (10.251.24.32) by AZ-NEU-EX05.Arm.com (10.240.25.133) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2507.39; Thu, 7 Nov 2024 16:07:39 +0000 Received: from e132406.cambridge.arm.com (10.2.3.22) by mail.arm.com (10.251.24.32) with Microsoft SMTP Server id 15.1.2507.39 via Frontend Transport; Thu, 7 Nov 2024 16:07:39 +0000 From: Deepak Surti To: , , , CC: , , , , , , , , , , , , , Subject: [PATCH v1 1/4] perf: Allow periodic events to alternate between two sample periods Date: Thu, 7 Nov 2024 16:07:18 +0000 Message-ID: <20241107160721.1401614-2-deepak.surti@arm.com> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20241107160721.1401614-1-deepak.surti@arm.com> References: <20241107160721.1401614-1-deepak.surti@arm.com> MIME-Version: 1.0 X-EOPAttributedMessage: 1 X-MS-TrafficTypeDiagnostic: AMS0EPF0000019C:EE_|DB9PR08MB9539:EE_|DB1PEPF000509F6:EE_|DU2PR08MB10230:EE_ X-MS-Office365-Filtering-Correlation-Id: c2b727d3-a336-4209-ce71-08dcff466264 x-checkrecipientrouted: true NoDisclaimer: true X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam-Untrusted: BCL:0;ARA:13230040|82310400026|36860700013|1800799024|376014|7416014; X-Microsoft-Antispam-Message-Info-Original: 6nrDMyYsVEdicetwPtPzqi5yyVJpMIDG925JUHWuPznpMyuYVoejACpxQ6phD9u0v/mtW4wtu1VARX7cbs9A+/MDL/o/hq5kiurCm9VUHxT2c2B6IakF3kDWgoi1Vo1S0J9b2cRkgfeArexTUtLihKyNCJfNPkG7cUPGDwGV/HTO2/7CSGU6UmF9/q5Hw4+yq/r+K5Y3YqERL73ASwzSH8Td/IG25VN7uoddkkVb+4sZMYyohPd1c85ROy2PSyuMz9y0YFCdM6Lqf+P9b8b0WmKLqZZpWX3lS8jvJeRQ8jc5onRsyB0w5Ic/ThmZpl3WdRHui9Aj9Nne28G2TcAKsRLZQNWfUcZo69YJxo1NJ1peInP2BDO23YXAGKtMDpDtTX1sm+ylRcU9uLIvDAWdY6Z6yI1ViVFvDd7JyexJpnA92JFqmYDflatoEtJ5myQrrk2KJftaegqFdMvyUdnlk5DGjdrz36pe37tz3iSdHgJXVmdtvjjBT4ukVUajQvJgiChIEooAKa+jwO2mXmO/HQ3F9pwJiwHKP9qYsaSbKqkiNhe4X6LfYXguZoS51gp7a14Qz8ZVV+KPRkovsHFqsrwsm8K6onu190bkdEJEapEDbeIwK5wm7ZuZgCyEFnY6AIFCN4VMx50uAabPafCmtZXNXRHC77QUWa1n5HEKSokILjYPeIZl3OuKtXN5fsXa26AhF4CgYNPl2P4Biuk9iAKYYQQq21EQCxd3PmS9VTPxzhDt3hlklI/QhopgXkr4SoJDYN2KkQVuEEmQstMnP2YhBu6WGkMQZd0m8cOBt2+OkO0jNN7PE97RXL3ZZ6YCiCpx6PIFVnA2GeI4fifWhdlw+AgBgIldXhweWQFAhFkEskX9BELwDZLmT/bGz7e4KVqIFP+bU9ONsAlcEYAAMjwR91Kxu6vRHWXiwI2e2klDBx7bzzsczKCRYbP2Yqgny1RM4Qd96ANmSubWWtx/Moi64nf6EYNRqfsZlwDsHCUh2BzH3zBIuQUQ5TlWo5Ks7Pc81+qKdx59wnYnBcuaddJupa6bDeHnkOXCCMXR7CweqZo0JYFi1ijZZIOm1/GtE3IDC3CL3likA2M2zJANkarzM3eIyoP+7BjQGhVVUc/9MpqXNX0xJ8ApT0o54ePigSdNCR9jVZYkRR0sO7+Xe6Frp1tlu8HulOuM59sAsESRIWfrlgZ7dme7j+fyvPDmoJf+KraG4NMjDVSTslkLVgVJQD9i8BUr4sKhQRfZxtVfVy8tnim+9Jg7Xu4yx9xXo++4tyz6aqca6a/RTHo8FIagCNUk9uoIQnQnNNrwUsWylsulBGj+3t+ys4DvjdvYmZOANe349xxvRHO0gQkyJrN4SUatCRhgXoIwT9VKPPrjMTLxHFITBVWXWH6fx02PYCctCXFweH3p6s2TWhXf4Q== X-Forefront-Antispam-Report-Untrusted: CIP:40.67.248.234;CTRY:IE;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:nebula.arm.com;PTR:InfoDomainNonexistent;CAT:NONE;SFS:(13230040)(82310400026)(36860700013)(1800799024)(376014)(7416014);DIR:OUT;SFP:1101; X-MS-Exchange-Transport-CrossTenantHeadersStamped: DB9PR08MB9539 X-MS-Exchange-SkipListedInternetSender: ip=[2603:10a6:208:14::38];domain=AM0PR03CA0025.eurprd03.prod.outlook.com X-MS-Exchange-Transport-CrossTenantHeadersStripped: DB1PEPF000509F6.eurprd02.prod.outlook.com X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id-Prvs: 545309ad-36af-4957-2982-08dcff4659f6 X-Microsoft-Antispam: BCL:0;ARA:13230040|35042699022|1800799024|82310400026|14060799003|36860700013|376014; X-Microsoft-Antispam-Message-Info: 1bKI71zKL7jeGyuKA/IaCx53+pDaVEwZfEaCRZ+gFAjZuT3MAFIxdF/nJkXG7Mlxj+/adJ8MpJVwUxjhzVALBlM7Ty3V6o6qca+brf8SYhYbw1YZ0pJ660pYrnA2L3/dhIB4pDuAl/7dRwniKe/r/5f45NFf2kaL0odPRjYERTgYO2NY2IolhwGwrtRN2AnYKRahcSHyyB7Wy/yEG3CKoj+uHHDCeScVfPsLGOytYioAa3MJ7ahr0eZdOPlVxiu71iX2r1MT4wNsSq+tTdz2iU2RBNsNwosr+EemRi1HONTMV/DpcDon1bkOXcsZ9KASjb7+FGfAn390xNNb5qn6z6gTd9bwWw5nE6XlEAPGZXrdOxtGmy7Cm+KMSmZ5cX7y+4fQCJqIlprs1Mq9W8kFxjugnsj7NYyb33mGMzA5lc8rdTWKL/2im3G5yhcfMoRjX1Cd4eRvn/S7QyhiC0QGt1HRtLKH/7ExrNJtrQcI60xs6ZnANJJIJPT6R0gE3Q5GKR/2OvTTMvYE7UY7pEivvdEBA32NyO/GiszEOJPdWFrfu66RzdNqtSu2Z+oY7J0QXGBMPqXiXbCHLehFkfaL27/afeIcvIqidpUCbAdTF5rGpf71YhAtwhM+zlQbVzDXXGcx+0JvhZpaujuocFfD2eZC66xv7nW6/Cvf8pUdDzrJ8fvqbUTNKUrLT3Xd8zXutv8mrxtF2VEmT6yWqZVJ3K57NZt8EW7yTNQHhexFcTvsHsViLdkwxQ7BxZtd4L9vQYQN0rF9YJWUmDLpB81kzVUuNO42Wxn/IlKdqm7sMhenWm8JuIMN0Mz21CEGo1wu4LaGO0SgUdgkGjopXgZ0cFYguiJNd0GA43tLdnbBN44Ac+lwLywRmwZr8h2MtLPvYK390squ5y0PCjjO2TeUU8XmhFwxxmZYFkrmJzLqBp7VuPbrh+J82c9WLM3eoHV2HfbKRt4SJirGuhNcgrDR8owlzH/pUADWMVRV1BsnuNTnsxCVin4hbM+L/OuF2Uu5xEUMwfh25CzFlxUnkwkTQaZJsx4dLxnr7KQKIScB+TfSeQT2Gpqh18FuECmER/L+l03JLbchIpoc9Efb7cWs/P8wbbpSrBbEQ0VsEgpdqLLIBIADFLGHOOtn8tKHrkZenNMn9SnGTf1GAp9A0c9fcnWI+40YUphxUpRh3kqktXJNDd5ReZ8vilvT78NsdEFc/FDIDxiuEXndeEThdaqcrXs3SVwZRxhPXh8C6gbkCHDQWJDD4Uvc6z4PAKmXJC6FnQk2OccY/jMfPeJNIpRi66AhO6y0Jk5wA2jSCV8wP9X52LDwKZrHQz/ueQNMr/b9pBfoACZRhQTiAhABqlUafIuMBSG9dZu5LjkW0C00JSoBchfcHRiC5tWIsiSmdeQiZ6R4lLngtO5NI4KufxDJIw== X-Forefront-Antispam-Report: CIP:63.35.35.123;CTRY:IE;LANG:en;SCL:1;SRV:;IPV:CAL;SFV:NSPM;H:64aa7808-outbound-1.mta.getcheckrecipient.com;PTR:ec2-63-35-35-123.eu-west-1.compute.amazonaws.com;CAT:NONE;SFS:(13230040)(35042699022)(1800799024)(82310400026)(14060799003)(36860700013)(376014);DIR:OUT;SFP:1101; X-OriginatorOrg: arm.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 07 Nov 2024 16:08:14.3335 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: c2b727d3-a336-4209-ce71-08dcff466264 X-MS-Exchange-CrossTenant-Id: f34e5979-57d9-4aaa-ad4d-b122a662184d X-MS-Exchange-CrossTenant-OriginalAttributedTenantConnectingIp: TenantId=f34e5979-57d9-4aaa-ad4d-b122a662184d;Ip=[63.35.35.123];Helo=[64aa7808-outbound-1.mta.getcheckrecipient.com] X-MS-Exchange-CrossTenant-AuthSource: DB1PEPF000509F6.eurprd02.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: DU2PR08MB10230 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20241107_080821_191547_885A3CC1 X-CRM114-Status: UNSURE ( 7.25 ) X-CRM114-Notice: Please train this message. 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 From: Ben Gainey This change modifies perf_event_attr to add a second, alternative sample period field, and modifies the core perf overflow handling such that when specified an event will alternate between two sample periods. Currently, perf does not provide a mechanism for decoupling the period over which counters are counted from the period between samples. This is problematic for building a tool to measure per-function metrics derived from a sampled counter group. Ideally such a tool wants a very small sample window in order to correctly attribute the metrics to a given function, but prefers a larger sample period that provides representative coverage without excessive probe effect, triggering throttling, or generating excessive amounts of data. By alternating between a long and short sample_period and subsequently discarding the long samples, tools may decouple the period between samples that the tool cares about from the window of time over which interesting counts are collected. It is expected that typically tools would use this feature with the cycles or instructions events as an approximation for time, but no restrictions are applied to which events this can be applied to. Signed-off-by: Ben Gainey --- include/linux/perf_event.h | 5 +++++ include/uapi/linux/perf_event.h | 3 +++ kernel/events/core.c | 39 +++++++++++++++++++++++++++++++++ 3 files changed, 47 insertions(+) diff --git a/include/linux/perf_event.h b/include/linux/perf_event.h index fb908843f209..9910b3c115d0 100644 --- a/include/linux/perf_event.h +++ b/include/linux/perf_event.h @@ -270,6 +270,11 @@ struct hw_perf_event { */ u64 freq_time_stamp; u64 freq_count_stamp; + + /* + * Indicates that the alternative_sample_period is used + */ + bool using_alternative_sample_period; #endif }; diff --git a/include/uapi/linux/perf_event.h b/include/uapi/linux/perf_event.h index 4842c36fdf80..bedae424ba36 100644 --- a/include/uapi/linux/perf_event.h +++ b/include/uapi/linux/perf_event.h @@ -379,6 +379,7 @@ enum perf_event_read_format { #define PERF_ATTR_SIZE_VER6 120 /* add: aux_sample_size */ #define PERF_ATTR_SIZE_VER7 128 /* add: sig_data */ #define PERF_ATTR_SIZE_VER8 136 /* add: config3 */ +#define PERF_ATTR_SIZE_VER9 144 /* add: alternative_sample_period */ /* * Hardware event_id to monitor via a performance monitoring event: @@ -522,6 +523,8 @@ struct perf_event_attr { __u64 sig_data; __u64 config3; /* extension of config2 */ + + __u64 alternative_sample_period; }; /* diff --git a/kernel/events/core.c b/kernel/events/core.c index df27d08a7232..579b04af70a2 100644 --- a/kernel/events/core.c +++ b/kernel/events/core.c @@ -4185,6 +4185,8 @@ static void perf_adjust_period(struct perf_event *event, u64 nsec, u64 count, bo s64 period, sample_period; s64 delta; + WARN_ON_ONCE(hwc->using_alternative_sample_period); + period = perf_calculate_period(event, nsec, count); delta = (s64)(period - hwc->sample_period); @@ -9806,6 +9808,7 @@ static int __perf_event_overflow(struct perf_event *event, int throttle, struct perf_sample_data *data, struct pt_regs *regs) { + struct hw_perf_event *hwc = &event->hw; int events = atomic_read(&event->event_limit); int ret = 0; @@ -9822,6 +9825,26 @@ static int __perf_event_overflow(struct perf_event *event, !bpf_overflow_handler(event, data, regs)) return ret; + /* + * Swap the sample period to the alternative period + */ + if (event->attr.alternative_sample_period) { + bool using_alt = hwc->using_alternative_sample_period; + u64 sample_period = (using_alt ? event->attr.sample_period + : event->attr.alternative_sample_period); + + hwc->sample_period = sample_period; + hwc->using_alternative_sample_period = !using_alt; + + if (local64_read(&hwc->period_left) > 0) { + event->pmu->stop(event, PERF_EF_UPDATE); + + local64_set(&hwc->period_left, 0); + + event->pmu->start(event, PERF_EF_RELOAD); + } + } + /* * XXX event_limit might not quite work as expected on inherited * events @@ -12244,6 +12267,12 @@ perf_event_alloc(struct perf_event_attr *attr, int cpu, local64_set(&hwc->period_left, hwc->sample_period); + /* + * alternative_sample_period cannot be used with freq + */ + if (attr->freq && attr->alternative_sample_period) + goto err_ns; + /* * We do not support PERF_SAMPLE_READ on inherited events unless * PERF_SAMPLE_TID is also selected, which allows inherited events to @@ -12700,9 +12729,19 @@ SYSCALL_DEFINE5(perf_event_open, if (attr.freq) { if (attr.sample_freq > sysctl_perf_event_sample_rate) return -EINVAL; + if (attr.alternative_sample_period) + return -EINVAL; } else { if (attr.sample_period & (1ULL << 63)) return -EINVAL; + if (attr.alternative_sample_period) { + if (!attr.sample_period) + return -EINVAL; + if (attr.alternative_sample_period & (1ULL << 63)) + return -EINVAL; + if (attr.alternative_sample_period == attr.sample_period) + attr.alternative_sample_period = 0; + } } /* Only privileged users can get physical addresses */ From patchwork Thu Nov 7 16:07:19 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Deepak Surti X-Patchwork-Id: 13866716 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 6D142D43374 for ; Thu, 7 Nov 2024 16:17:42 +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:Content-Type: Content-Transfer-Encoding:MIME-Version:References:In-Reply-To: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:List-Owner; bh=I9LqgE8dW4hUmHx3D52niMT7JXJ5J/OinSVhVWI7jHI=; b=PKWSEEPvKpskXsib+TVOftnlH8 ZOV49ndOwRB9oqziGFLVMpmOJFIdMvOvgBlD+/+u9xTPWWHPMqTDagiD3wXqYJpRioHd4SwPUqwz6 VcRcQ6iOTeZMApWT2kXBDgUnfz2xRZjGxX0u7E+glTwa9owILq5ZRUnaM3uwL3ux+mAKeUefy4Umq C+SK/y5sY/6lJhD7bF/vVO5BW5ZmTWzU9Vk/3lLfoVfR64QAyDuUMW8wr52DLx/e0sVc4mq+dcSFn KVoqhnXiAkd2tW8E4Seq97xILC+7LRPSzpLupjmMs1DPIx2RTqEsBMQYkb89BEy4B5im09dj9WXet P24Hqmxg==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.98 #2 (Red Hat Linux)) id 1t95CK-00000007agj-2mR9; Thu, 07 Nov 2024 16:17:28 +0000 Received: from mail-am6eur05on20621.outbound.protection.outlook.com ([2a01:111:f403:2612::621] helo=EUR05-AM6-obe.outbound.protection.outlook.com) by bombadil.infradead.org with esmtps (Exim 4.98 #2 (Red Hat Linux)) id 1t953V-00000007Y9h-0ruo for linux-arm-kernel@lists.infradead.org; Thu, 07 Nov 2024 16:08:23 +0000 ARC-Seal: i=2; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=pass; b=qzB0dakSV95Dh9MKKmk1QjJRIHgkk/ScAkc5xtvUKyhC62pBhxuHDKRRIdL2Rv+lCunjEe+kV/CrivuDJ9tTuckaEOyhn4ESHK+uBWRTiUAeyfS+oFcX6shBCRygYM+YtRslpTYONCrpi/FKso1Qh1+axdtJHtjymkl59hFVxB1JO/GOaSh0iGwzH0Hb4uD9G4kaotnl+bgOQrPh5y4LtPl0FnhQPeD5kYmkd1sqY4h6NFi40kjWHDN0kKlXez0p7nkwBbTNjZN4M54zpHOqfJdjb8kEjfeKF5EAsredjWsha//tOHZgcl0IeMsw6QYgtpZFscytLqCluedXfHpcvA== ARC-Message-Signature: i=2; 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=I9LqgE8dW4hUmHx3D52niMT7JXJ5J/OinSVhVWI7jHI=; b=v2vxygWfUzn1hAFYCsEJgmZczcyO/H5iPk4kw/B04bNa+pRR0DuehSmDniFvPO8BkMucZtqA7PEfE15Gt/yUGLL+GsNyAJbPiJAG/AvfCtBx33nRVenZBFE1zDXx5vhSZYIlMjVZ/CbcKJi5JagSs6tbrU4Uq52sayOlMDlesOrvNiHUpUt93wKvh4K3fAOL0Ssa9E380khQ5o12VRl0pSvigSJZQ26/Q3DELUfnM9nTCbaFQGPnN+2O8IBTl9chhD4WZVihKIklSQI+Wm0E8eugTWgkwO7X5cowkz3sqLuq3/oAk5HYmCf5yAUvp84vudLT6huZdOPTsh1rTqc6Zg== ARC-Authentication-Results: i=2; mx.microsoft.com 1; spf=pass (sender ip is 63.35.35.123) smtp.rcpttodomain=lists.infradead.org smtp.mailfrom=arm.com; dmarc=pass (p=none sp=none pct=100) action=none header.from=arm.com; dkim=pass (signature was verified) header.d=arm.com; arc=pass (0 oda=1 ltdi=1 spf=[1,1,smtp.mailfrom=arm.com] dmarc=[1,1,header.from=arm.com]) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=arm.com; s=selector1; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=I9LqgE8dW4hUmHx3D52niMT7JXJ5J/OinSVhVWI7jHI=; b=l/7jiCeaGjcXkxOTj1jOs8kHsLAltjB64V31lNCuEjsE1YSltn/51KBVxuv4ciORCqg1jZGKCG0fuhvpYsPlnFdQj/mTDVnJM7ocPR8dYmesaaAXNurh4dgzdO5LlJTTi7nt9Af3HVCqVm4FbMRYA44QjBAnXLJI2z/2VMuXV5Q= Received: from AM6P193CA0124.EURP193.PROD.OUTLOOK.COM (2603:10a6:209:85::29) by AS8PR08MB7944.eurprd08.prod.outlook.com (2603:10a6:20b:541::11) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.8137.18; Thu, 7 Nov 2024 16:08:16 +0000 Received: from AMS1EPF00000040.eurprd04.prod.outlook.com (2603:10a6:209:85:cafe::78) by AM6P193CA0124.outlook.office365.com (2603:10a6:209:85::29) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.8137.20 via Frontend Transport; Thu, 7 Nov 2024 16:08:16 +0000 X-MS-Exchange-Authentication-Results: spf=pass (sender IP is 63.35.35.123) smtp.mailfrom=arm.com; dkim=pass (signature was verified) header.d=arm.com;dmarc=pass action=none header.from=arm.com; Received-SPF: Pass (protection.outlook.com: domain of arm.com designates 63.35.35.123 as permitted sender) receiver=protection.outlook.com; client-ip=63.35.35.123; helo=64aa7808-outbound-1.mta.getcheckrecipient.com; pr=C Received: from 64aa7808-outbound-1.mta.getcheckrecipient.com (63.35.35.123) by AMS1EPF00000040.mail.protection.outlook.com (10.167.16.37) with Microsoft SMTP Server (version=TLS1_3, cipher=TLS_AES_256_GCM_SHA384) id 15.20.8137.17 via Frontend Transport; Thu, 7 Nov 2024 16:08:16 +0000 Received: ("Tessian outbound 4a86a9c66651:v490"); Thu, 07 Nov 2024 16:08:16 +0000 X-CheckRecipientChecked: true X-CR-MTA-CID: 9f0652da09028213 X-TessianGatewayMetadata: BC+DMOY0e2MFItsCh36Ph9nYU8o/CqQblghzDbGznE47zeMSsNZMnknAmEd6DbqRKr7P0kGBH7pImpBhsAKwZ2ihk8OnXDCIaUk7ZI0yN4dqqx9Yp0q3BczN6ClGdnu0dENiQScy0nb/kjSXoFWO2goSfEeN0vxPclspEXzLol0= X-CR-MTA-TID: 64aa7808 Received: from Lf497499200bc.1 by 64aa7808-outbound-1.mta.getcheckrecipient.com id D4EA1FCE-6234-4EC4-9B9A-847986D2D82A.1; Thu, 07 Nov 2024 16:08:09 +0000 Received: from EUR05-VI1-obe.outbound.protection.outlook.com by 64aa7808-outbound-1.mta.getcheckrecipient.com with ESMTPS id Lf497499200bc.1 (version=TLSv1.3 cipher=TLS_AES_256_GCM_SHA384); Thu, 07 Nov 2024 16:08:09 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none; b=AAC1lRTDkNngFRld4DQvRXUlIfjkDujbWl1OZixutSuIfxHRlwR2aaOeh99LZDQlkkB580Arnt95JRuFSS48ZJhxYAtJQi1vwMyQXS2gy5h/zgcvCJX98yNnI0J4qZFRJAWa6izS0aiaK5lSriCnQ2kPXq6I5hrJiZebRSSdIar0g+gbssKSy41okZCgq7UX41fQq5/sWDC+1qJ1lAqXO7sOQzYKVV5Vr0/lsBR3GpcG1Lm4Jadn+aCwIQgnQ1JdQhRO0+v/tk2fQmZbtQI9/Jj/eyn5GvyqOSYEMdYp8BKs3/t+flc+wUcYnqCPukVeCgkh0GZrvZMU/6ARZbFrlw== 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=I9LqgE8dW4hUmHx3D52niMT7JXJ5J/OinSVhVWI7jHI=; b=Qthixx2w9YRriWGoRHwZjKO4l9SyggSOpbsvdmXWfiNp9Er0J/jo5E2PDvGuCFTqqX/hDeTf+Tq9Dv1Nm2c4+tRdBIlZczAdBOyh0qxH4fjxDlMMbYWnGRRDQoJ9fqniJMy3hxnVE1ZjBtSUsQ7v3FNp39AZnXGHS7f5chqRS0ZmjshHBWbZ0FMMuIkw3Vl2o7cFLFepf9exEVSbz2H7qsA2leHs58BZBRC+p2d3+9OJ2P+HSlmssUg+pP4c3OWKq1Ir+cJW20ZebUnVwB4lHZAZbnJLKemNmbuB+xHcLyUAYBfUEOMIZmyiu5jebmgjhGCNXNwIyiX2xMesDYp2QQ== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass (sender ip is 40.67.248.234) smtp.rcpttodomain=infradead.org smtp.mailfrom=arm.com; dmarc=pass (p=none sp=none pct=100) action=none header.from=arm.com; dkim=none (message not signed); arc=none (0) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=arm.com; s=selector1; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=I9LqgE8dW4hUmHx3D52niMT7JXJ5J/OinSVhVWI7jHI=; b=l/7jiCeaGjcXkxOTj1jOs8kHsLAltjB64V31lNCuEjsE1YSltn/51KBVxuv4ciORCqg1jZGKCG0fuhvpYsPlnFdQj/mTDVnJM7ocPR8dYmesaaAXNurh4dgzdO5LlJTTi7nt9Af3HVCqVm4FbMRYA44QjBAnXLJI2z/2VMuXV5Q= Received: from AM4PR0302CA0017.eurprd03.prod.outlook.com (2603:10a6:205:2::30) by AS8PR08MB6311.eurprd08.prod.outlook.com (2603:10a6:20b:290::15) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.8137.19; Thu, 7 Nov 2024 16:08:05 +0000 Received: from AMS0EPF0000019B.eurprd05.prod.outlook.com (2603:10a6:205:2:cafe::2f) by AM4PR0302CA0017.outlook.office365.com (2603:10a6:205:2::30) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.8137.20 via Frontend Transport; Thu, 7 Nov 2024 16:08:05 +0000 X-MS-Exchange-Authentication-Results: spf=pass (sender IP is 40.67.248.234) smtp.mailfrom=arm.com; dkim=none (message not signed) header.d=none;dmarc=pass action=none header.from=arm.com; Received-SPF: Pass (protection.outlook.com: domain of arm.com designates 40.67.248.234 as permitted sender) receiver=protection.outlook.com; client-ip=40.67.248.234; helo=nebula.arm.com; pr=C Received: from nebula.arm.com (40.67.248.234) by AMS0EPF0000019B.mail.protection.outlook.com (10.167.16.247) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.20.8137.17 via Frontend Transport; Thu, 7 Nov 2024 16:08:05 +0000 Received: from AZ-NEU-EX02.Emea.Arm.com (10.251.26.5) by AZ-NEU-EX03.Arm.com (10.251.24.31) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2507.39; Thu, 7 Nov 2024 16:07:43 +0000 Received: from AZ-NEU-EX04.Arm.com (10.251.24.32) by AZ-NEU-EX02.Emea.Arm.com (10.251.26.5) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2507.39; Thu, 7 Nov 2024 16:07:42 +0000 Received: from e132406.cambridge.arm.com (10.2.3.22) by mail.arm.com (10.251.24.32) with Microsoft SMTP Server id 15.1.2507.39 via Frontend Transport; Thu, 7 Nov 2024 16:07:42 +0000 From: Deepak Surti To: , , , CC: , , , , , , , , , , , , , Subject: [PATCH v1 2/4] perf: Allow adding fixed random jitter to the alternate sampling period Date: Thu, 7 Nov 2024 16:07:19 +0000 Message-ID: <20241107160721.1401614-3-deepak.surti@arm.com> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20241107160721.1401614-1-deepak.surti@arm.com> References: <20241107160721.1401614-1-deepak.surti@arm.com> MIME-Version: 1.0 X-EOPAttributedMessage: 1 X-MS-TrafficTypeDiagnostic: AMS0EPF0000019B:EE_|AS8PR08MB6311:EE_|AMS1EPF00000040:EE_|AS8PR08MB7944:EE_ X-MS-Office365-Filtering-Correlation-Id: 6a6cfa09-29fe-465e-6561-08dcff4663b7 x-checkrecipientrouted: true NoDisclaimer: true X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam-Untrusted: BCL:0;ARA:13230040|376014|36860700013|82310400026|1800799024|7416014; X-Microsoft-Antispam-Message-Info-Original: 1PV7PJDnKvnlG1CLly/JNYmtzce17tZ2rhz85qzeBg9lRW+nHiXSL7oXwTzVD0lBLTLzqeYi6xIMc1ot1cQcsmVghQxqL8MSq59FinUfQ0GeM9V/HDQhu+QYq1r8SZHxpUDQAPBddWdVGbq9kHDQmpW8BIyhofx7RHV2FAo8xBPgkWY2G5lcfXAhNSwCzVQXDgb7HKmZdCZnVetIYJPFqze9v2OK7Ivt9ARdp96DyhZADjHD/vQs2b5nPr97M5f5EqzPJ1xoTZB7rt6Gyw58haOdicX/GYizXJG1mwt4GNHXz9j5CtzKTj5D7xv/l0szbansTrwsAB/AMrMgSpbLa+kgi5EQrFkw7ZFVViI/a+0NyKa+0K5uZWwWjV2vjS9SHkYSr1FaWC2Og2dQ/JdD0Br4e/IqTtynoT+7Cg4qO+i6ft5o0809E10F3DdgM17ifUNRGJ0HPZKEaQj7E/874Al5y8jHU92PYLcVMyzq40efS/K5tWmoqtw654awvCdm1+DG9yhqT6RrfIhGvTCVgrZ+nMsK/eBmmmCJfaC6t/nbXhoUOCwYF3TDx21AlRJohUowN5t6cCq6IebduNrkP84MrRX6Ob0QEqSA5eaN2keNIluaO+2L16IGXwio/DVR7NItXj21SsveFIdG6wFD0Us+3oeIogLJLFmAE0oETpEOfEJrGRfSg91/2vZQwk1jBMjEf5kX/S+fhISVwAIq21Yc//o3pZs3D43lNUN3C20SQCHSzohsuQTdyd6WI3EXSxjpb6a5PLnMDNnRz+uSg4/2XXfhp8ZyK0JuB6G9vQW1kj6KN68+8uFjIb9fRdk9IKmzb1ryA3OE7l20+3HucdKfkr/yI+duFpcsaDxC3Gz1hVqmwS7TR3L97ZC6F1dBMjsGyd//NMv8T0XEcU1CoazqRgznXZKyoJ+6XtJKf1D4vhQd6xuetOvM2CTJAUTflUItBlFOjj87gsV76O46EBGQCf7veO/FIx/oCDEFd4XsEpO3lSx493mtZzeEDzdwlvsh/Z1s9qMjHAt9+z1qXJGHCx6T9PcwXewMwAHWqTiFfRnSbTx/0a5/99eylGKaLC6KITUAe6XdBuqmkZ6gbbAU5mjzfqxaF1lLoUMT//ZyRKoWNsdrMSuBwKWUrlzIXU0w9g4O68k0mcYNOrp/Hcj3dVKoCfZ+XKR6SCdU+yFsGeSbamu7YMw/CYY5SlrFamd8gzE09Q70oVHbpclbOptb4q/hJbvxWw/XA0uyUJ2BknvplP2WuKCIt8xNJzWbiX1oQu58ph0A/S1oR9TZM1y4GCKrGw/NVksBN8GAwcmKmejIlo3vEi3N9ZKYsIv5iUyushySACP/Jhav1QD+1JVLfQvVbKHVFiIOdquI7DBjcyxwPNHQTY4XDWqcNjzetnTY9wENVrN0TG1+3VgBDA== X-Forefront-Antispam-Report-Untrusted: CIP:40.67.248.234;CTRY:IE;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:nebula.arm.com;PTR:InfoDomainNonexistent;CAT:NONE;SFS:(13230040)(376014)(36860700013)(82310400026)(1800799024)(7416014);DIR:OUT;SFP:1101; X-MS-Exchange-Transport-CrossTenantHeadersStamped: AS8PR08MB6311 X-MS-Exchange-SkipListedInternetSender: ip=[2603:10a6:205:2::30];domain=AM4PR0302CA0017.eurprd03.prod.outlook.com X-MS-Exchange-Transport-CrossTenantHeadersStripped: AMS1EPF00000040.eurprd04.prod.outlook.com X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id-Prvs: fb36313d-646c-4e7b-6efe-08dcff465d21 X-Microsoft-Antispam: BCL:0;ARA:13230040|35042699022|376014|36860700013|1800799024|82310400026|14060799003; X-Microsoft-Antispam-Message-Info: 9L6GOY4DQ1ZHKu7fLLBmxSuB/lQxx1phdfruAQyUNh9HJz0RYqBIsm3njNu0TV+7WR+sKIksP1oL6J5RONFC2L4PQCL+6jo9HwFrmsQc58/LgPwJ4t7zaboUkLwBLjMGbrgPH6nUDwktKdK0IXlDsqh8URttJ1/ueb4S3k/0IdCmIp2VmXGG13LoLEhqjOonQw6W1w/xWUPnYK3ygbYNhHMbmFKL3NOiTlVaJDAAdt7lhciebVOLFJdcOpDNMLVtgTXpi5B4vodWSUDYzzKXRJLue6Ww9Nh2dPtu0K7eTvEwAR2b4Wj+X4+0+kQ9zbQIWZZStmqusghoO71OKeB28xnYaUIyv6nh+21iyeSAFSeTajP4VDmVUWkyF7F1+uf79SagvXQxkMAUCmA/3Ja8cVZOCJXT7xpGopOm2z8W0HU0QR+KnAZJoQqufoFElBpIhrIrigpRgV382Dr1NUpWFTPIb9VZPkhXaWMH/uGQlkcF3g4RxKPeC/IRHW+Pw74/LjsaR6fazIWEo5BvHv8Sv+OIDpWcxjshA6UOx/d8Kw6ow3Aq7ir1z1ol3sQoYhWLJO19VchYa6cTRL87zrDnsi/MIk9ga3RYUsJdMyvxCQ3XsQweNAIJqMwe6CFBe1cO2EKSfy8ezpIGQLYrj1ZMExTMyaVQohkI8NweEVOXT1VDNswGbFFRs2wT5t2nl6cRVWWdbpcAdPmQR5tb78fTe4oaq0ok6s+febEWyzpEj7WR/uPuTd83/n1zyKS6Whldd+vBY2DJ4vmsgI4EqTieGpsB0kKxIkeIALnzbfkRpLFk45UsqWN0PbFONBH3eZZlu9Fb+GX+ctLCkwwo9Bf0HlbabAJJopwiZLs1uNEzChEOJQSktqY9UV0Wg4FsKpEqbkmWBLxRVm53KURHSahdDKAMsHEDGZFFFqS5C91dV72K+UJDYEvoHlVY2AT0ioUiyiWXbaZrdwauIdusdT1Vt4CotEgK49u4ZEEPIC9CCz7sxNB2hLxDc/pJbQA6T5rAwNe/G+99jCEBlzR2XpORVld5ghng4lmzJQCYlcgZ2wswDe42GknNHT25V263vaWEBNUCUW61Cn0sykvd3l28q3UicAcLS4xcAu2/K2X3b604k3RM0Dxz7UOMT4BDjNDnnHoFlcomEDGxfBticmvXtLcGsS55ZKObwd0C+Y7tGYh4TMZmogxkeFr1w4CbrRUNt2Qq+Xym/8kq3F309UowVwhe1qdAQe7/R+rD+E7vByhjMcf6yg4OCuN4y64P20k5LwICOYYJIRJJKXqfROhnzW2NVhtQESj1TAHVP9vbXl2yL9ZCQ16KcBDJ/mwY1Zdb4B1hzbmNpM1LMv+r7JGtEUCt+v/sBJGGRKcA2EJu/dtKW5Gr4IZgptaAY/S80+sB0hXNdR1vOgg6/FPieprzOw== X-Forefront-Antispam-Report: CIP:63.35.35.123;CTRY:IE;LANG:en;SCL:1;SRV:;IPV:CAL;SFV:NSPM;H:64aa7808-outbound-1.mta.getcheckrecipient.com;PTR:ec2-63-35-35-123.eu-west-1.compute.amazonaws.com;CAT:NONE;SFS:(13230040)(35042699022)(376014)(36860700013)(1800799024)(82310400026)(14060799003);DIR:OUT;SFP:1101; X-OriginatorOrg: arm.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 07 Nov 2024 16:08:16.4899 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 6a6cfa09-29fe-465e-6561-08dcff4663b7 X-MS-Exchange-CrossTenant-Id: f34e5979-57d9-4aaa-ad4d-b122a662184d X-MS-Exchange-CrossTenant-OriginalAttributedTenantConnectingIp: TenantId=f34e5979-57d9-4aaa-ad4d-b122a662184d;Ip=[63.35.35.123];Helo=[64aa7808-outbound-1.mta.getcheckrecipient.com] X-MS-Exchange-CrossTenant-AuthSource: AMS1EPF00000040.eurprd04.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: AS8PR08MB7944 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20241107_080821_448105_C4C2AD26 X-CRM114-Status: GOOD ( 10.57 ) 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 From: Ben Gainey This change modifies the core perf overflow handler, adding some small random jitter to each sample period whenever an event switches between the two alternate sample periods. A new flag is added to perf_event_attr to opt into this behaviour. This change follows the discussion in [1], where it is recognized that it may be possible for certain patterns of execution to end up with biased results. [1] https://lore.kernel.org/linux-perf-users/Zc24eLqZycmIg3d2@tassilo/ Signed-off-by: Ben Gainey --- include/uapi/linux/perf_event.h | 10 +++++++++- kernel/events/core.c | 10 +++++++++- 2 files changed, 18 insertions(+), 2 deletions(-) diff --git a/include/uapi/linux/perf_event.h b/include/uapi/linux/perf_event.h index bedae424ba36..16dbeea5803e 100644 --- a/include/uapi/linux/perf_event.h +++ b/include/uapi/linux/perf_event.h @@ -461,7 +461,15 @@ struct perf_event_attr { inherit_thread : 1, /* children only inherit if cloned with CLONE_THREAD */ remove_on_exec : 1, /* event is removed from task on exec */ sigtrap : 1, /* send synchronous SIGTRAP on event */ - __reserved_1 : 26; + /* + * jitter_alternate_period: + * + * add a limited amount of jitter on each + * alternate period, where the jitter is between + * [0, (2< #include #include +#include #include #include #include @@ -9831,7 +9832,11 @@ static int __perf_event_overflow(struct perf_event *event, if (event->attr.alternative_sample_period) { bool using_alt = hwc->using_alternative_sample_period; u64 sample_period = (using_alt ? event->attr.sample_period - : event->attr.alternative_sample_period); + : event->attr.alternative_sample_period) + + (event->attr.jitter_alternate_period + ? get_random_u32_below(2 << + event->attr.jitter_alternate_period) + : 0); hwc->sample_period = sample_period; hwc->using_alternative_sample_period = !using_alt; @@ -12744,6 +12749,9 @@ SYSCALL_DEFINE5(perf_event_open, } } + if (attr.jitter_alternate_period && !attr.alternative_sample_period) + return -EINVAL; + /* Only privileged users can get physical addresses */ if ((attr.sample_type & PERF_SAMPLE_PHYS_ADDR)) { err = perf_allow_kernel(&attr); From patchwork Thu Nov 7 16:07:20 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Deepak Surti X-Patchwork-Id: 13866681 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 829F2D43375 for ; Thu, 7 Nov 2024 16:12:10 +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:Content-Type: Content-Transfer-Encoding:MIME-Version:References:In-Reply-To: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:List-Owner; bh=imYS8DI8E4tiVChbKkiQXUN9AItMte/SwBew5hwT0Hg=; b=c4WD1PTPMWPPjjRfqbN6oizi3j sbosS+xq9sl218a2ztBv33PN6WtMeOciRd/xnjsAwc8VutDFbHmeQBZVwAbBcMgK+TwCvckG364rg 63GGdFqPBRKDAMDKdeCsGzuJwLJpwBl/d5B+VeHy64ggI9U6ywcnf3GwJKlmXHwDMFlN5m0e97ELD 9SN1m7MhIGRIU6ci8/ag5xZuYX4cxDgzjkHatyXlfoOdo+UAx4VSw4reeWs1tbVKru7Tv/l7R7zEL BxWPZxv6YtOR6A44KvojUM6wdFb2SI2He2xecVg+FrBVoiE7759Sz5leaFtZnHXmmiUwx5DO+cuAG KAjZ4jrA==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.98 #2 (Red Hat Linux)) id 1t9570-00000007ZD4-2sgJ; Thu, 07 Nov 2024 16:11:58 +0000 Received: from mail-dbaeur03on2062f.outbound.protection.outlook.com ([2a01:111:f403:260d::62f] helo=EUR03-DBA-obe.outbound.protection.outlook.com) by bombadil.infradead.org with esmtps (Exim 4.98 #2 (Red Hat Linux)) id 1t953N-00000007Y7b-1mg2 for linux-arm-kernel@lists.infradead.org; Thu, 07 Nov 2024 16:08:15 +0000 ARC-Seal: i=2; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=pass; b=MoC/9kSTABOJNvwRlpjO+16y8Lc3yxI7NjDBQgdtOUv2Njw0nZtJK/4f76J3ya2HKtDRwVs6flcJyl2uGeWp7um0tuvEusFfK//K4MNs1tnKRkhb7WkbMdboU3M2BS5LH+9cygNcJdKDMnLxVeeqkVYPP0by3oAqKBJA1XIRDai+SYniGccE8sqvErLhKxYFTQeyGZPxSJx7VW+0n96fLiqRTDuiBPTJbkFxrq8F7xpx5UPWyhW1PIpZB7WRh79BZsd/Z8ct2NO1160hFyRHF69A3mKTchZ3BFePs5AUTtWklCPIXkzcVyAEF3FloT+uObh9XiNzR8dmy0Z5Cp0Ygg== ARC-Message-Signature: i=2; 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=imYS8DI8E4tiVChbKkiQXUN9AItMte/SwBew5hwT0Hg=; b=IoPNjySbuIxrrU/G1Et2XOEXfRogP4eWQ6HLAPi8D+249p7OempoC2IzSZL2KhpOxwjhtxuiHpFqb/ayITlGeI4NLV4/zz7e6kMcCP7SB0lyB+ZbA5TFrJR1PBbPXtWrEWYH6OwBNXIddCQk1iHek5N53rD3anbOXWCyejx82HbKKy0ixfrErToKM/xnpMd2bX3MskAbmYK8FENVkNpOuonpMCLeZ4EsaT3EvUuoloGt1Yp92Jt8M+4SC7MI1zkTHCdXBhe7IHckRMuetT4uxifoWKMkoZGz6ou2URrZMElKuc8DdKoFfkwZkryRrgLxeLVekBgba1BRpR+IK+NFEA== ARC-Authentication-Results: i=2; mx.microsoft.com 1; spf=pass (sender ip is 63.35.35.123) smtp.rcpttodomain=lists.infradead.org smtp.mailfrom=arm.com; dmarc=pass (p=none sp=none pct=100) action=none header.from=arm.com; dkim=pass (signature was verified) header.d=arm.com; arc=pass (0 oda=1 ltdi=1 spf=[1,1,smtp.mailfrom=arm.com] dmarc=[1,1,header.from=arm.com]) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=arm.com; s=selector1; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=imYS8DI8E4tiVChbKkiQXUN9AItMte/SwBew5hwT0Hg=; b=nG28rnejWiQSuKe3k+gYr4fkh741DhN+xDD/H5P69RsHENPE6lCpT4YtLZdzLhkwMUgewdJR+mpKLEZEvgaabZ5um/2HWbOO1bBsKK2z7O1zCtf2BlskG+RFqfNmma0kljppeCbe+wCXoGduKgEwcG3P6++G+3MFNN+wTbVNo/o= Received: from AS9PR05CA0333.eurprd05.prod.outlook.com (2603:10a6:20b:490::19) by DB3PR08MB9112.eurprd08.prod.outlook.com (2603:10a6:10:43c::16) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.8137.19; Thu, 7 Nov 2024 16:08:04 +0000 Received: from AM3PEPF0000A795.eurprd04.prod.outlook.com (2603:10a6:20b:490:cafe::f) by AS9PR05CA0333.outlook.office365.com (2603:10a6:20b:490::19) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.8137.20 via Frontend Transport; Thu, 7 Nov 2024 16:08:04 +0000 X-MS-Exchange-Authentication-Results: spf=pass (sender IP is 63.35.35.123) smtp.mailfrom=arm.com; dkim=pass (signature was verified) header.d=arm.com;dmarc=pass action=none header.from=arm.com; Received-SPF: Pass (protection.outlook.com: domain of arm.com designates 63.35.35.123 as permitted sender) receiver=protection.outlook.com; client-ip=63.35.35.123; helo=64aa7808-outbound-1.mta.getcheckrecipient.com; pr=C Received: from 64aa7808-outbound-1.mta.getcheckrecipient.com (63.35.35.123) by AM3PEPF0000A795.mail.protection.outlook.com (10.167.16.100) with Microsoft SMTP Server (version=TLS1_3, cipher=TLS_AES_256_GCM_SHA384) id 15.20.8137.17 via Frontend Transport; Thu, 7 Nov 2024 16:08:02 +0000 Received: ("Tessian outbound 0fe1877cedb7:v490"); Thu, 07 Nov 2024 16:08:02 +0000 X-CheckRecipientChecked: true X-CR-MTA-CID: 955455c070d0fd57 X-TessianGatewayMetadata: 1NXyiMFdCwX5V/iBG2noyGF5gUAe5DI1yjhjWFuw8kGhayV5D10pUw5DxC+FbanL3VJ/75d6qiEwJMELZTWQ2JwVRoVdOzE4vRzyCsTfhMBOt2u1B6pL0+xWWpqiwDvQ6oaLjltjuAGWRQIrHvjLdvmYOiFdXwPjoxBs9IFDxhc= X-CR-MTA-TID: 64aa7808 Received: from Ld3718656196f.1 by 64aa7808-outbound-1.mta.getcheckrecipient.com id 4519121B-5FF0-4EA1-A76F-AD37C88C1892.1; Thu, 07 Nov 2024 16:07:55 +0000 Received: from EUR05-DB8-obe.outbound.protection.outlook.com by 64aa7808-outbound-1.mta.getcheckrecipient.com with ESMTPS id Ld3718656196f.1 (version=TLSv1.3 cipher=TLS_AES_256_GCM_SHA384); Thu, 07 Nov 2024 16:07:55 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none; b=hIxWZBPFWjMMZFCQrZMG4XGsijA59B/7WZUPOpvv0cR7MZFssTFVulIQeRJM+cwebNYJngxwgtARFFiWQJ9RxVf5v9OfKU7dW/GC0C48NQyC5DosOOa1QPn19CogRokTWpkSD+vP7ugDuCYV5WfFTTxNB6yoDWey8FTpehCsLPdtxsXEgf7O/j8mnjk/nj71QP+NRPu5f8BlDkX2VsbEsN71daGjlkoTn3GBG1/gUDBPPG3a94QFRXXcaeM/64iQ2/61pgTKIW02b3rc4DZ17/S1bSRiEELjopqz82Y5DwwKvtG5v9liB/4pvtZBZe4iyc9C0NlNHGb33PHwjFEdMA== 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=imYS8DI8E4tiVChbKkiQXUN9AItMte/SwBew5hwT0Hg=; b=W8pisDYIPSbs7l1OJE55mOlAtYZ0uPkVs3lVfS1I0D+nJnDTYxf/mHeIiXSE4Ds11EormbGKejHz+v2b5Z7ClNnhWxqXIO1LSMo9ruNed/i7EiUXZrva5mRnVZZuYp7ei42JuOkJ1WeTc5YB9Agh4f6HzZCSJGUIh3AnZbdH5r6tpiyxLfBW78lT6BwwIxr2SP2EHE4f73syr4EL8USuLJYF2Scxz5Uod7M5d4EiyIgfmfRxAULmUp6E4b+rLJvi5S+vY3q9uJP5lUR+PrQsTn6ldNbEU1KZCh2zawPVsJx/VMyxR2YWlP5jpFwkvuwjPfcPLHlud6GqG6YR9bDPRA== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass (sender ip is 40.67.248.234) smtp.rcpttodomain=infradead.org smtp.mailfrom=arm.com; dmarc=pass (p=none sp=none pct=100) action=none header.from=arm.com; dkim=none (message not signed); arc=none (0) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=arm.com; s=selector1; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=imYS8DI8E4tiVChbKkiQXUN9AItMte/SwBew5hwT0Hg=; b=nG28rnejWiQSuKe3k+gYr4fkh741DhN+xDD/H5P69RsHENPE6lCpT4YtLZdzLhkwMUgewdJR+mpKLEZEvgaabZ5um/2HWbOO1bBsKK2z7O1zCtf2BlskG+RFqfNmma0kljppeCbe+wCXoGduKgEwcG3P6++G+3MFNN+wTbVNo/o= Received: from AS9PR06CA0668.eurprd06.prod.outlook.com (2603:10a6:20b:49c::13) by GV2PR08MB8001.eurprd08.prod.outlook.com (2603:10a6:150:a9::12) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.8114.30; Thu, 7 Nov 2024 16:07:47 +0000 Received: from AM2PEPF0001C711.eurprd05.prod.outlook.com (2603:10a6:20b:49c:cafe::b0) by AS9PR06CA0668.outlook.office365.com (2603:10a6:20b:49c::13) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.8137.19 via Frontend Transport; Thu, 7 Nov 2024 16:07:47 +0000 X-MS-Exchange-Authentication-Results: spf=pass (sender IP is 40.67.248.234) smtp.mailfrom=arm.com; dkim=none (message not signed) header.d=none;dmarc=pass action=none header.from=arm.com; Received-SPF: Pass (protection.outlook.com: domain of arm.com designates 40.67.248.234 as permitted sender) receiver=protection.outlook.com; client-ip=40.67.248.234; helo=nebula.arm.com; pr=C Received: from nebula.arm.com (40.67.248.234) by AM2PEPF0001C711.mail.protection.outlook.com (10.167.16.181) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.20.8137.17 via Frontend Transport; Thu, 7 Nov 2024 16:07:47 +0000 Received: from AZ-NEU-EX06.Arm.com (10.240.25.134) by AZ-NEU-EX04.Arm.com (10.251.24.32) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2507.39; Thu, 7 Nov 2024 16:07:46 +0000 Received: from AZ-NEU-EX04.Arm.com (10.251.24.32) by AZ-NEU-EX06.Arm.com (10.240.25.134) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2507.39; Thu, 7 Nov 2024 16:07:45 +0000 Received: from e132406.cambridge.arm.com (10.2.3.22) by mail.arm.com (10.251.24.32) with Microsoft SMTP Server id 15.1.2507.39 via Frontend Transport; Thu, 7 Nov 2024 16:07:44 +0000 From: Deepak Surti To: , , , CC: , , , , , , , , , , , , , Subject: [PATCH v1 3/4] tools/perf: Modify event parser to support alt-period term Date: Thu, 7 Nov 2024 16:07:20 +0000 Message-ID: <20241107160721.1401614-4-deepak.surti@arm.com> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20241107160721.1401614-1-deepak.surti@arm.com> References: <20241107160721.1401614-1-deepak.surti@arm.com> MIME-Version: 1.0 X-EOPAttributedMessage: 1 X-MS-TrafficTypeDiagnostic: AM2PEPF0001C711:EE_|GV2PR08MB8001:EE_|AM3PEPF0000A795:EE_|DB3PR08MB9112:EE_ X-MS-Office365-Filtering-Correlation-Id: 48d5b617-20fd-47ac-d7f1-08dcff465b8a x-checkrecipientrouted: true NoDisclaimer: true X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam-Untrusted: BCL:0;ARA:13230040|36860700013|1800799024|82310400026|7416014|376014; X-Microsoft-Antispam-Message-Info-Original: ijSdgZ3eM7n+KJl6Zb3YZaqV24eO9ml2s+AUsLLKviY/P/JC6r9eIT13+LCKfAiZvoG1LYtl130cgX+NeNf2DjJ35vo+sdGl6zMb2cxlc7GdBWR1VBu8WWWJRijPj9qybGDur9OFOZ6u4cdp3OkO5B8aF1KHv7uwTef6gFOXDK9XqIpeWWdQoi23qlDHLaXjngJ6zEzB8tWPb2e7o22VFV6G3T+/SJBs5UT6Ba9oA7qxY6IN5PYT7XiaY1Yf6oS9GyFs/Wc8pCSFhhwZIMpsZLXCel3MktWbe0aCDMrgU9GToY9aEh3mnG15M+xtXl0vkLFV1rfIhTmttskdy0Raf55PriyVvw8RnkScGQVrwqOMZou+noHhU1G7NLE5mdumN7JXgXqy/gME7PgOoFQdl8bmFo7PPKStt1Y+QreQekhaIwfQCLoJ6bhHW2G0SR7ZkeAo5fAzSzt4mZLm3MmJdqKwRJWxn4l1yEURoJ6BCVmexS1eSLw4vBPy9rN8ss2XbkAf7Ek2KZRBlV9YE8tt10oMnv8uBJgUPzvP3ExhkgA/y8daSFDGtJuMj/tK0LIx83fBR9Lx3iLMOU0oerSfio65xFpGA41M5mJ3mwfmLmSAl+MjZJE4YN9BEiHuGrlt3Q/CtD98bywT5HVEImauPRuH7YeRStI6/LPPQl4hFEDSBaQiSl9y3G1Jt5oFSgyslfJtTKjAoOlAyDU8sJa0suam0gT6yLVbKeNK7Cs7QGpMOsG3BDLzjvxeYOg7wRRvTeigg3JqLvB8s1CWsSzPHfrTzXhyi3QJBdJabCWc3yupfsLpEs8KWq/uDHDp1wmOtcPDFucjiQ3N6WLK/G+1Z8QnX27IdanCPXl7bmOya0AKFj1UUAV6GXJg+Kwd/tUhdHeOi2LYC8ngjdJJM5F7KoKqaSShYZnrwnDQTneNKAFZKFIMeF68oGJkTl5raATZXCsLrME+AcnvOCKSa0qSmKx7ljCQG/GBD0u3T4OnlohieDgtzCiFF7jtK7M4DAJ1Iifjd4qjz7uCHspnhP2ym7jKruMQTh21redw91MebKQ7lLzYMGV1X51dKT3ldPKc42fRcY71mO6vm447NZkvKdrUfSaynn+d8Uy66OIlH9Ot1AjEVVVvFYmGd9QcpQAHJDNrSdmplow1sF8UtVo6pKuO2HWfJp5oTho99rn//XAI5qzOlh78yJnaMKO3HzsaMLZzi8kIBpLsrvWuDA58qs4OJCDaW/djGbPzV8AuZS4vS4YJaDaRtYDIK+x9+Z1l6z4CT7tisknWfqJZYH3GhbysVmm3gVi28KWYjrv5/idUdPoTS9HDUUyVKBDzB5B4sGzt40IK/5FTf8+I1Bg22KnCnmfHxa/BEtigT4vsUXnqw1DrIRCLwoba4h6nYrCHj5PFSj9unwvYcorL3o67BQ== X-Forefront-Antispam-Report-Untrusted: CIP:40.67.248.234;CTRY:IE;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:nebula.arm.com;PTR:InfoDomainNonexistent;CAT:NONE;SFS:(13230040)(36860700013)(1800799024)(82310400026)(7416014)(376014);DIR:OUT;SFP:1101; X-MS-Exchange-Transport-CrossTenantHeadersStamped: GV2PR08MB8001 X-MS-Exchange-SkipListedInternetSender: ip=[2603:10a6:20b:49c::13];domain=AS9PR06CA0668.eurprd06.prod.outlook.com X-MS-Exchange-Transport-CrossTenantHeadersStripped: AM3PEPF0000A795.eurprd04.prod.outlook.com X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id-Prvs: 8d01a7ba-7508-444e-7403-08dcff465293 X-Microsoft-Antispam: BCL:0;ARA:13230040|14060799003|35042699022|36860700013|376014|1800799024|82310400026; X-Microsoft-Antispam-Message-Info: Jrxq212VcyTNJa1EInnXjflDNv3g/GpaaIptRQn2l266aJOHxpk4lAFPdwXL8ivO080XNaSElidqWXWx1QcWXWZ9n9ypan04YOBv5vrgURpxQjbZ3ZyosKzhJ/FhKx2UqIBPWyZzmnWNdL7vr0sASAEssAz9pE1go0/mi5I8k/TxCnea0GAqlL6n0HtG0ykIR4iaXnNnhjwWLnxBrygyu4mqeG+kL2Uk+N/6z9QRLchabGyB8jIiXFDi4J1NpT5oeb+2/qjr+75k7QlnTh0gd5/gZX37AZaDJ2w4HzjxZV1kcRCAD3/B4HFZhqTs/cgL78B9p+TbMlYGEZUq9TaeOPn8ItzrPYLT7+l9LzHYP4huln/g4flyWguUSL+C0MdHwlK0e8dr0wwwpNdBTuP+MEKxHKbW2BxZOBXaphdFUGEtC/pUU4SiSvv7+7VvOfJBUMrQiMEjd/b8d2eS1DZiu8YxCsVIXd+g4NG0Nw4S3vjC3MKLojpLI0x4FkhppekrdQcBCn1cth6REJwW3/Lk2sWA+7MgEszbhkxe75OrKGqVYMmXVdyV57ZB6C1HOX48SZxQkb0f+4GuSx5ctbf63/OnuhdXa2EIO1KM0OjkWXbVgZ+sc6XlRyRKHmt/8H3g12kKTSfJ1D1VTZp3fJZt9rq3VrYpTHJR0I79EAbXXNXE5wiMcm4ofb+okkM+TlVUZQ9M3hIgcChN60GS8ob8zf+ENS00Y6EqoFq7ul9TNjWRDvTMvccFQsmYd7XMt+YkU9JwJKz0efi8wjMdWjIwS9duWrNZYqtdJWJ0nHtdRzUPPZiFqIiFbzaN/JNscySRhHcQb9So2SH3z7wTg/5s/qTkSpE9CqiK61kVRz2Stu9CS/tKQhZh0Utmz7vOOyoouy3f7h8rlp2u/TLcIMkQvC1P0tQbAtJZE/vlfXXK2S2aMwPYHFsPqR8Rs4BebPJ1ezJXDai317BWsb422THHrCc1eR/TliqxoJGTu4FdfFzQDRh1VPJnHl23GPvImUg5R0jW7l8Abqz2hBQceSaW+bBG7FkPot4h4ftEAlOrSJox9sYJRPqY6f5Hf4oLhFJh3YU/8pQov06/OZuJS5HoKyhqlAGVmxlmVHK3Lnf0FUZ0yLnlM5SWVxNp3tKliyVCUfRan7Cq4DMq9VNpNNmZH/xI9F8mDygngv+V2aL3Z6gl7V2nzTIOgg8W9b91LAqTeMTrwb6FtCSU3lJ4YhJHGdyR8W+62YeIAzMjeZhbvYGPWTEUm+gBH0fCkCyEIcRfXDY1t0DKl0KSgtmlvLZRo5uKz9PFZeo3d3SWvTStQfOlr/Pm/UB/4b7u7r4nywdwjEK3P52m2OJ6ceEymzMNuUtAZvC4lkHvbTglF+hFsr2wnat2ufEmAc1nmniqkVny8LytUUeeXzj0jJ7DlGHgKw== X-Forefront-Antispam-Report: CIP:63.35.35.123;CTRY:IE;LANG:en;SCL:1;SRV:;IPV:CAL;SFV:NSPM;H:64aa7808-outbound-1.mta.getcheckrecipient.com;PTR:ec2-63-35-35-123.eu-west-1.compute.amazonaws.com;CAT:NONE;SFS:(13230040)(14060799003)(35042699022)(36860700013)(376014)(1800799024)(82310400026);DIR:OUT;SFP:1101; X-OriginatorOrg: arm.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 07 Nov 2024 16:08:02.7606 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 48d5b617-20fd-47ac-d7f1-08dcff465b8a X-MS-Exchange-CrossTenant-Id: f34e5979-57d9-4aaa-ad4d-b122a662184d X-MS-Exchange-CrossTenant-OriginalAttributedTenantConnectingIp: TenantId=f34e5979-57d9-4aaa-ad4d-b122a662184d;Ip=[63.35.35.123];Helo=[64aa7808-outbound-1.mta.getcheckrecipient.com] X-MS-Exchange-CrossTenant-AuthSource: AM3PEPF0000A795.eurprd04.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: DB3PR08MB9112 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20241107_080813_851660_8EB8E310 X-CRM114-Status: UNSURE ( 7.66 ) X-CRM114-Notice: Please train this message. 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 From: Ben Gainey parse-events is modified, adding the "alt-period" term which can be used to specify the alternative sampling period. Signed-off-by: Ben Gainey --- tools/include/uapi/linux/perf_event.h | 3 +++ tools/perf/tests/attr.c | 1 + tools/perf/tests/attr.py | 1 + tools/perf/tests/attr/base-record | 3 ++- tools/perf/tests/attr/base-record-spe | 1 + tools/perf/tests/attr/base-stat | 3 ++- tools/perf/tests/attr/system-wide-dummy | 3 ++- tools/perf/tests/attr/test-record-alt-period-term | 12 ++++++++++++ tools/perf/tests/attr/test-record-dummy-C0 | 3 ++- tools/perf/util/parse-events.c | 15 +++++++++++++++ tools/perf/util/parse-events.h | 3 ++- tools/perf/util/parse-events.l | 1 + tools/perf/util/perf_event_attr_fprintf.c | 1 + tools/perf/util/pmu.c | 1 + 14 files changed, 46 insertions(+), 5 deletions(-) create mode 100644 tools/perf/tests/attr/test-record-alt-period-term diff --git a/tools/include/uapi/linux/perf_event.h b/tools/include/uapi/linux/perf_event.h index 4842c36fdf80..bedae424ba36 100644 --- a/tools/include/uapi/linux/perf_event.h +++ b/tools/include/uapi/linux/perf_event.h @@ -379,6 +379,7 @@ enum perf_event_read_format { #define PERF_ATTR_SIZE_VER6 120 /* add: aux_sample_size */ #define PERF_ATTR_SIZE_VER7 128 /* add: sig_data */ #define PERF_ATTR_SIZE_VER8 136 /* add: config3 */ +#define PERF_ATTR_SIZE_VER9 144 /* add: alternative_sample_period */ /* * Hardware event_id to monitor via a performance monitoring event: @@ -522,6 +523,8 @@ struct perf_event_attr { __u64 sig_data; __u64 config3; /* extension of config2 */ + + __u64 alternative_sample_period; }; /* diff --git a/tools/perf/tests/attr.c b/tools/perf/tests/attr.c index 97e1bdd6ec0e..956b58c7ba8f 100644 --- a/tools/perf/tests/attr.c +++ b/tools/perf/tests/attr.c @@ -139,6 +139,7 @@ static int store_event(struct perf_event_attr *attr, pid_t pid, struct perf_cpu WRITE_ASS(branch_sample_type, "llu"); WRITE_ASS(sample_regs_user, "llu"); WRITE_ASS(sample_stack_user, PRIu32); + WRITE_ASS(alternative_sample_period, "llu"); fclose(file); return 0; diff --git a/tools/perf/tests/attr.py b/tools/perf/tests/attr.py index e890c261ad26..75c4527393f9 100644 --- a/tools/perf/tests/attr.py +++ b/tools/perf/tests/attr.py @@ -91,6 +91,7 @@ class Event(dict): 'branch_sample_type', 'sample_regs_user', 'sample_stack_user', + 'alternative_sample_period', ] def add(self, data): diff --git a/tools/perf/tests/attr/base-record b/tools/perf/tests/attr/base-record index b44e4e6e4443..403de2e2c891 100644 --- a/tools/perf/tests/attr/base-record +++ b/tools/perf/tests/attr/base-record @@ -5,7 +5,7 @@ group_fd=-1 flags=0|8 cpu=* type=0|1 -size=136 +size=144 config=0|1 sample_period=* sample_type=263 @@ -39,3 +39,4 @@ config2=0 branch_sample_type=0 sample_regs_user=0 sample_stack_user=0 +alternative_sample_period=0 \ No newline at end of file diff --git a/tools/perf/tests/attr/base-record-spe b/tools/perf/tests/attr/base-record-spe index 08fa96b59240..db528d7d8b73 100644 --- a/tools/perf/tests/attr/base-record-spe +++ b/tools/perf/tests/attr/base-record-spe @@ -38,3 +38,4 @@ config2=* branch_sample_type=* sample_regs_user=* sample_stack_user=* +alternative_sample_period=0 \ No newline at end of file diff --git a/tools/perf/tests/attr/base-stat b/tools/perf/tests/attr/base-stat index fccd8ec4d1b0..27ef0fa1386f 100644 --- a/tools/perf/tests/attr/base-stat +++ b/tools/perf/tests/attr/base-stat @@ -5,7 +5,7 @@ group_fd=-1 flags=0|8 cpu=* type=0 -size=136 +size=144 config=0 sample_period=0 sample_type=65536 @@ -39,3 +39,4 @@ config2=0 branch_sample_type=0 sample_regs_user=0 sample_stack_user=0 +alternative_sample_period=0 diff --git a/tools/perf/tests/attr/system-wide-dummy b/tools/perf/tests/attr/system-wide-dummy index a1e1d6a263bf..5c4d2a60931d 100644 --- a/tools/perf/tests/attr/system-wide-dummy +++ b/tools/perf/tests/attr/system-wide-dummy @@ -7,7 +7,7 @@ cpu=* pid=-1 flags=8 type=1 -size=136 +size=144 config=9 sample_period=1 # PERF_SAMPLE_IP | PERF_SAMPLE_TID | PERF_SAMPLE_TIME | @@ -50,3 +50,4 @@ config2=0 branch_sample_type=0 sample_regs_user=0 sample_stack_user=0 +alternative_sample_period=0 diff --git a/tools/perf/tests/attr/test-record-alt-period-term b/tools/perf/tests/attr/test-record-alt-period-term new file mode 100644 index 000000000000..e0de4c8eb1c8 --- /dev/null +++ b/tools/perf/tests/attr/test-record-alt-period-term @@ -0,0 +1,12 @@ +[config] +command = record +args = --no-bpf-event -e cycles/period=3,alt-period=2/ -- kill >/dev/null 2>&1 +ret = 1 +kernel_since = 6.11 + +[event-10:base-record] +sample_period=3 +alternative_sample_period=2 + +freq=0 +sample_type=7 diff --git a/tools/perf/tests/attr/test-record-dummy-C0 b/tools/perf/tests/attr/test-record-dummy-C0 index 576ec48b3aaf..d4f0546e02b6 100644 --- a/tools/perf/tests/attr/test-record-dummy-C0 +++ b/tools/perf/tests/attr/test-record-dummy-C0 @@ -10,7 +10,7 @@ cpu=0 pid=-1 flags=8 type=1 -size=136 +size=144 config=9 sample_period=4000 # PERF_SAMPLE_IP | PERF_SAMPLE_TID | PERF_SAMPLE_TIME | @@ -53,3 +53,4 @@ config2=0 branch_sample_type=0 sample_regs_user=0 sample_stack_user=0 +alternative_sample_period=0 diff --git a/tools/perf/util/parse-events.c b/tools/perf/util/parse-events.c index 9a8be1e46d67..48723cea3a51 100644 --- a/tools/perf/util/parse-events.c +++ b/tools/perf/util/parse-events.c @@ -826,6 +826,7 @@ static const char *config_term_name(enum parse_events__term_type term_type) [PARSE_EVENTS__TERM_TYPE_RAW] = "raw", [PARSE_EVENTS__TERM_TYPE_LEGACY_CACHE] = "legacy-cache", [PARSE_EVENTS__TERM_TYPE_HARDWARE] = "hardware", + [PARSE_EVENTS__TERM_TYPE_ALT_SAMPLE_PERIOD] = "alt-period", }; if ((unsigned int)term_type >= __PARSE_EVENTS__TERM_TYPE_NR) return "unknown term"; @@ -854,6 +855,7 @@ config_term_avail(enum parse_events__term_type term_type, struct parse_events_er case PARSE_EVENTS__TERM_TYPE_NAME: case PARSE_EVENTS__TERM_TYPE_METRIC_ID: case PARSE_EVENTS__TERM_TYPE_SAMPLE_PERIOD: + case PARSE_EVENTS__TERM_TYPE_ALT_SAMPLE_PERIOD: case PARSE_EVENTS__TERM_TYPE_PERCORE: return true; case PARSE_EVENTS__TERM_TYPE_USER: @@ -998,6 +1000,16 @@ do { \ return -EINVAL; } break; + case PARSE_EVENTS__TERM_TYPE_ALT_SAMPLE_PERIOD: + CHECK_TYPE_VAL(NUM); + if (term->val.num == 0) { + parse_events_error__handle(err, term->err_val, + strdup("expected a non-zero value"), + NULL); + return -EINVAL; + } + attr->alternative_sample_period = term->val.num; + break; case PARSE_EVENTS__TERM_TYPE_DRV_CFG: case PARSE_EVENTS__TERM_TYPE_USER: case PARSE_EVENTS__TERM_TYPE_LEGACY_CACHE: @@ -1124,6 +1136,7 @@ static int config_term_tracepoint(struct perf_event_attr *attr, case PARSE_EVENTS__TERM_TYPE_RAW: case PARSE_EVENTS__TERM_TYPE_LEGACY_CACHE: case PARSE_EVENTS__TERM_TYPE_HARDWARE: + case PARSE_EVENTS__TERM_TYPE_ALT_SAMPLE_PERIOD: default: if (err) { parse_events_error__handle(err, term->err_term, @@ -1255,6 +1268,7 @@ do { \ case PARSE_EVENTS__TERM_TYPE_RAW: case PARSE_EVENTS__TERM_TYPE_LEGACY_CACHE: case PARSE_EVENTS__TERM_TYPE_HARDWARE: + case PARSE_EVENTS__TERM_TYPE_ALT_SAMPLE_PERIOD: default: break; } @@ -1308,6 +1322,7 @@ static int get_config_chgs(struct perf_pmu *pmu, struct parse_events_terms *head case PARSE_EVENTS__TERM_TYPE_RAW: case PARSE_EVENTS__TERM_TYPE_LEGACY_CACHE: case PARSE_EVENTS__TERM_TYPE_HARDWARE: + case PARSE_EVENTS__TERM_TYPE_ALT_SAMPLE_PERIOD: default: break; } diff --git a/tools/perf/util/parse-events.h b/tools/perf/util/parse-events.h index 10cc9c433116..f1482361321a 100644 --- a/tools/perf/util/parse-events.h +++ b/tools/perf/util/parse-events.h @@ -79,7 +79,8 @@ enum parse_events__term_type { PARSE_EVENTS__TERM_TYPE_RAW, PARSE_EVENTS__TERM_TYPE_LEGACY_CACHE, PARSE_EVENTS__TERM_TYPE_HARDWARE, -#define __PARSE_EVENTS__TERM_TYPE_NR (PARSE_EVENTS__TERM_TYPE_HARDWARE + 1) + PARSE_EVENTS__TERM_TYPE_ALT_SAMPLE_PERIOD, +#define __PARSE_EVENTS__TERM_TYPE_NR (PARSE_EVENTS__TERM_TYPE_ALT_SAMPLE_PERIOD + 1) }; struct parse_events_term { diff --git a/tools/perf/util/parse-events.l b/tools/perf/util/parse-events.l index 5a0bcd7f166a..1972a5a696ef 100644 --- a/tools/perf/util/parse-events.l +++ b/tools/perf/util/parse-events.l @@ -331,6 +331,7 @@ percore { return term(yyscanner, PARSE_EVENTS__TERM_TYPE_PERCORE); } aux-output { return term(yyscanner, PARSE_EVENTS__TERM_TYPE_AUX_OUTPUT); } aux-sample-size { return term(yyscanner, PARSE_EVENTS__TERM_TYPE_AUX_SAMPLE_SIZE); } metric-id { return term(yyscanner, PARSE_EVENTS__TERM_TYPE_METRIC_ID); } +alt-period { return term(yyscanner, PARSE_EVENTS__TERM_TYPE_ALT_SAMPLE_PERIOD); } cpu-cycles|cycles { return hw_term(yyscanner, PERF_COUNT_HW_CPU_CYCLES); } stalled-cycles-frontend|idle-cycles-frontend { return hw_term(yyscanner, PERF_COUNT_HW_STALLED_CYCLES_FRONTEND); } stalled-cycles-backend|idle-cycles-backend { return hw_term(yyscanner, PERF_COUNT_HW_STALLED_CYCLES_BACKEND); } diff --git a/tools/perf/util/perf_event_attr_fprintf.c b/tools/perf/util/perf_event_attr_fprintf.c index 59fbbba79697..c6af598070b5 100644 --- a/tools/perf/util/perf_event_attr_fprintf.c +++ b/tools/perf/util/perf_event_attr_fprintf.c @@ -335,6 +335,7 @@ int perf_event_attr__fprintf(FILE *fp, struct perf_event_attr *attr, PRINT_ATTRf(sample_max_stack, p_unsigned); PRINT_ATTRf(aux_sample_size, p_unsigned); PRINT_ATTRf(sig_data, p_unsigned); + PRINT_ATTRf(alternative_sample_period, p_unsigned); return ret; } diff --git a/tools/perf/util/pmu.c b/tools/perf/util/pmu.c index 61bdda01a05a..7615d05e389f 100644 --- a/tools/perf/util/pmu.c +++ b/tools/perf/util/pmu.c @@ -1738,6 +1738,7 @@ int perf_pmu__for_each_format(struct perf_pmu *pmu, void *state, pmu_format_call "percore", "aux-output", "aux-sample-size=number", + "alt-period=number", }; struct perf_pmu_format *format; int ret; From patchwork Thu Nov 7 16:07:21 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Deepak Surti X-Patchwork-Id: 13866717 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 E43A1D43377 for ; Thu, 7 Nov 2024 16:21:39 +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:Content-Type: Content-Transfer-Encoding:MIME-Version:References:In-Reply-To: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:List-Owner; bh=tZ/alzjkXRVhJbyU/UQMeY9dzEOt1z/ZPXPWZpB/Yhk=; b=0QgvpP2VmxF4sAm2ZsVgsX9RQz fVxo1YRV4mx1ixAq5Jn4FwAitOoY4Pw/S1OUkl9ngHrVqwZhsKXHsF9s36MXFz3wVQAcI8bbnSrTP C95g1nfh959bO4JyG0Hs+XwvbKgdL3owFlCi5vo/hYzNpYmIcWadJm6A/S5AROW/zRS6Gr72sC4/f W+nrjxWxP+q6kjk0x0QNDfY3oELJESZ+00OtA3kFKDD4/lcJ9+QDUVGpODqMQc+s5dHPTy/tGPJH8 UA7wV3uoUli6I88j7qlT4h1KoH0flbFIQXdI4Zum7czJeqGNAxRt4vZdjYUe1HrOU/vj9QP3c26pI rBIM6BTQ==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.98 #2 (Red Hat Linux)) id 1t95G8-00000007bqS-2hSe; Thu, 07 Nov 2024 16:21:24 +0000 Received: from mail-vi1eur05on20620.outbound.protection.outlook.com ([2a01:111:f403:2613::620] helo=EUR05-VI1-obe.outbound.protection.outlook.com) by bombadil.infradead.org with esmtps (Exim 4.98 #2 (Red Hat Linux)) id 1t954p-00000007YUg-0m4i for linux-arm-kernel@lists.infradead.org; Thu, 07 Nov 2024 16:09:44 +0000 ARC-Seal: i=2; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=pass; b=XQBNgIDcqc71H6nfNsyCy9wAOMiAlQ98a8AUc1oij8y/uPcOFArlnrN75erdcuOnXGH8Qxe4sDWrdMpa7UgD1hRYWq4lNKdDwJUEjZmgDzH+/m4WrODP0YKOeInvHDGeuId1fb2cTGD6QFmWHHHxrxhcpJxvXIzmzRSJF7QCE2FRCGn7PawgkVxBmUrf3PXM2T+kPcrAyvix7p647LtyT2ssywSy7noDybV/lJpsPgOouCvZYBU/tgIKE4qehfYnQOLVkD3gGEL0yswAbnQcrCqBrWziNGOGlaOrUBYbbVny0gUM6XLV5udPf4Wd3zN3mTjqwEf5di9pxgoqi++mWA== ARC-Message-Signature: i=2; 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=tZ/alzjkXRVhJbyU/UQMeY9dzEOt1z/ZPXPWZpB/Yhk=; b=w0pfJKVB4tcyOWziUtqqYss/EC6w3zzFc95c2jRCWGrQReeGnDncJ0INOVAYXZDvkIjP79Mer3GfVo9F0ObwEExgACen1TWT+k/iBTY5w4CK8xawDJalDYZwpA/dhQ/9CHmXfj9g5i6cYz1AvrqwUn4Ljjly7DXN5ht0+3PJWa9EJLODa8MHdh6kWImZT/qEtQ0gypVxtf1wJTwHFmu1BWAG0azf8ZLKBajwUYFLF1Lq8GsgNVW5sS8Cb3Ez92CUWVpvLaqVdCE5isqsBnDxC7Av6tY+ZmIcweVFgc13VIQ4cbPviyYQpMVdkd2h9UpjUoOrZJBWwTxnp5Tm+VqpEQ== ARC-Authentication-Results: i=2; mx.microsoft.com 1; spf=pass (sender ip is 63.35.35.123) smtp.rcpttodomain=lists.infradead.org smtp.mailfrom=arm.com; dmarc=pass (p=none sp=none pct=100) action=none header.from=arm.com; dkim=pass (signature was verified) header.d=arm.com; arc=pass (0 oda=1 ltdi=1 spf=[1,1,smtp.mailfrom=arm.com] dmarc=[1,1,header.from=arm.com]) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=arm.com; s=selector1; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=tZ/alzjkXRVhJbyU/UQMeY9dzEOt1z/ZPXPWZpB/Yhk=; b=nZNWolRWhiTa4NrCUVQvV0rkSRp+2bU+ZHUispC3ljs4Cc9dEGpWHwi4JdZVS5nJ0lIgEK80HPa6SlsmFpl4YnsVIkaI+gzxyGR5UQDtadsMFhn127v2UcACBHj6aZhf1aEWL5bsAx4xPjs34qsi4Cm1dxhXS4zMm4M+oJASzs0= Received: from DUZP191CA0041.EURP191.PROD.OUTLOOK.COM (2603:10a6:10:4f8::20) by AS8PR08MB8945.eurprd08.prod.outlook.com (2603:10a6:20b:5b5::12) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.8114.30; Thu, 7 Nov 2024 16:09:34 +0000 Received: from DB1PEPF00039234.eurprd03.prod.outlook.com (2603:10a6:10:4f8:cafe::4) by DUZP191CA0041.outlook.office365.com (2603:10a6:10:4f8::20) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.8137.20 via Frontend Transport; Thu, 7 Nov 2024 16:09:34 +0000 X-MS-Exchange-Authentication-Results: spf=pass (sender IP is 63.35.35.123) smtp.mailfrom=arm.com; dkim=pass (signature was verified) header.d=arm.com;dmarc=pass action=none header.from=arm.com; Received-SPF: Pass (protection.outlook.com: domain of arm.com designates 63.35.35.123 as permitted sender) receiver=protection.outlook.com; client-ip=63.35.35.123; helo=64aa7808-outbound-1.mta.getcheckrecipient.com; pr=C Received: from 64aa7808-outbound-1.mta.getcheckrecipient.com (63.35.35.123) by DB1PEPF00039234.mail.protection.outlook.com (10.167.8.107) with Microsoft SMTP Server (version=TLS1_3, cipher=TLS_AES_256_GCM_SHA384) id 15.20.8137.17 via Frontend Transport; Thu, 7 Nov 2024 16:09:33 +0000 Received: ("Tessian outbound 8223600b7a9c:v490"); Thu, 07 Nov 2024 16:08:33 +0000 X-CheckRecipientChecked: true X-CR-MTA-CID: 573f6fff17491099 X-TessianGatewayMetadata: 4HNeXTWXU6Akrp+qb97tsQiIN2nyXEpUHsNm/72iCnoMtr5UU+T3Ytl6EhQreN2xOHcfKIuQZ1ZoTqRtusWxWAq6OUiPZV1Zy1htG2Gmx57XPwvDjPcbYd8jPx7vl66NbQFYyg7GUoY/knpvvBP67GO2ZkZZd8ULCZt5pHY+Ajs= X-CR-MTA-TID: 64aa7808 Received: from L2e95e45bda57.1 by 64aa7808-outbound-1.mta.getcheckrecipient.com id CBF47E2A-0E0A-4469-9404-D7318797DC7F.1; Thu, 07 Nov 2024 16:08:25 +0000 Received: from EUR05-VI1-obe.outbound.protection.outlook.com by 64aa7808-outbound-1.mta.getcheckrecipient.com with ESMTPS id L2e95e45bda57.1 (version=TLSv1.3 cipher=TLS_AES_256_GCM_SHA384); Thu, 07 Nov 2024 16:08:25 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none; b=O9m3c+0tVFEz6e3QGwTnCMsM3CaPDsBdD5uxU4Pwhn2jJzMjauCDEErnGw6/cwlZ2/D5Og9ApJcPU7UB4rNJlZAsxZqOXrLw+LP4xNh1bqjposmyfZLZCXUusHlgouqKFWcTDwrNTnTc8WrCAIIDaSHmQlJnoRXUBmIQNo3SK82bNWOlZGz6nr8ZIwClXaLd6ftwVLTaBWGl/NYXIoIqKbS9aDrvUAK9K9+sHT77vL/UN4HpCUVWTeS82ThZHiV2Q0GbO0ZnB6kD6lNW+RwkawyRy9LVHZqueO9O6eg2BHLoNpBQnAvnAp11d43caiHdzkAnR+ePjFGsspkBznDJSA== 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=tZ/alzjkXRVhJbyU/UQMeY9dzEOt1z/ZPXPWZpB/Yhk=; b=JWp8RrmHHhjf23w91TijVpZgyeOA7ZQcBVQPIW/T5o6KbkU7XdPBGI6wLk9WB1zRnXI7OJaq5QA/HUhlhOy/aTLbcrjmqkwJ+8RGjYNAqIN7JyrAEJrrjXbhxg0WtPPLtnwMaSlOryMzpHfvBqeWSWH3v/29aq2K9BVmZ5YnJuz+bX3p3SXXh99Gm2g3Ls0fh2B3uaY7fXrfuFHZPdYQahXqcHFJv+X13ztmD06rMieVsRDp1VvLFvmqr8DTDk3alGR8k+Ss6c0L7uq5GKjJCPbD+apkFg/p42/bjplOyZbF504xEseN99+WVnr++DIoi5Vr8ziyZM+FFcKdMcQ09g== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass (sender ip is 40.67.248.234) smtp.rcpttodomain=infradead.org smtp.mailfrom=arm.com; dmarc=pass (p=none sp=none pct=100) action=none header.from=arm.com; dkim=none (message not signed); arc=none (0) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=arm.com; s=selector1; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=tZ/alzjkXRVhJbyU/UQMeY9dzEOt1z/ZPXPWZpB/Yhk=; b=nZNWolRWhiTa4NrCUVQvV0rkSRp+2bU+ZHUispC3ljs4Cc9dEGpWHwi4JdZVS5nJ0lIgEK80HPa6SlsmFpl4YnsVIkaI+gzxyGR5UQDtadsMFhn127v2UcACBHj6aZhf1aEWL5bsAx4xPjs34qsi4Cm1dxhXS4zMm4M+oJASzs0= Received: from AS4P190CA0028.EURP190.PROD.OUTLOOK.COM (2603:10a6:20b:5d0::17) by PAWPR08MB10239.eurprd08.prod.outlook.com (2603:10a6:102:367::17) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.8114.31; Thu, 7 Nov 2024 16:08:21 +0000 Received: from AMS0EPF00000199.eurprd05.prod.outlook.com (2603:10a6:20b:5d0:cafe::52) by AS4P190CA0028.outlook.office365.com (2603:10a6:20b:5d0::17) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.8137.20 via Frontend Transport; Thu, 7 Nov 2024 16:08:21 +0000 X-MS-Exchange-Authentication-Results: spf=pass (sender IP is 40.67.248.234) smtp.mailfrom=arm.com; dkim=none (message not signed) header.d=none;dmarc=pass action=none header.from=arm.com; Received-SPF: Pass (protection.outlook.com: domain of arm.com designates 40.67.248.234 as permitted sender) receiver=protection.outlook.com; client-ip=40.67.248.234; helo=nebula.arm.com; pr=C Received: from nebula.arm.com (40.67.248.234) by AMS0EPF00000199.mail.protection.outlook.com (10.167.16.245) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.20.8137.17 via Frontend Transport; Thu, 7 Nov 2024 16:08:21 +0000 Received: from AZ-NEU-EX06.Arm.com (10.240.25.134) by AZ-NEU-EX03.Arm.com (10.251.24.31) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2507.39; Thu, 7 Nov 2024 16:07:48 +0000 Received: from AZ-NEU-EX04.Arm.com (10.251.24.32) by AZ-NEU-EX06.Arm.com (10.240.25.134) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2507.39; Thu, 7 Nov 2024 16:07:47 +0000 Received: from e132406.cambridge.arm.com (10.2.3.22) by mail.arm.com (10.251.24.32) with Microsoft SMTP Server id 15.1.2507.39 via Frontend Transport; Thu, 7 Nov 2024 16:07:46 +0000 From: Deepak Surti To: , , , CC: , , , , , , , , , , , , , Subject: [PATCH v1 4/4] tools/perf: Modify event parser to support alt-period-jitter term Date: Thu, 7 Nov 2024 16:07:21 +0000 Message-ID: <20241107160721.1401614-5-deepak.surti@arm.com> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20241107160721.1401614-1-deepak.surti@arm.com> References: <20241107160721.1401614-1-deepak.surti@arm.com> MIME-Version: 1.0 X-EOPAttributedMessage: 1 X-MS-TrafficTypeDiagnostic: AMS0EPF00000199:EE_|PAWPR08MB10239:EE_|DB1PEPF00039234:EE_|AS8PR08MB8945:EE_ X-MS-Office365-Filtering-Correlation-Id: d1e194c2-f01a-4700-975c-08dcff4691cd x-checkrecipientrouted: true NoDisclaimer: true X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam-Untrusted: BCL:0;ARA:13230040|1800799024|7416014|376014|36860700013|82310400026; X-Microsoft-Antispam-Message-Info-Original: xVdQLaGkhG4+9fxwBWBvjoM0NOiXnoKS3bQz5gbUNR0ixDA6lDgm/tGbae4vTMIwwsPPbHTaS4phEez2htm9bdUVK3qwjTAxul1APTSeu/Om/QNZPA6lLvbrM2sWXXXb8wGI3xXTioFRR0so7dqwKpUTaAPmopJg6gE5xfO0KA97VXi/MyfLAwXqF8DHP+7XcCiK9GPPpMQ7Xu634Hr5x4IgfpVUm0JztynW0FpDfSkrNoMkMq94nQ0lsu7kj7ZBd+FRdKZE4ntFF/1/KXt3hlXJ3kBu3sGE4SDH15YM34lZdEid+75y20XUccdVhesuEReKD/BuiYd7esvRbo2xSolQVMDe8DQc7NW8XeIIlN+s1unuFV6PdidP8yC2lVNmvUqYogltXHH/g+fAV5HiF2DM7qagkzgR0MNi+xce4h4b02wSgLxy2x0cFw+1T1Mng7m5XEu+wV4uYxOLvzc/HwCTcS42LdfobwE0ulIKvY7eWleYcSDpUVqZtyIePl/unMlc9QYPLvgc/nJ7Pox65MsP8/lf1Ub7yzxlshCtYM1w1c5TRJxvraOS6fgdghuMFWYbGaJFREkU+LnBtE3g3RI1Q0HPprkycEyUiRpjVtKByY4OnKedBosjLOubTAKjehdlDx9tOK3cHkJg6PD1fFtEpzVi1PVdXo710buvSYjLIzll1ElsXm011mNSWISZbgO5PQV0ilnHMUHPgR/eM+jMKlL+8ZKOYKvSyK3T+aoBmx+373/qYFXR3GVKC05mG5nqUeJT4VKH4Puto0lnonMj5b1lqvbg1d+Waf+2mw1oUj+0GJ8iULTnf0jYpeRtlH8IEln8pK33VgZH7LpANFhvIQmi88xi74Vku32/FHSMm1LgQMo/P5BdopgZr9cIF0IQMfHo8R+dptoZRhXTYUl3gkKkRiZQZ0sICvwvAJYDp35d/PUEgGDKEKnkYhi2YNrh/JI5xfK0wenaLXBEqQ/LgT11BW+vZSWbdGdLTf03JOpepRYIe67NN7ByuyDh15HTNZuPz5pSnDgdSPzkzd9mVePgFdZM/8Xr0ebjWv/qot7Txb/05YzYqMwfUYH/XurOlXZrdONpvJkIt1AuCyw3SmiEYgewDCIiyHBBcg9+Sjxbb4Bs1maL6pvweH454XZFZTkUGVBgyfcYFswPgS7qoBnjjaiaWzy860LHs5PeaPdgw9f2nR6iHzpC1LaseiJZ46b7jLIYq99D4jE9XUoQ/oxtjsGHrtSHhsOnfgucgFMDrDFwCS2EKRvw96PaHuUl7Pc/jiWofNIgYt0/5SZtR/THK2094L6FvKA2ENy6zg4+e0kWCAM/2m/MR1yPQqIWQKHIZx1cvgoOFVOh3ei5q//ftgje0lG0Npoqaa8ndJSq0+Gpsa4sjJdDEEz4sdW0mWkHAgK2fesY5tEUXQ== X-Forefront-Antispam-Report-Untrusted: CIP:40.67.248.234;CTRY:IE;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:nebula.arm.com;PTR:InfoDomainNonexistent;CAT:NONE;SFS:(13230040)(1800799024)(7416014)(376014)(36860700013)(82310400026);DIR:OUT;SFP:1101; X-MS-Exchange-Transport-CrossTenantHeadersStamped: PAWPR08MB10239 X-MS-Exchange-SkipListedInternetSender: ip=[2603:10a6:20b:5d0::17];domain=AS4P190CA0028.EURP190.PROD.OUTLOOK.COM X-MS-Exchange-Transport-CrossTenantHeadersStripped: DB1PEPF00039234.eurprd03.prod.outlook.com X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id-Prvs: b81b87fd-2e59-48b8-3a72-08dcff466688 X-Microsoft-Antispam: BCL:0;ARA:13230040|36860700013|35042699022|1800799024|82310400026|376014|14060799003; X-Microsoft-Antispam-Message-Info: Qz69eaf5j/sUMLBXypMpo9yZBP3be/axJLRPXi7IAbo21ElwQ+bSHQiyIPjWWEJo0rXWqBMq/P1Lw6K26vOGGbyln1gTZjVL7fg1JK0RSFyWTHvHrTteQXz4LsVYFBnFYQvkPfM0RwScssQTDMTjs4a7Rk3r4Wz1HaAmBDaX2jA/+vD6LN8aM34Ju5IPT/zDb7FRNl8CRyGgTMyzyPiRMUwDuA0BKSdUB2mP8tmaXrTslIm9TxgekxsZk0tWTk8D6G0ZfPy+j5lkmxcYO/ibEwrANjTDTpAZN4JQ3QVvTGHoTDO3COXLs8rsB5DazeKuhKvwf4cM6orNmkZxibjoWLdxkLbdk8Dp0TLwP3AWGuA+YMpK7oh76ob7v6Fk9onixIZajLSpsvpJH8YnIvEeAfnoxhO95Crop4UWIsiMqBtivQISbg12G+VyOgQZZha0yxnHyxMyv8j4bhxnLduh2BwJHTkF7UR1dRbWGM9EFIbzn3xY/T+wyDAAhBcn4LSa+f+h/s5goek+wlOQJ8dHZiwe9u4sIxr4zgyqWlm3jpGPPUUWc8GEtObotwhAoZfcqIFSBmoqS29DkdI7kWu7l3VHDI301fmgi6Xexvqv9z4xmy+xk4+Q/IDKN1ViPbdC+MjAGHDhku1hyoqxrpSeeKReu+WynKknREI3n+4+WBtlIFlT9L06Y5Yl0MzEaUURL3dWrYdmKoN75C9Ej6aQala+pBqbF38KT5+NGYEYkWhqEbwd0R8a24gVyV2LOMlE6q39/J26DT8aybcax/U3FJNJ3zU1vL4bRdtRWePy3zG/Oo6imyFVCGcxJTnBdZihE0v0ih3QbQLj7vUePhd5cETviNJbsKHoCVF+PgtK9/S3La+t1W+/fdNp4Ci+xZtgqNCQL05ySh9N4KugOMA0hnA5aN3v9QA3aE9Sk+7URpZ7oVeYQTSHi2WvLmsNMo1Ukr8vXUTD5XxkxsFdnFPQ6fpXyoNZZ2Uzt066YbBjnPrNBX4T+alJluT6rNPMZUoVZZzGlbLoHcg64hF2q5g5xTMzdL4OCBM5axWj1/K8BiTdg5YLjql/Jgnf0NRpx85YPxgdmPuttV5f7yREEhGBDlsyMTr8enofejtFA7l02aDopNapAh/n8eGpQCcUhT75mYZkPShAxU9n5OPd6CQi12L/NSKPrz9P1R8rTV+O2QYb+UWbGyTYlaT1d1aq2DJc9CMSo6qKZ8pM+7d1ychaerNbpX0FjCCeMJ6+I8aclReLHvVGxIMIxonSJoMCu/cg+zOREX9Ah1rd098n6XwcWBhgHPxizEhv9v5JgJD2epR6++W5znT1rKjKbKzYCe/va2yYNZC8yUoPcwKtazeu4eZtG3YLClIa39OxMciitdVdb3egZYhBBknhp67aI6yz+LHmhujrxwvN+PJPb1kS7g== X-Forefront-Antispam-Report: CIP:63.35.35.123;CTRY:IE;LANG:en;SCL:1;SRV:;IPV:CAL;SFV:NSPM;H:64aa7808-outbound-1.mta.getcheckrecipient.com;PTR:ec2-63-35-35-123.eu-west-1.compute.amazonaws.com;CAT:NONE;SFS:(13230040)(36860700013)(35042699022)(1800799024)(82310400026)(376014)(14060799003);DIR:OUT;SFP:1101; X-OriginatorOrg: arm.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 07 Nov 2024 16:09:33.8575 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: d1e194c2-f01a-4700-975c-08dcff4691cd X-MS-Exchange-CrossTenant-Id: f34e5979-57d9-4aaa-ad4d-b122a662184d X-MS-Exchange-CrossTenant-OriginalAttributedTenantConnectingIp: TenantId=f34e5979-57d9-4aaa-ad4d-b122a662184d;Ip=[63.35.35.123];Helo=[64aa7808-outbound-1.mta.getcheckrecipient.com] X-MS-Exchange-CrossTenant-AuthSource: DB1PEPF00039234.eurprd03.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: AS8PR08MB8945 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20241107_080943_408293_8742D8AA X-CRM114-Status: UNSURE ( 7.95 ) X-CRM114-Notice: Please train this message. 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 From: Ben Gainey parse-events is modified, adding the "alt-period-jitter" term which can be used to enable random jitter of the alternative sample period. Signed-off-by: Ben Gainey --- tools/include/uapi/linux/perf_event.h | 10 +++++++++- tools/perf/tests/attr.c | 1 + tools/perf/tests/attr.py | 1 + tools/perf/tests/attr/base-record | 3 ++- tools/perf/tests/attr/base-record-spe | 3 ++- tools/perf/tests/attr/base-stat | 1 + tools/perf/tests/attr/system-wide-dummy | 1 + .../tests/attr/test-record-alt-period-jitter-term | 13 +++++++++++++ tools/perf/tests/attr/test-record-dummy-C0 | 1 + tools/perf/util/parse-events.c | 15 +++++++++++++++ tools/perf/util/parse-events.h | 3 ++- tools/perf/util/parse-events.l | 1 + tools/perf/util/pmu.c | 1 + 13 files changed, 50 insertions(+), 4 deletions(-) create mode 100644 tools/perf/tests/attr/test-record-alt-period-jitter-term diff --git a/tools/include/uapi/linux/perf_event.h b/tools/include/uapi/linux/perf_event.h index bedae424ba36..16dbeea5803e 100644 --- a/tools/include/uapi/linux/perf_event.h +++ b/tools/include/uapi/linux/perf_event.h @@ -461,7 +461,15 @@ struct perf_event_attr { inherit_thread : 1, /* children only inherit if cloned with CLONE_THREAD */ remove_on_exec : 1, /* event is removed from task on exec */ sigtrap : 1, /* send synchronous SIGTRAP on event */ - __reserved_1 : 26; + /* + * jitter_alternate_period: + * + * add a limited amount of jitter on each + * alternate period, where the jitter is between + * [0, (2</dev/null 2>&1 +ret = 1 +kernel_since = 6.11 + +[event-10:base-record] +sample_period=3 +alternative_sample_period=2 +jitter_alternate_period=7 + +freq=0 +sample_type=7 diff --git a/tools/perf/tests/attr/test-record-dummy-C0 b/tools/perf/tests/attr/test-record-dummy-C0 index d4f0546e02b6..0f3360c35a5e 100644 --- a/tools/perf/tests/attr/test-record-dummy-C0 +++ b/tools/perf/tests/attr/test-record-dummy-C0 @@ -54,3 +54,4 @@ branch_sample_type=0 sample_regs_user=0 sample_stack_user=0 alternative_sample_period=0 +jitter_alternate_period=0 diff --git a/tools/perf/util/parse-events.c b/tools/perf/util/parse-events.c index 48723cea3a51..d3a4f52a7644 100644 --- a/tools/perf/util/parse-events.c +++ b/tools/perf/util/parse-events.c @@ -827,6 +827,7 @@ static const char *config_term_name(enum parse_events__term_type term_type) [PARSE_EVENTS__TERM_TYPE_LEGACY_CACHE] = "legacy-cache", [PARSE_EVENTS__TERM_TYPE_HARDWARE] = "hardware", [PARSE_EVENTS__TERM_TYPE_ALT_SAMPLE_PERIOD] = "alt-period", + [PARSE_EVENTS__TERM_TYPE_ALT_PERIOD_JITTER] = "alt-period-jitter", }; if ((unsigned int)term_type >= __PARSE_EVENTS__TERM_TYPE_NR) return "unknown term"; @@ -856,6 +857,7 @@ config_term_avail(enum parse_events__term_type term_type, struct parse_events_er case PARSE_EVENTS__TERM_TYPE_METRIC_ID: case PARSE_EVENTS__TERM_TYPE_SAMPLE_PERIOD: case PARSE_EVENTS__TERM_TYPE_ALT_SAMPLE_PERIOD: + case PARSE_EVENTS__TERM_TYPE_ALT_PERIOD_JITTER: case PARSE_EVENTS__TERM_TYPE_PERCORE: return true; case PARSE_EVENTS__TERM_TYPE_USER: @@ -1010,6 +1012,16 @@ do { \ } attr->alternative_sample_period = term->val.num; break; + case PARSE_EVENTS__TERM_TYPE_ALT_PERIOD_JITTER: + CHECK_TYPE_VAL(NUM); + if ((unsigned int)term->val.num > 7) { + parse_events_error__handle(err, term->err_val, + strdup("expected a value between 0-7"), + NULL); + return -EINVAL; + } + attr->jitter_alternate_period = (unsigned int)term->val.num; + break; case PARSE_EVENTS__TERM_TYPE_DRV_CFG: case PARSE_EVENTS__TERM_TYPE_USER: case PARSE_EVENTS__TERM_TYPE_LEGACY_CACHE: @@ -1137,6 +1149,7 @@ static int config_term_tracepoint(struct perf_event_attr *attr, case PARSE_EVENTS__TERM_TYPE_LEGACY_CACHE: case PARSE_EVENTS__TERM_TYPE_HARDWARE: case PARSE_EVENTS__TERM_TYPE_ALT_SAMPLE_PERIOD: + case PARSE_EVENTS__TERM_TYPE_ALT_PERIOD_JITTER: default: if (err) { parse_events_error__handle(err, term->err_term, @@ -1269,6 +1282,7 @@ do { \ case PARSE_EVENTS__TERM_TYPE_LEGACY_CACHE: case PARSE_EVENTS__TERM_TYPE_HARDWARE: case PARSE_EVENTS__TERM_TYPE_ALT_SAMPLE_PERIOD: + case PARSE_EVENTS__TERM_TYPE_ALT_PERIOD_JITTER: default: break; } @@ -1323,6 +1337,7 @@ static int get_config_chgs(struct perf_pmu *pmu, struct parse_events_terms *head case PARSE_EVENTS__TERM_TYPE_LEGACY_CACHE: case PARSE_EVENTS__TERM_TYPE_HARDWARE: case PARSE_EVENTS__TERM_TYPE_ALT_SAMPLE_PERIOD: + case PARSE_EVENTS__TERM_TYPE_ALT_PERIOD_JITTER: default: break; } diff --git a/tools/perf/util/parse-events.h b/tools/perf/util/parse-events.h index f1482361321a..9b9649da1932 100644 --- a/tools/perf/util/parse-events.h +++ b/tools/perf/util/parse-events.h @@ -80,7 +80,8 @@ enum parse_events__term_type { PARSE_EVENTS__TERM_TYPE_LEGACY_CACHE, PARSE_EVENTS__TERM_TYPE_HARDWARE, PARSE_EVENTS__TERM_TYPE_ALT_SAMPLE_PERIOD, -#define __PARSE_EVENTS__TERM_TYPE_NR (PARSE_EVENTS__TERM_TYPE_ALT_SAMPLE_PERIOD + 1) + PARSE_EVENTS__TERM_TYPE_ALT_PERIOD_JITTER, +#define __PARSE_EVENTS__TERM_TYPE_NR (PARSE_EVENTS__TERM_TYPE_ALT_PERIOD_JITTER + 1) }; struct parse_events_term { diff --git a/tools/perf/util/parse-events.l b/tools/perf/util/parse-events.l index 1972a5a696ef..c22e64407d64 100644 --- a/tools/perf/util/parse-events.l +++ b/tools/perf/util/parse-events.l @@ -332,6 +332,7 @@ aux-output { return term(yyscanner, PARSE_EVENTS__TERM_TYPE_AUX_OUTPUT); } aux-sample-size { return term(yyscanner, PARSE_EVENTS__TERM_TYPE_AUX_SAMPLE_SIZE); } metric-id { return term(yyscanner, PARSE_EVENTS__TERM_TYPE_METRIC_ID); } alt-period { return term(yyscanner, PARSE_EVENTS__TERM_TYPE_ALT_SAMPLE_PERIOD); } +alt-period-jitter { return term(yyscanner, PARSE_EVENTS__TERM_TYPE_ALT_PERIOD_JITTER); } cpu-cycles|cycles { return hw_term(yyscanner, PERF_COUNT_HW_CPU_CYCLES); } stalled-cycles-frontend|idle-cycles-frontend { return hw_term(yyscanner, PERF_COUNT_HW_STALLED_CYCLES_FRONTEND); } stalled-cycles-backend|idle-cycles-backend { return hw_term(yyscanner, PERF_COUNT_HW_STALLED_CYCLES_BACKEND); } diff --git a/tools/perf/util/pmu.c b/tools/perf/util/pmu.c index 7615d05e389f..c7a5ee61c436 100644 --- a/tools/perf/util/pmu.c +++ b/tools/perf/util/pmu.c @@ -1739,6 +1739,7 @@ int perf_pmu__for_each_format(struct perf_pmu *pmu, void *state, pmu_format_call "aux-output", "aux-sample-size=number", "alt-period=number", + "alt-period-jitter=number", }; struct perf_pmu_format *format; int ret;