<feed xmlns='http://www.w3.org/2005/Atom'>
<title>user/sven/linux.git/include/linux/workqueue.h, branch v4.12.4</title>
<subtitle>Linux Kernel
</subtitle>
<id>https://git.stealer.net/cgit.cgi/user/sven/linux.git/atom?h=v4.12.4</id>
<link rel='self' href='https://git.stealer.net/cgit.cgi/user/sven/linux.git/atom?h=v4.12.4'/>
<link rel='alternate' type='text/html' href='https://git.stealer.net/cgit.cgi/user/sven/linux.git/'/>
<updated>2017-04-15T10:20:53Z</updated>
<entry>
<title>workqueue: Provide work_on_cpu_safe()</title>
<updated>2017-04-15T10:20:53Z</updated>
<author>
<name>Thomas Gleixner</name>
<email>tglx@linutronix.de</email>
</author>
<published>2017-04-12T20:07:28Z</published>
<link rel='alternate' type='text/html' href='https://git.stealer.net/cgit.cgi/user/sven/linux.git/commit/?id=0e8d6a9336b487a1dd6f1991ff376e669d4c87c6'/>
<id>urn:sha1:0e8d6a9336b487a1dd6f1991ff376e669d4c87c6</id>
<content type='text'>
work_on_cpu() is not protected against CPU hotplug. For code which requires
to be either executed on an online CPU or to fail if the CPU is not
available the callsite would have to protect against CPU hotplug.

Provide a function which does get/put_online_cpus() around the call to
work_on_cpu() and fails the call with -ENODEV if the target CPU is not
online.

Preparatory patch to convert several racy task affinity manipulations.

Signed-off-by: Thomas Gleixner &lt;tglx@linutronix.de&gt;
Acked-by: Tejun Heo &lt;tj@kernel.org&gt;
Cc: Fenghua Yu &lt;fenghua.yu@intel.com&gt;
Cc: Tony Luck &lt;tony.luck@intel.com&gt;
Cc: Herbert Xu &lt;herbert@gondor.apana.org.au&gt;
Cc: "Rafael J. Wysocki" &lt;rjw@rjwysocki.net&gt;
Cc: Peter Zijlstra &lt;peterz@infradead.org&gt;
Cc: Benjamin Herrenschmidt &lt;benh@kernel.crashing.org&gt;
Cc: Sebastian Siewior &lt;bigeasy@linutronix.de&gt;
Cc: Lai Jiangshan &lt;jiangshanlai@gmail.com&gt;
Cc: Viresh Kumar &lt;viresh.kumar@linaro.org&gt;
Cc: Michael Ellerman &lt;mpe@ellerman.id.au&gt;
Cc: "David S. Miller" &lt;davem@davemloft.net&gt;
Cc: Len Brown &lt;lenb@kernel.org&gt;
Link: http://lkml.kernel.org/r/20170412201042.262610721@linutronix.de
Signed-off-by: Thomas Gleixner &lt;tglx@linutronix.de&gt;

</content>
</entry>
<entry>
<title>workqueue: avoid clang warning</title>
<updated>2017-02-02T20:22:18Z</updated>
<author>
<name>Arnd Bergmann</name>
<email>arnd@arndb.de</email>
</author>
<published>2017-02-01T17:01:17Z</published>
<link rel='alternate' type='text/html' href='https://git.stealer.net/cgit.cgi/user/sven/linux.git/commit/?id=a45463cbf3f9dcdae683033c256f50bded513d6a'/>
<id>urn:sha1:a45463cbf3f9dcdae683033c256f50bded513d6a</id>
<content type='text'>
Building with clang shows lots of warning like:

drivers/amba/bus.c:447:8: warning: implicit conversion from 'long long' to 'int' changes value from 4294967248 to -48
      [-Wconstant-conversion]
static DECLARE_DELAYED_WORK(deferred_retry_work, amba_deferred_retry_func);
       ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
include/linux/workqueue.h:187:26: note: expanded from macro 'DECLARE_DELAYED_WORK'
        struct delayed_work n = __DELAYED_WORK_INITIALIZER(n, f, 0)
                                ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
include/linux/workqueue.h:177:10: note: expanded from macro '__DELAYED_WORK_INITIALIZER'
        .work = __WORK_INITIALIZER((n).work, (f)),                      \
                ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
include/linux/workqueue.h:170:10: note: expanded from macro '__WORK_INITIALIZER'
        .data = WORK_DATA_STATIC_INIT(),                                \
                ^~~~~~~~~~~~~~~~~~~~~~~
include/linux/workqueue.h:111:39: note: expanded from macro 'WORK_DATA_STATIC_INIT'
        ATOMIC_LONG_INIT(WORK_STRUCT_NO_POOL | WORK_STRUCT_STATIC)
        ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~
include/asm-generic/atomic-long.h:32:41: note: expanded from macro 'ATOMIC_LONG_INIT'
 #define ATOMIC_LONG_INIT(i)     ATOMIC_INIT(i)
                                ~~~~~~~~~~~~^~
arch/arm/include/asm/atomic.h:21:27: note: expanded from macro 'ATOMIC_INIT'
 #define ATOMIC_INIT(i)  { (i) }
                        ~  ^

This makes the type cast explicit, which shuts up the warning.

Signed-off-by: Arnd Bergmann &lt;arnd@arndb.de&gt;
Signed-off-by: Tejun Heo &lt;tj@kernel.org&gt;
</content>
</entry>
<entry>
<title>Merge branch 'for-4.10' of git://git.kernel.org/pub/scm/linux/kernel/git/tj/wq</title>
<updated>2016-12-13T20:59:57Z</updated>
<author>
<name>Linus Torvalds</name>
<email>torvalds@linux-foundation.org</email>
</author>
<published>2016-12-13T20:59:57Z</published>
<link rel='alternate' type='text/html' href='https://git.stealer.net/cgit.cgi/user/sven/linux.git/commit/?id=c11a6cfb0103d5d831e20bd9b75d10d13519fec5'/>
<id>urn:sha1:c11a6cfb0103d5d831e20bd9b75d10d13519fec5</id>
<content type='text'>
Pull workqueue updates from Tejun Heo:
 "Mostly patches to initialize workqueue subsystem earlier and get rid
  of keventd_up().

  The patches were headed for the last merge cycle but got delayed due
  to a bug found late minute, which is fixed now.

  Also, to help debugging, destroy_workqueue() is more chatty now on a
  sanity check failure."

* 'for-4.10' of git://git.kernel.org/pub/scm/linux/kernel/git/tj/wq:
  workqueue: move wq_numa_init() to workqueue_init()
  workqueue: remove keventd_up()
  debugobj, workqueue: remove keventd_up() usage
  slab, workqueue: remove keventd_up() usage
  power, workqueue: remove keventd_up() usage
  tty, workqueue: remove keventd_up() usage
  mce, workqueue: remove keventd_up() usage
  workqueue: make workqueue available early during boot
  workqueue: dump workqueue state on sanity check failures in destroy_workqueue()
</content>
</entry>
<entry>
<title>workqueue: kerneldocify workqueue_attrs</title>
<updated>2016-10-28T16:54:32Z</updated>
<author>
<name>Silvio Fricke</name>
<email>silvio.fricke@gmail.com</email>
</author>
<published>2016-10-28T08:14:09Z</published>
<link rel='alternate' type='text/html' href='https://git.stealer.net/cgit.cgi/user/sven/linux.git/commit/?id=42412c3aae5d8ea57a46b8ff86bb67bc1a270d9c'/>
<id>urn:sha1:42412c3aae5d8ea57a46b8ff86bb67bc1a270d9c</id>
<content type='text'>
Only formating changes.

Signed-off-by: Silvio Fricke &lt;silvio.fricke@gmail.com&gt;
Acked-by: Tejun Heo &lt;tj@kernel.org&gt;
Signed-off-by: Jonathan Corbet &lt;corbet@lwn.net&gt;
</content>
</entry>
<entry>
<title>Merge branch 'for-4.9' into for-4.10</title>
<updated>2016-10-19T16:12:40Z</updated>
<author>
<name>Tejun Heo</name>
<email>tj@kernel.org</email>
</author>
<published>2016-10-19T16:12:40Z</published>
<link rel='alternate' type='text/html' href='https://git.stealer.net/cgit.cgi/user/sven/linux.git/commit/?id=8bc4a04455969c36bf54a942ad9d28d80969ed51'/>
<id>urn:sha1:8bc4a04455969c36bf54a942ad9d28d80969ed51</id>
<content type='text'>
</content>
</entry>
<entry>
<title>workqueue: remove keventd_up()</title>
<updated>2016-09-17T17:18:21Z</updated>
<author>
<name>Tejun Heo</name>
<email>tj@kernel.org</email>
</author>
<published>2016-09-16T19:49:34Z</published>
<link rel='alternate' type='text/html' href='https://git.stealer.net/cgit.cgi/user/sven/linux.git/commit/?id=863b710b664bdcb90c0c682ee24adb368f497a5b'/>
<id>urn:sha1:863b710b664bdcb90c0c682ee24adb368f497a5b</id>
<content type='text'>
keventd_up() no longer has in-kernel users.  Remove it and make
wq_online static.

Signed-off-by: Tejun Heo &lt;tj@kernel.org&gt;
</content>
</entry>
<entry>
<title>workqueue: make workqueue available early during boot</title>
<updated>2016-09-17T17:18:21Z</updated>
<author>
<name>Tejun Heo</name>
<email>tj@kernel.org</email>
</author>
<published>2016-09-16T19:49:32Z</published>
<link rel='alternate' type='text/html' href='https://git.stealer.net/cgit.cgi/user/sven/linux.git/commit/?id=3347fa0928210d96aaa2bd6cd5a8391d5e630873'/>
<id>urn:sha1:3347fa0928210d96aaa2bd6cd5a8391d5e630873</id>
<content type='text'>
Workqueue is currently initialized in an early init call; however,
there are cases where early boot code has to be split and reordered to
come after workqueue initialization or the same code path which makes
use of workqueues is used both before workqueue initailization and
after.  The latter cases have to gate workqueue usages with
keventd_up() tests, which is nasty and easy to get wrong.

Workqueue usages have become widespread and it'd be a lot more
convenient if it can be used very early from boot.  This patch splits
workqueue initialization into two steps.  workqueue_init_early() which
sets up the basic data structures so that workqueues can be created
and work items queued, and workqueue_init() which actually brings up
workqueues online and starts executing queued work items.  The former
step can be done very early during boot once memory allocation,
cpumasks and idr are initialized.  The latter right after kthreads
become available.

This allows work item queueing and canceling from very early boot
which is what most of these use cases want.

* As systemd_wq being initialized doesn't indicate that workqueue is
  fully online anymore, update keventd_up() to test wq_online instead.
  The follow-up patches will get rid of all its usages and the
  function itself.

* Flushing doesn't make sense before workqueue is fully initialized.
  The flush functions trigger WARN and return immediately before fully
  online.

* Work items are never in-flight before fully online.  Canceling can
  always succeed by skipping the flush step.

* Some code paths can no longer assume to be called with irq enabled
  as irq is disabled during early boot.  Use irqsave/restore
  operations instead.

v2: Watchdog init, which requires timer to be running, moved from
    workqueue_init_early() to workqueue_init().

Signed-off-by: Tejun Heo &lt;tj@kernel.org&gt;
Suggested-by: Linus Torvalds &lt;torvalds@linux-foundation.org&gt;
Link: http://lkml.kernel.org/r/CA+55aFx0vPuMuxn00rBSM192n-Du5uxy+4AvKa0SBSOVJeuCGg@mail.gmail.com
</content>
</entry>
<entry>
<title>workqueue: add cancel_work()</title>
<updated>2016-08-29T14:13:21Z</updated>
<author>
<name>Jens Axboe</name>
<email>axboe@fb.com</email>
</author>
<published>2016-08-24T21:51:50Z</published>
<link rel='alternate' type='text/html' href='https://git.stealer.net/cgit.cgi/user/sven/linux.git/commit/?id=f72b8792d180948b4b3898374998f5ac8c02e539'/>
<id>urn:sha1:f72b8792d180948b4b3898374998f5ac8c02e539</id>
<content type='text'>
Like cancel_delayed_work(), but for regular work.

Signed-off-by: Jens Axboe &lt;axboe@fb.com&gt;
Mehed-by: Tejun Heo &lt;tj@kernel.org&gt;
Acked-by: Tejun Heo &lt;tj@kernel.org&gt;
</content>
</entry>
<entry>
<title>workqueue: Convert to state machine callbacks</title>
<updated>2016-07-14T07:34:43Z</updated>
<author>
<name>Thomas Gleixner</name>
<email>tglx@linutronix.de</email>
</author>
<published>2016-07-13T17:16:29Z</published>
<link rel='alternate' type='text/html' href='https://git.stealer.net/cgit.cgi/user/sven/linux.git/commit/?id=7ee681b25284782ecf380bf5ccf55f13c52fd0ce'/>
<id>urn:sha1:7ee681b25284782ecf380bf5ccf55f13c52fd0ce</id>
<content type='text'>
Get rid of the prio ordering of the separate notifiers and use a proper state
callback pair.

Signed-off-by: Thomas Gleixner &lt;tglx@linutronix.de&gt;
Signed-off-by: Anna-Maria Gleixner &lt;anna-maria@linutronix.de&gt;
Reviewed-by: Sebastian Andrzej Siewior &lt;bigeasy@linutronix.de&gt;
Acked-by: Tejun Heo &lt;tj@kernel.org&gt;
Cc: Andrew Morton &lt;akpm@linux-foundation.org&gt;
Cc: Lai Jiangshan &lt;jiangshanlai@gmail.com&gt;
Cc: Linus Torvalds &lt;torvalds@linux-foundation.org&gt;
Cc: Nicolas Iooss &lt;nicolas.iooss_linux@m4x.org&gt;
Cc: Oleg Nesterov &lt;oleg@redhat.com&gt;
Cc: Paul E. McKenney &lt;paulmck@linux.vnet.ibm.com&gt;
Cc: Peter Zijlstra &lt;peterz@infradead.org&gt;
Cc: Rasmus Villemoes &lt;linux@rasmusvillemoes.dk&gt;
Cc: Rusty Russell &lt;rusty@rustcorp.com.au&gt;
Cc: rt@linutronix.de
Link: http://lkml.kernel.org/r/20160713153335.197083890@linutronix.de
Signed-off-by: Ingo Molnar &lt;mingo@kernel.org&gt;
</content>
</entry>
<entry>
<title>workqueue: skip flush dependency checks for legacy workqueues</title>
<updated>2016-01-29T18:31:10Z</updated>
<author>
<name>Tejun Heo</name>
<email>tj@kernel.org</email>
</author>
<published>2016-01-29T10:59:46Z</published>
<link rel='alternate' type='text/html' href='https://git.stealer.net/cgit.cgi/user/sven/linux.git/commit/?id=23d11a58a9a60dcb52c8fc6494efce908b24c295'/>
<id>urn:sha1:23d11a58a9a60dcb52c8fc6494efce908b24c295</id>
<content type='text'>
fca839c00a12 ("workqueue: warn if memory reclaim tries to flush
!WQ_MEM_RECLAIM workqueue") implemented flush dependency warning which
triggers if a PF_MEMALLOC task or WQ_MEM_RECLAIM workqueue tries to
flush a !WQ_MEM_RECLAIM workquee.

This assumes that workqueues marked with WQ_MEM_RECLAIM sit in memory
reclaim path and making it depend on something which may need more
memory to make forward progress can lead to deadlocks.  Unfortunately,
workqueues created with the legacy create*_workqueue() interface
always have WQ_MEM_RECLAIM regardless of whether they are depended
upon memory reclaim or not.  These spurious WQ_MEM_RECLAIM markings
cause spurious triggering of the flush dependency checks.

  WARNING: CPU: 0 PID: 6 at kernel/workqueue.c:2361 check_flush_dependency+0x138/0x144()
  workqueue: WQ_MEM_RECLAIM deferwq:deferred_probe_work_func is flushing !WQ_MEM_RECLAIM events:lru_add_drain_per_cpu
  ...
  Workqueue: deferwq deferred_probe_work_func
  [&lt;c0017acc&gt;] (unwind_backtrace) from [&lt;c0013134&gt;] (show_stack+0x10/0x14)
  [&lt;c0013134&gt;] (show_stack) from [&lt;c0245f18&gt;] (dump_stack+0x94/0xd4)
  [&lt;c0245f18&gt;] (dump_stack) from [&lt;c0026f9c&gt;] (warn_slowpath_common+0x80/0xb0)
  [&lt;c0026f9c&gt;] (warn_slowpath_common) from [&lt;c0026ffc&gt;] (warn_slowpath_fmt+0x30/0x40)
  [&lt;c0026ffc&gt;] (warn_slowpath_fmt) from [&lt;c00390b8&gt;] (check_flush_dependency+0x138/0x144)
  [&lt;c00390b8&gt;] (check_flush_dependency) from [&lt;c0039ca0&gt;] (flush_work+0x50/0x15c)
  [&lt;c0039ca0&gt;] (flush_work) from [&lt;c00c51b0&gt;] (lru_add_drain_all+0x130/0x180)
  [&lt;c00c51b0&gt;] (lru_add_drain_all) from [&lt;c00f728c&gt;] (migrate_prep+0x8/0x10)
  [&lt;c00f728c&gt;] (migrate_prep) from [&lt;c00bfbc4&gt;] (alloc_contig_range+0xd8/0x338)
  [&lt;c00bfbc4&gt;] (alloc_contig_range) from [&lt;c00f8f18&gt;] (cma_alloc+0xe0/0x1ac)
  [&lt;c00f8f18&gt;] (cma_alloc) from [&lt;c001cac4&gt;] (__alloc_from_contiguous+0x38/0xd8)
  [&lt;c001cac4&gt;] (__alloc_from_contiguous) from [&lt;c001ceb4&gt;] (__dma_alloc+0x240/0x278)
  [&lt;c001ceb4&gt;] (__dma_alloc) from [&lt;c001cf78&gt;] (arm_dma_alloc+0x54/0x5c)
  [&lt;c001cf78&gt;] (arm_dma_alloc) from [&lt;c0355ea4&gt;] (dmam_alloc_coherent+0xc0/0xec)
  [&lt;c0355ea4&gt;] (dmam_alloc_coherent) from [&lt;c039cc4c&gt;] (ahci_port_start+0x150/0x1dc)
  [&lt;c039cc4c&gt;] (ahci_port_start) from [&lt;c0384734&gt;] (ata_host_start.part.3+0xc8/0x1c8)
  [&lt;c0384734&gt;] (ata_host_start.part.3) from [&lt;c03898dc&gt;] (ata_host_activate+0x50/0x148)
  [&lt;c03898dc&gt;] (ata_host_activate) from [&lt;c039d558&gt;] (ahci_host_activate+0x44/0x114)
  [&lt;c039d558&gt;] (ahci_host_activate) from [&lt;c039f05c&gt;] (ahci_platform_init_host+0x1d8/0x3c8)
  [&lt;c039f05c&gt;] (ahci_platform_init_host) from [&lt;c039e6bc&gt;] (tegra_ahci_probe+0x448/0x4e8)
  [&lt;c039e6bc&gt;] (tegra_ahci_probe) from [&lt;c0347058&gt;] (platform_drv_probe+0x50/0xac)
  [&lt;c0347058&gt;] (platform_drv_probe) from [&lt;c03458cc&gt;] (driver_probe_device+0x214/0x2c0)
  [&lt;c03458cc&gt;] (driver_probe_device) from [&lt;c0343cc0&gt;] (bus_for_each_drv+0x60/0x94)
  [&lt;c0343cc0&gt;] (bus_for_each_drv) from [&lt;c03455d8&gt;] (__device_attach+0xb0/0x114)
  [&lt;c03455d8&gt;] (__device_attach) from [&lt;c0344ab8&gt;] (bus_probe_device+0x84/0x8c)
  [&lt;c0344ab8&gt;] (bus_probe_device) from [&lt;c0344f48&gt;] (deferred_probe_work_func+0x68/0x98)
  [&lt;c0344f48&gt;] (deferred_probe_work_func) from [&lt;c003b738&gt;] (process_one_work+0x120/0x3f8)
  [&lt;c003b738&gt;] (process_one_work) from [&lt;c003ba48&gt;] (worker_thread+0x38/0x55c)
  [&lt;c003ba48&gt;] (worker_thread) from [&lt;c0040f14&gt;] (kthread+0xdc/0xf4)
  [&lt;c0040f14&gt;] (kthread) from [&lt;c000f778&gt;] (ret_from_fork+0x14/0x3c)

Fix it by marking workqueues created via create*_workqueue() with
__WQ_LEGACY and disabling flush dependency checks on them.

Signed-off-by: Tejun Heo &lt;tj@kernel.org&gt;
Reported-and-tested-by: Thierry Reding &lt;thierry.reding@gmail.com&gt;
Link: http://lkml.kernel.org/g/20160126173843.GA11115@ulmo.nvidia.com
Fixes: fca839c00a12 ("workqueue: warn if memory reclaim tries to flush !WQ_MEM_RECLAIM workqueue")
</content>
</entry>
</feed>
