Received: by 2002:a25:8b91:0:0:0:0:0 with SMTP id j17csp7676520ybl; Thu, 16 Jan 2020 03:50:08 -0800 (PST) X-Google-Smtp-Source: APXvYqwN6RMvllfsFs6YZ4SFGudLtxM25NmSK2oIsC3KhqBvV8/Owh2m/6n6KnmLuGuHmj+y3Kqa X-Received: by 2002:a05:6808:907:: with SMTP id w7mr3777417oih.91.1579175408288; Thu, 16 Jan 2020 03:50:08 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1579175408; cv=none; d=google.com; s=arc-20160816; b=J5WOEiNvHOFCVYaFUKPcsOXG6eCtEaKxeL3KSrCMusVKQvNL0E01i7mzj4JOhwzT5T pproWx6mzR4A+Ijf+A6Io21kaSuM8zmdHuMI2n/gcQ1EZlzZHS7ozzbM7EfgexCZzS0V lS5UfKtQtSFbqgfDPqLJqXbE8Ij/ssaQthF07jaeke9zRtq6qtnee0B+1g+bYx9gdLh7 Ho2x2l8KbpELl1heAcrqaPkIRUG6AHUX+AgA90ko3qQBFnbxc0dyFuQZyyunt0eGTnGD ZCzcY4xZz8wGx+VkFj+rcD63BGn4DuEvMk56mi69HQuaI7UldVjw5yi6R9xSXMAT5Fnu TXEQ== 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 :content-language:in-reply-to:mime-version:user-agent:date :message-id:subject:autocrypt:from:references:cc:to:dkim-signature; bh=iEyTx9TEcWJyn1ta/15HwPIyPGIk9ArjmSOrnrTyNEE=; b=RklShjdlF24Me5qLi7jse7PcI3+HX6jcS4gHVJIfG4moUUxCis1+ueXyo8uIlrQnLC U+xcja6gF/7BrvhIHdPo9MxaAQ+7tPnuycUzOLWtmKSaogIWa7Fuc51PmIj0LqttpjqM wXdGDH3o+sv2QDLRCs4squkeMAC1DInY1dM96BPqh8jW0mKSEkBhdgQhxr0oh61EKYqc cou7oZ434TvPQC1boOPQTSMUPfS468gjcL69yo0joo38KyovdrtMERn6IdW9XVHojs0s BvcTq6uoAwVcn0EyYNMMEX5+s/s6Al+70ySJY4hiFIAFQMoYbif4E3PcYPz7naNa6QVk Yd3A== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@freesources.org header.s=20160526 header.b=bw75+kS3; 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=fail (p=NONE sp=NONE dis=NONE) header.from=freesources.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id c79si11972230oig.208.2020.01.16.03.49.56; Thu, 16 Jan 2020 03:50:08 -0800 (PST) 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=fail header.i=@freesources.org header.s=20160526 header.b=bw75+kS3; 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=fail (p=NONE sp=NONE dis=NONE) header.from=freesources.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726187AbgAPLs7 (ORCPT + 99 others); Thu, 16 Jan 2020 06:48:59 -0500 Received: from mx3.freesources.org ([195.34.172.217]:51022 "EHLO mx3.freesources.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726018AbgAPLs7 (ORCPT ); Thu, 16 Jan 2020 06:48:59 -0500 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=freesources.org; s=20160526; h=Content-Transfer-Encoding:Content-Type: In-Reply-To:MIME-Version:Date:Message-ID:Subject:From:References:Cc:To:Sender :Reply-To:Content-ID:Content-Description:Resent-Date:Resent-From: Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Id:List-Help: List-Unsubscribe:List-Subscribe:List-Post:List-Owner:List-Archive; bh=iEyTx9TEcWJyn1ta/15HwPIyPGIk9ArjmSOrnrTyNEE=; b=bw75+kS3km0xYL749yMNb/f4e7 93QDCgEyXSbujTsKHEStw8oMVfTLv6moK2fRlAfkd78sgqYw5MQIS9Q4l5Y54PhVph4EAxqY3R3ac DHbRomYWHKhRtErApuydWan9vpOVnZwidjSYBCpFd8kaVl6DiOaM+6+eMpna7uOmTpmQ=; Received: from anon-42-243.vpn.ipredator.se ([46.246.42.243]) by mx3.freesources.org with esmtpsa (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.89) (envelope-from ) id 1is3dq-0004b4-Dl; Thu, 16 Jan 2020 11:48:50 +0000 To: "Rafael J. Wysocki" Cc: "Rafael J. Wysocki" , Linux Kernel Mailing List , Linux PM , Pavel Machek , Len Brown , Tim Dittler , Yannik Sembritzki References: From: Jonas Meurer Autocrypt: addr=jonas@freesources.org; prefer-encrypt=mutual; keydata= mQINBEqFXAEBEAC+7gfLht8lDqGH1EPYoctDHvWQ4nk60UFDLfjqHmBGReL/9C7CyxYaqgY4 V1/DXPCmsO5PvHMSi6VPn3B81alPKMT6syQhxDN6CXETh/mrxRbTPyQVSKYdD/BvA94vgwfy iInR0N7K6J/mRxqKug14vXlABvfmyWBnW89d15OWs9qy1Ge1mHaA8UgIoUInR2mMqNHQf0nF /TtClN2uPmtv/GeGHfSSCQEjYq9Ih2Z1Re2hnwW1peEc0x7piKUXCXHGyrQdz5IE69SqV1gg vafUrWHNPWz5ZtXsihYioNi3ISuoHUjkKdn+t55en5tvWvi+2JQnMCGa/Wr7iA2EOxallR+z rQRBDe/6wp1XEz6vN1LqCeaRyVOR6q00PtN/Ot0tzPswrHKE6binqG6FBRbu+zeo87cNbMmH IAdIT3ysZCAwA2g310fBByCSiNnfhHg2GyqfC4eDtL/K7uVNqQQEon0yv8lzyUloofKER8eA W4PtahGcLLbREnekAwQMpU8y1a++QXdk1ckLoyGuBVpBX8PiRirzYVmYsGRMK2u0yI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ATCH v2] PM: Add a switch for disabling/enabling sync() before suspend Message-ID: Date: Thu, 16 Jan 2020 12:48:45 +0100 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:68.0) Gecko/20100101 Thunderbird/68.3.0 MIME-Version: 1.0 In-Reply-To: Content-Type: text/plain; charset=utf-8 Content-Language: de-DE Content-Transfer-Encoding: 8bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Hey Rafael, thanks a lot for taking the time for this thorough review. It's much appreciated! I tried to address all your concerns and will resubmit the patch shortly. Rafael J. Wysocki: > On Fri, Dec 20, 2019 at 5:03 PM Jonas Meurer wrote: >> >> The switch allows to enable or disable the final sync() from the suspend.c >> Linux Kernel system suspend implementation. This is useful to avoid race >> conditions if block devices have been suspended before. Be aware that you >> have to take care of sync() yourself before suspending the system if you >> disable it here. >> >> Congruously, the behaviour of build-time switch CONFIG_SUSPEND_SKIP_SYNC >> is slightly changed: It now configures the default for fun-time switch >> '/sys/power/sync_on_suspend'. >> >> Signed-off-by: Jonas Meurer > > First, I would use a slightly different subject. What about "PM: > suspend: Add sysfs attribute to control the "sync on suspend" > behavior"? Sure, much more appropriate. Changed :) > Then, I would write in the changelog that whether or not filesystems > are synced before system suspend by the kernel depends on a Kconfig > option which is not flexible enough, because there are cases in which > user space may want to decide whether or not the sync in the kernel > should be carried out. > > Actually, in the example case given by you, it is not clear enough why > you cannot build the kernel with CONFIG_SUSPEND_SKIP_SYNC set, so it > would be good to explain that. Or give a different example. > > Then I would say that the existing CONFIG_SUSPEND_SKIP_SYNC will be > used to set the default value of the new sysfs attribute after the > patch. Tried to address that now. Don't hesitate to sugest further improvements if you feel it's still not properly explained. >> --- >> Documentation/ABI/testing/sysfs-power | 15 ++++++++++++ >> include/linux/suspend.h | 2 ++ >> kernel/power/Kconfig | 5 +++- >> kernel/power/main.c | 33 +++++++++++++++++++++++++++ >> kernel/power/suspend.c | 2 +- >> 5 files changed, 55 insertions(+), 2 deletions(-) >> >> diff --git a/Documentation/ABI/testing/sysfs-power b/Documentation/ABI/testing/sysfs-power >> index 6f87b9dd384b..783b3ce8eb06 100644 >> --- a/Documentation/ABI/testing/sysfs-power >> +++ b/Documentation/ABI/testing/sysfs-power >> @@ -407,3 +407,18 @@ Contact: Kalesh Singh >> Description: >> The /sys/power/suspend_stats/last_failed_step file contains >> the last failed step in the suspend/resume path. >> + >> +What: /sys/power/sync_on_suspend >> +Date: October 2019 >> +Contact: Jonas Meurer >> +Description: >> + This file controls the switch to enable or disable the final >> + sync() before system suspend. This is useful to avoid race >> + conditions if block devices have been suspended before. Be >> + aware that you have to take care of sync() yourself before >> + suspending the system if you disable it here. > > I'm not entirely happy with the paragraph above. > > It basically doesn't have to explain what the feature is useful for, > but if you waht to give an example, I would write something like this: > > "This file controls whether or not the kernel will sync() filesystems > during system suspend (after freezing user space and before suspending > devices). For example, user space may want to prevent the kernel from > syncing filesystems at that time in cases when system suspend works > reliably and is carried out relatively often, so doing a system-wide > filesystem sync every time it happens is not really useful." On a second thought I agree that the example/reasoning doesn't belong here. I removed it altogether. >> + >> + Writing a "1" to this file enables the sync() and writing a >> + "0" disables it. Reads from the file return the current value. >> + The default is "1" but can be configured with the build-time >> + config flag "SUSPEND_SKIP_SYNC". >> diff --git a/include/linux/suspend.h b/include/linux/suspend.h >> index 6fc8843f1c9e..4a230c2f1c31 100644 >> --- a/include/linux/suspend.h >> +++ b/include/linux/suspend.h >> @@ -329,6 +329,7 @@ extern void arch_suspend_disable_irqs(void); >> extern void arch_suspend_enable_irqs(void); >> >> extern int pm_suspend(suspend_state_t state); >> +extern bool sync_on_suspend_enabled; >> #else /* !CONFIG_SUSPEND */ >> #define suspend_valid_only_mem NULL >> >> @@ -342,6 +343,7 @@ static inline bool pm_suspend_default_s2idle(void) { return false; } >> >> static inline void suspend_set_ops(const struct platform_suspend_ops *ops) {} >> static inline int pm_suspend(suspend_state_t state) { return -ENOSYS; } >> +static inline bool sync_on_suspend_enabled(void) { return true; } >> static inline bool idle_should_enter_s2idle(void) { return false; } >> static inline void __init pm_states_init(void) {} >> static inline void s2idle_set_ops(const struct platform_s2idle_ops *ops) {} >> diff --git a/kernel/power/Kconfig b/kernel/power/Kconfig >> index d3667b4075c1..7cbfbeacd68a 100644 >> --- a/kernel/power/Kconfig >> +++ b/kernel/power/Kconfig >> @@ -27,7 +27,10 @@ config SUSPEND_SKIP_SYNC >> Skip the kernel sys_sync() before freezing user processes. >> Some systems prefer not to pay this cost on every invocation >> of suspend, or they are content with invoking sync() from >> - user-space before invoking suspend. Say Y if that's your case. >> + user-space before invoking suspend. There's a run-time switch >> + at '/sys/power/sync_on_suspend' to configure this behaviour. >> + This setting changes the default for the run-tim switch. Say Y >> + to change the default to disable the kernel sys_sync(). >> >> config HIBERNATE_CALLBACKS >> bool >> diff --git a/kernel/power/main.c b/kernel/power/main.c >> index e26de7af520b..69b7a8aeca3b 100644 >> --- a/kernel/power/main.c >> +++ b/kernel/power/main.c >> @@ -190,6 +190,38 @@ static ssize_t mem_sleep_store(struct kobject *kobj, struct kobj_attribute *attr >> } >> >> power_attr(mem_sleep); >> + >> +/* >> + * sync_on_suspend: invoke ksys_sync_helper() before suspend. >> + * >> + * show() returns whether ksys_sync_helper() is invoked before suspend. >> + * store() accepts 0 or 1. 0 disables ksys_sync_helper() and 1 enables it. >> + */ >> +bool sync_on_suspend_enabled = !IS_ENABLED(CONFIG_SUSPEND_SKIP_SYNC); >> + >> +static ssize_t sync_on_suspend_show(struct kobject *kobj, >> + struct kobj_attribute *attr, char *buf) >> +{ >> + return sprintf(buf, "%d\n", sync_on_suspend_enabled); >> +} >> + >> +static ssize_t sync_on_suspend_store(struct kobject *kobj, >> + struct kobj_attribute *attr, >> + const char *buf, size_t n) >> +{ >> + unsigned long val; >> + >> + if (kstrtoul(buf, 10, &val)) >> + return -EINVAL; >> + >> + if (val > 1) >> + return -EINVAL; >> + >> + sync_on_suspend_enabled = !!val; >> + return n; >> +} >> + >> +power_attr(sync_on_suspend); >> #endif /* CONFIG_SUSPEND */ >> >> #ifdef CONFIG_PM_SLEEP_DEBUG >> @@ -855,6 +887,7 @@ static struct attribute * g[] = { >> &wakeup_count_attr.attr, >> #ifdef CONFIG_SUSPEND >> &mem_sleep_attr.attr, >> + &sync_on_suspend_attr.attr, >> #endif >> #ifdef CONFIG_PM_AUTOSLEEP >> &autosleep_attr.attr, >> diff --git a/kernel/power/suspend.c b/kernel/power/suspend.c >> index f3b7239f1892..2c47280fbfc7 100644 >> --- a/kernel/power/suspend.c >> +++ b/kernel/power/suspend.c >> @@ -564,7 +564,7 @@ static int enter_state(suspend_state_t state) >> if (state == PM_SUSPEND_TO_IDLE) >> s2idle_begin(); >> >> - if (!IS_ENABLED(CONFIG_SUSPEND_SKIP_SYNC)) { >> + if (sync_on_suspend_enabled) { >> trace_suspend_resume(TPS("sync_filesystems"), 0, true); >> ksys_sync_helper(); >> trace_suspend_resume(TPS("sync_filesystems"), 0, false); >> -- > > The patch itself looks fine to me. Yay, that's great to hear :) Cheers, jonas