From patchwork Wed Feb 27 19:58:32 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ulf Hansson X-Patchwork-Id: 159288 Delivered-To: patches@linaro.org Received: by 2002:a02:5cc1:0:0:0:0:0 with SMTP id w62csp4833374jad; Wed, 27 Feb 2019 11:58:41 -0800 (PST) X-Received: by 2002:a19:5003:: with SMTP id e3mr1885361lfb.160.1551297521248; Wed, 27 Feb 2019 11:58:41 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1551297521; cv=none; d=google.com; s=arc-20160816; b=mFfDLQ2WjjfLoyv0s6QVi1vkuSBLCuxscgOkmGEQUhr9OJbE++eRsbtXTjkeF5s0kp N9nNngFoqh2qD0XIKjJOouhPwxPBoLNfJVwCE5ol5sYGb1dyBZthdW4f1MFwh26OF7Oc T1Twj9shkzsfuSLCEFGUy8Btu5ENWCiPPRqrZ7zRrKD/UotaqcPXB73ygcMB7+zTLqVF o0hUU6lGFn77T8wzF+89VhqpdbDcXUsf2xLLlmLmNRP37/gpldQKK1NOf/gnqZWpj9UQ kq/mL3JokGZgvvlQY/o4/v8d6wOfB5wpUB1MOun/B1WNvPLPslIUAFYmyq/urjOXkwRR 0GKQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=message-id:date:subject:cc:to:from:dkim-signature; bh=E+SW/FzCToYtA2IYYZgzpn69wj9GD9/vb8yka3Fu1rA=; b=EGZV+ILpmY71plW0NRV176tnI2FPK65OuGdbfNrfWlr2rSCEAOQk9CnaSKJuCP2Yec HM/LaJpxIdNNIbBA0H1lHJUHwTEvuN9mWLm4vlBd1V+82CuhfRQe9GzbD31BMXEn7/F/ mKQmE/XBW5ZBDwju6PUFJhVaNivlymL5pGo9Myur7rfZJPVpoieJipfIP5SctFE+PWsa jFTWPVamXWcSWYf61iymSZq54Y59wpD4gVUhe6sWY1UVLyeFLKAjnkHCyemRC0Zn3heD INAv5lALPWxfLPaejK2dXrNGg5tljh3kT+DJfehP05YUVSTbdKIS+zWP9HEsrAHvbZfR ZjrA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=LHC0cawg; spf=pass (google.com: domain of ulf.hansson@linaro.org designates 209.85.220.65 as permitted sender) smtp.mailfrom=ulf.hansson@linaro.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from mail-sor-f65.google.com (mail-sor-f65.google.com. [209.85.220.65]) by mx.google.com with SMTPS id f8sor3209156ljj.13.2019.02.27.11.58.41 for (Google Transport Security); Wed, 27 Feb 2019 11:58:41 -0800 (PST) Received-SPF: pass (google.com: domain of ulf.hansson@linaro.org designates 209.85.220.65 as permitted sender) client-ip=209.85.220.65; Authentication-Results: mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=LHC0cawg; spf=pass (google.com: domain of ulf.hansson@linaro.org designates 209.85.220.65 as permitted sender) smtp.mailfrom=ulf.hansson@linaro.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:cc:subject:date:message-id; bh=E+SW/FzCToYtA2IYYZgzpn69wj9GD9/vb8yka3Fu1rA=; b=LHC0cawgZgGXdf0YwSx8zusmDieSvGvjJwI0LerpUVk2TeKuKHJTcjUKtj1ZU+5Ipo 6wR4tj0qNZjDUCWLWBz3YuJdEtRJId1t7BdanHHP4nCrhs3DzaNFaHDIrERH2plbsJua UUbnZLpz0W/2lwkOsZe9OmNqtwtH42Exqse/6vtQWMp8EmiF0h3Sk60mhNTdb8/2ttKZ P5EoJ/DeNTxAvMukjoPiQmeZ+sTeHBjW4kSwJmrGX1Inuoy9ix30bHfvT6Dpl9ne/xBO wbDfpVSq2uQxzjlP0a3u403cf75UwjzbOvmQZ3k8ZZfw/jJbQYdq8jE5Syw3H4MXwYUk 7OJg== 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=E+SW/FzCToYtA2IYYZgzpn69wj9GD9/vb8yka3Fu1rA=; b=I1TE8VxFVUgd6LnK4gezM4e7iLN2UcncA5MlWKYwzCTc+S1oJkrzCwWpuLFo9h8YX/ g5UvTDUnOUnOHeQM52r2Rz+b9UE7SnASn4FncVa5ZBPxwHeyAxfQ7x8FuRyaI0AvKhAb 73LJ7aXxQkYrioQisfTojYRpVKW+kxoajWiC1MvI6EAohIWeOi1fACddbumpbtdVVW8j UvmE3ye6t/g4+3XbKU7j+b74xTb4jqtC2Pm+mR/UOh/C3BVBLn6OoG4NqGt98TrcNq0g vOhoNLhg3dGa6tWNNwyaOaCy61NbcpZmkzUD+mOCZT/CSzlQ96Fy46WR5Igb3tOlrlza MQFw== X-Gm-Message-State: AHQUAuZYUUwrXxCsyZL8b3JM4tTZHKf+cLFXnUOb2dfonym1/i9ZHAq7 qmcP8Y5oNg3L6PUwhtPXhPXFfKrI X-Google-Smtp-Source: APXvYqw53mdCCWDHLmI+zZBzRlW+bF8UGhtaXLrep4fwgKErZhI4r8naM3JxZjlYs+G1aEny6inl7g== X-Received: by 2002:a2e:21d1:: with SMTP id h78mr2213515lji.49.1551297520660; Wed, 27 Feb 2019 11:58:40 -0800 (PST) Return-Path: Received: from localhost.localdomain (h-158-174-22-210.NA.cust.bahnhof.se. [158.174.22.210]) by smtp.gmail.com with ESMTPSA id z128sm723802lfa.60.2019.02.27.11.58.38 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Wed, 27 Feb 2019 11:58:39 -0800 (PST) From: Ulf Hansson To: "Rafael J . Wysocki" , linux-pm@vger.kernel.org Cc: Frederic Weisbecker , Thomas Gleixner , Sudeep Holla , Lorenzo Pieralisi , Mark Rutland , Daniel Lezcano , "Raju P . L . S . S . S . N" , Stephen Boyd , Tony Lindgren , Kevin Hilman , Lina Iyer , Ulf Hansson , Viresh Kumar , Vincent Guittot , Geert Uytterhoeven , linux-arm-kernel@lists.infradead.org, linux-arm-msm@vger.kernel.org, linux-kernel@vger.kernel.org Subject: [PATCH v12 0/4] PM / Domains: Support hierarchical CPU arrangement (PSCI/ARM) Date: Wed, 27 Feb 2019 20:58:32 +0100 Message-Id: <20190227195836.24739-1-ulf.hansson@linaro.org> X-Mailer: git-send-email 2.17.1 Changes in v12: - Drop the patches for restructuring tick_nohz_get_sleep_length(). Instead replace them all with a new timer/cpuidle patch, according to suggestions by Rafael. - The entire v12 series, including the PSCI/ARM changes are available in a git branch [2]. Changes in v11: - This version contains only the infrastructure changes that is needed for deployment. The PSCI/ARM changes have also been updated and tested, but I will post them separately. Still, to provide completeness, I have published a branch containing everything to a git tree [1], feel free to have a look and test. - The v10 series contained a patch, "timer: Export next wakeup time of a CPU", which has been replaced by a couple of new patches, whom reworks the existing tick_nohz_get_sleep_length() function, to provide the next timer expiration instead of the duration. - More changelogs are available per patch. Changes in v10: - Quite significant changes have been to the PSCI driver deployment. According to an agreement with Lorenzo, the hierarchical CPU layout for PSCI should be orthogonal to whether the PSCI FW supports OSI or not. This has been taken care of in this version. - Drop the generic attach/detach helpers of CPUs to genpd, instead make that related code internal to PSCI, for now. - Fix "BUG: sleeping for invalid context" for hotplug, as reported by Raju. - Addressed various comments from version 8 and 9. - Clarified changelogs and re-wrote the cover-letter to better explain the motivations behind these changes. Background: For ARM64/ARM based platforms CPUs are often arranged in a hierarchical manner. >From a CPU idle state perspective, this means some states may be shared among a group of CPUs (aka CPU cluster). To deal with idle management of a group of CPUs, sometimes the kernel needs to be involved to manage the last-man standing algorithm, simply because it can't rely solely on power management FWs to deal with this. Depending on the platform, of course. There are a couple of typical scenarios for when the kernel needs to be in control, dealing with synchronization of when the last CPU in a cluster is about to enter a deep idle state. 1) The kernel needs to carry out so called last-man activities before the CPU cluster can enter a deep idle state. This may for example involve to configure external logics for wakeups, as the GIC may no longer be functional once a deep cluster idle state have been entered. Likewise, these operations may need to be restored, when the first CPU wakes up. 2) Other more generic I/O devices, such as an MMC controller for example, may be a part of the same power domain as the CPU cluster, due to a shared power-rail. For these scenarios, when the MMC controller is in use dealing with an MMC request, a deeper idle state of the CPU cluster may needs to be temporarily disabled. This is needed to retain the MMC controller in a functional state, else it may loose its register-context in the middle of serving a request. In this series, we are extending the generic PM domain (aka genpd) to be used for also CPU devices. Hence the goal is to re-use much of its current code to help us manage the last-man standing synchronization. Moreover, as we already use genpd to model power domains for generic I/O devices, both 1) and 2) can be address with its help. Moreover, to address these problems for ARM64 DT based platforms, we are deploying support for genpd and runtime PM to the PSCI FW driver - and finally we make some updates to two ARM64 DTBs, as to deploy the new PSCI CPU topology layout. The series has been tested on a Qcom 410c dragonboard and on a Hisilicon Hikey board. The first one uses PSCI OS-initiated mode, while the second uses the PSCI Platform-Coordinated mode. Kind regards Ulf Hansson [1] git.linaro.org/people/ulf.hansson/linux-pm.git next_v11 [2] git.linaro.org/people/ulf.hansson/linux-pm.git next_v12 Ulf Hansson (4): PM / Domains: Add a generic data pointer to the genpd_power_state struct PM / Domains: Add support for CPU devices to genpd cpuidle: Export the next timer/tick expiration for a CPU PM / Domains: Add genpd governor for CPUs drivers/base/power/domain.c | 78 ++++++++++++++++++++++++++-- drivers/base/power/domain_governor.c | 62 +++++++++++++++++++++- drivers/cpuidle/cpuidle.c | 8 +++ include/linux/cpuidle.h | 1 + include/linux/pm_domain.h | 20 ++++++- include/linux/tick.h | 7 ++- kernel/time/tick-sched.c | 12 +++++ 7 files changed, 182 insertions(+), 6 deletions(-) -- 2.17.1