From mboxrd@z Thu Jan 1 00:00:00 1970 From: Pingfan Liu Subject: [PATCH 1/2] powerpc/cpuidle: dynamically register/unregister cpuidle_device during hotplug Date: Thu, 2 Aug 2018 21:42:38 +0800 Message-ID: <1533217359-11420-1-git-send-email-kernelfans@gmail.com> Return-path: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: linuxppc-dev-bounces+glppe-linuxppc-embedded-2=m.gmane.org@lists.ozlabs.org Sender: "Linuxppc-dev" To: linuxppc-dev@lists.ozlabs.org Cc: linux-pm@vger.kernel.org, "Rafael J. Wysocki" , Pingfan Liu , Tyrel Datwyler List-Id: linux-pm@vger.kernel.org cpuidle_device is touched during the cpu hotplug. At present, ppc64 just online/offline cpu during hotplug/unplug. But if using the register_cpu/unregister_cpu() API to implement the hotplug, the dir /sys/../cpuX is created/destroyed during hotplug, hence we also need to create the file cpuX/cpuidle dynamically. Cc: Benjamin Herrenschmidt Cc: Michael Ellerman Cc: "Rafael J. Wysocki" Cc: Tyrel Datwyler Cc: linux-pm@vger.kernel.org Signed-off-by: Pingfan Liu --- drivers/cpuidle/cpuidle-powernv.c | 2 ++ drivers/cpuidle/cpuidle-pseries.c | 2 ++ 2 files changed, 4 insertions(+) diff --git a/drivers/cpuidle/cpuidle-powernv.c b/drivers/cpuidle/cpuidle-powernv.c index d29e4f0..94d0def 100644 --- a/drivers/cpuidle/cpuidle-powernv.c +++ b/drivers/cpuidle/cpuidle-powernv.c @@ -166,6 +166,7 @@ static int powernv_cpuidle_cpu_online(unsigned int cpu) struct cpuidle_device *dev = per_cpu(cpuidle_devices, cpu); if (dev && cpuidle_get_driver()) { + cpuidle_register_device(dev); cpuidle_pause_and_lock(); cpuidle_enable_device(dev); cpuidle_resume_and_unlock(); @@ -181,6 +182,7 @@ static int powernv_cpuidle_cpu_dead(unsigned int cpu) cpuidle_pause_and_lock(); cpuidle_disable_device(dev); cpuidle_resume_and_unlock(); + cpuidle_unregister_device(dev); } return 0; } diff --git a/drivers/cpuidle/cpuidle-pseries.c b/drivers/cpuidle/cpuidle-pseries.c index 9e56bc4..a53be8a 100644 --- a/drivers/cpuidle/cpuidle-pseries.c +++ b/drivers/cpuidle/cpuidle-pseries.c @@ -193,6 +193,7 @@ static int pseries_cpuidle_cpu_online(unsigned int cpu) struct cpuidle_device *dev = per_cpu(cpuidle_devices, cpu); if (dev && cpuidle_get_driver()) { + cpuidle_register_device(dev); cpuidle_pause_and_lock(); cpuidle_enable_device(dev); cpuidle_resume_and_unlock(); @@ -208,6 +209,7 @@ static int pseries_cpuidle_cpu_dead(unsigned int cpu) cpuidle_pause_and_lock(); cpuidle_disable_device(dev); cpuidle_resume_and_unlock(); + cpuidle_unregister_device(dev); } return 0; } -- 2.7.4 From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail-pl0-x243.google.com (mail-pl0-x243.google.com [IPv6:2607:f8b0:400e:c01::243]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by lists.ozlabs.org (Postfix) with ESMTPS id 41hBFb0pHwzF22V for ; Thu, 2 Aug 2018 23:42:59 +1000 (AEST) Received: by mail-pl0-x243.google.com with SMTP id s17-v6so1051082plp.7 for ; Thu, 02 Aug 2018 06:42:59 -0700 (PDT) From: Pingfan Liu To: linuxppc-dev@lists.ozlabs.org Cc: Pingfan Liu , Benjamin Herrenschmidt , Michael Ellerman , "Rafael J. Wysocki" , Tyrel Datwyler , linux-pm@vger.kernel.org Subject: [PATCH 1/2] powerpc/cpuidle: dynamically register/unregister cpuidle_device during hotplug Date: Thu, 2 Aug 2018 21:42:38 +0800 Message-Id: <1533217359-11420-1-git-send-email-kernelfans@gmail.com> List-Id: Linux on PowerPC Developers Mail List List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , cpuidle_device is touched during the cpu hotplug. At present, ppc64 just online/offline cpu during hotplug/unplug. But if using the register_cpu/unregister_cpu() API to implement the hotplug, the dir /sys/../cpuX is created/destroyed during hotplug, hence we also need to create the file cpuX/cpuidle dynamically. Cc: Benjamin Herrenschmidt Cc: Michael Ellerman Cc: "Rafael J. Wysocki" Cc: Tyrel Datwyler Cc: linux-pm@vger.kernel.org Signed-off-by: Pingfan Liu --- drivers/cpuidle/cpuidle-powernv.c | 2 ++ drivers/cpuidle/cpuidle-pseries.c | 2 ++ 2 files changed, 4 insertions(+) diff --git a/drivers/cpuidle/cpuidle-powernv.c b/drivers/cpuidle/cpuidle-powernv.c index d29e4f0..94d0def 100644 --- a/drivers/cpuidle/cpuidle-powernv.c +++ b/drivers/cpuidle/cpuidle-powernv.c @@ -166,6 +166,7 @@ static int powernv_cpuidle_cpu_online(unsigned int cpu) struct cpuidle_device *dev = per_cpu(cpuidle_devices, cpu); if (dev && cpuidle_get_driver()) { + cpuidle_register_device(dev); cpuidle_pause_and_lock(); cpuidle_enable_device(dev); cpuidle_resume_and_unlock(); @@ -181,6 +182,7 @@ static int powernv_cpuidle_cpu_dead(unsigned int cpu) cpuidle_pause_and_lock(); cpuidle_disable_device(dev); cpuidle_resume_and_unlock(); + cpuidle_unregister_device(dev); } return 0; } diff --git a/drivers/cpuidle/cpuidle-pseries.c b/drivers/cpuidle/cpuidle-pseries.c index 9e56bc4..a53be8a 100644 --- a/drivers/cpuidle/cpuidle-pseries.c +++ b/drivers/cpuidle/cpuidle-pseries.c @@ -193,6 +193,7 @@ static int pseries_cpuidle_cpu_online(unsigned int cpu) struct cpuidle_device *dev = per_cpu(cpuidle_devices, cpu); if (dev && cpuidle_get_driver()) { + cpuidle_register_device(dev); cpuidle_pause_and_lock(); cpuidle_enable_device(dev); cpuidle_resume_and_unlock(); @@ -208,6 +209,7 @@ static int pseries_cpuidle_cpu_dead(unsigned int cpu) cpuidle_pause_and_lock(); cpuidle_disable_device(dev); cpuidle_resume_and_unlock(); + cpuidle_unregister_device(dev); } return 0; } -- 2.7.4