Linux-rt-users archive on lore.kernel.org
 help / color / Atom feed
From: Sebastian Andrzej Siewior <bigeasy@linutronix.de>
To: John Mathew <john.mathew@unikie.com>
Cc: linux-rt-users@vger.kernel.org, lukas.bulwahn@gmail.com,
	Thomas Gleixner <tglx@linutronix.de>,
	Steven Rostedt <rostedt@goodmis.org>
Subject: [PATCH RT] swait: Remove the warning with more than two waiters
Date: Fri, 20 Mar 2020 17:54:42 +0100
Message-ID: <20200320165442.fqmcmwxrk64d3csm@linutronix.de> (raw)
In-Reply-To: <20200218071857.14805-1-john.mathew@unikie.com>

The warning was introduced to find callers of complete_all() having
multiple waiters enqueued. As completa_all() wakes all waiters with
disabled interrupts it may lead visibile latency spikes with a larger
amount of waiters.

Since the warning was introduced, most of the feedback was in the
"setup/configure" phase which is nothing that would disturb the RT
workload because it is not yet active.
There were reports regarding the crypto code which may wake multiple
waiters if all of them request an algorithm which requires a module to
be loaded first. If this really become a problem during runtime it
should be investigated then.

Remove the warning if more than two waiters are worken up via the
complete_all() interface.

Signed-off-by: Sebastian Andrzej Siewior <bigeasy@linutronix.de>
---
 include/linux/suspend.h  | 6 ------
 kernel/power/hibernate.c | 7 -------
 kernel/power/suspend.c   | 4 ----
 kernel/sched/swait.c     | 5 -----
 4 files changed, 22 deletions(-)

diff --git a/include/linux/suspend.h b/include/linux/suspend.h
index 5030ab13db060..cd97d2c8840cc 100644
--- a/include/linux/suspend.h
+++ b/include/linux/suspend.h
@@ -197,12 +197,6 @@ struct platform_s2idle_ops {
 	void (*end)(void);
 };
 
-#if defined(CONFIG_SUSPEND) || defined(CONFIG_HIBERNATION)
-extern bool pm_in_action;
-#else
-# define pm_in_action false
-#endif
-
 #ifdef CONFIG_SUSPEND
 extern suspend_state_t mem_sleep_current;
 extern suspend_state_t mem_sleep_default;
diff --git a/kernel/power/hibernate.c b/kernel/power/hibernate.c
index c8713bbc44810..3c0a5a8170b02 100644
--- a/kernel/power/hibernate.c
+++ b/kernel/power/hibernate.c
@@ -689,10 +689,6 @@ static int load_image_and_restore(void)
 	return error;
 }
 
-#ifndef CONFIG_SUSPEND
-bool pm_in_action;
-#endif
-
 /**
  * hibernate - Carry out system hibernation, including saving the image.
  */
@@ -706,8 +702,6 @@ int hibernate(void)
 		return -EPERM;
 	}
 
-	pm_in_action = true;
-
 	lock_system_sleep();
 	/* The snapshot device should not be opened while we're running */
 	if (!atomic_add_unless(&snapshot_device_available, -1, 0)) {
@@ -784,7 +778,6 @@ int hibernate(void)
 	atomic_inc(&snapshot_device_available);
  Unlock:
 	unlock_system_sleep();
-	pm_in_action = false;
 	pr_info("hibernation exit\n");
 
 	return error;
diff --git a/kernel/power/suspend.c b/kernel/power/suspend.c
index a9a6ada0c8e47..27f149f5d4a9f 100644
--- a/kernel/power/suspend.c
+++ b/kernel/power/suspend.c
@@ -595,8 +595,6 @@ static int enter_state(suspend_state_t state)
 	return error;
 }
 
-bool pm_in_action;
-
 /**
  * pm_suspend - Externally visible function for suspending the system.
  * @state: System sleep state to enter.
@@ -611,7 +609,6 @@ int pm_suspend(suspend_state_t state)
 	if (state <= PM_SUSPEND_ON || state >= PM_SUSPEND_MAX)
 		return -EINVAL;
 
-	pm_in_action = true;
 	pr_info("suspend entry (%s)\n", mem_sleep_labels[state]);
 	error = enter_state(state);
 	if (error) {
@@ -621,7 +618,6 @@ int pm_suspend(suspend_state_t state)
 		suspend_stats.success++;
 	}
 	pr_info("suspend exit\n");
-	pm_in_action = false;
 	return error;
 }
 EXPORT_SYMBOL(pm_suspend);
diff --git a/kernel/sched/swait.c b/kernel/sched/swait.c
index c58068d2ee06c..c56c315524ae6 100644
--- a/kernel/sched/swait.c
+++ b/kernel/sched/swait.c
@@ -35,7 +35,6 @@ EXPORT_SYMBOL(swake_up_locked);
 void swake_up_all_locked(struct swait_queue_head *q)
 {
 	struct swait_queue *curr;
-	int wakes = 0;
 
 	while (!list_empty(&q->task_list)) {
 
@@ -43,11 +42,7 @@ void swake_up_all_locked(struct swait_queue_head *q)
 					task_list);
 		wake_up_process(curr->task);
 		list_del_init(&curr->task_list);
-		wakes++;
 	}
-	if (pm_in_action)
-		return;
-	WARN(wakes > 2, "complete_all() with %d waiters\n", wakes);
 }
 EXPORT_SYMBOL(swake_up_all_locked);
 
-- 
2.26.0.rc2


      reply index

Thread overview: 16+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-12-11  7:17 complete_all() with x waiters in swake_up_all_locked John Mathew
2019-12-12 17:12 ` Sebastian Andrzej Siewior
2019-12-13  9:08   ` John Mathew
2019-12-18 16:53     ` Sebastian Andrzej Siewior
2019-12-31 10:00       ` [PATCH] crypto: only wait for completion once John Mathew
2020-01-14 12:47         ` Sebastian Andrzej Siewior
2020-02-11 11:48           ` John Mathew
2020-02-11 12:04             ` Sebastian Andrzej Siewior
2020-02-11 15:52               ` John Mathew
2020-02-11 15:59                 ` Sebastian Andrzej Siewior
2020-02-12 12:55                   ` John Mathew
2020-02-12 17:02                     ` Sebastian Andrzej Siewior
2020-02-13  6:58                       ` John Mathew
2020-02-13  8:31                         ` Sebastian Andrzej Siewior
2020-02-18  7:18                           ` [PATCH] swait: Increase number of waiters for warning John Mathew
2020-03-20 16:54                             ` Sebastian Andrzej Siewior [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20200320165442.fqmcmwxrk64d3csm@linutronix.de \
    --to=bigeasy@linutronix.de \
    --cc=john.mathew@unikie.com \
    --cc=linux-rt-users@vger.kernel.org \
    --cc=lukas.bulwahn@gmail.com \
    --cc=rostedt@goodmis.org \
    --cc=tglx@linutronix.de \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link

Linux-rt-users archive on lore.kernel.org

Archives are clonable:
	git clone --mirror https://lore.kernel.org/linux-rt-users/0 linux-rt-users/git/0.git

	# If you have public-inbox 1.1+ installed, you may
	# initialize and index your mirror using the following commands:
	public-inbox-init -V2 linux-rt-users linux-rt-users/ https://lore.kernel.org/linux-rt-users \
		linux-rt-users@vger.kernel.org
	public-inbox-index linux-rt-users

Example config snippet for mirrors

Newsgroup available over NNTP:
	nntp://nntp.lore.kernel.org/org.kernel.vger.linux-rt-users


AGPL code for this site: git clone https://public-inbox.org/public-inbox.git