From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753495AbdFMQGV (ORCPT ); Tue, 13 Jun 2017 12:06:21 -0400 Received: from mail-yw0-f178.google.com ([209.85.161.178]:32864 "EHLO mail-yw0-f178.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752192AbdFMQGT (ORCPT ); Tue, 13 Jun 2017 12:06:19 -0400 Date: Tue, 13 Jun 2017 12:06:16 -0400 From: Tejun Heo To: Peter Zijlstra , Ingo Molnar Cc: Lai Jiangshan , linux-kernel , Johannes Berg Subject: Re: single-threaded wq lockdep is broken Message-ID: <20170613160616.GE28327@htj.duckdns.org> References: <1495999993.3578.1.camel@sipsolutions.net> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <1495999993.3578.1.camel@sipsolutions.net> User-Agent: Mutt/1.8.2 (2017-04-18) Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 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 #include #include #include 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);