Received: by 2002:a5b:505:0:0:0:0:0 with SMTP id o5csp1364734ybp; Wed, 9 Oct 2019 12:58:04 -0700 (PDT) X-Google-Smtp-Source: APXvYqzXZvBKCApFhulE9OXBIrLs7F5dw9RNraZo1P+NlMpbOBW75+NIqZyTYP48Tr2MT/h9vTFf X-Received: by 2002:a17:906:1d02:: with SMTP id n2mr4498299ejh.303.1570651084275; Wed, 09 Oct 2019 12:58:04 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1570651084; cv=none; d=google.com; s=arc-20160816; b=qxaPBIVy4eUdtqZmVcs4Ln9Xrpg113PrNMwjybw5GRKES3RASwKfsrD4b2GG25XeNc IHW9WRGDmIZKT+5ql5lbEm8EBZaO/5Q6Mt9S3LNHSmhV0bJQ/iDwaYYlc7q/AUK6ifGl rey3ejRNXwVjJmEUwD/LBr9gf34yRkLPjJYyJY5O6BpDBUqPMpjbDQttXN9ZOcaeuPdW i3EZWe6TBbE57eIeT63YRvs3TrA1BnN/RR26fNoqjnzF35kYUWMQzH3Lr4l4m09zBV6F M/cwrm2TrMYTMzj1X15Y5i7ldpQ8j/r1MPslUgQhtiq89E10KnqH0y4lMuIRfjyW8YA+ s2eQ== 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; bh=kArv5bfG+8fnWcFO2sgMIET+QANk5OKhiLIuJKCEyWs=; b=kvy/BZD3P7Ykrv/e7adnPQAV5iZpSY4zbcvMI0Xvmam6NhcBycPbVXvvOpH9kvqdKw FpgaSUxS5ymkiRjUUBQ+3Nys3BQcUBhdRROIjSc4qkz0QwpFd0mpHzLJ6tcQqbBItNzC n72X1ddHn9PMxq2KN9jqVC5jBEUrKvuhB1ICsvCWGNyabzPBxyVio5tn/OXQtMm283FZ aqGqrusy0qEAELK2/MX/BgN8ckKL2ODuoDdMX7JpYQEcLs+ua1Wfp++UypSb8RnEqq7W F3bk/u41jQR1Nbwfsd6rrO3cecbcn2dqW4bDyFcNtKbf0WhwpU0nTvJs46KbMN/cAxYn xaoQ== 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 j18si1714460ejv.201.2019.10.09.12.57.40; Wed, 09 Oct 2019 12:58:04 -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 S1731287AbfJITzK (ORCPT + 99 others); Wed, 9 Oct 2019 15:55:10 -0400 Received: from muru.com ([72.249.23.125]:36342 "EHLO muru.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1730490AbfJITzK (ORCPT ); Wed, 9 Oct 2019 15:55:10 -0400 Received: from atomide.com (localhost [127.0.0.1]) by muru.com (Postfix) with ESMTPS id 1D6228140; Wed, 9 Oct 2019 19:55:43 +0000 (UTC) Date: Wed, 9 Oct 2019 12:55:06 -0700 From: Tony Lindgren To: Alan Stern Cc: "Rafael J . Wysocki" , Dmitry Torokhov , Grygorii Strashko , Ulf Hansson , linux-pm@vger.kernel.org, linux-kernel@vger.kernel.org Subject: Re: [PATCH] PM / runtime: Add support for wake-up reason for wakeirqs Message-ID: <20191009195506.GO5610@atomide.com> References: <20191009182803.63742-1-tony@atomide.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: User-Agent: Mutt/1.12.1 (2019-06-15) Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org * Alan Stern [191009 18:51]: > On Wed, 9 Oct 2019, Tony Lindgren wrote: > > > With generic wakeirqs we can wake a device, but do not know if the > > device woke to a wakeirq. Let's add pm_runtime_wakeup_is_wakeirq() so > > a device can check the wake-up reason. > > People have tried many times over the years to do something like this. > It's never right. > > The problem is simple: It's impossible to know for certain why the > system woke up from suspend. In fact, there may be many wakeup sources > all active at the same time, and any of them could be the one > responsible for actually waking the system. Hmm yeah good point. Even with dedicated wakeirq it could race against a timer for the wake-up event. > All you can do is check to see whether a particular wakeup source is > active at the present moment. You can't tell whether it was active in > the past (while the system was suspended) or whether it caused the > system to resume. We can actually do more than that now though :) With handle_threaded_wake_irq() we could optionally call a handler before we call pm_runtime_resume() and let the consumer device driver figure out what the state is. Regards, Tony