Received: by 2002:a25:ad19:0:0:0:0:0 with SMTP id y25csp2805091ybi; Thu, 18 Jul 2019 14:52:16 -0700 (PDT) X-Google-Smtp-Source: APXvYqy12/bGWgG7iLt4xFYCqICjHqL5fViZExWTLDspKKDMTy0QlVjRReRcOIt46yESqzUbeLn/ X-Received: by 2002:a17:902:296a:: with SMTP id g97mr51711787plb.115.1563486736880; Thu, 18 Jul 2019 14:52:16 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1563486736; cv=none; d=google.com; s=arc-20160816; b=MjSlyVYtw5BOPbi6NP69BWost5ZtkpgIB8NmfGMv07GYcNGG7pxXdnI1m8w5vFdnTP AjvHG70MnfS4wSP9nMfZQBbJrzUkJLcaxyzoS9XAyQSKI9X1TYZrNWgHD8+84UqYbJvI rcHqu74DV65NP/j5B+VYRVdW5X42fm+cy0yN+wTkO3hjqtDSap5NUmz45KXUx9VRcM4F KZJHzQMAP/rxOA87dEIHq8Jz6agS0VIsTHClm0qYZ7l6JledS9DbTwT07DUuiXz+a4rb OJFBVb6eP8PDZj4cCSv/J+MKQKzMr51SAExpx2rRGuQC9xM6Ibbyu7rwHuslImYkiGa2 ziCQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:dkim-signature; bh=vVaakzPBBxcCnU1uQoatmOIcAq9lkWIyC/ZitRYoNgg=; b=dQFG+K7FdWLmJaDfzEKgnp9fMDU4PzHMv3Iek0tJZNxc2GjJQWyg2CakCr+iXV5urO TXmcssHjn+6lBXrG/msAHgVxCmE5o527WRYAlep43WgRItv+OwT5cQ8OlKE5nRbRyjS/ Ac4nch4Ci4NOANxcAy2vxSlFxoFzNIxWiQOgCxMQO+KF7d25X/+rV+U1X466UYIAz3oD Bvxx5Bi+9hvK81ftqXdQLcg/gpA9mZUL1ohHW4fzjsZYSHBQ35FwfdOwWMv8jZlQYW4D 4iPufStwdw/qvlhZo7N7KHv9+vREpAP4oU6uCjOlasQJvsakTgXOB0r4TGkpVDNBWr9d sNbg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=X0bRe+v4; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id 18si1834pgf.457.2019.07.18.14.52.01; Thu, 18 Jul 2019 14:52:16 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=X0bRe+v4; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2391351AbfGRVtt (ORCPT + 99 others); Thu, 18 Jul 2019 17:49:49 -0400 Received: from mail-vs1-f68.google.com ([209.85.217.68]:33164 "EHLO mail-vs1-f68.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727921AbfGRVts (ORCPT ); Thu, 18 Jul 2019 17:49:48 -0400 Received: by mail-vs1-f68.google.com with SMTP id m8so20263004vsj.0 for ; Thu, 18 Jul 2019 14:49:47 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc; bh=vVaakzPBBxcCnU1uQoatmOIcAq9lkWIyC/ZitRYoNgg=; b=X0bRe+v4iwS6jdXfFpHS/B1EX7o/Ag7+xrNChOx3rwtQf1rriCNbBBc2AORVmlG9gC KVxWBeK9NBQ8gBXi8w3Av9R1Yh8r3h7xlJoRYPAOSzyytZUVC4+ejy9Cn3PMuHz9YpW/ IxLuV6N64nVRcqJGyugTEStIUQQsmFjSjI3Fy/4XjJOaWPe1Tv10djjEfP5VnAyre9Oz +v6sV/2I3P9kSX69DLaBAK+GbpCi9bKxUIteMutCxdGAkTLk6xGcGP1HExLaCbrye+OE 8gxLRO/Twcav0vXVKqTdUtgl/TBIEzaP0a1edGLGuHPegpLd/TMcEm8b/qDG4Ok3mPbw W7Xw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=vVaakzPBBxcCnU1uQoatmOIcAq9lkWIyC/ZitRYoNgg=; b=Ks9fb1p582+/P9XYKp7Rxa9m2Ez1JzKV/cIGEI43YjdZNTZ2XRxdlzHfXlWoxdRZwf QiL/hoGoH+sykAXn2WYQzzvImlZtNQ8q8Vt0UOEn2xN+oxhZNMVoR/RI7Fi1C0lNw0dl fPKgdmUQ9pCWHljCpp6Qc3ZCPe82jFx3g7sK7zHN/gPxSbkvfPA+gWGgH9Hzp3ApSNlH cbVK1n8GXNZLv5l3HYlNh8h4XBsU2bfEcu09CCpc7BBjdLkeXc20obW2VFm0p6siMBGY RywqQWds0ajebuYpDkgB2kvbVSKg36FjsoUVhraPGeoLc1wyL0CNCgOJ00flA1+/Cdgm OikA== X-Gm-Message-State: APjAAAXOKi9ZJMaXG0rNnZE53gGUD4x05b8NVV+79KnZWTUCoMmqyE4j v1iANkiGpFTvVcBtACWtQtwwt/0W4GSIO/6vRCLgRA== X-Received: by 2002:a67:e454:: with SMTP id n20mr31593172vsm.34.1563486587134; Thu, 18 Jul 2019 14:49:47 -0700 (PDT) MIME-Version: 1.0 References: <20190513192300.653-1-ulf.hansson@linaro.org> <20190513192300.653-15-ulf.hansson@linaro.org> <20190716155317.GB32490@e121166-lin.cambridge.arm.com> <20190718133053.GA27222@e121166-lin.cambridge.arm.com> <20190718174116.GD25567@codeaurora.org> In-Reply-To: <20190718174116.GD25567@codeaurora.org> From: Ulf Hansson Date: Thu, 18 Jul 2019 23:49:11 +0200 Message-ID: Subject: Re: [PATCH 14/18] drivers: firmware: psci: Manage runtime PM in the idle path for CPUs To: Lina Iyer Cc: Lorenzo Pieralisi , Sudeep Holla , Mark Rutland , Linux ARM , "Rafael J . Wysocki" , Daniel Lezcano , "Raju P . L . S . S . S . N" , Amit Kucheria , Bjorn Andersson , Stephen Boyd , Niklas Cassel , Tony Lindgren , Kevin Hilman , Viresh Kumar , Vincent Guittot , Geert Uytterhoeven , Souvik Chakravarty , Linux PM , linux-arm-msm , Linux Kernel Mailing List Content-Type: text/plain; charset="UTF-8" Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Thu, 18 Jul 2019 at 19:41, Lina Iyer wrote: > > On Thu, Jul 18 2019 at 10:55 -0600, Ulf Hansson wrote: > >On Thu, 18 Jul 2019 at 15:31, Lorenzo Pieralisi > > wrote: > >> > >> On Thu, Jul 18, 2019 at 12:35:07PM +0200, Ulf Hansson wrote: > >> > On Tue, 16 Jul 2019 at 17:53, Lorenzo Pieralisi > >> > wrote: > >> > > > >> > > On Mon, May 13, 2019 at 09:22:56PM +0200, Ulf Hansson wrote: > >> > > > When the hierarchical CPU topology layout is used in DT, let's allow the > >> > > > CPU to be power managed through its PM domain, via deploying runtime PM > >> > > > support. > >> > > > > >> > > > To know for which idle states runtime PM reference counting is needed, > >> > > > let's store the index of deepest idle state for the CPU, in a per CPU > >> > > > variable. This allows psci_cpu_suspend_enter() to compare this index with > >> > > > the requested idle state index and then act accordingly. > >> > > > >> > > I do not see why a system with two CPU CPUidle states, say CPU retention > >> > > and CPU shutdown, should not be calling runtime PM on CPU retention > >> > > entry. > >> > > >> > If the CPU idle governor did select the CPU retention for the CPU, it > >> > was probably because the target residency for the CPU shutdown state > >> > could not be met. > >> > >> The kernel does not know what those cpu states represent, so, this is an > >> assumption you are making and it must be made clear that this code works > >> as long as your assumption is valid. > >> > >> If eg a "cluster" retention state has lower target_residency than > >> the deepest CPU idle state this assumption is wrong. > > > >Good point, you are right. I try to find a place to document this assumption. > > > >> > >> And CPUidle and genPD governor decisions are not synced anyway so, > >> again, this is an assumption, not a certainty. > >> > >> > In this case, there is no point in allowing any other deeper idle > >> > states for cluster/package/system, since those have even greater > >> > residencies, hence calling runtime PM doesn't make sense. > >> > >> On the systems you are testing on. > > > >So what you are saying typically means, that if all CPUs in the same > >cluster have entered the CPU retention state, on some system the > >cluster may also put into a cluster retention state (assuming the > >target residency is met)? > > > >Do you know of any systems that has these characteristics? > > > Many QCOM SoCs can do that. But with the hardware improving, the > power-performance benefits skew the results in favor of powering off > the cluster than keeping the CPU and cluster in retention. > > Kevin H and I thought of this problem earlier on. But that is a second > level problem to solve and definitely to be thought of after we have the > support for the deepest states in the kernel. We left that out for a > later date. The idea would have been to setup the allowable state(s) in > the DT for CPU and cluster state definitions and have the genpd take > that into consideration when deciding the idle state for the domain. Thanks for confirming. This more or less means we need to improve the hierarchical support in genpd to support more levels, such that it makes sense to have a genpd governor assigned at more than one level. This doesn't work well today. As I also have stated, this is on my todo list for genpd. However, I also agree with your standpoint, that let's start simple to enable the deepest state as a start with, then we can improve things on top. Kind regards Uffe