Received: by 2002:a05:6a10:5bc5:0:0:0:0 with SMTP id os5csp901185pxb; Thu, 21 Oct 2021 11:38:44 -0700 (PDT) X-Google-Smtp-Source: ABdhPJxrTN9Yux5QkdLLTL7SRmeCkxYYfq16vcjgRJ2EVf2iE5Dv31Td+dNyW7C3Li3FjdBHNgik X-Received: by 2002:a63:7506:: with SMTP id q6mr5687639pgc.349.1634841524134; Thu, 21 Oct 2021 11:38:44 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1634841524; cv=none; d=google.com; s=arc-20160816; b=qBBifIiBpSczZ3K4x8cVpPc7Q1h7nSUsiXD/DpT7UdoOjU8wFgMx3uGqbmo4Fgy2xP OKM8VjX/gGWbjlXoO9qjK7De50XprSW4roOOU880Ji7SaB/q7BxxL3oUhrd5L0OT4+8M /YhYfxJZDs/jqSl/qkSJwxH9zt+CBjyWlXEEh08Um3noWIOZkqPY7YiuyH/MDZyhfCSk u/+HvcMufP9kZ8upwROfnNM2WXm36URQ6c1PQ04+TKTG7gftlvZ2edEd89yFJXeVvIJu Au8OU1B72DtpTEZqZ+HRJXGJxdofLDWsJKvo9q+hNE2B6XQPZBnmg+uDG1v3sTvz3vGI ttJA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:cc:to:subject:message-id:date:from:in-reply-to :references:mime-version:dkim-signature; bh=KFwenL5XcnRNpptcSA2cgOLSm+ikdKJzsWm5PgT8Ins=; b=BdUx7VVoCVCG9LwqXo2BeF07OKKA7UsYPrD7HupfgMMMlkTLAq9duMZP+cSAJWaJNE FbGKOAK+Nj241+xlUOX1O7+k/4M3LnfitA9ZuiYwmNF5ah/Wcd3lWsF/leLUeKrnQIcd Ur8ncj0ZieqjIqZDWNld27Dy05d42z5H5fqFsWZ8dGcsHx32lat/lkUVLPUFsaSqMg4e yOkRwyn33WdCYm8I3juQQ5IGUrCzQUpQOr84xHEyH8oTPOWMhOo0/D6wqm7HspeYtj1a +V78LR2UyZqcH6jPaSeZf8EebHRR0M+8QkCktiv/TFbOm3RwHNFHpZvcOwW2WQFiPzGj 5QJA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=OJyAvfRJ; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 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. [23.128.96.18]) by mx.google.com with ESMTP id k34si9957548pgi.413.2021.10.21.11.38.28; Thu, 21 Oct 2021 11:38:44 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=OJyAvfRJ; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 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 S230103AbhJUSjF (ORCPT + 99 others); Thu, 21 Oct 2021 14:39:05 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:41204 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230020AbhJUSjE (ORCPT ); Thu, 21 Oct 2021 14:39:04 -0400 Received: from mail-lj1-x231.google.com (mail-lj1-x231.google.com [IPv6:2a00:1450:4864:20::231]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id B02ECC061764 for ; Thu, 21 Oct 2021 11:36:47 -0700 (PDT) Received: by mail-lj1-x231.google.com with SMTP id d13so1614604ljg.0 for ; Thu, 21 Oct 2021 11:36: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=KFwenL5XcnRNpptcSA2cgOLSm+ikdKJzsWm5PgT8Ins=; b=OJyAvfRJ5jZ79JXyHWkRZUCQ6cXZuVSfYnKgESe+bsyL3wQqD44nkm0/2lfr5lcyFf VBb3ct4DjtXApDhsHmiFbZIHXzj9yPNKlyqvtrQP5QKGGBzf+zqOAtdOq7ld5PYn0Y1c YsXdIBJEDq1Xo89E6wOO3IoCxmPrioKOp4gyOTLLNYSc/n2tmPwxilfBXEsL1/E9n9t1 7E9oP7oOqWi4oLQCtK3dS7vc/N4iJhAgISb6/VYI4OSFChBnOFPYVnRLhdIJUn9zPAGU PWHJW6RifcIdWE2vOhl1qflAZ7Zt7nPeVLqK9gme/u+y2fp8GzTxELWCpxwEyaO1xdBv lNxA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=KFwenL5XcnRNpptcSA2cgOLSm+ikdKJzsWm5PgT8Ins=; b=GklxvQMxPtid7/BAxZ9uUrmDQWxn9f2CsLkOm7NR+XtZNZDYkimDl2Oj/IdVcUYQVv AG0vQvlj1DmP4UlNzlC0HuKEy/4WPwtfa169I3eadrZzBvi8yMyL6IX5t1bQkgmGZiC8 YwXdz9icbmWZ9jzKdEIx2OQRBpv8NO+2k7vhZ9fVdNJ0x85VwFbFlDR6Jl1kLGz7uV4w RloAmE+Amc//Q+gWgOHjil7JHW5YqnaLpVXR277jkiVf1tZyQuIkIJ+ptZl3qrErYWOi HtFBOojo3OVYjkf69Gk0XRP0GhtGSJD2dBk521pdHq9gYH+nucyOmt/ZSaCebqnuS0zK rPVA== X-Gm-Message-State: AOAM5302x0dnS3brBDgJnI1BpyzIkIcdkC3bYOkc2kdvrF5YJ4CR6lCI 8nZDjnHmuh4DEzHGINoGgA2/Cx/N8oKB6CSNT3lk0A== X-Received: by 2002:a2e:a5c8:: with SMTP id n8mr7921763ljp.367.1634841406007; Thu, 21 Oct 2021 11:36:46 -0700 (PDT) MIME-Version: 1.0 References: <20210929144451.113334-1-ulf.hansson@linaro.org> <20210929144451.113334-3-ulf.hansson@linaro.org> In-Reply-To: From: Ulf Hansson Date: Thu, 21 Oct 2021 20:36:08 +0200 Message-ID: Subject: Re: [PATCH 2/2] PM: sleep: Fix runtime PM based cpuidle support To: "Rafael J. Wysocki" Cc: Daniel Lezcano , Linux PM , Maulik Shah , Peter Zijlstra , Vincent Guittot , Len Brown , Bjorn Andersson , Linux ARM , Linux Kernel Mailing List Content-Type: text/plain; charset="UTF-8" Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org [...] > > > > > > > > > > > > > Additionally, since find_deepest_state() is being called for > > > > > > > cpuidle_enter_s2idle() too, we would need to treat the new > > > > > > > CPUIDLE_STATE_DISABLED_ flag in a special way, right? > > > > > > > > > > > > No, it already checks "disabled". > > > > > > > > > > Yes, but that would be wrong. > > > > > > > > Hmmm. > > > > > > > > > The use case I want to support, for cpuidle-psci, is to allow all idle > > > > > states in suspend-to-idle, > > > > > > > > So does PM-runtime work in suspend-to-idle? How? > > > > > > > > > but prevent those that rely on runtime PM > > > > > (after it has been disabled) for the regular idle path. > > > > > > > > Do you have a special suspend-to-idle handling of those states that > > > > doesn't require PM-runtime? > > > > > > Regardless, pausing cpuidle in the suspend-to-idle path simply doesn't > > > make sense at all, so this needs to be taken care of in the first > > > place. > > > > Right, I do agree, don't get me wrong. But, do we really want to treat > > s2-to-idle differently, compared to s2-to-ram in regards to this? > > > > Wouldn't it be a lot easier to let cpuidle drivers to opt-out for > > cpuidle_pause|resume(), no matter whether it's for s2-to-idle or > > s2-to-ram? > > I don't think so. > > Suspend-to-idle resume cpuidle after pausing it which is just plain > confusing and waste of energy and the fact that the system-wide > suspend flow interferes with using PM-runtime for implementing cpuidle > callbacks at the low level really is an orthogonal problem. It's certainly an orthogonal problem, I agree. However, trying to solve it in two different ways, may not really be worth the effort, in my opinion. As I kind of pointed out in the earlier reply, I am not sure there are any other relatively easy solutions available, to fix the problem for runtime PM based cpuidle drivers. We probably need to call cpuidle_pause() (or similar) in some way. > > > > > > > The problem with PM-runtime being unavailable after dpm_suspend() > > > needs to be addressed in a different way IMO, because it only affects > > > one specific use case. > > > > It's one specific case so far, but we have the riscv driver on its > > way, which would suffer from the same problem. > > So perhaps they should be advised about this issue. Yes, I will let them know - and hopefully I will soon also be able to provide them with a fix. :-) > > > Anyway, an option is to figure out what platforms and cpuidle drivers, > > that really needs cpuidle_pause|resume() at this point and make an > > opt-in solution instead. > > None of them need to pause cpuidle for suspend-to-idle AFAICS. I assume so too, otherwise things would have been broken when cpuidle_resume() is called in s2idle_enter(). But, it's still a bit unclear. > > Some may want it in the non-s2idle suspend path, but I'm not sure > about the exact point where cpuidle needs to be paused in this case. > Possibly before offlining the nonboot CPUs. Okay. Note that, I assume it would be okay to also pause cpuidle a bit earlier in these cases, like in dpm_suspend() for example. The point is, it's really a limited short period of time for when cpuidle would be paused, so I doubt it would have any impact on the consumed energy. Right? > > > This could then be used by runtime PM based > > cpuidle drivers as well. Would that be a way forward? > > The PM-runtime case should be addressed directly IMO, we only need to > figure out how to do that. If you have any other suggestions, I am listening. :-) > > I'm wondering how you are dealing with the case when user space > prevents pd_dev from suspending via sysfs, for that matter. That should work fine during runtime - because runtime PM is enabled for the device. Kind regards Uffe