From patchwork Wed Nov 20 07:06:08 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jacky Bai X-Patchwork-Id: 13880775 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 AE48FD6E2C9 for ; Wed, 20 Nov 2024 07:08:04 +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=mL6P6MihgG/Eyk3Jv8B9O2tfojXyCe1PZG/SLjVIpQg=; b=RseX1dBtEyRifKqqapk6IqBm1E PGSrk5i3YFvM74cUbVd4zoNAadT+Eneox3hkjQj94/MrB3W1qXB1oQzPIsM7rhKMEb2V7yLiy+97+ PgfpcdXNts9v1jc7m0jJzA5V0/ECMH3BkVzNHmfTgrS6W7pSZbidIYEpIU6oR/VDgCOpHqzIAwUva sioQ1CJvvK03BsR/WXB3cCiBarxWTgcQqO3ryK3pyNDSMp0OHir8UEfC4Wxy/CJj+0bs4sUQEEq7p g6sqVX+PeVzKwnaIMBnzvV26zJkleboHxkFZMeZ9O+bXMDo0qLDgaOta65shVMJu+zJKB/23lEmvX bCwCIbrw==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.98 #2 (Red Hat Linux)) id 1tDeod-0000000Ea6O-3iNC; Wed, 20 Nov 2024 07:07:55 +0000 Received: from mail-vi1eur05on20613.outbound.protection.outlook.com ([2a01:111:f403:2613::613] helo=EUR05-VI1-obe.outbound.protection.outlook.com) by bombadil.infradead.org with esmtps (Exim 4.98 #2 (Red Hat Linux)) id 1tDenB-0000000EZdT-0FFK for linux-arm-kernel@lists.infradead.org; Wed, 20 Nov 2024 07:06:26 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none; b=DHcV2BF4jTx01VHJ/7xe4D7lPnD/2Qwah2C+s5EyP2hEIaPjpAYQfpjipIj0+cYpdNvQd6uYUTfD/hdErOeKvTuced8RiqoQvbAlamN4fJOb2R/VLqDec8faSl7G8fiFn2FJ2DcmoUi9mPfp6049N1YixfehaNzFlQgWvAFTYB+JE7Bu9Hr/CYLKJ8JOsan7hZo1xNLOeKCUM/P9e629GmlRVSKN9pttQvnBeay7DwCMDvBRGnH/hVrbcvRJXbu1wF8f61Cpc14cxhBCYiIpusZ6S5Xw6d/XtOVSiihJ57YrkVP3Xp2YH3f0TVb2cm3B3/y5orIDxNs4qYFYvdBjgw== 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=mL6P6MihgG/Eyk3Jv8B9O2tfojXyCe1PZG/SLjVIpQg=; b=qRHxVTCnxocHsFk1HT1aHgW84Ah7vIzRPLirvjwDjJ8JIr5o9x9Pz6VpmNetJtMWNV3vL4C5wJBW/XqW71FVKI8o1HUGR5UVfK2FUzvIKZWz/G9EvfPaW2+FFW7tXG2qddjtzFO9VvfO9oaaHwVqxb+s9O2C2zMGbk25vLcJLVyNRWRmALK9oshY0+On0lvVzyKSSp+goVV3XSR/6tvmsxoKVkwXKSHB1CdmQTdxp9AGB4dA8tdM1oCbLHqIam8dmYC6+H4/CGSLslEE43nzBrbhEoiMyK44L8NEjn4IbeFSDQYwbViIQSZxyMptQGq1okR/69Y03IDqI2XCl3dIhQ== 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=mL6P6MihgG/Eyk3Jv8B9O2tfojXyCe1PZG/SLjVIpQg=; b=VNgaIs8XbwbKwmwtm35r8fJ57wWFCecBSmCxQ7N1j5QWjghgN+vgGdWnKJ6B0hA+MT9Lbwm/0g918pDe+0Fxs/r97CKXyCnLkk2wmf2NPHAWNgnfZ9kO/qWl4D/MH695eO5a7OzcWWbIbzRtiCAhReG+tSJlDyZ+KLqLp9RI0DhZBnkr0agqmAsPWEV4FKdOKHdpEYRUjHWUUda/iFBXEyCt8ucNhBZS+c973kETxVfR3bBuAFBo6U8yYLNNsZpXxZGSJZSnU2t6Hso8q1DMDYktg0aRFcNsnMVaV+0SJ9jNJ1a/TMCKOlLx2NpiLOMLlAwgP5awq0DwkpgSHpD6Gg== 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 PAWPR04MB9933.eurprd04.prod.outlook.com (2603:10a6:102:385::22) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.8158.22; Wed, 20 Nov 2024 07:06:16 +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 07:06:16 +0000 From: Jacky Bai To: lpieralisi@kernel.org, sudeep.holla@arm.com, rafael@kernel.org, daniel.lezcano@linaro.org, james.morse@arm.com Cc: linux-pm@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org, imx@lists.linux.dev Subject: [PATCH] cpuidle: psci: Init cpuidle only for present CPUs Date: Wed, 20 Nov 2024 15:06:08 +0800 Message-Id: <20241120070608.1314850-1-ping.bai@nxp.com> X-Mailer: git-send-email 2.34.1 X-ClientProxiedBy: SGBP274CA0023.SGPP274.PROD.OUTLOOK.COM (2603:1096:4:b0::35) To AS8PR04MB8642.eurprd04.prod.outlook.com (2603:10a6:20b:429::24) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: AS8PR04MB8642:EE_|PAWPR04MB9933:EE_ X-MS-Office365-Filtering-Correlation-Id: d2c21a0b-b253-40fc-f35e-08dd0931d319 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0;ARA:13230040|1800799024|366016|52116014|376014|38350700014; X-Microsoft-Antispam-Message-Info: V62D+s0VpTXFGcbBqTkEK9lt538DlJ5wpmpOV130c6+ed+xKbUw+x4f3g36+o6xgGtbfn0keMPgaGb/IjfAEH4nHMmyDEnkC+2RVVf2Go8sV3YkORMrqfwk2GsaRR3RdeCoz9ySjlwNS8NlBNdNi4B9momN7Y34sRdThH+81jLDzgPE20KC11a0FixXmUHr06GsD3nisy77nZ8HkR8X+R2p3OrKzB4FHvAhaHQdd/QkxKJ6vTZxHlIDNLjXC/pF/GIaMnJqkTnI0PV3LCThVTGP/9b/x6Opa+CcNPp4gCDIgbppHaIwOl5bAWKAzHxVLwELJckp8s+TCS9OcT7wk3oB8k2CoiIU0WUM/Y4z7mgyJc30UJL/12YyfmugYbIF0cjiMFAzfHgJcA9Ecj6DBU9weAGKYylg/ewsex3ReINcMve7IaG9N+eHEpFzPMsr348hq92Mr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52116014)(376014)(38350700014);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: tq1tYPW0V9TYWPL75l6uj+J8jOpR7t2gtfbvsUbkv2f3Ne4RAGgpzf3F2Sqhva806eSsos5fr1xVlhuo9jcFk1/eTJiymJenSIKOVKRVqtw2og9s0t/LBMcBA70Q6sfngVFHa2McFSs1FHDa7K9GvI5Ml3v+bfax6JGwGSrOqBxor0D5PeVqmmkCFp2HPokWa0HWXzq3WBrY6h295GU8phDdHlCmnbOJfT6Kiy8kQmfp4vkj7LeGeKEs6vmIsc+TpmRkEz0ljgjpX9JQDwYldtTe2DDHBP47xymaVPl8q85WJ/jgELxawP96JhwPuTjGgbZ5Zw+ES2WyF0aVtLsS/wu7GNN33hpSXKZDETD7T6OePyodOOPisn1A68+Qp4IBgyhfyvWOcSClu8pj+lFRvInSi55EnZAVQyzH09p742CPnl0xuYObVi1SDryj2mBLU4w/95rD7cZ1t0oN73Uhfv+NldHSoR0zZnnDUhmDWfpED6Wx7mYZHhNC7iRLj/VGxLbaj4t1MyZfbeTsweR/k9YqSdr9vsCYNUClq3eyDHN0s/7oTnpu0ZDqAAqEJEe3W5Oyxw6hoKuF2t54BvZp8XZ6z6NcK3/tsDv6EjCUGIcLWGUAJYGoCuBn4z5ZgROqpSXQJgq9jJQk9pB2GsuBstwtTQH2cci0mn9zOo22Nl+aIw977ftxab6hZ+kYG0UgOOuvzSC4nYEuGywmQvvZzfrAhV+UEEjhded6kK3u6KUO7rMJovokbkRBidja7h88kZ88+7cfjsRwEds96CmXaqbuXBvDvOudSeGh1aNPRlA8kLAgn+ke4HzYtbbvX6jywAVGSH1HpqMyGtAqbwW0mROAm3YvMaTNJM0kJw8chQRMi6ySrkVdGsV4sUC6eTsnZgGj4AblqER8FFavGYKosLjxjp7izQRKxFo08u5YjK7qLojuTs/fZE57heOgYaiANONBjtcUabmBzdS0tjh64RzmNH9+43NRZ2r20+OjoKvRy2jZ2MBoY+k7bzBRjqebXQRU4ORI2M2eQze9OCOoYQ0mv7H06Yv3pY8ec+UJxfTqCkIrg1Kz1NzlRyT5yvLvIeaUvHD2FKlh4FUSYcK8hSEPUlvuVzbp6oaNyesfDAZ5C76GSURIcXkaD/1N93G8COvKUrc41+egn8Hd0wpmyEIhhCrFkr4tYiQiiP9vXSMfsL2xyAJrj6924PEeA5XMKHyYgd2KnE8xB/4FO7bx27KUA4gxFEZCFzrywnJ9+YFJB1Z8Elgy/JTu68qgLPBR63nrmcioLjIsvcHWBXlHEeOKcdrQ072/yrZtn4gY9aVv9Qvm/IwPh77jCkSRUKLiPAK7x1bIcmkjFBtCj/lkfn2zPVDkjfSBtEqI8QuOOPIb9k0a1qtX4p0lzz0bFF2UmzOi8+VXXmzmnBZ14a735Qb0SJGtY9gR78GP1adPZlYNTmFCC+a/21jayQDNfpH6YN1zz3q5QiG6R/lLw/fKfTHu3ffa1G3LqHITI1vl9lI2MZMTXZdkveRWqJVigr4YmiuaseOLFi1NudX7ejsVw+NyUc8oULVJTX6xo7d/Zyx/M9ncyHSICqsuBxfPmypY X-OriginatorOrg: nxp.com X-MS-Exchange-CrossTenant-Network-Message-Id: d2c21a0b-b253-40fc-f35e-08dd0931d319 X-MS-Exchange-CrossTenant-AuthSource: AS8PR04MB8642.eurprd04.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 20 Nov 2024 07:06:15.9367 (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: 2Fz2rfiyxFsBj9+Qej4aKDxRJFdC2W+PklnVEIwt4YJLvUDEAg+0slHZVl1X8UnVcAxcxrpDxXYbAKSjr9w/eg== X-MS-Exchange-Transport-CrossTenantHeadersStamped: PAWPR04MB9933 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20241119_230625_095583_D9A674FC X-CRM114-Status: GOOD ( 13.95 ) 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 paremeters, 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 cpudile 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. 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;