From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from PH8PR06CU001.outbound.protection.outlook.com (mail-westus3azon11012024.outbound.protection.outlook.com [40.107.209.24]) (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 44EB4199D8; Sat, 21 Mar 2026 09:46:06 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=fail smtp.client-ip=40.107.209.24 ARC-Seal:i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1774086368; cv=fail; b=m/vgjx7cjQuKUj7M1RayIYiHNi1YbLxWVe90phdx7Jm+8bH+qnmlf+6GwHHSRJlDf1FldhT+zB4UOL3HJxghNDhxyC9sAU/UXr8BTjcC409DaRShQMOc8wBr4lL4aWr/v96qFwJ1pLvzE8mnk9SSU/TUQfk/ySZwBcTBDN0/hqg= ARC-Message-Signature:i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1774086368; c=relaxed/simple; bh=XDa37KBqs9tF1tFlEA82KUE4VfMiAAPefAMQUjIGjxU=; h=Message-ID:Date:MIME-Version:Subject:From:To:CC:References: In-Reply-To:Content-Type; b=X4+k+c1pIacgM9PmzbHmrRPGhVK39CcRZ48GQ+vtbj7xaiojC80VdwTHrHXvyKAoJiEBCjUL8WHwdllOPWGGePt/LAyqArk9zyHP0KQ2JMVwjtfs6+m5uDKkB+vArP8m+aYbp4owQppUUITtr5xN1zYRNoM2vkpDuSJDP+WCwvU= 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=AsLsrGYA; arc=fail smtp.client-ip=40.107.209.24 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="AsLsrGYA" ARC-Seal: i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none; b=Epa9wNQrcuWrH8hgJAEAUYlaPP/9h2id6Jc+STK2tgfSssuIg49kIb3tQ/EOtbmwet2ZLXJJ7vhMaQn+mTgbHDTHQPHHrLrQM2DuSY8DpER4q3vNRs0rAZ5+paR3bFxs9jySjK70aRyXmRJvt/Pl1VjJf0V33qaasrj+rYwCs9DWxqk6a4YyPr5WMKjO7VIP+oN9t1J/quX++DUzEpyUeoTLOtCX+bfvXKZ6/l41zgnQFrwOy6z3Qbgy6tcncG0tQa04UHuNcoKmGDvkDMWTrgIRIEpxJRAAT/MCvg4TwUyf3yuvKUosyANw6Jh/dhV/OwSXC9esNpsrOVE/aOcrew== 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=+NdmXCVLRExDXYiAyq0VhoMW4tTMgEl/sr9HEt2I+Bw=; b=WcXqiRlKRwffBD54EIyB6o0+meu5V4K3pe+yjqOaSqcQSGfmXqO2t7HF3mlvnAsQWr2ln7rBnGACkjZBYWfBRE+0BrGKs2EY5cxS+vd7i5yB0qvlbN1miI/mFKOYMY2tveU6aqqg+ahpAEUgVDi/9Cvnu5PqOGs5JWlA6PLj13FeloMNIoZ9ybWapvMP9gFplg0QfWrrab8ZV0+6zu+R1KNf56Hc13taGgoX0JVdX8btlecyTpFxc/aartXgXc+HwFjbjqydxHzqJ2MCWmMJoKzSPg9+95W+xrEk4UNMm24EqnAlvVYyN6QhQTzTANPJDdW0ds62MuRkza6aVDYTTA== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass (sender ip is 165.204.84.17) smtp.rcpttodomain=intel.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=+NdmXCVLRExDXYiAyq0VhoMW4tTMgEl/sr9HEt2I+Bw=; b=AsLsrGYAia4IkLSR6AHYbjeHkRw/SCjLOC2EHpofnisi/7n2mUfjDkeIXgsZDkYcqbsuFxpF6ZbmczT6lWkbeXO1HvClBTogTFWzBfPpJXNQBc+2/VFD8AnkbGVMbw/M88DFNx2kolc0gt/ILe79kXzjRSizcIrGxqyoYPbZoIY= Received: from DSSP220CA0009.NAMP220.PROD.OUTLOOK.COM (2603:10b6:8:3d3::17) by DS0PR12MB8766.namprd12.prod.outlook.com (2603:10b6:8:14e::15) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.9745.14; Sat, 21 Mar 2026 09:46:02 +0000 Received: from DS3PEPF000099DE.namprd04.prod.outlook.com (2603:10b6:8:3d3:cafe::e2) by DSSP220CA0009.outlook.office365.com (2603:10b6:8:3d3::17) with Microsoft SMTP Server (version=TLS1_3, cipher=TLS_AES_256_GCM_SHA384) id 15.20.9723.25 via Frontend Transport; Sat, 21 Mar 2026 09:46:02 +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 DS3PEPF000099DE.mail.protection.outlook.com (10.167.17.200) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.9723.19 via Frontend Transport; Sat, 21 Mar 2026 09:46:02 +0000 Received: from satlexmb10.amd.com (10.181.42.219) 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; Sat, 21 Mar 2026 04:46:02 -0500 Received: from satlexmb08.amd.com (10.181.42.217) by satlexmb10.amd.com (10.181.42.219) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.2.2562.17; Sat, 21 Mar 2026 04:46:01 -0500 Received: from [172.31.184.125] (10.180.168.240) by satlexmb08.amd.com (10.181.42.217) with Microsoft SMTP Server id 15.2.2562.17 via Frontend Transport; Sat, 21 Mar 2026 04:45:58 -0500 Message-ID: <10204982-a007-4f44-ab12-bcddfe4140c8@amd.com> Date: Sat, 21 Mar 2026 15:15:57 +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: [tip: sched/core] sched/topology: Compute sd_weight considering cpuset partitions From: K Prateek Nayak To: "Chen, Yu C" CC: , , Shrikanth Hegde , Valentin Schneider , Dietmar Eggemann , , Nathan Chancellor , Peter Zijlstra References: <20260312044434.1974-2-kprateek.nayak@amd.com> <177382132440.1647592.1849180094328011054.tip-bot2@tip-bot2> <20260320235824.GA1176840@ax162> <60406550-d90e-4efa-a4d9-f901421887f8@intel.com> <470ce693-ee2e-414e-930b-d6581d649110@intel.com> <7fad91ea-e6cd-43c8-abe3-16d7843247ed@amd.com> Content-Language: en-US In-Reply-To: <7fad91ea-e6cd-43c8-abe3-16d7843247ed@amd.com> Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: 7bit X-EOPAttributedMessage: 0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: DS3PEPF000099DE:EE_|DS0PR12MB8766:EE_ X-MS-Office365-Filtering-Correlation-Id: bff452a9-9356-442c-3ee5-08de872eaa1b X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0;ARA:13230040|1800799024|36860700016|376014|82310400026|56012099003|22082099003|18002099003; X-Microsoft-Antispam-Message-Info: x9nIsGUK3uHjjLHh9/qXKVN7C7aVABPZIZYs7Yd7JME8uHswvEBxWk/S4YsKE8rQaHfjj7MP/GhkiGIvZvhX1Kx+eBBHly+vebjSKRPv4ztyPV1MtxS9DV1IyULnF5D4AwOPdiwmX0k8WIvZlWJBX9ecIdCdwaWyHdZK9rVFuqZk0IaVzqAweTrcWzYPTZE0Zd+vghC5o2ozisNQD0c/u/5j6rG5WoUq/EGljUvFAPD9UHrvE7PbjJupWLRqltHeoPfy4uc7emyUDev599jM9p5OJzbzd85KqR2x6cSR9/DCP+YAgHpo6fbrjJ2+JG2yoH9h29b6m7yWjmVvfCVCm9tMz1DoPU3YzgcY0ib+sZER4qU5ZAg+4MgMmVfytK6bwdFkxzQYCKwfxgpdek66PpIg7x1DWne1/czsABst7C3aa3Y7c/+PAr1hC5N+iU8hFuyXx4MWjTrb0inNZ5vbtr8sG5vKu8MFESbaaAAqMK0TcJx7+D18wZZMdNF8jbX11roqEoRMIkA6H6JemQPu/no5mN76O44T3gmJ/kLdwjO5pImDTQhYDRoeN0T0OocvU9b+Z8ksldjuVuT93pJM3yH604mMQRcS+m18U03FTafelo1pnCiQzqw/oYBb70xv/To3rJhd6cg2gx3GJVNw7lpAC+L+aY8bxXJdAF0JKFIe9k/QjOWxYTEeIy6aSiK8WWn7C8fwb1aArfKGgnrgnCbmgjglLENTKoCSCdfA9rjlmd2uD1qgydRjUpQOplMrD7KY/XW9uFn/5c43+41/IQ== X-Forefront-Antispam-Report: CIP:165.204.84.17;CTRY:US;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:satlexmb07.amd.com;PTR:InfoDomainNonexistent;CAT:NONE;SFS:(13230040)(1800799024)(36860700016)(376014)(82310400026)(56012099003)(22082099003)(18002099003);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: DtgKCJQpav36N3hQqSkmUaRIqKnQIuM+YgiUNJyi2oSgkyc7ZdHL8kjtSALDHQLXqv67PEGprPQTUghburOPozKGXb9LhhGWLySfKU9wVuMgD4WoHkqsYAvCqCyvtKkG/WF93qXkuPKG4ngsD15ZmgG5PpCS3HXAO9StxYnQ5CahFuFSxbXqwVv/jGIUD7cw9Tdb1sVlfvLd6X1pvc3fXuzrhxmzKWs8KJbXqIhHl5gSvfHZ095GnZ11nGvbtJfTQcs609SrmWv7xv4Uy11YoQw0FLQH3Y90kY+BdKIh56bzVQHvsMrsEJ2PN5a5Uvch8v7629o63lPkOvD+wxcHsDPBlQj1Pi38iouLMKb3dCh7ORE6nrEiyG2zBGsxZmfTigIrdslgoWyjwNO7ulPcgD9wXi6vgSIvhe2XSHlVtLGxz+ee+CyW9vnhBefY8FAp X-OriginatorOrg: amd.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 21 Mar 2026 09:46:02.4550 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: bff452a9-9356-442c-3ee5-08de872eaa1b 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: DS3PEPF000099DE.namprd04.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: DS0PR12MB8766 Hello folks, On 3/21/2026 2:29 PM, K Prateek Nayak wrote: > So I managed to reproduce the crash and it is actually crashing at: > > last->next = first; > > in build_sched_groups(). If I print the span befora nd after we do > the *sd = { ... }, I see: > > [ 0.056301] span before: 0 > [ 0.056559] span after: > [ 0.056686] span double check: > > double check does a cpumask_pr_args(sched_domain_span(sd)). > This solves the crash on top of this patch: > > diff --git a/kernel/sched/topology.c b/kernel/sched/topology.c > index 79bab80af8f2..b347ae5d2786 100644 > --- a/kernel/sched/topology.c > +++ b/kernel/sched/topology.c > @@ -1693,6 +1693,8 @@ sd_init(struct sched_domain_topology_level *tl, > .name = tl->name, > }; > > + cpumask_and(sd_span, cpu_map, tl->mask(tl, cpu)); > + > WARN_ONCE((sd->flags & (SD_SHARE_CPUCAPACITY | SD_ASYM_CPUCAPACITY)) == > (SD_SHARE_CPUCAPACITY | SD_ASYM_CPUCAPACITY), > "CPU capacity asymmetry not supported on SMT\n"); > --- > > And I see: > > [ 0.056479] span before: 0 > [ 0.056749] span after: 0 > [ 0.056881] span double check: 0 > > > But since span[] is a variable array at the end of sched_domain struct, > doing a *sd = { ... } shouldn't modify it since the size isn't known at > compile time and the compiler will only overwrite the fixed fields. > > Is there a compiler angle I'm missing here? So this is what I've found: By default we have: cpumask_size: 4 struct sched_domain size: 296 If I do: diff --git a/include/linux/sched/topology.h b/include/linux/sched/topology.h index a1e1032426dc..f0bebce274f7 100644 --- a/include/linux/sched/topology.h +++ b/include/linux/sched/topology.h @@ -148,7 +148,7 @@ struct sched_domain { * by attaching extra space to the end of the structure, * depending on how many CPUs the kernel has booted up with) */ - unsigned long span[]; + unsigned long span[1]; }; static inline struct cpumask *sched_domain_span(struct sched_domain *sd) --- I still see: cpumask_size: 4 struct sched_domain size: 296 Which means we are overwriting the sd->span during *sd assignment even with the variable length array at the end :-( -- Thanks and Regards, Prateek