Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.kernel > #1664984 > unrolled thread

Re: single-threaded wq lockdep is broken

Started byTejun Heo <tj@kernel.org>
First post2017-06-13 18:10 +0200
Last post2017-06-13 18:10 +0200
Articles 1 — 1 participant

Back to article view | Back to linux.kernel

This discussion starts older than the indexed window; earlier articles aren't shown. The article labeled Started by below is the oldest one visible, not the original post.


Contents

  Re: single-threaded wq lockdep is broken Tejun Heo <tj@kernel.org> - 2017-06-13 18:10 +0200

#1664984 — Re: single-threaded wq lockdep is broken

FromTejun Heo <tj@kernel.org>
Date2017-06-13 18:10 +0200
SubjectRe: single-threaded wq lockdep is broken
Message-ID<tRWye-1GR-17@gated-at.bofh.it>
Hello,

Johannes reported that lockdep warning on single threaded workqueues
doesn't work anymore.  Nothing really changed there and all the
relevant lockdep annotaitons are being invoked correctly.  The
following is the extracted lockdep-only reproducer.

The culprit seems to be lock_map_acquire_read() being mapped to
lock_map_acquire_shared_recursive() instead of
lock_map_acquire_shared().  Is the following expected to not trigger
lockdep warning?  Should workqueue be using
rwsem_acquire[_read]/release() instead of lock_map*()?

Thanks.

#include <linux/kernel.h>
#include <linux/mutex.h>
#include <linux/slab.h>
#include <linux/module.h>

DEFINE_MUTEX(mtx);

static int init(void)
{
	static struct lock_class_key key;
	struct lockdep_map *map;

	printk("XXX lockdep test start\n");

	map = kzalloc(sizeof(*map), GFP_KERNEL);
	lockdep_init_map(map, "test_map", &key, 0);

	mutex_lock(&mtx);
	lock_map_acquire(map);
	lock_map_release(map);
	mutex_unlock(&mtx);

	lock_map_acquire_read(map);
	mutex_lock(&mtx);
	mutex_unlock(&mtx);
	lock_map_release(map);

	printk("XXX lockdep test end\n");
	return 0;
}
module_init(init);

[toc] | [standalone]


Back to top | Article view | linux.kernel


csiph-web