From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from foss.arm.com (foss.arm.com [217.140.110.172]) by smtp.subspace.kernel.org (Postfix) with ESMTP id A33AC1DACB8 for ; Fri, 7 Mar 2025 09:50:33 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=217.140.110.172 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1741341035; cv=none; b=AdYuM+GxQ9PMUH/I3jcL5FT4p77gXAeXyTVycoJwuEGBcTs6aupX1+5gdSoWEeOraR8Nk7Yl/du7NACHktvYOnN80XT5xfEpm6CyiFAF1n1BwC/xQOpZjY9OYhS0T4qfXOjf37YhnusWXcqOEhD4Q5uA9s56BaarwKbHupDYx8U= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1741341035; c=relaxed/simple; bh=d3agI50q2xWFJ5p1wa9JH4JwPRcj3aWovddGpnxeI40=; h=Date:From:To:Cc:Subject:Message-ID:References:MIME-Version: Content-Type:Content-Disposition:In-Reply-To; b=Np9WDvYYBbj6JQcO1H4n9m4MsLEwDX3RKTqLM6+RzPXEaQASYXlIS9P2EnZFS81Qvht/JOHqaks9FIlLjdQXR1rcOKBrpk6o5hlhjOepckH7XqJAFoP1/XHz33+Ly5HqP1BHFWCuvywv0nZdYfSYVZ24khFxAYIDkL9UZoz1gFc= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=arm.com; spf=pass smtp.mailfrom=arm.com; arc=none smtp.client-ip=217.140.110.172 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=arm.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=arm.com Received: from usa-sjc-imap-foss1.foss.arm.com (unknown [10.121.207.14]) by usa-sjc-mx-foss1.foss.arm.com (Postfix) with ESMTP id 9A661150C; Fri, 7 Mar 2025 01:50:45 -0800 (PST) Received: from bogus (e133711.arm.com [10.1.196.55]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPSA id BCEF93F66E; Fri, 7 Mar 2025 01:50:29 -0800 (PST) Date: Fri, 7 Mar 2025 09:50:26 +0000 From: Sudeep Holla To: Jacky Bai Cc: , , , , Sudeep Holla , , , , , , , , , , , , , , Subject: Re: [PATCH v4] cpuidle: Init cpuidle only for present CPUs Message-ID: References: <20250307080303.2660506-1-ping.bai@nxp.com> Precedence: bulk X-Mailing-List: imx@lists.linux.dev List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20250307080303.2660506-1-ping.bai@nxp.com> On Fri, Mar 07, 2025 at 04:03:03PM +0800, Jacky Bai wrote: > for_each_possible_cpu() is currently used to initialize cpuidle > in below cpuidle drivers: > drivers/cpuidle/cpuidle-arm.c > drivers/cpuidle/cpuidle-big_little.c > drivers/cpuidle/cpuidle-psci.c > drivers/cpuidle/cpuidle-riscv-sbi.c > > However, in cpu_dev_register_generic(), for_each_present_cpu() > is used to register CPU devices which means the CPU devices are > only registered for present CPUs and not all possible CPUs. > > With nosmp or maxcpus=0, only the boot CPU is present, lead > to the failure: > > | Failed to register cpuidle device for cpu1 > > Then rollback to cancel all CPUs' cpuidle registration. > > Change for_each_possible_cpu() to for_each_present_cpu() in the > above cpuidle drivers to ensure it only registers cpuidle devices > for CPUs that are actually present. > > Fixes: b0c69e1214bc ("drivers: base: Use present CPUs in GENERIC_CPU_DEVICES") > Reviewed-by: Dhruva Gole > Reviewed-by: Sudeep Holla > Tested-by: Yuanjie Yang > Signed-off-by: Jacky Bai > --- > - v4 changes: > - add changes for other cpuidle driver that has the similar issue > as cpuidle-pcsi driver. > > - v3 changes: > - improve the changelog as suggested by Sudeep > --- > drivers/cpuidle/cpuidle-arm.c | 8 ++++---- > drivers/cpuidle/cpuidle-big_little.c | 2 +- > drivers/cpuidle/cpuidle-psci.c | 4 ++-- > drivers/cpuidle/cpuidle-riscv-sbi.c | 4 ++-- Why have you spared drivers/cpuidle/cpuidle-qcom-spm.c ? IIUC the issue exists there as well. -- Regards, Sudeep From mboxrd@z Thu Jan 1 00:00:00 1970 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 08FA6C19F32 for ; Fri, 7 Mar 2025 09:52:53 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender: Content-Transfer-Encoding:Content-Type:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:In-Reply-To:MIME-Version:References: Message-ID:Subject:Cc:To:From:Date:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=xMQYrE5MsR7PNG/SePg7zjqaUV+emFXDdfFCF8SLnnM=; b=Gf/U5eYtRby4ve 0MUlofV9GmKm3mp2BE4r36z9Ji5cSLBDjn8HaT9PpV9910idWI2Pn7q81oaO5+KyJqCCg37D5c9QU Xg7wRTgfM136yOG1YfnJgzOGiN8lOgfihGgDUEJFAzq9Ai9EUCTVSFmC5toL99UTVF+jAnr4Lkk4a 2+yx9jj4yn1865jHv1Cn6OfDfyWcY1DiFcpI3es9BrVSjvbkBNXTMAmFgm2g6hUDRbkOxHe9K+iha +iOSztUNzocc021LExF2+EvzUfO6vqsfZOankLaHUT8ZQenXGWhUSu7ngoifsJR7lcuX+HTE01l7B ZCs9bjpLc95Ckkd5a+1A==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.98 #2 (Red Hat Linux)) id 1tqUNq-0000000Dlfu-0vpf; Fri, 07 Mar 2025 09:52:46 +0000 Received: from foss.arm.com ([217.140.110.172]) by bombadil.infradead.org with esmtp (Exim 4.98 #2 (Red Hat Linux)) id 1tqULk-0000000DlLn-122P; Fri, 07 Mar 2025 09:50:37 +0000 Received: from usa-sjc-imap-foss1.foss.arm.com (unknown [10.121.207.14]) by usa-sjc-mx-foss1.foss.arm.com (Postfix) with ESMTP id 9A661150C; Fri, 7 Mar 2025 01:50:45 -0800 (PST) Received: from bogus (e133711.arm.com [10.1.196.55]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPSA id BCEF93F66E; Fri, 7 Mar 2025 01:50:29 -0800 (PST) Date: Fri, 7 Mar 2025 09:50:26 +0000 From: Sudeep Holla To: Jacky Bai Cc: , , , , Sudeep Holla , , , , , , , , , , , , , , Subject: Re: [PATCH v4] cpuidle: Init cpuidle only for present CPUs Message-ID: References: <20250307080303.2660506-1-ping.bai@nxp.com> MIME-Version: 1.0 Content-Disposition: inline In-Reply-To: <20250307080303.2660506-1-ping.bai@nxp.com> X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20250307_015036_330884_A399F6FD X-CRM114-Status: GOOD ( 16.43 ) X-BeenThere: linux-riscv@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Sender: "linux-riscv" Errors-To: linux-riscv-bounces+linux-riscv=archiver.kernel.org@lists.infradead.org On Fri, Mar 07, 2025 at 04:03:03PM +0800, Jacky Bai wrote: > for_each_possible_cpu() is currently used to initialize cpuidle > in below cpuidle drivers: > drivers/cpuidle/cpuidle-arm.c > drivers/cpuidle/cpuidle-big_little.c > drivers/cpuidle/cpuidle-psci.c > drivers/cpuidle/cpuidle-riscv-sbi.c > > However, in cpu_dev_register_generic(), for_each_present_cpu() > is used to register CPU devices which means the CPU devices are > only registered for present CPUs and not all possible CPUs. > > With nosmp or maxcpus=0, only the boot CPU is present, lead > to the failure: > > | Failed to register cpuidle device for cpu1 > > Then rollback to cancel all CPUs' cpuidle registration. > > Change for_each_possible_cpu() to for_each_present_cpu() in the > above cpuidle drivers to ensure it only registers cpuidle devices > for CPUs that are actually present. > > Fixes: b0c69e1214bc ("drivers: base: Use present CPUs in GENERIC_CPU_DEVICES") > Reviewed-by: Dhruva Gole > Reviewed-by: Sudeep Holla > Tested-by: Yuanjie Yang > Signed-off-by: Jacky Bai > --- > - v4 changes: > - add changes for other cpuidle driver that has the similar issue > as cpuidle-pcsi driver. > > - v3 changes: > - improve the changelog as suggested by Sudeep > --- > drivers/cpuidle/cpuidle-arm.c | 8 ++++---- > drivers/cpuidle/cpuidle-big_little.c | 2 +- > drivers/cpuidle/cpuidle-psci.c | 4 ++-- > drivers/cpuidle/cpuidle-riscv-sbi.c | 4 ++-- Why have you spared drivers/cpuidle/cpuidle-qcom-spm.c ? IIUC the issue exists there as well. -- Regards, Sudeep _______________________________________________ linux-riscv mailing list linux-riscv@lists.infradead.org http://lists.infradead.org/mailman/listinfo/linux-riscv