From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by smtp.lore.kernel.org (Postfix) with ESMTP id CB188C433F5 for ; Mon, 17 Jan 2022 09:34:04 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 319E26B0071; Mon, 17 Jan 2022 04:34:04 -0500 (EST) Received: by kanga.kvack.org (Postfix, from userid 40) id 2C9606B0073; Mon, 17 Jan 2022 04:34:04 -0500 (EST) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 1B8226B0074; Mon, 17 Jan 2022 04:34:04 -0500 (EST) X-Delivered-To: linux-mm@kvack.org Received: from forelay.hostedemail.com (smtprelay0117.hostedemail.com [216.40.44.117]) by kanga.kvack.org (Postfix) with ESMTP id 05C366B0071 for ; Mon, 17 Jan 2022 04:34:04 -0500 (EST) Received: from smtpin29.hostedemail.com (10.5.19.251.rfc1918.com [10.5.19.251]) by forelay02.hostedemail.com (Postfix) with ESMTP id 9C41595B19 for ; Mon, 17 Jan 2022 09:34:03 +0000 (UTC) X-FDA: 79039267566.29.3F34737 Received: from galois.linutronix.de (Galois.linutronix.de [193.142.43.55]) by imf13.hostedemail.com (Postfix) with ESMTP id 078372001C for ; Mon, 17 Jan 2022 09:34:02 +0000 (UTC) Date: Mon, 17 Jan 2022 10:33:59 +0100 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linutronix.de; s=2020; t=1642412040; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: in-reply-to:in-reply-to:references:references; bh=gUwYyjGRaOG1n9rddzpFHQxZYYxv3VHs0gt0bcZZRuA=; b=WBCWSuzouFzebECmDhPjNM+D2l6VhV19Ryfp5UsxS9uY+IYnSKT1xCzbIlcccbeyUXzptm GspzC/IfdPLjYppxaEsoROdlsitjTlxgAxMaohEGWn1V7+A+nXGO+qeKgE0gYpawEOoQGm 1uGGOer9ERclfF/i+6TvvWeGAQt+IAZMaPRgHmrQ2QGb4pLGfK4a2vklBpBi3gtx99FqVf cKXEiSlqCvF9oR4KQx8gVXCZm9NJJ2Wf0csezAo5K9d5ZNqJJ0rCJGR5lUzS+6+60O35Y2 GCRaA7Hrx3HbSHGEAkcDoi9iWcXqXbT8tbR+Hnx22GSvk9tjwRnOJQoTb1ccQA== DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=linutronix.de; s=2020e; t=1642412040; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: in-reply-to:in-reply-to:references:references; bh=gUwYyjGRaOG1n9rddzpFHQxZYYxv3VHs0gt0bcZZRuA=; b=7ZpD5/huBQf6jeg4H2LeNre/AS5SE5cxbG3mRUmUd3MNrgOCHLvXnx41x1VfolCJMnI8jd GBDh9Id+n29bqnDQ== From: Sebastian Andrzej Siewior To: Xin Long Cc: Hyeonggon Yoo <42.hyeyoo@gmail.com>, LKML , linux-mm@kvack.org, Christoph Lameter , Pekka Enberg , David Rientjes , Joonsoo Kim , Andrew Morton , Vlastimil Babka , Antoine Tenart Subject: Re: [PATCH] mm: slub: fix a deadlock warning in kmem_cache_destroy Message-ID: References: <388098b2c03fbf0a732834fc01b2d875c335bc49.1642170196.git.lucien.xin@gmail.com> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline In-Reply-To: X-Rspamd-Queue-Id: 078372001C X-Stat-Signature: 7sx9fb5xe7fenji4ja5h496rek1uhgk5 Authentication-Results: imf13.hostedemail.com; dkim=pass header.d=linutronix.de header.s=2020 header.b=WBCWSuzo; dkim=pass header.d=linutronix.de header.s=2020e header.b="7ZpD5/hu"; dmarc=pass (policy=none) header.from=linutronix.de; spf=pass (imf13.hostedemail.com: domain of bigeasy@linutronix.de designates 193.142.43.55 as permitted sender) smtp.mailfrom=bigeasy@linutronix.de X-Rspamd-Server: rspam06 X-HE-Tag: 1642412042-870050 X-Bogosity: Ham, tests=bogofilter, spamicity=0.000000, version=1.2.4 Sender: owner-linux-mm@kvack.org Precedence: bulk X-Loop: owner-majordomo@kvack.org List-ID: On 2022-01-17 16:32:46 [+0800], Xin Long wrote: > another issue. From the code analysis, this issue does exist on the > upstream kernel, though I couldn't build an upstream RT kernel for the > testing. This should also reproduce in v5.16 since the commit in question is there. > > > CPU0 CPU1 > > > ---- ---- > > > cpus_read_lock() > > > kn->active++ > > > cpus_read_lock() [a] > > > wait until kn->active == 0 > > > > > > Although cpu_hotplug_lock is a RWSEM, [a] will not block in there. But as > > > lockdep annotations are added for cpu_hotplug_lock, a deadlock warning > > > would be detected: The cpu_hotplug_lock is a per-CPU RWSEM. The lock in [a] will block if there is a writer pending. > > > ====================================================== > > > WARNING: possible circular locking dependency detected > > > ------------------------------------------------------ > > > dmsetup/1832 is trying to acquire lock: > > > ffff986f5a0f9f20 (kn->count#144){++++}-{0:0}, at: kernfs_remove+0x1d/0x30 > > > > > > but task is already holding lock: > > > ffffffffa43817c0 (slab_mutex){+.+.}-{3:3}, at: kmem_cache_destroy+0x2a/0x120 > > > I tried to create & destroy a cryptarget which creates/destroy a cache via bio_put_slab(). Either the callchain is different or something else is but I didn't see a lockdep warning. Sebastian