linux/kernel
Lukas Wunner 4b1438cae6 workqueue: Allow retrieval of current task's work struct
commit 27d4ee0307 upstream.

Introduce a helper to retrieve the current task's work struct if it is
a workqueue worker.

This allows us to fix a long-standing deadlock in several DRM drivers
wherein the ->runtime_suspend callback waits for a specific worker to
finish and that worker in turn calls a function which waits for runtime
suspend to finish.  That function is invoked from multiple call sites
and waiting for runtime suspend to finish is the correct thing to do
except if it's executing in the context of the worker.

Cc: Lai Jiangshan <jiangshanlai@gmail.com>
Cc: Dave Airlie <airlied@redhat.com>
Cc: Ben Skeggs <bskeggs@redhat.com>
Cc: Alex Deucher <alexander.deucher@amd.com>
Acked-by: Tejun Heo <tj@kernel.org>
Reviewed-by: Lyude Paul <lyude@redhat.com>
Signed-off-by: Lukas Wunner <lukas@wunner.de>
Link: https://patchwork.freedesktop.org/patch/msgid/2d8f603074131eb87e588d2b803a71765bd3a2fd.1518338788.git.lukas@wunner.de
Signed-off-by: Ben Hutchings <ben@decadent.org.uk>
History 2018-06-16 22:22:18 +01:00
..
debug kdb: Fix handling of kallsyms_symbol_next() return value 2018-03-03 15:51:46 +00:00
events perf/hwbp: Simplify the perf-hwbp code, fix documentation 2018-06-16 22:21:34 +01:00
gcov gcov: add support for GCC 4.9 2014-06-10 15:34:46 -07:00
irq genirq: Make sparse_irq_lock protect what it should protect 2017-11-26 13:50:35 +00:00
locking lockdep: teach lockdep about memalloc_noio_save 2017-08-26 02:14:45 +01:00
power PM / sleep: fix device reference leak in test_suspend 2017-02-23 03:54:27 +00:00
printk printk/console: Always disable boot consoles that use init memory before it is freed 2017-11-26 13:50:15 +00:00
rcu srcu: Allow use of Classic SRCU from both process and interrupt context 2017-09-15 18:30:07 +01:00
sched x86: pvclock: Really remove the sched notifier for cross-cpu migrations 2018-02-13 18:42:34 +00:00
time nohz: Prevent a timer interrupt storm in tick_nohz_stop_sched_tick() 2018-03-03 15:52:07 +00:00
trace tracing: Fix possible double free on failure of allocating trace buffer 2018-03-03 15:52:07 +00:00
.gitignore Ignore generated file kernel/x509_certificate_list 2013-12-10 18:21:34 +00:00
acct.c kernel/acct.c: fix the acct->needcheck check in check_free_space() 2018-03-03 15:52:13 +00:00
async.c kernel/async.c: revert "async: simplify lowest_in_progress()" 2018-06-16 22:22:07 +01:00
audit.c audit: use supplied gfp_mask from audit_buffer in kauditd_send_multicast_skb 2015-01-15 10:44:43 +00:00
audit.h audit: Use struct net not pid_t to remember the network namespce to reply in 2014-03-20 10:10:53 -04:00
audit_tree.c audit: keep inode pinned 2014-11-27 11:21:43 +00:00
audit_watch.c audit: Fix use after free in audit_remove_watch_rule() 2017-11-11 13:33:20 +00:00
auditfilter.c audit: restore AUDIT_LOGINUID unset ABI 2015-01-15 10:44:46 +00:00
auditsc.c audit: fix a double fetch in audit_log_single_execve_arg() 2016-08-22 22:38:28 +01:00
backtracetest.c kernel/backtracetest.c: replace no level printk by pr_info() 2014-06-04 16:54:14 -07:00
bounds.c mm: do not allocate page->ptl dynamically, if spinlock_t fits to long 2013-12-20 12:25:45 -08:00
capability.c exec: Ensure mm->user_ns contains the execed files 2018-01-01 20:52:11 +00:00
cgroup.c cgroup: make sure a parent css isn't offlined before its children 2016-02-25 00:18:35 +00:00
cgroup_freezer.c cgroup: remove css_parent() 2014-05-16 13:22:48 -04:00
compat.c kernel/compat.c: use sizeof() instead of sizeof 2014-06-04 16:54:19 -07:00
configs.c proc: Supply PDE attribute setting accessor functions 2013-05-01 17:29:18 -04:00
context_tracking.c x86/kprobes: Fix build errors and blacklist context_track_user 2014-06-14 09:07:44 +02:00
cpu.c hotplug: Make register and unregister notifier API symmetric 2017-03-16 02:26:31 +00:00
cpu_pm.c kernel/cpu_pm.c: fix various typos 2012-05-31 17:49:27 -07:00
cpuset.c cpuset: PF_SPREAD_PAGE and PF_SPREAD_SLAB should be atomic flags 2017-10-12 15:28:22 +01:00
crash_dump.c Merge branch 'modsplit-Oct31_2011' of git://git.kernel.org/pub/scm/linux/kernel/git/paulg/linux 2011-11-06 19:44:47 -08:00
cred.c Merge branch 'for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/ebiederm/user-namespace 2012-12-18 10:55:28 -08:00
delayacct.c kernel/delayacct.c: remove redundant checking in __delayacct_add_tsk() 2013-11-13 12:09:12 +09:00
dma.c Remove all #inclusions of asm/system.h 2012-03-28 18:30:03 +01:00
elfcore.c switch elf_core_write_extra_phdrs() to dump_emit() 2013-11-09 00:16:23 -05:00
exec_domain.c kernel/exec_domain.c: code clean-up 2014-06-04 16:54:15 -07:00
exit.c wait/ptrace: assume __WALL if the child is traced 2016-08-22 22:38:04 +01:00
extable.c kprobes, x86/alternatives: Use text_mutex to protect smp_alt_modules 2018-02-13 18:42:17 +00:00
fork.c KAISER: Kernel Address Isolation 2018-01-09 00:35:13 +00:00
freezer.c freezer: Do not freeze tasks killed by OOM killer 2014-11-05 11:43:08 +00:00
futex.c futex: Prevent overflow by strengthen input validation 2018-03-03 15:52:22 +00:00
futex_compat.c ptrace: use fsuid, fsgid, effective creds for fs access checks 2017-09-15 18:30:17 +01:00
groups.c kernel: make groups_sort calling a responsibility group_info allocators 2018-03-03 15:51:59 +00:00
hrtimer.c hrtimer: Ensure POSIX compliance (relative CLOCK_REALTIME hrtimers) 2018-06-16 22:21:53 +01:00
hung_task.c kernel/hung_task.c: convert simple_strtoul to kstrtouint 2014-06-04 16:54:15 -07:00
irq_work.c perf/x86: Warn to early_printk() in case irq_work is too slow 2014-02-21 21:49:07 +01:00
itimer.c itimer: Use printk_once instead of WARN_ONCE 2012-04-10 11:00:30 +02:00
jump_label.c jump_labels: API for flushing deferred jump label updates 2017-03-16 02:26:58 +00:00
kallsyms.c kernel: use macros from compiler.h instead of __attribute__((...)) 2014-04-07 16:36:11 -07:00
kcmp.c ptrace: use fsuid, fsgid, effective creds for fs access checks 2017-09-15 18:30:17 +01:00
Kconfig.freezer container freezer: implement freezer cgroup subsystem 2008-10-20 08:52:34 -07:00
Kconfig.hz kernel: remove CONFIG_USE_GENERIC_SMP_HELPERS 2013-11-15 09:32:22 +09:00
Kconfig.locks locking/rwsem: Add CONFIG_RWSEM_SPIN_ON_OWNER 2014-07-16 14:57:13 +02:00
Kconfig.preempt locking/kconfig: Simplify INLINE_SPIN_UNLOCK usage 2012-03-23 13:18:57 +01:00
kexec.c kexec: fix build error when hugetlbfs is disabled 2014-07-30 20:09:37 -07:00
kmod.c signals: change wait_for_helper() to use kernel_sigaction() 2014-06-06 16:08:12 -07:00
kprobes.c tracing/kprobes: Enforce kprobes teardown after testing 2017-09-15 18:29:43 +01:00
ksysfs.c kobject: Make support for uevent_helper optional. 2014-04-25 12:00:49 -07:00
kthread.c kthread: fix return value of kthread_create() upon SIGKILL. 2014-06-04 16:53:51 -07:00
latencytop.c kernel/latencytop.c: convert seq_printf to seq_puts 2014-06-04 16:54:15 -07:00
Makefile Merge branch 'x86-asmlinkage-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip 2014-03-31 14:13:25 -07:00
module-internal.h KEYS: Separate the kernel signature checking keyring from module signing 2013-09-25 17:17:01 +01:00
module.c module/retpoline: Warn about missing retpoline in module 2018-03-19 18:59:11 +00:00
module_signing.c keys: change asymmetric keys to use common hash definitions 2013-10-25 17:15:18 -04:00
notifier.c kprobes, notifier: Use NOKPROBE_SYMBOL macro in notifier 2014-04-24 10:26:39 +02:00
nsproxy.c Merge branch 'for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/ebiederm/user-namespace 2013-09-07 14:35:32 -07:00
padata.c padata: free correct variable 2017-08-26 02:14:30 +01:00
panic.c x86/panic: replace smp_send_stop() with kdump friendly version in panic path 2017-02-23 03:54:11 +00:00
params.c kernel/params.c: align add_sysfs_param documentation with code 2018-01-01 20:51:47 +00:00
pid.c exit: pidns: alloc_pid() leaks pid_namespace if child_reaper is exiting 2015-01-15 10:43:53 +00:00
pid_namespace.c pid_ns: Sleep in TASK_INTERRUPTIBLE in zap_pid_ns_processes 2017-09-15 18:29:35 +01:00
posix-cpu-timers.c posix_cpu_timer: Exit early when process has been reaped 2016-11-20 01:16:49 +00:00
posix-timers.c posix-timer: Properly check sigevent->sigev_notify 2018-03-03 15:52:00 +00:00
profile.c kernel/profile.c: use static const char instead of static char 2014-06-06 16:08:13 -07:00
ptrace.c ptrace: Properly initialize ptracer_cred on fork 2018-01-01 20:52:11 +00:00
range.c range: Do not add new blank slot with add_range_with_merge 2013-06-18 11:32:10 -05:00
reboot.c kernel/reboot.c: convert simple_strtoul to kstrtoint 2014-06-04 16:54:15 -07:00
relay.c Merge branch 'for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/viro/vfs 2014-04-12 14:49:50 -07:00
res_counter.c kernel/res_counter.c: replace simple_strtoull by kstrtoull 2014-06-04 16:54:15 -07:00
resource.c kernel/resource.c: fix muxed resource handling in __request_region() 2016-03-04 10:26:43 +00:00
seccomp.c sched: move no_new_privs into new atomic flags 2017-10-12 15:28:22 +01:00
signal.c signal: Only reschedule timers on signals timers have sent 2017-09-15 18:30:12 +01:00
smp.c kernel/smp.c:on_each_cpu_cond(): fix warning in fallback path 2014-09-17 09:21:54 -07:00
smpboot.c smpboot: Add missing get_online_cpus() in smpboot_register_percpu_thread() 2015-02-10 13:38:44 +00:00
smpboot.h smpboot: Provide infrastructure for percpu hotplug threads 2012-08-13 17:01:07 +02:00
softirq.c ksoftirqd: Enable IRQs and call cond_resched() before poking RCU 2015-02-24 10:01:04 +00:00
stacktrace.c kernel: Map most files to use export.h instead of module.h 2011-10-31 09:20:12 -04:00
stop_machine.c kernel/stop_machine.c: kernel-doc warning fix 2014-06-04 16:54:15 -07:00
sys.c sched: move no_new_privs into new atomic flags 2017-10-12 15:28:22 +01:00
sys_ni.c sys_sgetmask/sys_ssetmask: add CONFIG_SGETMASK_SYSCALL 2014-06-04 16:54:14 -07:00
sysctl.c pipe: reject F_SETPIPE_SZ with size over UINT_MAX 2018-06-16 22:22:10 +01:00
sysctl_binary.c fs/coredump: prevent fsuid=0 dumps into user-controlled directories 2016-05-01 00:06:04 +02:00
system_certificates.S KEYS: correct alignment of system_certificate_list content in assembly file 2013-12-10 18:25:28 +00:00
system_keyring.c KEYS: correct alignment of system_certificate_list content in assembly file 2013-12-10 18:25:28 +00:00
task_work.c task_work: remove fifo ordering guarantee 2015-09-30 13:20:50 +01:00
taskstats.c genetlink: only pass array to genl_register_family_with_ops() 2013-11-19 16:39:05 -05:00
test_kprobes.c kernel/: rename random32() to prandom_u32() 2013-04-29 18:28:42 -07:00
time.c time: settimeofday: Validate the values of tv from user 2015-02-02 10:01:02 +00:00
timeconst.bc kernel: Replace timeconst.pl with a bc script 2013-02-16 23:17:25 +01:00
timer.c timer: Prevent overflow in apply_slack 2014-04-30 13:46:17 +02:00
torture.c torture: Remove __init from torture_init_begin/end 2014-05-14 09:46:30 -07:00
tracepoint.c tracing: syscall_regfunc() should not skip kernel threads 2014-06-21 00:15:26 -04:00
tsacct.c cputime: Use accessors to read task cputime stats 2013-01-27 19:23:31 +01:00
uid16.c kernel: make groups_sort calling a responsibility group_info allocators 2018-03-03 15:51:59 +00:00
up.c smp: Rename __smp_call_function_single() to smp_call_function_single_async() 2014-02-24 14:47:15 -08:00
user-return-notifier.c hlist: drop the node parameter from iterators 2013-02-27 19:10:24 -08:00
user.c userns: Add a knob to disable setgroups on a per user namespace basis 2015-01-15 10:43:58 +00:00
user_namespace.c userns: Allow setting gid_maps without privilege when setgroups is disabled 2015-01-15 10:43:59 +00:00
utsname.c userns: Kill nsown_capable it makes the wrong thing easy 2013-08-30 23:44:11 -07:00
utsname_sysctl.c sysctl: convert use of typedef ctl_table to struct ctl_table 2014-06-06 16:08:16 -07:00
watchdog.c kernel/watchdog.c: print traces for all cpus on lockup detection 2014-06-23 16:47:44 -07:00
workqueue.c workqueue: Allow retrieval of current task's work struct 2018-06-16 22:22:18 +01:00
workqueue_internal.h workqueue: Fix NULL pointer dereference 2018-01-01 20:52:01 +00:00