Received: by 2002:a25:f815:0:0:0:0:0 with SMTP id u21csp2345862ybd; Thu, 27 Jun 2019 10:50:13 -0700 (PDT) X-Google-Smtp-Source: APXvYqzVFrZqU6nDW8w2fkfFe9/fAzXFbjEprnT7B0qRiEG87TM7W9qlJvLWwmB5+9A7jdBwrefP X-Received: by 2002:a17:902:9a82:: with SMTP id w2mr5961882plp.291.1561657813157; Thu, 27 Jun 2019 10:50:13 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1561657813; cv=none; d=google.com; s=arc-20160816; b=udXZ2GeEZsgkMW2NAxmAbxf3v0QoWVDUy3AW/h6oruGueLSkYowtrqNcrWPVA+/jhw OR5HPtwN+NTRr8Sg2dlY2dnBd2lvi+trmMqDHyB2hEzurdK0tsuUrW/OJyu56sdC0rA9 eAd+Py5cYW2b2ZxkrrwOH41+3+Rku2yZcnzFgNPFrGfbvYh8Q4+Y5eTUhOt++Wzg1GlI xUWLP1KfRUQX3bvySM5UfG72yo9zvPl+HWsoWGIu6ZwIus0SozWZNOv1VWxDMUPreNVP TDUqlTyepMitajzuMv8zQx0DftW0rUV//aRw2Vfm2QJ1vAviRK8mf7S85tqqlCYipMEx 1bxw== 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=0PWpxWInmBihdXeBaDjkUi8GUy5yyA1d4v1NbpnssFo=; b=w7I23cqthqiuf7Cn0RMsa2OFiNB1dGPFxZMSC6D1I0FPirkwiWJe/kF9ep8UROJ1wo sAktpVhRw/MqRIY4qv9ykPAf7MgxAvpgeNJ+aknjbmRLsi1YSKBdNVFz/i9k1rGaPNgK P8F7RkgYS0TCIr0py9REuTxUU6dFH2NDtAYsZ6d6YQdmKE6gUSZbKbeQ4BADIrirk8BP XuUyYlH+xG8asRJPApv46ZF/lKykFI+2SdTtngF/MsIKJbolusLDTb8+y0jl5C2F+07h tWjdZmcCSFLHx2bF18W8keSQI0uOrOB+zEogLv2yTVg4V4TOMew+Zdf5zTEmWtXijFBO rT9w== 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 w7si2596090pgs.168.2019.06.27.10.49.56; Thu, 27 Jun 2019 10:50:13 -0700 (PDT) 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 S1726730AbfF0Rtv (ORCPT + 99 others); Thu, 27 Jun 2019 13:49:51 -0400 Received: from cloudserver094114.home.pl ([79.96.170.134]:41283 "EHLO cloudserver094114.home.pl" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726540AbfF0Rtv (ORCPT ); Thu, 27 Jun 2019 13:49:51 -0400 Received: from 79.184.254.216.ipv4.supernova.orange.pl (79.184.254.216) (HELO kreacher.localnet) by serwer1319399.home.pl (79.96.170.134) with SMTP (IdeaSmtpServer 0.83.267) id 6e6e2abbf5608c5b; Thu, 27 Jun 2019 19:49:48 +0200 From: "Rafael J. Wysocki" To: Ravi Chandra Sadineni Cc: len.brown@intel.com, pavel@ucw.cz, gregkh@linuxfoundation.org, linux-pm@vger.kernel.org, linux-kernel@vger.kernel.org, tbroch@google.com, rajatja@google.com Subject: Re: [PATCH] power: Do not clear events_check_enabled in pm_wakeup_pending() Date: Thu, 27 Jun 2019 19:49:48 +0200 Message-ID: <6609527.OrdeQrBG9Y@kreacher> In-Reply-To: <20190619175142.237794-1-ravisadineni@chromium.org> References: <20190619175142.237794-1-ravisadineni@chromium.org> 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 Wednesday, June 19, 2019 7:51:42 PM CEST Ravi Chandra Sadineni wrote: > events_check_enabled bool is set when wakeup_count sysfs attribute > is written. User level daemon is expected to write this attribute > just before suspend. > > When this boolean is set, calls to pm_wakeup_event() will result in > increment of per device and global wakeup count that helps in > identifying the wake source. global wakeup count is also used by > pm_wakeup_pending() to identify if there are any pending events that > should result in an suspend abort. > > Currently calls to pm_wakeup_pending() also clears events_check_enabled. > This can be a problem when there are multiple wake events or when the > suspend is aborted due to an interrupt on a shared interrupt line. > For example an Mfd device can create several platform devices which > might fetch the state on resume in the driver resume method and increment > the wakeup count if needed. But if events_check_enabled is cleared before > resume methods get to execute, wakeup count will not be incremented. Thus > let us not reset the bool here. > > Note that events_check_enabled is also cleared in suspend.c/enter_state() > on every resume at the end. > > Signed-off-by: Ravi Chandra Sadineni > --- > drivers/base/power/wakeup.c | 1 - > 1 file changed, 1 deletion(-) > > diff --git a/drivers/base/power/wakeup.c b/drivers/base/power/wakeup.c > index 5b2b6a05a4f3..88aade871589 100644 > --- a/drivers/base/power/wakeup.c > +++ b/drivers/base/power/wakeup.c > @@ -838,7 +838,6 @@ bool pm_wakeup_pending(void) > > split_counters(&cnt, &inpr); > ret = (cnt != saved_count || inpr > 0); > - events_check_enabled = !ret; This effectively changes the meaning of the wakeup_count metric. so it cannot be applied. > } > raw_spin_unlock_irqrestore(&events_lock, flags); > >