lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [thread-next>] [day] [month] [year] [list]
Message-Id: <20170213204322.27588-1-tony@atomide.com>
Date:   Mon, 13 Feb 2017 12:43:22 -0800
From:   Tony Lindgren <tony@...mide.com>
To:     "Rafael J . Wysocki" <rafael.j.wysocki@...el.com>,
        Alan Stern <stern@...land.harvard.edu>
Cc:     Brian Norris <briannorris@...omium.org>,
        Dmitry Torokhov <dmitry.torokhov@...il.com>,
        Greg Kroah-Hartman <gregkh@...uxfoundation.org>,
        Grygorii Strashko <grygorii.strashko@...com>,
        Len Brown <len.brown@...el.com>, Nishanth Menon <nm@...com>,
        Pavel Machek <pavel@....cz>,
        Ulf Hansson <ulf.hansson@...aro.org>, linux-pm@...r.kernel.org,
        linux-kernel@...r.kernel.org, linux-omap@...r.kernel.org,
        Tero Kristo <t-kristo@...com>
Subject: [PATCH] PM / wakeirq: report a wakeup_event on dedicated wekup irq

From: Grygorii Strashko <grygorii.strashko@...com>

There are two reasons for reporting wakeup event when dedicated wakeup
IRQ is triggered:

- wakeup events accounting, so proper statistical data will be
  displayed in sysfs and debugfs;

- there are small window when System is entering suspend during which
  dedicated wakeup IRQ can be lost:

dpm_suspend_noirq()
  |- device_wakeup_arm_wake_irqs()
      |- dev_pm_arm_wake_irq(X)
         |- IRQ is enabled and marked as wakeup source
[1]...
  |- suspend_device_irqs()
     |- suspend_device_irq(X)
	|- irqd_set(X, IRQD_WAKEUP_ARMED);
	   |- wakup IRQ armed

The wakeup IRQ can be lost if it's triggered at point [1]
and not armed yet.

Hence, fix above cases by adding simple pm_wakeup_event() call in
handle_threaded_wake_irq().

Fixes: 4990d4fe327b ("PM / Wakeirq: Add automated device wake IRQ
handling")
Cc: Brian Norris <briannorris@...omium.org>
Cc: Tero Kristo <t-kristo@...com>
Signed-off-by: Grygorii Strashko <grygorii.strashko@...com>
Tested-by: Keerthy <j-keerthy@...com>
[tony@...mide.com: added missing return to avoid warnings]
Tested-by: Tony Lindgren <tony@...mide.com>
Signed-off-by: Tony Lindgren <tony@...mide.com>
---
 drivers/base/power/wakeirq.c | 7 +++++++
 1 file changed, 7 insertions(+)

diff --git a/drivers/base/power/wakeirq.c b/drivers/base/power/wakeirq.c
--- a/drivers/base/power/wakeirq.c
+++ b/drivers/base/power/wakeirq.c
@@ -141,6 +141,13 @@ static irqreturn_t handle_threaded_wake_irq(int irq, void *_wirq)
 	struct wake_irq *wirq = _wirq;
 	int res;
 
+	/* Maybe abort suspend? */
+	if (irqd_is_wakeup_set(irq_get_irq_data(irq))) {
+		pm_wakeup_event(wirq->dev, 0);
+
+		return IRQ_HANDLED;
+	}
+
 	/* We don't want RPM_ASYNC or RPM_NOWAIT here */
 	res = pm_runtime_resume(wirq->dev);
 	if (res < 0)
-- 
2.11.1

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ