Re: [PATCH 3/3] intel_idle: fix cpuidle_device unregistration
From: "Rafael J. Wysocki" <rafael@kernel.org>
Date: 2021-11-24 13:59:06
On Wed, Nov 24, 2021 at 2:44 PM Zhang Rui [off-list ref] wrote:
On Wed, 2021-11-24 at 14:20 +0100, Rafael J. Wysocki wrote:quoted
On Wed, Oct 27, 2021 at 10:07 AM Zhang Rui [off-list ref] wrote:quoted
cpuidle_device is allocated as percpu data, and it is registered for every CPU that has ever been onlined. When unregistering, checking current online CPUs is not sufficient, because some cpu may be offlined later with its cpuidle_device registered.But the unregistration happens only in the error code path of intel_idle_init(), doesn't it?yes.quoted
While I agree that doing a for_each_present_cpu() walk for that is more prudent', I'm not sure if that makes any difference in practice.And yes, exactly. This is not a problem as long as intel_idle driver can not be unloaded. There is no technical gap either to unregister the intel_idle cpuidle driver, or to unload the intel_idle module. And this potential issue will be exposed only when we decided to do so. If you prefer to describe this *potential* issue more precisely, I totally agree. If you want to fix it only when really needed, that's also okay to me.
I would prefer to fix it first and then extend as needed.