From mboxrd@z Thu Jan 1 00:00:00 1970 Authentication-Results: smtp.subspace.kernel.org; arc=pass header.oldest-pass=0 smtp.remote-ip=40.107.201.0 ARC-Seal: i=2; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; cv=pass; t=1796305401; b=JTU2QdstcLnkiKWGTSTd1qzBqMUsEN00RgNm2SSj/LXUYyR13qZGVTfENWw0414qtNk6 IOaK/AnsT7UakEuU6d1bi+wFbDmBRbP3emmVnt+mr6PoQSATwOggBGfQJRnpZiXIGMxOi DxfIaDUo7zkeHSFYpVmhIrRVljhoHhIemTYstJrmmbkinYxIqR7UWXiE9afNf+4TCiYxx ZVXZvEmL0JU97ZMqZbsE1/cCQWQSHh2TdnxpOOvlBLP4Xbk85V4Nh7dCrpAgzMIaQ3OmO VOelWz1NYAuqN+Tg3DaBgQ3s91pTuB6kkUx2cSFpuz8W4+IL2RAxv5O+i/HRiValBWA== ARC-Message-Signature: i=2; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; c=relaxed/relaxed; t=1796305401; h=DMARC-Filter:DKIM-Signature:Received:Received: X-MS-Exchange-Authentication-Results:Received-SPF:Received:Received: Received:Received:Message-ID:Date:MIME-Version:User-Agent:Subject:To: CC:References:Content-Language:From:In-Reply-To:Content-Type: Content-Transfer-Encoding:X-EOPAttributedMessage: X-MS-PublicTrafficType:X-MS-TrafficTypeDiagnostic: X-MS-Office365-Filtering-Correlation-Id:X-MS-Exchange-SenderADCheck: X-MS-Exchange-AntiSpam-Relay:X-Microsoft-Antispam: X-Microsoft-Antispam-Message-Info:X-Forefront-Antispam-Report: X-MS-Exchange-AntiSpam-MessageData-ChunkCount: X-MS-Exchange-AntiSpam-MessageData-0:X-OriginatorOrg: X-MS-Exchange-CrossTenant-OriginalArrivalTime: X-MS-Exchange-CrossTenant-Network-Message-Id: X-MS-Exchange-CrossTenant-Id: X-MS-Exchange-CrossTenant-OriginalAttributedTenantConnectingIp: X-MS-Exchange-CrossTenant-AuthSource:X-MS-Exchange-CrossTenant-AuthAs: X-MS-Exchange-CrossTenant-FromEntityHeader: X-MS-Exchange-Transport-CrossTenantHeadersStamped; bh=NAytouXfr2okI5WRPzDpv1K0wO3WW8qk8J2dzSdgQHs=; b=QCLQUtuTWrNMK9Zz7nFw2e0M6Esr1TdYNik0dd0iP0bIxQDfQ/YpocWYOB/FSs1CmAvE R25gnvKro2aPAje9b+Tzx+SgJo+znmhRCUBQ9q/pd+A5Vq7y4JaJDpZPKYUsRiuoWlfAT AG0eNKbQSa+zz2sl8GToGTuvh6ctfOooEV7BHSi5vwQF2R/TJg+BVR6+OoKNAYCzc5Qbd 4AuioiBHcwTI49mOOXNzgb95wNBg4HKHHifhsXouFI3oxJjKM5tFaSyDiiiQ3Z139ZkOt 639oB+snVDr5XCk/pnW/Ts7LOEhzngppfXzCJlhvkHxu/AMTTbiRiXzZlz3kg0TSmZw== ARC-Authentication-Results: i=2; smtp.subspace.kernel.org; dmarc=pass header.from=amd.com; spf=fail smtp.mailfrom=amd.com; dkim=pass header.d=amd.com header.i=@amd.com header.a=rsa-sha256 header.s=selector1 header.b=kJq5amnx; arc=pass header.oldest-pass=0 smtp.remote-ip=40.107.201.0 Received: from CH4PR04CU002.outbound.protection.outlook.com (mail-northcentralusazon11013000.outbound.protection.outlook.com [40.107.201.0]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange ECDHE (secp384r1) server-signature ECDSA (prime256v1) server-digest SHA256) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id DB644606A32F; Thu, 3 Dec 2026 13:43:20 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.4.2 smtp.subspace.kernel.org DB644606A32F Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=amd.com Authentication-Results: smtp.subspace.kernel.org; spf=fail smtp.mailfrom=amd.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key, unprotected) header.d=amd.com header.i=@amd.com header.a=rsa-sha256 header.s=selector1 header.b=kJq5amnx ARC-Seal: i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none; b=MbV2/dWKQr8wdfwCpScsTvUHJrToyo1vv3wouR69hG1ccIyNJfCu2ljTLeuqEuxS8QK+CL9p3FC3+QbxptFaNMnNP+dqSPP1AJyzZ0cZbBXrWCr4g9olfd3piuls/WudtSqH6uA2HoNDS+mCj/I6s2MXl3K2yM8jtVrPQje5uxN6RuMxFwGUaBg3jZUGIQTCPKmTglNg2gt4K0s16TfD66rXtqQaesIgbv67teaWogcV/XEIPj8/zOQaCvsr9p/RvER0jQ+ysN8+UoOedBlDKcQ+eFLz4sLm6lzIF9otbcCSeOti3S1GJ7gMTk2WUV9HN/6vF68570uqTa/qaZA6rQ== 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=NAytouXfr2okI5WRPzDpv1K0wO3WW8qk8J2dzSdgQHs=; b=JK1mum/285pAsBrUb6+caI4hI786rgxqnufn6S2YR83o1yiZS6Ds8EYqYhxI+Bfyc849H/sw6Z7MZWWvw3fvjJwP4RY1wgmK8pRNXjKdHo3VShKZrOOunqUfEVk35UA9BELPPs6BnzypA+O5T4uhViNjD3HIszcsSBRmaKfCCnv7sPKPH/BCljla7y6fOt+0i6XvbF3JoiXpQ+7zXXdihOvKDjeG3hyujvxxjPREoEUaeB1eJxkRgPoMtI4IPV109KREt4D9R8kOfxiI/Yj9Hu4MF6eqgrJet3fVR7SNSpfj/HW2bf5se0iD86DCU8/laC8QTlxPgCzM82YFa5o+Hg== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass (sender ip is 165.204.84.17) smtp.rcpttodomain=mailbox.org smtp.mailfrom=amd.com; dmarc=pass (p=quarantine sp=quarantine pct=100) action=none header.from=amd.com; dkim=none (message not signed); arc=none (0) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=amd.com; s=selector1; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=NAytouXfr2okI5WRPzDpv1K0wO3WW8qk8J2dzSdgQHs=; b=kJq5amnx1+2/wxupGLKHjhmRfqMfTqmLYmcMV0TajS2r0mc73/8wvMqdfzoN4Uf7o3CdQ59IfDfInBROSvEJgsAWHwjg/9OUt5qIfwTNQHaywrfxwTmgREZaE2LhF/IfJ/o6ceX/vnhQbxbCFA2erXjfPysV2xxzyiEsIlFrXKU= Received: from CH5P221CA0020.NAMP221.PROD.OUTLOOK.COM (2603:10b6:610:1f2::11) by DS0PR12MB7536.namprd12.prod.outlook.com (2603:10b6:8:11c::21) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.21.688.12; Thu, 3 Dec 2026 13:43:13 +0000 Received: from DS8PEPF000000DD.namprd05.prod.outlook.com (2603:10b6:610:1f2:cafe::66) by CH5P221CA0020.outlook.office365.com (2603:10b6:610:1f2::11) with Microsoft SMTP Server (version=TLS1_3, cipher=TLS_AES_256_GCM_SHA384) id 15.21.688.12 via Frontend Transport; Thu, 3 Dec 2026 13:43:11 +0000 X-MS-Exchange-Authentication-Results: mx.microsoft.com 1; spf=pass (sender IP is 165.204.84.17) smtp.mailfrom=amd.com; dkim=none (message not signed) header.d=none;dmarc=pass action=none header.from=amd.com; Received-SPF: Pass (protection.outlook.com: domain of amd.com designates 165.204.84.17 as permitted sender) receiver=protection.outlook.com; client-ip=165.204.84.17; helo=satlexmb08.amd.com; pr=C Received: from satlexmb08.amd.com (165.204.84.17) by DS8PEPF000000DD.mail.protection.outlook.com (10.167.23.198) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.21.709.6 via Frontend Transport; Thu, 3 Dec 2026 13:43:10 +0000 Received: from Satlexmb09.amd.com (10.181.42.218) by satlexmb08.amd.com (10.181.42.217) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.2.2562.57; Thu, 3 Dec 2026 07:43:07 -0600 Received: from satlexmb07.amd.com (10.181.42.216) by satlexmb09.amd.com (10.181.42.218) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.2.2562.57; Thu, 3 Dec 2026 07:43:06 -0600 Received: from [10.94.186.132] (10.180.168.240) by satlexmb07.amd.com (10.181.42.216) with Microsoft SMTP Server id 15.2.2562.57 via Frontend Transport; Thu, 3 Dec 2026 07:42:59 -0600 Message-ID: Date: Thu, 3 Dec 2026 19:12:58 +0530 X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Post: List-Help: List-Subscribe: List-Unsubscribe: List-Owner: Precedence: list MIME-Version: 1.0 User-Agent: Mozilla Thunderbird Subject: Re: [PATCH v4 2/4] perf/x86/amd/core: Handle overflows of counters stopped by a throttle To: Oancea Catalin , Peter Zijlstra , Ingo Molnar , Arnaldo Carvalho de Melo , Namhyung Kim CC: Kan Liang , Mark Rutland , Alexander Shishkin , Jiri Olsa , "Ian Rogers" , Adrian Hunter , "James Clark" , Thomas Gleixner , "Borislav Petkov" , Dave Hansen , , "H. Peter Anvin" , , , Dapeng Mi , Ravi Bangoria References: <20261203113922.77972-1-john3@mailbox.org> <20261203113922.77972-3-john3@mailbox.org> Content-Language: en-US From: Ravi Bangoria In-Reply-To: <20261203113922.77972-3-john3@mailbox.org> Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: 7bit X-EOPAttributedMessage: 0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: DS8PEPF000000DD:EE_|DS0PR12MB7536:EE_ X-MS-Office365-Filtering-Correlation-Id: b06f0f10-9a04-456d-c72b-08df51435f05 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0;ARA:13230040|82310400026|23010399003|36860700016|1800799024|376014|7416014|11063799006|5023799004|4143699003|6133799003|261009223027099003|22082099003|18002099003|10067099003|56012099006|261022105027099003|261022075727099003|261028144727099003|261102123227099003|261021121427099003|261026140227099003; X-Microsoft-Antispam-Message-Info: gmK9Dit1ltov4Fst/3/zOMYMPINdEG4EueBVW7j7aUR335kGONXgGk+hWDirxZCOurNNiUvG+KuEnHcRdMsCKUtyrqmWh2TX+VWaOxEUQGfPnLVOOAwh6vFsZWF2G08WEJJBmQ+M1D7HBk/O7aCo63OKge+hpWngrEFy0EHfMY4DwsLI9m0EF+zb2VoB7PhlhmwSTZLpQkX154HTGUdm1GwNN7lUADEKYYynmk/a5GepUJZOm3sA6XUCOgo8ZK6nK5gTTYA8rQFlv0dLRSIdmXm1s7jClXM4Du/GM32a8VtGKMHUwo4VO6hDmddPHXIKv//aGN4Ax5JvDpKQlagfARzwx+oj/tx2VT6/ZHdhwRD4+ucrXAZSEBTbw7hIHLnVTzGdgPiuNYTeo0QXE341KleiDSPkNQUN5tc9qpPa0bUpK2BoqMFSoL6ZQFl40gbMcOZpDtJbF/XPaDdOefGHkmcVfwhzvN1kdZIILEdFXpQ6ss3O0czwPv8ExXmoqtFzTLf2mhQwSF9WX9qQ5a7EY4kPZhh40omFnSaiZIRF01yGUrjW1tMHi9DmdAg9mnkm1/KUFcYB0IZhODKb1f7ayBpZh+VhtiS+2Lld3dIUCMdrHqo2SgpNFTSE4Xdmfs5f47IBystIc2YGKbVY5CK0vGkwa7CJPk7lpBQGKWUtka4tR72FGA8x4b9j3ONyql+5keRLU7dtdrMiztCwRD5XJQ== X-Forefront-Antispam-Report: CIP:165.204.84.17;CTRY:US;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:satlexmb08.amd.com;PTR:InfoDomainNonexistent;CAT:NONE;SFS:(13230040)(82310400026)(23010399003)(36860700016)(1800799024)(376014)(7416014)(11063799006)(5023799004)(4143699003)(6133799003)(261009223027099003)(22082099003)(18002099003)(10067099003)(56012099006)(261022105027099003)(261022075727099003)(261028144727099003)(261102123227099003)(261021121427099003)(261026140227099003);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: utt1+CCOHKI53NJyP6ZF1cwswSRMRdPs5RsQ+2c+FhyQvPCMXy4tazZLQMqg70x4u083vdLC0Xp0s/69i90nCzF2NvEkq/kPZ8iA8tr56vO/+13Pf29ifG6l5uwGKpJTmzGyHpjt7wriz/aX1ITosMuJ4R9grobuVBjUnEzE1+EkP0qQAHQrm3n0cx8z3mjmh+XJjf9JP6ss7KjWKQdcTLMEvtxSxlM2QnTCPdf+By76G/zWA3GhuMPDOv39GJtXpmCa7oG2t2Lii66n7ZvrMkpw7qwNguy+D+4KBVFX4I0ztLZ5nCcMYrFWqIj4iJpVcERQlG3iMSaGnuGkp1MBih3B5nn07UUbJCN5xOKRbUXI7HDj5ix21HDBOxzINvw7MUJKDzHA26tGoLUGdELeqRozcBF9B++43vWavlNDxrxEgrnZDX+lIU3p8HQqwFXH X-OriginatorOrg: amd.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 03 Dec 2026 13:43:10.7961 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: b06f0f10-9a04-456d-c72b-08df51435f05 X-MS-Exchange-CrossTenant-Id: 3dd8961f-e488-4e60-8e11-a82d994e183d X-MS-Exchange-CrossTenant-OriginalAttributedTenantConnectingIp: TenantId=3dd8961f-e488-4e60-8e11-a82d994e183d;Ip=[165.204.84.17];Helo=[satlexmb08.amd.com] X-MS-Exchange-CrossTenant-AuthSource: DS8PEPF000000DD.namprd05.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: DS0PR12MB7536 > Since commit 9734e25fbf5a ("perf: Fix the throttle logic for a group") > a throttle stops the whole event group. perf_event_overflow() can > therefore stop counters which the NMI handler has not reached yet. > > amd_pmu_v2_handle_irq() tests cpuc->active_mask while it walks the > counters. It skips a sibling which was stopped that way, also when the > sibling has overflowed in the same NMI. The overflow is not handled, > the status bit stays set and the handler warns: > > New overflows for inactive PMCs: 2 > WARNING: arch/x86/events/amd/core.c:1031 at amd_pmu_v2_handle_irq+0x86e/0x9a0 > > An unprivileged task can trigger this with perf_event_paranoid at its > default of 2: a group of two sampling events with short periods on the > task itself, which spins in user space. > > Take a copy of active_mask before the loop and walk the counters which > were active on entry. The overflow of a counter which was stopped in > the meantime is then handled like any other. > > The problem was found with syzkaller. An AI coding assistant (Claude > Code) was used in the analysis and in writing the reproducer and the > patch. > > Fixes: 9734e25fbf5a ("perf: Fix the throttle logic for a group") > Signed-off-by: Oancea Catalin > Cc: stable@vger.kernel.org Reviewed-by: Ravi Bangoria Thanks, Ravi