Received: by 2002:a05:6a10:22f:0:0:0:0 with SMTP id 15csp1410882pxk; Thu, 10 Sep 2020 14:50:08 -0700 (PDT) X-Google-Smtp-Source: ABdhPJxjfqWtIYzLyQcjteAhOVFcQnamwCC+2zptj1rId+J5prCkxGU/8H/YxnEsodjUMlBIbCUr X-Received: by 2002:a50:d65e:: with SMTP id c30mr11793114edj.57.1599774608607; Thu, 10 Sep 2020 14:50:08 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1599774608; cv=none; d=google.com; s=arc-20160816; b=pvrVf6+d39hZHtSiFDLUvTrz0kvndyIy61vwasLyYgkZboVoNN9sX+T2vwCZP7Too+ ayHgnmI3YC+K8GWFwggOPcB3Y78MnqD0zPDNqMOPu07TB7eDibfF58jOZ27//fA/R59l 49JpTpFibu2wy0lm9AKyqDb9BN734J9+8SwauMSjXP7seTeicGu+fTg8h9OgWHWFy+xb 4ieruc9ti8RxjMoxpOvIcc0ymXSbBMXGynXwqo29t541FGYv5Hm1vZ9/Gi607iyI3pds +ftGskZE4ey9VRC7nTIokMKU8earjHlEJBwaaZ8IrCGy7N+D1NS4yNpm1e2NIMT3xR6E C6eQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from; bh=M9k7adfJeD08Dl3xq27vTSmJeJj2Fgaqb40Ze4QxpuE=; b=poMychirI7aDgtO3Fwnji9e1STuSV6Cv1TKawl5bIZlytLK8yVBm8P4pSUdaswqcDu LbE0AatvzUWznP6eeNdaC61qCVfWqMV+5GgThZTQKZK3YN58XUBuOdkzif4a2u06pBfU n6JReh6pLCWS0n8yqJ9kfaGmNuk9Aoz9V4XdfpnaaN4Z69rcEJSEaRgFvwpe1c6cAVOD 4/haC8qI58tXtjI8NnJQZcQiobnNjSJhMbtfZJruZWFwqSaVIjQfc7vo7Js/lsGo6c8Y DTaVVWt8uqGDsGQdlTmX45WzpPaYxhem4a1+8/Pceic0tmwLCnyUFapIGnGehnXVUtJ3 JRiw== ARC-Authentication-Results: i=1; mx.google.com; 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 Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id g21si4402464ejs.503.2020.09.10.14.49.44; Thu, 10 Sep 2020 14:50:08 -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; 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 Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1728371AbgIJVnt (ORCPT + 99 others); Thu, 10 Sep 2020 17:43:49 -0400 Received: from cloudserver094114.home.pl ([79.96.170.134]:56066 "EHLO cloudserver094114.home.pl" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1730722AbgIJM41 (ORCPT ); Thu, 10 Sep 2020 08:56:27 -0400 Received: from 89-64-87-170.dynamic.chello.pl (89.64.87.170) (HELO kreacher.localnet) by serwer1319399.home.pl (79.96.170.134) with SMTP (IdeaSmtpServer 0.83.468) id 0b9e2c09bd0fb81d; Thu, 10 Sep 2020 14:55:07 +0200 From: "Rafael J. Wysocki" To: "Claude. Yen" Cc: "Rafael J. Wysocki" , Daniel Lezcano , Frederic Weisbecker , Thomas Gleixner , Ingo Molnar , Matthias Brugger , Bjorn Andersson , Greg Kroah-Hartman , Stephen Boyd , Douglas Anderson , Linux PM , Linux Kernel Mailing List , Linux ARM , "moderated list:ARM/Mediatek SoC..." , wsd_upstream Subject: Re: [PATCH] PM: s2idle: Introduce syscore callbacks in s2idle flow Date: Thu, 10 Sep 2020 14:55:06 +0200 Message-ID: <1955367.r5QahNuf3v@kreacher> In-Reply-To: <1599099247.4435.4.camel@mtksdccf07> References: <1598943859-21857-1-git-send-email-claude.yen@mediatek.com> <1599099247.4435.4.camel@mtksdccf07> MIME-Version: 1.0 Content-Transfer-Encoding: 7Bit Content-Type: text/plain; charset="us-ascii" Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Thursday, September 3, 2020 4:14:07 AM CEST Claude. Yen wrote: > On Tue, 2020-09-01 at 13:57 +0200, Rafael J. Wysocki wrote: > > On Tue, Sep 1, 2020 at 9:05 AM Claude Yen wrote: > > > > > > This series based on 5.9-rc1 > > > This patch makes s2idle call existing syscore callbacks. Currently, > > > when s2idle is selected as system suspend method, callbacks hooked > > > by register_syscore_ops() will not be triggered. This may induce > > > unexpected results. > > > > They are not executed by design. > > > > > For example, sched_clock_suspend() was added to s2idle flow in > > > commit 3f2552f7e9c5 ("timers/sched_clock: Prevent generic sched_clock > > > wrap caused by tick_freeze()") to fix clock wrap problem. However, > > > sched_clock_suspend() is originally registered in syscore callback. > > > > I'm not sure why this matters here. > > If functions in syscore callbacks are needed in s2idle, explicit > migration is needed like commit 3f2552f7e9c5 ("timers/sched_clock: > Prevent generic sched_clock wrap caused by tick_freeze()"). > Thus, I am wondering if such effort could be saved. Yes, it could. You can define platform ops for s2idle and invoke what's needed from there. > > > With this patch, if another syscore callback is needed in s2idle, > > > additional migration effort could be saved. > > > > s2idle cannot execute syscore callbacks, because it doesn' take > > non-boot CPUs offline and it won't do that. > > > > Thanks! > > Yes, the current design of syscore callback needs non-boot CPUs offline. > Considering the following case: in s2idle flow, there is a status that > only one CPU is alive and other CPUs have enter deepest idle state. > This situation is similar to getting non-boot CPUs offline, though all > CPUs are online from kernel's perspective. It is only similar AFAICS. You don't migrate interrupts during s2idle, for example. > Reply from Stephen mentioned that if an operation is needed in both > S2R and s2idle, CPU_PM notifier can be utilized. > In my opinion, CPU_PM notifier is particularly for CPU entering idle > state. In contrast, syscore callback is for system going low power > state. There exists semantic difference between these two callbacks. Fair enough. > Could the current design of syscore callback be re-designed as > system-wide suspend callback? No, it couldn't. > Proposed suspend flow in this patch: > > Freeze tasks > | > V > Device suspend callbacks > | > |-------------s2idle---------- > | | > V | > Disable nonboot CPUs Is this CPU last core to enter idle? > | | > V |------------- > syscore callbacks | | > | No Yes > V | | > platform suspend V V > enter idle syscore callback > | > V > enter idle > The primary problem with this is that on some architectures (x86 at least) the syscore things cannot be run during the s2idle flow. Also there is a way to invoke them through the platform ops as I said. Thanks!