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 81F55C433F5 for ; Mon, 11 Oct 2021 10:12:19 +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 36F9260F22 for ; Mon, 11 Oct 2021 10:12:19 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.4.1 mail.kernel.org 36F9260F22 Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=linaro.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=PYdGEY2b1zU82GlQMDvdoEA1DlQtan0hdPwp6RDB1OI=; b=pFlXGpoEpAYeRV +IrfxblRGpeemgxYqOfFd0iNAGblHAcD4I/HaoWJw4S5VJo2lxpXh/sS7ZEgrHXyyJPVnjHGeHQoh YK8b4HX4Ji4jaOWWBIZClhVMLsm1ikOVAhqKzbLZzcv0Bo/Fpx27/ipNeix5vMSd3fOuO7KSnuG6a XF1k95QO1SGieNQJXfrHnRWhy0s67f7NinoNE8uO9M4xib4MwZiDP2yVwg8ZOlIjmFVcJfxRNRjHH O3cuKSk52r1RPJrHLp/2fHc1TsmXLc8ZwoNTJfYAurPn/hwlAcPuH5VrJXDrSQawQ3+iq/LcCojp9 uOL88efRqfG4IMqNMX7A==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.94.2 #2 (Red Hat Linux)) id 1mZsF1-008m63-CW; Mon, 11 Oct 2021 10:09:09 +0000 Received: from mail-lf1-x134.google.com ([2a00:1450:4864:20::134]) by bombadil.infradead.org with esmtps (Exim 4.94.2 #2 (Red Hat Linux)) id 1mZsBO-008khx-Pm for linux-arm-kernel@lists.infradead.org; Mon, 11 Oct 2021 10:05:24 +0000 Received: by mail-lf1-x134.google.com with SMTP id p16so398712lfa.2 for ; Mon, 11 Oct 2021 03:05:21 -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=y7cA9NqfV+l2ldiwKTZK6iXcHWSwpaV4+LaQNy+YSxw=; b=DHJRAlQ/cdsO002wqdk9U35i1vwGEsuhUrydew3ZbfwrGMuiHim3q+FY/zgXSjLtBJ bkOjFr1Wy76JZM8vj4HnCj3tY9Qrm7dKaTbPkD8i8DjItqI6mzVKOZn4knA/v6hBV3tZ Qkl3bH4Z7EChWg8dbSHD05ONtYISW2TnjlXsRVTyzGhb830HwXGEK45nYPRJOooqBYDG WQ4D6924TpZNHKEX+2/gx/dR/cDffPWK3Bs1KnPaoKqnx+++sx2OhHITerwerl9R3fwr Itaf1J67i0H6VXb8KyGDuSAB1vqynd2jLyj6Hlst+KUULBnuNi92Ugb3LLu4RujqNJAV AJLw== 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=y7cA9NqfV+l2ldiwKTZK6iXcHWSwpaV4+LaQNy+YSxw=; b=QxtlHxioVw0/6Qz5wdeMRKTSq/gbWhsji7pLvRnrT4SSGDa+yw4rU7RYU2amLMrGAm DjZtFpiIkRd/CkZsyNRUioUY8WA7NyJOHiLBjxDvvKTvsbgRoOhmMushN2e0J1kajowA ZStC+bRztqGZaKv3vwtbRhe3z8cwOTzRvlVIcDwN9eYTGyPdYcf0GnQXHeBtN1SvobnK /xXc1K/UKJOcjzSDwrcVjlXz9eEWwbWEF3wDg36R0nS1vZFOgoljYNgwdzIn+Qqrmq5O uDpHk0ZHGQq52rytJ00iN+LpeBktNjKXxaC0VXCUYGyraDSuB7+EXDNfquMzRhcsbl7d PqwQ== X-Gm-Message-State: AOAM5307AuC00iNId7cpcYqECS0ns2FpMb9f/ysqTvHv5hWGCuacy3K6 LcEhF7WkleMbMQp5FIOBHOiYSSD8aMpMbwmLdkzN/G/2nFg9/w== X-Google-Smtp-Source: ABdhPJxpc5P58y+Wm08HRpFIFUVVqV+WvrwkxexpxQHYYrEHJZq7Bm2y9XfrGnWChqbEa1jyTK4LdR7a2ZYDwDsUdyI= X-Received: by 2002:a05:6512:1515:: with SMTP id bq21mr26262661lfb.71.1633946720249; Mon, 11 Oct 2021 03:05:20 -0700 (PDT) MIME-Version: 1.0 References: <20210929144451.113334-1-ulf.hansson@linaro.org> <20210929144451.113334-2-ulf.hansson@linaro.org> <4692163.31r3eYUQgx@kreacher> In-Reply-To: <4692163.31r3eYUQgx@kreacher> From: Ulf Hansson Date: Mon, 11 Oct 2021 12:04:44 +0200 Message-ID: Subject: Re: [PATCH 1/2] cpuidle: Avoid calls to cpuidle_resume|pause() for s2idle To: "Rafael J. Wysocki" 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-20211011_030522_922094_84BBBDD0 X-CRM114-Status: GOOD ( 26.22 ) 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 Sat, 9 Oct 2021 at 17:39, Rafael J. Wysocki wrote: > > On Wednesday, September 29, 2021 4:44:50 PM CEST Ulf Hansson wrote: > > In s2idle_enter(), cpuidle_resume|pause() are invoked to re-allow calls to > > the cpuidle callbacks during s2idle operations. This is needed because > > cpuidle is paused in-between in dpm_suspend_noirq() and dpm_resume_noirq(). > > Well, in fact, doing that last thing for s2idle is pointless, because cpuidle > is going to be resumed eventually anyway in that case and the breakage expected > to be prevented by the pausing will still occur. > > So I would rather do something like the patch below (untested). Hi Rafael, >From a standalone change point of view, what you suggest seems reasonable to me. However, the main issue I am really trying to fix in this series is being done in patch2/2. And unfortunately, the below change doesn't really fit with what I suggest in patch2/2. Can you please have a look at patch2 as well? If you think it may be better, I squash the two patches? Kind regards Uffe > > --- > drivers/base/power/main.c | 11 ++++++----- > kernel/power/suspend.c | 8 ++++++-- > 2 files changed, 12 insertions(+), 7 deletions(-) > > Index: linux-pm/drivers/base/power/main.c > =================================================================== > --- linux-pm.orig/drivers/base/power/main.c > +++ linux-pm/drivers/base/power/main.c > @@ -747,8 +747,6 @@ void dpm_resume_noirq(pm_message_t state > > resume_device_irqs(); > device_wakeup_disarm_wake_irqs(); > - > - cpuidle_resume(); > } > > /** > @@ -881,6 +879,7 @@ void dpm_resume_early(pm_message_t state > void dpm_resume_start(pm_message_t state) > { > dpm_resume_noirq(state); > + cpuidle_resume(); > dpm_resume_early(state); > } > EXPORT_SYMBOL_GPL(dpm_resume_start); > @@ -1336,8 +1335,6 @@ int dpm_suspend_noirq(pm_message_t state > { > int ret; > > - cpuidle_pause(); > - > device_wakeup_arm_wake_irqs(); > suspend_device_irqs(); > > @@ -1521,9 +1518,13 @@ int dpm_suspend_end(pm_message_t state) > if (error) > goto out; > > + cpuidle_pause(); > + > error = dpm_suspend_noirq(state); > - if (error) > + if (error) { > + cpuidle_resume(); > dpm_resume_early(resume_event(state)); > + } > > out: > dpm_show_time(starttime, state, error, "end"); > Index: linux-pm/kernel/power/suspend.c > =================================================================== > --- linux-pm.orig/kernel/power/suspend.c > +++ linux-pm/kernel/power/suspend.c > @@ -97,7 +97,6 @@ static void s2idle_enter(void) > raw_spin_unlock_irq(&s2idle_lock); > > cpus_read_lock(); > - cpuidle_resume(); > > /* Push all the CPUs into the idle loop. */ > wake_up_all_idle_cpus(); > @@ -105,7 +104,6 @@ static void s2idle_enter(void) > swait_event_exclusive(s2idle_wait_head, > s2idle_state == S2IDLE_STATE_WAKE); > > - cpuidle_pause(); > cpus_read_unlock(); > > raw_spin_lock_irq(&s2idle_lock); > @@ -405,6 +403,9 @@ static int suspend_enter(suspend_state_t > if (error) > goto Devices_early_resume; > > + if (state != PM_SUSPEND_TO_IDLE) > + cpuidle_pause(); > + > error = dpm_suspend_noirq(PMSG_SUSPEND); > if (error) { > pr_err("noirq suspend of devices failed\n"); > @@ -459,6 +460,9 @@ static int suspend_enter(suspend_state_t > dpm_resume_noirq(PMSG_RESUME); > > Platform_early_resume: > + if (state != PM_SUSPEND_TO_IDLE) > + cpuidle_resume(); > + > platform_resume_early(state); > > Devices_early_resume: > _______________________________________________ linux-arm-kernel mailing list linux-arm-kernel@lists.infradead.org http://lists.infradead.org/mailman/listinfo/linux-arm-kernel