From patchwork Thu Aug 2 13:42:38 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Pingfan Liu X-Patchwork-Id: 952738 Return-Path: X-Original-To: patchwork-incoming@ozlabs.org Delivered-To: patchwork-incoming@ozlabs.org Received: from lists.ozlabs.org (lists.ozlabs.org [203.11.71.2]) (using TLSv1.2 with cipher ADH-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 41hBKw2BTFz9s3q for ; Thu, 2 Aug 2018 23:46:44 +1000 (AEST) Authentication-Results: ozlabs.org; dmarc=fail (p=none dis=none) header.from=gmail.com Authentication-Results: ozlabs.org; dkim=fail reason="signature verification failed" (2048-bit key; unprotected) header.d=gmail.com header.i=@gmail.com header.b="sfP03gyi"; dkim-atps=neutral Received: from lists.ozlabs.org (lists.ozlabs.org [IPv6:2401:3900:2:1::3]) by lists.ozlabs.org (Postfix) with ESMTP id 41hBKv74vJzF2F1 for ; Thu, 2 Aug 2018 23:46:43 +1000 (AEST) Authentication-Results: lists.ozlabs.org; dmarc=pass (p=none dis=none) header.from=gmail.com Authentication-Results: lists.ozlabs.org; dkim=fail reason="signature verification failed" (2048-bit key; unprotected) header.d=gmail.com header.i=@gmail.com header.b="sfP03gyi"; dkim-atps=neutral X-Original-To: linuxppc-dev@lists.ozlabs.org Delivered-To: linuxppc-dev@lists.ozlabs.org Authentication-Results: lists.ozlabs.org; spf=pass (mailfrom) smtp.mailfrom=gmail.com (client-ip=2607:f8b0:400e:c01::243; helo=mail-pl0-x243.google.com; envelope-from=kernelfans@gmail.com; receiver=) Authentication-Results: lists.ozlabs.org; dmarc=pass (p=none dis=none) header.from=gmail.com Authentication-Results: lists.ozlabs.org; dkim=pass (2048-bit key; unprotected) header.d=gmail.com header.i=@gmail.com header.b="sfP03gyi"; dkim-atps=neutral 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) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id; bh=mtWU64ivVoZeMEbDQ1KOBT4vm1AMXNECKE32Wg7rcPw=; b=sfP03gyipSUXSJE40AhcPmG1EMvACvjuiVlkSIXBR0OjBJUcTriuK+AcndKySh+808 2ArdK50tCibtzzJSFJQ4MeZ/+9H+YcMm4f9+CIrgJDiIrXa4wF8qXqyRo75CO1XWLq0d XX8WstvwLJAbsOmIhBHN4eisGFgsKO/IbghnYuhbMJIJCKxf/w6xHMl8xndz42y+Bx6Z g0LdCr3aS4x8wts9IHvLhkXrxyMuoayHncX7stywQFQgBPjouQn2PcZ5oxTZ0gyMb6Bh x4CVwAQDq6fEvmTL/ef8b/oE3yRXS4rC6Wh2gcf1gpWfb87nkDnNETi6cmqWnAKgTdVx fHaQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id; bh=mtWU64ivVoZeMEbDQ1KOBT4vm1AMXNECKE32Wg7rcPw=; b=pltrVcSBSTHBI15/FfeQbWzGn0vDfVr8D1QeI1R7CVIfA8dAWpj8BMebiciq4LKI25 vqXUv5d5Boe0CvyfdLAy4lX1bqLtYLdtkPjj/EBFgMrwisoGX39Ee0Aa2yaBKuMQtqY7 f3JhFz0B3h+tXefR1UFZy5NPcE9VDCJo1zH76SGt2oogG+hRaL8P3wWzKt++T2su8fVR COQjoqKHRBM04E9CJWyX3CpqdIjACAtCgIU4X4CUegiIsXNGwBOacWEk7sC1RCZQUZVe rLTsXdzI/DXAoVkOWmXnjPlBrE8e5BsafVxQJqZla+hnoQC486b6C8Rgg4k0xsSgp+1T 0dYQ== X-Gm-Message-State: AOUpUlFjXVgOGWHzA9goDeALcbWQl0nyU7NM1acyY1ISZcDTd5FvKM4H tVCfvHOFBJI3n1NdnQDw7EiInHI= X-Google-Smtp-Source: AAOMgpe++7n3kvFfOUpUa3twMYE/fT07IndhNTAXwcU4UJ8KPuQKiNKamoz7MELeh9FWoWmANtaDFw== X-Received: by 2002:a17:902:4d45:: with SMTP id o5-v6mr2450949plh.78.1533217377237; Thu, 02 Aug 2018 06:42:57 -0700 (PDT) Received: from mylaptop.redhat.com ([209.132.188.80]) by smtp.gmail.com with ESMTPSA id m81-v6sm5664113pfa.188.2018.08.02.06.42.53 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Thu, 02 Aug 2018 06:42:56 -0700 (PDT) From: Pingfan Liu To: linuxppc-dev@lists.ozlabs.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> X-Mailer: git-send-email 2.7.4 X-BeenThere: linuxppc-dev@lists.ozlabs.org X-Mailman-Version: 2.1.27 Precedence: list List-Id: Linux on PowerPC Developers Mail List List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: linux-pm@vger.kernel.org, "Rafael J. Wysocki" , Pingfan Liu , Tyrel Datwyler Errors-To: linuxppc-dev-bounces+patchwork-incoming=ozlabs.org@lists.ozlabs.org Sender: "Linuxppc-dev" 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; }