summaryrefslogtreecommitdiff
path: root/kernel/workqueue.c
diff options
context:
space:
mode:
authorThierry Reding <treding@nvidia.com>2026-04-29 12:30:50 +0200
committerThierry Reding <treding@nvidia.com>2026-04-29 12:30:50 +0200
commitb7e100fa94d2b7ca53142c552f9c8a5618090987 (patch)
treeff3ac1171476e4d684463ae80e72c68436e0444a /kernel/workqueue.c
parent55cbde2fdc60130ca81097e0d1bcd64708925096 (diff)
parentde8a048f0f6a770f0afb7e988f8881c2903dc4ea (diff)
downloadlinux-next-b7e100fa94d2b7ca53142c552f9c8a5618090987.tar.gz
linux-next-b7e100fa94d2b7ca53142c552f9c8a5618090987.zip
Merge branch 'master' of git://git.code.sf.net/p/tomoyo/tomoyo.git
Diffstat (limited to 'kernel/workqueue.c')
-rw-r--r--kernel/workqueue.c28
1 files changed, 28 insertions, 0 deletions
diff --git a/kernel/workqueue.c b/kernel/workqueue.c
index 5f747f241a5f..bdf0879f4caf 100644
--- a/kernel/workqueue.c
+++ b/kernel/workqueue.c
@@ -3183,6 +3183,10 @@ static bool manage_workers(struct worker *worker)
return true;
}
+#ifdef CONFIG_NET_DEV_REFCNT_TRACKER
+static noinline void process_one_work(struct worker *worker, struct work_struct *work);
+#endif
+
/**
* process_one_work - process single work
* @worker: self
@@ -3206,6 +3210,9 @@ __acquires(&pool->lock)
unsigned long work_data;
int lockdep_start_depth, rcu_start_depth;
bool bh_draining = pool->flags & POOL_BH_DRAINING;
+#ifdef CONFIG_KCOV
+ unsigned int old_kcov_mode, new_kcov_mode;
+#endif
#ifdef CONFIG_LOCKDEP
/*
* It is permissible to free the struct work_struct from
@@ -3299,7 +3306,13 @@ __acquires(&pool->lock)
*/
lockdep_invariant_state(true);
trace_workqueue_execute_start(work);
+#ifdef CONFIG_KCOV
+ old_kcov_mode = READ_ONCE(current->kcov_mode);
+#endif
worker->current_func(work);
+#ifdef CONFIG_KCOV
+ new_kcov_mode = READ_ONCE(current->kcov_mode);
+#endif
/*
* While we must be careful to not use "work" after this, the trace
* point will only record its address.
@@ -3322,6 +3335,11 @@ __acquires(&pool->lock)
debug_show_held_locks(current);
dump_stack();
}
+#ifdef CONFIG_KCOV
+ if (unlikely((old_kcov_mode & ~(1 << 30)) != (new_kcov_mode & ~(1 << 30))))
+ pr_err("BUG: workqueue function %ps changed kcov_mode from %u to %u\n",
+ worker->current_func, old_kcov_mode, new_kcov_mode);
+#endif
/*
* The following prevents a kworker from hogging CPU on !PREEMPTION
@@ -3413,6 +3431,11 @@ static int worker_thread(void *__worker)
struct worker *worker = __worker;
struct worker_pool *pool = worker->pool;
+#ifdef CONFIG_KCOV
+ if (unlikely(current->kcov_mode & ~(1 << 30)))
+ pr_err("BUG: %s started with kcov_mode=%u\n", __func__, current->kcov_mode);
+#endif
+
/* tell the scheduler that this is a workqueue worker */
set_pf_worker(true);
woke_up:
@@ -3565,6 +3588,11 @@ static int rescuer_thread(void *__rescuer)
struct workqueue_struct *wq = rescuer->rescue_wq;
bool should_stop;
+#ifdef CONFIG_KCOV
+ if (unlikely(current->kcov_mode & ~(1 << 30)))
+ pr_err("BUG: %s started with kcov_mode=%u\n", __func__, current->kcov_mode);
+#endif
+
set_user_nice(current, RESCUER_NICE_LEVEL);
/*