From patchwork Wed Nov 20 10:37:49 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jacky Bai X-Patchwork-Id: 13881012 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 5D8CCD63923 for ; Wed, 20 Nov 2024 10:39:15 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender:List-Subscribe:List-Help :List-Post:List-Archive:List-Unsubscribe:List-Id:MIME-Version:Content-Type: Content-Transfer-Encoding:Message-Id:Date:Subject:Cc:To:From:Reply-To: Content-ID:Content-Description:Resent-Date:Resent-From:Resent-Sender: Resent-To:Resent-Cc:Resent-Message-ID:In-Reply-To:References:List-Owner; bh=eXsFevkNMNX6BhJbVRjzF5PlyoCddsLPpl0DppZ5DHw=; b=qqwLeXVvdNgoxuk07tc2fkuxMB nrv18U0Vfi0am7sL5nKkVmo3Y9wC3sJ2Y1lHuHOzsSsKGMmoE5UVZzyEBd5fGf4nWVn4DDUKksGDw 13zMgXZSoIdxMqNj8Q0HYd52YL5zVUewI5103941dYloAXYzN9a11d/F6wfbQr/MOb8YikUgtTb3r cTbz4lX+U5q9XAkLf+o7Ly1hoaXlaLq+a1GpTyMsekwTp1DASOLwWSPm0h1g6zqirVo5zJp9drBQO 68K24/b2RyMOVYEnyqni0hNIMWhdGE7iLQ7lbArBQ5zbAJiGFE8PmBw5ShyplEQAhecPM1HwGZNuH lyKWrdtw==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.98 #2 (Red Hat Linux)) id 1tDi6y-0000000F4ab-0WVX; Wed, 20 Nov 2024 10:39:04 +0000 Received: from mail-db8eur05on2062b.outbound.protection.outlook.com ([2a01:111:f403:2614::62b] helo=EUR05-DB8-obe.outbound.protection.outlook.com) by bombadil.infradead.org with esmtps (Exim 4.98 #2 (Red Hat Linux)) id 1tDi61-0000000F4Wg-3bsZ for linux-arm-kernel@lists.infradead.org; Wed, 20 Nov 2024 10:38:06 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none; b=JFTzR14zS/9JlHz8mx3UDUN2x1lWjLXzZ4uV/Ptt/6rTYQZHEV+/KlQzy50zApnMTpwBD2tPcW+mEdT2CdaVrtvNcJV8Z0DHlHSRXXrB1A0hRb/8uD0R44godwRYdAt3G72a5a5W6g/uYU9UgVdUNhW2HC3cyG3+80P7l0WaVgRPcuQROttrlRQiKDQQe6R0sBxXSAxCO22M2X3LXgld77mkaxcfnFuFrD0k8YgNM/B0eMlnnasJKgaHufjeh6ZYAxzVtmDxn4HSG8OS6fAYXWlHBzzNQf8xdFIKuIF+5pGZmFwYPBxEFDMhecLerXrDGbuEDp2I0BQObHt4dS/U7Q== 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=eXsFevkNMNX6BhJbVRjzF5PlyoCddsLPpl0DppZ5DHw=; b=pK0zM8A8xERYuPwkDTEz8tbiTmXRhwcSkR/yEgRJ0PMUWk/GDYNQuECxTpwklS8BUomAX+V5XoSa+3DPhUPDIsjRqidH+foFukMMsvHOq6OkuAsYc8s+Y2rryKP5XXRGciD7aK9qeOGLj+lE6ecFkYwEadwh0KPoPwNunHqjx+LaEnCpLKbEDaZcqSz5g1Vt4dTn8AFhl5o+F6Rs7lXDZ16YM4FQHfhibS3dDU7BNy4YK/ElGekK5Szlx/UN7of263sYNtybsOSVrHukTdxpy8IEF1+THfHj0MkyKUAXkcySjeZUGIN6WUNbz0mn8yi10NknGL1ePldP94a1dHF/zQ== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=nxp.com; dmarc=pass action=none header.from=nxp.com; dkim=pass header.d=nxp.com; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=nxp.com; s=selector1; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=eXsFevkNMNX6BhJbVRjzF5PlyoCddsLPpl0DppZ5DHw=; b=NnfF3YC5xF8x+qy2rr1NxPnFr0zZEQVqrAcHwtKm/JPWztPLCcKT4cyh2swycgBOCu1MZCjAZvO41qJvlJeKxdbFCPIAzlR+WztdrhrnKV/pIExU5KCkjSHczK8JFrHQCevHSv6o59lwRxXbIlnaWdztG8tRW/8mgTzJAREU3YVAlCQQnSFc2ZjC5FVgpcqpRLHunCxbPzjGoKdjERGgc8KmHKgSa2sRgGQPWSfTLHM4kAfGtYNsCt9I6TxfNwYaCw2NkEClXV2lXLsf/eT7klEkwNTHoR6w/Km+Z3NH48eEDBU/bMI8+g57T9QI+MjtWfPhsUpiXZtiuGjrh8+rgg== Authentication-Results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=nxp.com; Received: from AS8PR04MB8642.eurprd04.prod.outlook.com (2603:10a6:20b:429::24) by DU2PR04MB8742.eurprd04.prod.outlook.com (2603:10a6:10:2e0::6) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.8158.24; Wed, 20 Nov 2024 10:38:01 +0000 Received: from AS8PR04MB8642.eurprd04.prod.outlook.com ([fe80::50d3:c32a:2a83:34bb]) by AS8PR04MB8642.eurprd04.prod.outlook.com ([fe80::50d3:c32a:2a83:34bb%6]) with mapi id 15.20.8158.023; Wed, 20 Nov 2024 10:38:01 +0000 From: Jacky Bai To: lpieralisi@kernel.org, sudeep.holla@arm.com, rafael@kernel.org, daniel.lezcano@linaro.org, james.morse@arm.com, d-gole@ti.com Cc: linux-pm@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org, imx@lists.linux.dev, khilman@baylibre.com Subject: [PATCH v2] cpuidle: psci: Init cpuidle only for present CPUs Date: Wed, 20 Nov 2024 18:37:49 +0800 Message-Id: <20241120103749.1450017-1-ping.bai@nxp.com> X-Mailer: git-send-email 2.34.1 X-ClientProxiedBy: SI2P153CA0030.APCP153.PROD.OUTLOOK.COM (2603:1096:4:190::15) To AS8PR04MB8642.eurprd04.prod.outlook.com (2603:10a6:20b:429::24) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: AS8PR04MB8642:EE_|DU2PR04MB8742:EE_ X-MS-Office365-Filtering-Correlation-Id: 765bfb85-6bdb-409d-5299-08dd094f6832 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0;ARA:13230040|376014|7416014|52116014|366016|1800799024|38350700014; X-Microsoft-Antispam-Message-Info: 9ZLA+DfbVGMJsFjDvk5H/7++wHSW0TB0sRWt0c7WUVjD7jEDJ+sWi8G7lPE+pbrZHaZECz3nM/5vs1PVR3qAJm8WqQ6RTzOjzUjjmZfbYAv0N8Wynv9gWPi2xeEoUgxXNJWapzovTVr2W1ZGdU0YbPkikfEjEHNIPIIM6NpLqkYJG2/eX4TNTWM464UVEXu8B6VH/BV+mg0jDHw37wNLyIhG/u4fPipFz/dwngBtFTq+h6IqefLrA9Xd/vDu1tlVb8CoJ/OlGa4rzyySBP1y0B+PdjknXyGBtEraqYSR+VdpSeoZYch4f/l7VKrBzjKSqAOtsprgpI1w0hEhA9NbiTaSTdUe9g363zB4QZG9yLjuVU1d880LnAwtz+JluTgeKQQtkTDG7TAPK9I608YAZx2nLDzR7ACYix4WY40k1uTLOzK8l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:NONE;SFS:(13230040)(376014)(7416014)(52116014)(366016)(1800799024)(38350700014);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: EqitKUE2eWYAirc4xyv5PeFpYnAE1X+9TTUBR8k4Chuf2VhzJMiLYmD6dBzHZ4Ndpwf5NWL6hzJjgjLSZ9s8LU3B/sb60Bt6sUVKBwmF/596AToxPvAKXC3XH6YbsPfY54YvkUQGdnDAVTqYpA66yRdwZ/z36RE0XKIlERM4Hg50wv/Bgn/owwQLIaK5KhDydPTaD39O8tSjsFN6pf2EdMZUZdyCZnyVHpwe5v1lEGKfG//m75oh9BahKtsMW9SNqigV1OCRvcxKFy1hokIiB9U7LlsB81Xu+t6+aJcvzNrtu9MGdQ5aSapVtLwEQo3vCl30kj1plUsPf3FE3j9d/SgiJSVu2bncAL6FhIo5RFNfSUeeVYS3TUHoT1YdDOGr0ezhjHBfBaTjJgkH9k49QKzVPk0/2chJiu9EAH80Fj0ub+lEmz5MK6aFYJVkyJ+S1WFfzhbqyEgQRlqymsitVvcC2YfaCZw8qHDV4/APNl8yEiW0+y9gIweB1kAFXTYj5kRgxZWj+3wFnpWjJ8stcJZCinmIkVxN/6fA8lWG0XeGBP0XW4Engbep30dW5fbvIpQFiK+BjY9SA+ejI9LbXCqL7PZAaAAautsWJBMnlDCjH0Kh/pLslCEwIGwAWSQfPEGUIacHfqH6rdXceavSpgs+uimSjKbf0SRY2eFYNceqjr3rupfHWGOTns2KRMuUGRMppnzRmr+g0bcL2p0px9xMRtKdGgAgcXfo68p6oiIuXULAVuLd4WqJBteUqNvyFB4Y7BcG+4HGEeJqUxt9+Pd381A+U3ppHo77yT/c2PYoMzH378AOxMG8CGNjXqqCkI/d/WO317Ppjqr6W0cVQhYNRtR0cTQzahTXi3F31nFCLADXzM0T811a8OWPACQ458SXYADAoE2DsjaBD8D/cbv5ORKeuIKbFB11ZKPQOUGQpemUnzfsPJtssO/UjG2VTAIxFCAauyoNS1yPFECxgJZ+QeUeI+1PaYsr4WvdvjNJPVqKhyUgl8fRcuO/go3ya19okHtFS+i9BYrhHLieiHIEMrdFxHx5Sy0wr+szG/T09OVGX+715No0NzmKZdV8+kUdugKBqWdk9DRqL66wNgG1W105IDlRmSlS9EidqWu68n904B8pwTmb1OeKxKWckt07JWNNIb+ULtXFzmOEBiptHVPqiC24ptFijaISPFqeLJmcS0c2cRA+jmlerpSF07kpQ58obTRf5sJS4sxUim/lOMLjQx+Pqpwrh/XEQwdzbaFvxx6yxi6DkuoUQZaT5AHKq7idCAqIdiJ4i60vzO4FSKPraeSEZX69OJSY3XTaWeQBVBIJDkSlZfZa+FYoS5/I1vnpK7CmNvlbgTNN+Kf42BJgiiKykebM/fIlAkdd2bEmpvPrKkt1vQeeJ5MVElWWhqQhAszYlAib7KyHr/SUJMRz2uIElQY3RDSt0DI5N8iN+5JPgUx0LkUsp61JtwPS/Kd1MXQ8Lc0WR713DuH1Yvm34Vt4aXCqqD5vhULYvboIiL1O3yBUBkCDnVVjbFa40rBVnjpkW1UNaIKjzAMvW02EiIuNHv0Zuk79pgzfxzqQhSU1ogLR5n0HWLHH X-OriginatorOrg: nxp.com X-MS-Exchange-CrossTenant-Network-Message-Id: 765bfb85-6bdb-409d-5299-08dd094f6832 X-MS-Exchange-CrossTenant-AuthSource: AS8PR04MB8642.eurprd04.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 20 Nov 2024 10:38:01.3938 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: 686ea1d3-bc2b-4c6f-a92c-d99c5c301635 X-MS-Exchange-CrossTenant-MailboxType: HOSTED X-MS-Exchange-CrossTenant-UserPrincipalName: SMXQDgPnI1wOCPoPUgOc4BXURnEwBB7yUHAn1706U0cJeEHBzoZk0cM1tMuCKe8yvJ1Ze9netu5XIOqN6f6EbA== X-MS-Exchange-Transport-CrossTenantHeadersStamped: DU2PR04MB8742 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20241120_023805_895519_2096AD6E X-CRM114-Status: GOOD ( 13.84 ) 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 With 'nosmp' or 'maxcpus=0' boot command line parameters, the 'cpu_present_mask' may not be the same as 'cpu_possible_mask'. In current psci cpuidle driver init, for_each_possible_cpu() is used to init the cpuidle for each possible CPU. but in drivers/base/cpu.c ->cpu_dev_register_generic(), for_each_present_cpu() is used to register cpu device for present CPUs. When boot system with 'nosmp' or 'maxcpus=0', the cpuidle driver init failed due to no valid CPU device sysfs node for non-boot CPUs. [ 0.182993] Failed to register cpuidle device for cpu1 Use for_each_present_cpu() to register cpuidle only for present CPUs. Fixes: b0c69e1214bc ("drivers: base: Use present CPUs in GENERIC_CPU_DEVICES") Signed-off-by: Jacky Bai Reviewed-by: Dhruva Gole --- drivers/cpuidle/cpuidle-psci.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/cpuidle/cpuidle-psci.c b/drivers/cpuidle/cpuidle-psci.c index 2562dc001fc1..00117e9b33e8 100644 --- a/drivers/cpuidle/cpuidle-psci.c +++ b/drivers/cpuidle/cpuidle-psci.c @@ -410,7 +410,7 @@ static int psci_cpuidle_probe(struct platform_device *pdev) struct cpuidle_driver *drv; struct cpuidle_device *dev; - for_each_possible_cpu(cpu) { + for_each_present_cpu(cpu) { ret = psci_idle_init_cpu(&pdev->dev, cpu); if (ret) goto out_fail;