Received: by 2002:a05:6a10:af89:0:0:0:0 with SMTP id iu9csp2962374pxb; Mon, 17 Jan 2022 09:04:33 -0800 (PST) X-Google-Smtp-Source: ABdhPJwu6u4nHKM3M/pjgPDvs+q86bj2B6ZPOBMbxbydinBc1sXUH8MaEQRSBoPZQ2VManyd31s6 X-Received: by 2002:a63:1c56:: with SMTP id c22mr2949869pgm.595.1642439073193; Mon, 17 Jan 2022 09:04:33 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1642439073; cv=none; d=google.com; s=arc-20160816; b=kp1AbTbyCOfNWVasR1k0cFNZPEpJCHJz36168fYjHm9XhVtwlLBc3jlqRFhrs7bwzX PJO9B2zkCDorpDZzwvKixLvZ5zoVaGFjrAqDN8fIWgFanUJ++30c5TGc8VdGYJL4J9U/ qGTpf+D7TeVsa2IkTdXxDvTyoIT5LHpd8pKdeQGvwtP5EUl5Lcc1GZhWGf8gEHYRA6C4 Tw0tYdk9xJerVPQ8HRZd5La+6b6VOlBEzadxQZLKv8pzY/Q4MUZtHzxz72gHyMn78SRX v6+m3H5WmPHeKftTXqw0Z7fZOByUyMKVn2oHmqCn5+Z/RuY9gCNwT15bhEOVuIF3TVsE sJjw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:in-reply-to:content-disposition:mime-version :references:message-id:subject:cc:to:from:dkim-signature :dkim-signature:date; bh=gUwYyjGRaOG1n9rddzpFHQxZYYxv3VHs0gt0bcZZRuA=; b=YFBDeN6MepGK8+z4AvL/Z3YTj8rj91grUS0BajZNxta1YXxN1NMjHkD6bt00NYsI7O uZvpKFg9AQTpY+VZcniqC6JtowFX1yq8b6yUjFlsjFPUVLY+92cezUECrhULxZT32AaW vMueAFCJASe7Y5O6TXaVN0bqj+4pwr9Fg3SfZJJNL1cwvn43bXwnFfj6NnLvi/bRo1xE vhM5f2VR4h33vdtzgflzbxqf0aPpH2aKOXkQJhFqBt+HC7ILsJifyadbqi7BjEn2ACzB LAw+UzACGGW3ie4qbcOK4H0A4aSDGHWSLDKTd5RHKVTAr7ZXCWh6ZuPBWzamJu322uHa 3L9A== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linutronix.de header.s=2020 header.b=WBCWSuzo; dkim=neutral (no key) header.i=@linutronix.de header.s=2020e header.b="7ZpD5/hu"; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=linutronix.de Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id y10si3211319plr.186.2022.01.17.09.04.21; Mon, 17 Jan 2022 09:04:33 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@linutronix.de header.s=2020 header.b=WBCWSuzo; dkim=neutral (no key) header.i=@linutronix.de header.s=2020e header.b="7ZpD5/hu"; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=linutronix.de Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S235770AbiAQJeE (ORCPT + 99 others); Mon, 17 Jan 2022 04:34:04 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:55276 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231282AbiAQJeC (ORCPT ); Mon, 17 Jan 2022 04:34:02 -0500 Received: from galois.linutronix.de (Galois.linutronix.de [IPv6:2a0a:51c0:0:12e:550::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 429AFC061574 for ; Mon, 17 Jan 2022 01:34:02 -0800 (PST) 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: Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 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