From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from BL0PR03CU003.outbound.protection.outlook.com (mail-eastusazon11012045.outbound.protection.outlook.com [52.101.53.45]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id B97261EB5E3 for ; Tue, 18 Nov 2025 01:39:02 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=fail smtp.client-ip=52.101.53.45 ARC-Seal:i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1763429944; cv=fail; b=rVRMd3BxkmVihBjINvqcMRSME+MoZA7bE0fmzhcMBlGWZdll13w9CcU7/F0zRpSxoE7NwcXkreln74uhulnvRVEnLfB+wd+EBhLlMk6m/bup3JmB7mx5MxhkW8kBuV59dN58+rEv8jjtNMFzKyL326jOkmtZ4eIwmHvbS6gi7FY= ARC-Message-Signature:i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1763429944; c=relaxed/simple; bh=1FRSR4J7rrnBevt0sjfLvBn7of1GdqTimaZkd3OsT/o=; h=Message-ID:Date:MIME-Version:Subject:To:CC:References:From: In-Reply-To:Content-Type; b=lOy1mdb458US4uRgBftckjFiNLgHLRX+aHZiUVMOD4m2NOuMfBIXw2j3JQv2xTxb6E9IfNP6pvNhrdzCwXS5qlHmzCdCa7hdn+S61HgObQrBBWyxtiCefUIwDdA2N0xC3og6aQpJbYPEPcgI6IO4IPZ6wdSuFi+MDIa2Z7NNkdE= ARC-Authentication-Results:i=2; smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=amd.com; spf=fail smtp.mailfrom=amd.com; dkim=pass (1024-bit key) header.d=amd.com header.i=@amd.com header.b=QOYN968S; arc=fail smtp.client-ip=52.101.53.45 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) header.d=amd.com header.i=@amd.com header.b="QOYN968S" ARC-Seal: i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none; b=FbTudhA9r/TZRWNzUB7lA1y0kBgERWiOhHC4BGb+489eLyhwQgXDSalKnsGU7bheM8NAdlLRs5lppLQIjf7OSrNlIUEi4IanJS2Jaf5kANfAGEh0JLhdLJT9FAUoTYx7BHUQ5trguExhlDozeuhSRuf1f8ZhHgzxBup8RPFPFU9m65aQLq+MK5IztHi7haXRc/2MVQTVoL6kVWrcNIfJZvFQc87Y7cIhXC6m/T5zQYicBH2gBVcFpSEFCvhL3YLQHQl9ml7LzkvB3CB4g1PbzR5/Tcw+IoKN0WZn6YZoLlg9nYpCDClLkHOoU14iN4UVBDKKyPWYYDdpo5RZG9qvJQ== 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=cZBjUxpeq25oucuOfZ0Jp1PHdzZLhxG5Cz0ftozK8HM=; b=QK68RP++DOdLg99eRvtbtWEmRLClJYyUGugzpsOkB8HxCG362YhKcmBO6JWMx+nvTWrMovUmwunmVPT5js0kxqHoG6KNr7asy6ifKOu34MmBEGEMaSDqtW/HvgCOtxbBJId8TFV2aPRXKfwVApa4AEsFTAVgjl1prlqwBZnMTnmrNR+XBX9oZGQyoPRZ2B62T3Td90nhyITT6RwyDYI9K9nQHHcvCr+zcZAHbmGaeB1Fvdcb0eKJ28yXkd/8l8GxiNxkeKAJVGAhK1QInJQOVfFt5NsThHilf9OkFdsPyUo27VCjmy6lJ9SVpisGLN/r7yYY39amkkwa99yqXdRzUg== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass (sender ip is 165.204.84.17) smtp.rcpttodomain=google.com 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=cZBjUxpeq25oucuOfZ0Jp1PHdzZLhxG5Cz0ftozK8HM=; b=QOYN968SychlSkV/vU2SzOlknaV4/o3/t5lH4BM05qlDoSLEw5CNyvUePccvqG63UaJedZgiQJIWLMtuDHbmq8yJ2ajRFPBzMvOAw3sRjbAwxFVtQexw8C65GHLwag6l/l6a7i437hmyOF4Tew+xaLOddfZsE9WN3yoRSOoqGzI= Received: from SJ0PR03CA0254.namprd03.prod.outlook.com (2603:10b6:a03:3a0::19) by PH8PR12MB6818.namprd12.prod.outlook.com (2603:10b6:510:1c9::11) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.9320.16; Tue, 18 Nov 2025 01:38:55 +0000 Received: from CO1PEPF000044FB.namprd21.prod.outlook.com (2603:10b6:a03:3a0:cafe::5f) by SJ0PR03CA0254.outlook.office365.com (2603:10b6:a03:3a0::19) with Microsoft SMTP Server (version=TLS1_3, cipher=TLS_AES_256_GCM_SHA384) id 15.20.9320.23 via Frontend Transport; Tue, 18 Nov 2025 01:38:47 +0000 X-MS-Exchange-Authentication-Results: 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=satlexmb07.amd.com; pr=C Received: from satlexmb07.amd.com (165.204.84.17) by CO1PEPF000044FB.mail.protection.outlook.com (10.167.241.201) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.9366.1 via Frontend Transport; Tue, 18 Nov 2025 01:38:54 +0000 Received: from satlexmb07.amd.com (10.181.42.216) by satlexmb07.amd.com (10.181.42.216) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.2.2562.17; Mon, 17 Nov 2025 17:38:53 -0800 Received: from [172.31.184.125] (10.180.168.240) by satlexmb07.amd.com (10.181.42.216) with Microsoft SMTP Server id 15.2.2562.17 via Frontend Transport; Mon, 17 Nov 2025 17:38:50 -0800 Message-ID: Date: Tue, 18 Nov 2025 07:08:49 +0530 Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 User-Agent: Mozilla Thunderbird Subject: Re: [RFC PATCH 0/5] sched/psi: Fix PSI accounting with proxy execution To: John Stultz CC: Ingo Molnar , Peter Zijlstra , Juri Lelli , Vincent Guittot , Johannes Weiner , Suren Baghdasaryan , , Dietmar Eggemann , Steven Rostedt , Ben Segall , Mel Gorman , Valentin Schneider References: <20251117185550.365156-1-kprateek.nayak@amd.com> Content-Language: en-US From: K Prateek Nayak In-Reply-To: Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: 8bit X-EOPAttributedMessage: 0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: CO1PEPF000044FB:EE_|PH8PR12MB6818:EE_ X-MS-Office365-Filtering-Correlation-Id: 166de12b-769b-4e94-364f-08de26433c06 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0;ARA:13230040|36860700013|1800799024|376014|7416014|82310400026; X-Microsoft-Antispam-Message-Info: =?utf-8?B?RUdlL1Q4K3EwNEVKUFI4NnloUnFuTHVpZXk5U3lGS3RsSFd0Rm5md0taVGIx?= =?utf-8?B?R1JZWjlJZ1JyejJOQ1VldjczNG81bkRGeFVJYTB6R1A1QUFwVzNVa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1Y1lzVklXYnhwc01p?= =?utf-8?B?bmtRcVZFaEx0emxnWXJXRy8vWnB6aS9lT3JzMituczV4Wm5nNmxOTTVWR2Na?= =?utf-8?B?VDZvYXFDTGxwQThCWjVGTjBGeWRXN0N5b2w5N2ZCZEJnWTFNa2tyU212MWxy?= =?utf-8?B?MVV3bnFQQ25XczNmK2RQSlpHeDg0aVB2TUpEY1ZjUFRSSWkvbUhpMWpvK3ZH?= =?utf-8?Q?iqA+u86dSaJ0gIQkV3Xr1YXRF?= X-Forefront-Antispam-Report: CIP:165.204.84.17;CTRY:US;LANG:en;SCL:1;SRV:;IPV:CAL;SFV:NSPM;H:satlexmb07.amd.com;PTR:InfoDomainNonexistent;CAT:NONE;SFS:(13230040)(36860700013)(1800799024)(376014)(7416014)(82310400026);DIR:OUT;SFP:1101; X-OriginatorOrg: amd.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 18 Nov 2025 01:38:54.3561 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 166de12b-769b-4e94-364f-08de26433c06 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=[satlexmb07.amd.com] X-MS-Exchange-CrossTenant-AuthSource: CO1PEPF000044FB.namprd21.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: PH8PR12MB6818 Hello John, On 11/18/2025 6:15 AM, John Stultz wrote: > On Mon, Nov 17, 2025 at 10:56 AM K Prateek Nayak wrote: >> >> When booting into a kernel with CONFIG_SCHED_PROXY_EXEC and CONFIG_PSI, >> a inconsistent task state warning was noticed soon after the boot >> similar to: >> >> psi: inconsistent task state! task=... cpu=... psi_flags=4 clear=0 set=4 >> >> On analysis, the following sequence of event was found to be the cause >> of the splat: >> >> o Blocked task is retained on the runqueue. >> o psi_sched_switch() sees task_on_rq_queued() and retains the runnable >> signals for the task. >> o Tasks blocks later via proxy_deactivate() but psi_dequeue() doesn't >> adjust the PSI flags since DEQUEUE_SLEEP is set expecting >> psi_sched_switch() to fix the signals. >> o The blocked task is woken up with the PSI state still reflecting that >> the task is runnable (TSK_RUNNING) leading to the splat. > > Hey, K Prateek! > Thanks for chasing this down and sending this series out! > > I'm still getting my head around the description above (its been > awhile since I last looked at the PSI code), but early on I often hit > PSI splats, and I thought I had addressed it with the patch here: > https://github.com/johnstultz-work/linux-dev/commit/f60923a6176b3778a8fc9b9b0bbe4953153ce565 Oooo! Let me go test that. > > And with that I've not run across any warnings since. > > Now, I hadn't tripped over the issue recently with the subset of the > full series I've been pushing upstream, and as I most easily ran into > it with the sleeping owner enqueuing feature I was holding the fix > back for those changes. But I realize unfortunately CONFIG_PSI at some > point got disabled in my test defconfig, so I've not had the > opportunity to trip it, and sure enough I can trivially see it booting > with the current upstream code. I hit this on tip:sched/core when looking at the recent sched_yield() changes. Maybe the "blocked_on" serialization with the proxy migration will make this all go away :) > > Applying that fix does seem to avoid the warnings in my trivial > testing, but again I've not dug through the logic in awhile, so you > may have a better sense of the inadequacies of that fix. > > If it looks reasonable to you, I'll rework the commit message so it > isn't so focused on the sleeping-owner-enquing case and submit it. That would be great! And it seems to be a lot more simpler than the the stuff I'm trying to do. I'll give it a spin and get back to you. Thank you again for pointing to the fix. > > I'll have to spend some time here looking more at your proposed > solution. On the initial glance, I do fret a little with the > task->sched_proxy bit overlapping a bit in meaning with the > task->blocked_on value. Ack! I'm pretty sure with the blocked_on locking we'll not have these "interesting" situations but I posted the RFC out just in case we needed something in the interim but turns out its a solved problem :) On last thing, it'll be good to get some clarification on how to treat the blocked tasks retained on the runqueue for PSI - quick look at your fix suggests we still consider them runnable (TSK_RUNNING) from PSI standpoint - is this ideal or should PSI consider these tasks blocked? -- Thanks and Regards, Prateek