lkml.org 
[lkml]   [2022]   [Apr]   [24]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
Patch in this message
/
Date
From
Subject[PATCH] checkpatch: warn about flushing system-wide workqueues
Flushing the system-wide WQ has possibility of deadlock, for the caller
waits for completion of all works in that WQ even if the caller cannot
wait for completion of one of works due to locking dependency. Since
it is difficult to catch such attempts using lockdep, try to catch also
using checkpatch.

Signed-off-by: Tetsuo Handa <penguin-kernel@I-love.SAKURA.ne.jp>
---
scripts/checkpatch.pl | 7 +++++++
1 file changed, 7 insertions(+)

diff --git a/scripts/checkpatch.pl b/scripts/checkpatch.pl
index 577e02998701..d114652ba837 100755
--- a/scripts/checkpatch.pl
+++ b/scripts/checkpatch.pl
@@ -7226,6 +7226,13 @@ sub process {
"Deprecated use of '$deprecated_api', prefer '$new_api' instead\n" . $herecurr);
}

+# check for flushing system-wide workqueues
+ if ($line =~ /\bflush_scheduled_work\b\s*\(/ || $line =~ /\bflush_workqueue\b\s*\(\s*\bsystem_wq\b\s*\)/ ||
+ $line =~ /\bflush_workqueue\b\s*\(\s*\bsystem_(highpri|long|unbound|freezable|power_efficient|freezable_power_efficient)_wq\b\s*\)/) {
+ ERROR("DEPRECATED_API",
+ "Flushing system-wide workqueues is dangerous and will be forbidden - see https://lkml.kernel.org/r/49925af7-78a8-a3dd-bce6-cfc02e1a9236\@I-love.SAKURA.ne.jp\n" . $herecurr);
+ }
+
# check for various structs that are normally const (ops, kgdb, device_tree)
# and avoid what seem like struct definitions 'struct foo {'
if (defined($const_structs) &&
--
2.34.1
\
 
 \ /
  Last update: 2022-04-25 01:33    [W:0.088 / U:0.084 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site