Received: by 10.223.164.202 with SMTP id h10csp93316wrb; Mon, 6 Nov 2017 03:14:22 -0800 (PST) X-Google-Smtp-Source: ABhQp+SuAJWRsrqXEakAN4EPUZ36r7ARqfmOgYIT9uLtVdmXlH3fUrPExSxcpseOzy4j93uC3m2l X-Received: by 10.98.158.6 with SMTP id s6mr16542532pfd.191.1509966862434; Mon, 06 Nov 2017 03:14:22 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1509966862; cv=none; d=google.com; s=arc-20160816; b=WwLZ0rsdAyFRm0Y6iIZ9WkZqM++Zivj/bn1PKbEi5ZfWhoCf/eHyGvwVSw3vWK1Khb VPVQYqhOuIuBaqS/XWu9gyUjzAVO0RZt9GHFX5At+CEo/s0oA8nwlwdpKDsGKCpHqN6j C1oQAv/VQ8Ot3LjKGhaSsKobIaxN7IpG7KHv3YJf5TJ25ZibIDmXwI142PoIcvLXPc0z 80JXxIF9I8SM0ZXmPZQ3XR5UmrxWkPWOP9LLuC7dB1lyINjHd9z9PnKiajvfEb4USu4t al12firAFUEeU1zvYlIHdta/sHzpozwsjWGAJoIDJhetniEXFx232IaSSDE7YQ+AtmWY f+2Q== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:user-agent:in-reply-to :content-disposition:mime-version:references:message-id:subject:cc :to:from:date:arc-authentication-results; bh=iLXcg3OAM7kW+TmUnn7Dr/Fdi5obBJvNJSX3TlV3Zss=; b=GxzZ3uW5REChxrwSti18o0ZF79thFL7UZXHFVVOFX5R8djtS5xRjyfHK616o3sYmQE Gc+20SNXVottoyWcKBmKYMtPWYW+x72HpTbHImGl2+e+3N37MVLXGWaUDHt7r2ZKeYGD DxSx/b6+sRaOa8XsrK3MQHi/XeXBhot1shTDiWVOH3IA1rPwjZLyTyrYgmINPP7Z1oa2 RrYCSocQ59TG1+4L6TYsnXMQQFC0+CTwZB6qOA+QdRRBZQDQR8ibuevZcE8W6RhPglcu PhtdrK0YIqXc8IhpHayEQcEip0i024/4s3sc9wFVXbz9K9l5OB+Igs1ZYHdAZDZG/YaQ f8rA== ARC-Authentication-Results: i=1; mx.google.com; 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 Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id q80si12069613pfk.189.2017.11.06.03.14.08; Mon, 06 Nov 2017 03:14:22 -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; 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 Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752193AbdKFLNc (ORCPT + 99 others); Mon, 6 Nov 2017 06:13:32 -0500 Received: from atrey.karlin.mff.cuni.cz ([195.113.26.193]:43581 "EHLO atrey.karlin.mff.cuni.cz" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752129AbdKFLN2 (ORCPT ); Mon, 6 Nov 2017 06:13:28 -0500 Received: by atrey.karlin.mff.cuni.cz (Postfix, from userid 512) id 44CB481A7A; Mon, 6 Nov 2017 12:13:27 +0100 (CET) Date: Mon, 6 Nov 2017 12:13:26 +0100 From: Pavel Machek To: Rajat Jain Cc: "Rafael J. Wysocki" , Len Brown , linux-pm@vger.kernel.org, linux-kernel@vger.kernel.org, dtor@google.com, rajatxjain@gmail.com Subject: Re: [PATCH] PM / s2idle: Clear the events_check_enabled flag Message-ID: <20171106111326.GD24863@amd> References: <20171031214424.84783-1-rajatja@google.com> MIME-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha1; protocol="application/pgp-signature"; boundary="J5MfuwkIyy7RmF4Q" Content-Disposition: inline In-Reply-To: <20171031214424.84783-1-rajatja@google.com> User-Agent: Mutt/1.5.23 (2014-03-12) Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org --J5MfuwkIyy7RmF4Q Content-Type: text/plain; charset=us-ascii Content-Disposition: inline Content-Transfer-Encoding: quoted-printable On Tue 2017-10-31 14:44:24, Rajat Jain wrote: > Problem: This flag does not get cleared currently in the suspend or > resume path in the following cases: >=20 > * In case some driver's suspend routine returns an error. > * Successful s2idle case > * etc? >=20 > Why is this a problem: What happens is that the next suspend attempt > could fail even though the user did not enable the flag by writing to > /sys/power/wakeup_count. This is 1 use case how the issue can be seen > (but similar use case with driver suspend failure can be thought of): >=20 > 1. Read /sys/power/wakeup_count > 2. echo count > /sys/power/wakeup_count > 3. echo freeze > /sys/power/wakeup_count > 4. Let the system suspend, and wakeup the system using some wake source > that calls pm_wakeup_event() e.g. power button or something. > 5. Note that the combined wakeup count would be incremented due > to the pm_wakeup_event() in the resume path. > 6. After resuming the events_check_enabled flag is still set. >=20 > At this point if the user attempts to freeze again (without writing to > /sys/power/wakeup_count), the suspend would fail even though there has > been no wake event since the past resume. >=20 > What this patch does: >=20 > It moves the clearing of the flag to just before a resume is completed, > so that it is always cleared for the corner cases mentioned above. >=20 > Signed-off-by: Rajat Jain Acked-by: Pavel Machek --=20 (english) http://www.livejournal.com/~pavelmachek (cesky, pictures) http://atrey.karlin.mff.cuni.cz/~pavel/picture/horses/blo= g.html --J5MfuwkIyy7RmF4Q Content-Type: application/pgp-signature; name="signature.asc" Content-Description: Digital signature -----BEGIN PGP SIGNATURE----- Version: GnuPG v1 iEYEARECAAYFAloAQ9YACgkQMOfwapXb+vKG+QCfQNkSWQfcicJGu1mwnsk/8ygE RFQAoK7nG4BvFZEa1Spfky+VNbvrJeQH =+ode -----END PGP SIGNATURE----- --J5MfuwkIyy7RmF4Q-- From 1582811184076421063@xxx Tue Oct 31 21:46:13 +0000 2017 X-GM-THRID: 1582811184076421063 X-Gmail-Labels: Inbox,Category Forums