Received: by 2002:a05:6a10:5bc5:0:0:0:0 with SMTP id os5csp1690228pxb; Fri, 22 Oct 2021 06:01:04 -0700 (PDT) X-Google-Smtp-Source: ABdhPJyJHBAQCTRXteKP9l/fSHG3920PlsMZIps75aiuqIVZhTqkN+C5768HqwIl3z4Vc455p4lo X-Received: by 2002:a05:6402:141:: with SMTP id s1mr17006144edu.317.1634907664372; Fri, 22 Oct 2021 06:01:04 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1634907664; cv=none; d=google.com; s=arc-20160816; b=aDZBeq2Xovk0heWhvB0iYB0sLYXAUDN7PAssSZntqaVQQ/XyIDTZPSioeLakzmhM2i fZzpCfiwg2i1nX6Vc1293vjmASg7z6Jcx2+fCreZYawIV0GzIwjQ/98BLFTh/VTsYIkw Z3ELCVjSZiLQjKBOf2aYdDsLh3xXKX2m3F25S8yhClVwl02UqkGZ6dY0AMDPzswxq9Hb zU0IzuiP9V/3hojYPE+gsRHUECMLFp55FajrWuf77pO1nLhtTXVSmdOS+eqkUL3a5Y7U 5pols8G9SXxn9yiH52YLw3blxk+CfGf7Pi0v1s4VuWO4L7y+Ht5fRr28Xw2SZfePoQMb PbnQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :message-id:date:subject:cc:to:from; bh=KbW/YjkifzG1/JrjBOf9EQK1F1bNubuhTkWKGzDbxbE=; b=VV2y2tMBqpJ/rqeur5gBypNA/T9AAxXSMOTbePslG/eRMuTbRTM81Dcg1FIcvbDUZX 6CDS5ZU/qFinOPdEQaZWluEElUVeJK+pzPGT2J84BvyGFJn5LI7+kj1r0UUXbyo6KnLR kI/Fzh5hF5A9ahlghVXmr2A5hDR8MBRDvFiRiDQnnH26E8MdHD+M2ueNVmG1wvTLewwp 7XeQS9qWMiqKxblL4Ti+lCfY+abAMv9457LxjqeC1xUUvUW6L4LyZ211RO8Ng3HRgN7G +hd2+P5QyBXajeXOpALvvaqw2nTYnOVwOXQJVEKVWoYe5YuCTn/LE8haBq5X/cnAzWfn NTUQ== 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 m15si17940437edc.103.2021.10.22.06.00.40; Fri, 22 Oct 2021 06:01:04 -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 S232733AbhJVNAo (ORCPT + 99 others); Fri, 22 Oct 2021 09:00:44 -0400 Received: from cloudserver094114.home.pl ([79.96.170.134]:41596 "EHLO cloudserver094114.home.pl" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232381AbhJVNAn (ORCPT ); Fri, 22 Oct 2021 09:00:43 -0400 Received: from localhost (127.0.0.1) (HELO v370.home.net.pl) by /usr/run/smtp (/usr/run/postfix/private/idea_relay_lmtp) via UNIX with SMTP (IdeaSmtpServer 3.0.0) id 0a6d88729bbdbd76; Fri, 22 Oct 2021 14:58:25 +0200 Received: from kreacher.localnet (unknown [213.134.175.233]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by v370.home.net.pl (Postfix) with ESMTPSA id 8D19966A92E; Fri, 22 Oct 2021 14:58:24 +0200 (CEST) From: "Rafael J. Wysocki" To: Linux PM Cc: LKML , Ulf Hansson , Alan Stern , Maulik Shah Subject: [PATCH] PM: sleep: Do not let "syscore" devices runtime-suspend during system transitions Date: Fri, 22 Oct 2021 14:58:23 +0200 Message-ID: <5773062.lOV4Wx5bFT@kreacher> MIME-Version: 1.0 Content-Transfer-Encoding: 7Bit Content-Type: text/plain; charset="UTF-8" X-CLIENT-IP: 213.134.175.233 X-CLIENT-HOSTNAME: 213.134.175.233 X-VADE-SPAMSTATE: clean X-VADE-SPAMCAUSE: gggruggvucftvghtrhhoucdtuddrgedvtddrvddvkedgheejucetufdoteggodetrfdotffvucfrrhhofhhilhgvmecujffqoffgrffnpdggtffipffknecuuegrihhlohhuthemucduhedtnecusecvtfgvtghiphhivghnthhsucdlqddutddtmdenucfjughrpefhvffufffkggfgtgesthfuredttddtjeenucfhrhhomhepfdftrghfrggvlhculfdrucghhihsohgtkhhifdcuoehrjhifsehrjhifhihsohgtkhhirdhnvghtqeenucggtffrrghtthgvrhhnpefhgedtffejheekgeeljeevvedtuefgffeiieejuddutdekgfejvdehueejjeetvdenucfkphepvddufedrudefgedrudejhedrvdeffeenucevlhhushhtvghrufhiiigvpedtnecurfgrrhgrmhepihhnvghtpedvudefrddufeegrddujeehrddvfeefpdhhvghlohepkhhrvggrtghhvghrrdhlohgtrghlnhgvthdpmhgrihhlfhhrohhmpedftfgrfhgrvghlucflrdcuhgihshhotghkihdfuceorhhjfiesrhhjfiihshhotghkihdrnhgvtheqpdhrtghpthhtoheplhhinhhugidqphhmsehvghgvrhdrkhgvrhhnvghlrdhorhhgpdhrtghpthhtoheplhhinhhugidqkhgvrhhnvghlsehvghgvrhdrkhgvrhhnvghlrdhorhhgpdhrtghpthhtohepuhhlfhdrhhgrnhhsshhonheslhhinhgrrhhordhorhhgpdhrtghpthhtohepshhtvghrnhesrhhofihlrghnugdrhhgrrhhvrghrugdrvgguuhdprhgtphhtthhopehmkhhshhgrhhestghouggv rghurhhorhgrrdhorhhg X-DCC--Metrics: v370.home.net.pl 1024; Body=5 Fuz1=5 Fuz2=5 Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Rafael J. Wysocki There is no reason to allow "syscore" devices to runtime-suspend during system-wide PM transitions, because they are subject to the same possible failure modes as any other devices in that respect. Accordingly, change device_prepare() and device_complete() to call pm_runtime_get_noresume() and pm_runtime_put(), respectively, for "syscore" devices too. Fixes: 057d51a1268f ("Merge branch 'pm-sleep'") Signed-off-by: Rafael J. Wysocki Cc: 3.10+ # 3.10+ --- drivers/base/power/main.c | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) Index: linux-pm/drivers/base/power/main.c =================================================================== --- linux-pm.orig/drivers/base/power/main.c +++ linux-pm/drivers/base/power/main.c @@ -1048,7 +1048,7 @@ static void device_complete(struct devic const char *info = NULL; if (dev->power.syscore) - return; + goto out; device_lock(dev); @@ -1078,6 +1078,7 @@ static void device_complete(struct devic device_unlock(dev); +out: pm_runtime_put(dev); } @@ -1789,9 +1790,6 @@ static int device_prepare(struct device int (*callback)(struct device *) = NULL; int ret = 0; - if (dev->power.syscore) - return 0; - /* * If a device's parent goes into runtime suspend at the wrong time, * it won't be possible to resume the device. To prevent this we @@ -1800,6 +1798,9 @@ static int device_prepare(struct device */ pm_runtime_get_noresume(dev); + if (dev->power.syscore) + return 0; + device_lock(dev); dev->power.wakeup_path = false;