From patchwork Mon Apr 16 06:35:06 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Pingfan Liu X-Patchwork-Id: 898480 Return-Path: X-Original-To: patchwork-incoming@ozlabs.org Delivered-To: patchwork-incoming@ozlabs.org Received: from lists.ozlabs.org (lists.ozlabs.org [IPv6:2401:3900:2:1::3]) (using TLSv1.2 with cipher ADH-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 40Pdz16K4hz9s0b for ; Mon, 16 Apr 2018 16:39:41 +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="DP29fAxV"; 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 40Pdz14kr5zF1xV for ; Mon, 16 Apr 2018 16:39:41 +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="DP29fAxV"; 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::242; helo=mail-pl0-x242.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="DP29fAxV"; dkim-atps=neutral Received: from mail-pl0-x242.google.com (mail-pl0-x242.google.com [IPv6:2607:f8b0:400e:c01::242]) (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 40Pdt30KtNzDqRV for ; Mon, 16 Apr 2018 16:35:22 +1000 (AEST) Received: by mail-pl0-x242.google.com with SMTP id k9-v6so4683390pll.12 for ; Sun, 15 Apr 2018 23:35:22 -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:in-reply-to:references; bh=2SHZqsgkmAEez4AMatTLlxxKsFPPcth7wh0Mh4IfvWI=; b=DP29fAxVzRa48CcjL3tV06FMITeY9JC+qCM6XYGaTXhdaHNhZhlpQ5I/9zQiX9mycC gv4tUUJkIRqj9p+EK7hYRYsKHwes7dDVLGB/HCVclIB+kWFnKI/BTZBxki8PPE/mLJzM r8RXMczcs8RiOJtsttWhMwE2K5J5G3mmox6bas8/gnf9rO4vPn8x5+pRsWZmJYxpDK/d 8VKEhdtxJel5+6TsM59GwBMLMN9EVTZcVF4swPLYwYsZutKQ/1ghKXOpNypEeSvqt/9g M9aRTHuG/GdTxWDU+awPQHCU8z4SFyexSoN7wnBsPdKT/XD1+68hpDMoAOHxDlB0mBCH 4Y7w== 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:in-reply-to :references; bh=2SHZqsgkmAEez4AMatTLlxxKsFPPcth7wh0Mh4IfvWI=; b=s2EMbwHgsIZZtltYL+T3E5R/3y9P9nzwYCFyy48J3lkYFhhnicZ8eCYsPaXD10nlW9 LKO1nkt68svqlaWnNK94YGdcI6G4qd+xSQIkJ0p1Mq7+2HIZKQMw5D7D1Bp96XrllEjE Pt9CRz1sbfS+Eha/y6T72yf2ZolN335uZcIxvCf1kPgxoNSvTBWXCgc1rDe4ldkyXa3T KX598Gwn72MsOC6aEXESG/5RxeOEdES4cPUoRd6JhNMI79SpD9A5B5J5DUNgetqewWKx +dw7aCdtMxvC3g2UvZiN8wgOR3OFf8i//4iAZvIxj5B9ZenSlCBc14O1MONtAhcnKVgv rPGg== X-Gm-Message-State: ALQs6tDoAeBaunYTit6WnQh1KwPhEiewN+2NzFksyVCZW1hWWfGTu+17 vyRd+ADKivWfruRqD3xsNnox X-Google-Smtp-Source: AIpwx49VlN+Xdbh3XZ50GjaA0GanUIatDg8BS+mujlfso5FPmVjJaZGvHlw+kWvCp5R+olcbEJdrJw== X-Received: by 2002:a17:902:bc84:: with SMTP id bb4-v6mr3440090plb.8.1523860520925; Sun, 15 Apr 2018 23:35:20 -0700 (PDT) Received: from mylaptop.nay.redhat.com ([209.132.188.80]) by smtp.gmail.com with ESMTPSA id u19sm10111187pfg.96.2018.04.15.23.35.18 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Sun, 15 Apr 2018 23:35:20 -0700 (PDT) From: Pingfan Liu To: linuxppc-dev@lists.ozlabs.org Subject: [PATCHv2 1/3] powerpc/cpuidle: dynamically register/unregister cpuidle_device during hotplug Date: Mon, 16 Apr 2018 14:35:06 +0800 Message-Id: <1523860508-19364-2-git-send-email-kernelfans@gmail.com> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1523860508-19364-1-git-send-email-kernelfans@gmail.com> References: <1523860508-19364-1-git-send-email-kernelfans@gmail.com> X-BeenThere: linuxppc-dev@lists.ozlabs.org X-Mailman-Version: 2.1.26 Precedence: list List-Id: Linux on PowerPC Developers Mail List List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Hari Bathini , Paul Mackerras Errors-To: linuxppc-dev-bounces+patchwork-incoming=ozlabs.org@lists.ozlabs.org Sender: "Linuxppc-dev" cpuidle_device is touched during the cpu hotplug. In order to cope with the incoming patch [3/3], which causes the dir /sys/../cpuX is created/destroyed during hotplug, we also need to create the file cpuX/cpuidle dynamically. Signed-off-by: Pingfan Liu Reviewed-by: Hari Bathini --- 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 1a8234e..962c944 100644 --- a/drivers/cpuidle/cpuidle-powernv.c +++ b/drivers/cpuidle/cpuidle-powernv.c @@ -144,6 +144,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(); @@ -159,6 +160,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; }