From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 773C1C433F5 for ; Thu, 21 Oct 2021 19:04:09 +0000 (UTC) Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 404BD604AC for ; Thu, 21 Oct 2021 19:04:09 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.4.1 mail.kernel.org 404BD604AC Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=kernel.org Authentication-Results: mail.kernel.org; spf=none smtp.mailfrom=lists.infradead.org DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender: Content-Transfer-Encoding:Content-Type:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:Cc:To:Subject:Message-ID:Date:From: In-Reply-To:References:MIME-Version:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=KLstbR2XfqH7EX7Stzf/LDbYgxkYOfhQnVcvjDPWR64=; b=y6Ok2hnqigHnyu pVDz1u94hj6p32EPTQvV75uCe1Nkq5pAcSAjnMR/NclOos1Y3S8lzWBCqX7y+0djVgLeDlm2czCPg IbKs/ACPAZskRLO7uNhsZAdfg49mfLlehxlE0gkxzVxNjK6k40LUwc/PtAtbY6DgEQEQItYChimPM mTyHTpn3ynBTrTQI4p42VZ+QhzYTCgGMHtbwIaUlDALUXhG0hocMZAjZXeCZXFNymwjlLKoYTRk04 VH+G8XaH5c1PG0i3YQbIz0E9et2n+o31dLlP1IVpCCacElfTosKebQ9XCO+K+83uh9L49a6X+XO01 6MXGf0qjpNFRiSC0OGWQ==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.94.2 #2 (Red Hat Linux)) id 1mddKs-008wtL-Jc; Thu, 21 Oct 2021 19:02:42 +0000 Received: from mail-oi1-f172.google.com ([209.85.167.172]) by bombadil.infradead.org with esmtps (Exim 4.94.2 #2 (Red Hat Linux)) id 1mddKp-008wrk-2b for linux-arm-kernel@lists.infradead.org; Thu, 21 Oct 2021 19:02:40 +0000 Received: by mail-oi1-f172.google.com with SMTP id n63so2091575oif.7 for ; Thu, 21 Oct 2021 12:02:36 -0700 (PDT) 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=W7TkRZBg0XypFSbXfRFIpqf6ScvCTqPGc+rgARxQ4LA=; b=iEbvrC5N2xg7RS/TRAjKdmZZzhh8+EzChnokLoCDOf5LS9o3xC8Fze4UUOsiWxb+r2 75sU4BXWK9N/6C96nt5OhlifCzxF94lxeq86e0qhsOC8Q9BGYNkwVcANhuoFUFpytOXy YeDnMpD8CNbAfiZ7idlRZ55EqEykYMnggK8yX1PE0KpFByC7E3PXCBuwgR2g7kfgyiPr OXcx5g93Z+5Bk7BOL9NDWH49UyM/CToknHzP607uvBX+TC1fS9M6s/D+SDS84pgQxDPW DXf8hUBmTAkF+Hk9WbcFIAJXphLjhNo0ne+gonqhafVuWeViDSK7yhn9YeB7uATrbUPE bSVA== X-Gm-Message-State: AOAM530crk4g65dSLFPh17B0jUcVWsXoffN06HRWZ7ZLn2N84txzMcgu 4nS8zwXNkFrj+UowNZ5hZ/l6OgtXZtNQdD93g1FfUxuNOQo= X-Google-Smtp-Source: ABdhPJzf2WcHwGOnLbgy1YaTHUIzSnbvS5pD5Zraj6p32xvOZ2slzltcvMkcEUasinTitUk1PoMt+RZrjw3bUKsPfow= X-Received: by 2002:a05:6808:e87:: with SMTP id k7mr2165504oil.166.1634842956087; Thu, 21 Oct 2021 12:02:36 -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: "Rafael J. Wysocki" Date: Thu, 21 Oct 2021 21:02:24 +0200 Message-ID: Subject: Re: [PATCH 2/2] PM: sleep: Fix runtime PM based cpuidle support To: Ulf Hansson Cc: "Rafael J. Wysocki" , Daniel Lezcano , Linux PM , Maulik Shah , Peter Zijlstra , Vincent Guittot , Len Brown , Bjorn Andersson , Linux ARM , Linux Kernel Mailing List X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20211021_120239_142337_447E4BE6 X-CRM114-Status: GOOD ( 20.59 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org On Thu, Oct 21, 2021 at 8:12 PM Ulf Hansson wrote: > > On Thu, 21 Oct 2021 at 18:33, Rafael J. Wysocki wrote: > > > > On Thu, Oct 21, 2021 at 6:17 PM Ulf Hansson wrote: [cut] > > So in theory you could check the pm_runtime_put_sync_suspend() return > > value and fall back to something like WFI if that's an error code. > > I have already tried that, but it simply got too complicated. The main > issue was that runtime PM could become disabled for the device in the > middle of executing the ->enter() callback. So IIUC the problem is that you cannot resume after suspending in that case. IOW, you need to guarantee that if the suspend is successful, the resume also will take place, but if the suspend fails, you basically don't care. > For example, if pm_runtime_get_sync() fails, I still need to make sure > the reference counting in genpd becomes correct - and I can't do that > using dev_pm_genpd_resume(). That's because it's not designed to be > called in this "unknown" suspend phase, but should be called after the > noirq phase and be properly balanced with dev_pm_genpd_suspend(). > > In other words, the error path didn't work out for me. It should be sufficient to call wake_up_all_idle_cpus() in the suspend path before dpm_suspend_late(), because system suspend acquires a PM-runtime reference on every device. IOW, it won't let any devices runtime-suspend, so if your power domain devices are resumed in that path, they will never suspend again in it and the pm_runtime_put_sync_suspend() in __psci_enter_domain_idle_state() becomes a reference counter management call which works regardless of whether or not PM runtime is disabled. _______________________________________________ linux-arm-kernel mailing list linux-arm-kernel@lists.infradead.org http://lists.infradead.org/mailman/listinfo/linux-arm-kernel