Received: by 2002:a05:6a10:af89:0:0:0:0 with SMTP id iu9csp3354324pxb; Mon, 17 Jan 2022 18:24:43 -0800 (PST) X-Google-Smtp-Source: ABdhPJyB83xSldCsCnMNkYsaE3HIXJFjVIenhhc3OrpiT5RqL5mRjy7q31d9FmsceH5Vh3SBKBay X-Received: by 2002:a17:902:8a94:b0:14a:bb95:6a64 with SMTP id p20-20020a1709028a9400b0014abb956a64mr7782449plo.115.1642472683237; Mon, 17 Jan 2022 18:24:43 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1642472683; cv=none; d=google.com; s=arc-20160816; b=ftPFpHR0bqQ0/IlMS5d/wFO7LyzecG65hcr1fHD2O+FhTa4x7zuqB3BjuLV1OUBv0X 6GGvbZfFHyZJ1wcjbwo2LOpCCOTqwk41fq7z01EZ2Nf9hBnyWXUmQ0OVEZnPt0NaVUgu KLqVxbyr9FK3mbbXQvCSYpWzvu5o5pEYNYCcMmtJpWwuguVetVfM4q7hNfvIG9PxwWap zWzewtx3tVTrV9itXc9SHyo8VnjM/lbjrWo34xWbU5J/bI0oM2JdPiHPsL6znWHHVIaR LOug6Ju9yFJNZ5hnE995KVcNhML1EbOXEzl2ep7IaSDHSd5az9gA4W7/Pf7yjKfkPZDC zKQg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:in-reply-to:subject :from:references:cc:to:content-language:user-agent:mime-version:date :message-id:dkim-signature:dkim-signature; bh=ac5nyObxkkedzmWPxZXWjsCjSPwuhnK/aotnvT2TN1I=; b=0yliC9yhM0eim8lHXqgPp1Uh4oVJ2PbQY3Y5nu0Xh9gskFRPO7HpNKST5TN/jR3c26 lRB1nLeNkKv4Ov79emnxTnIpfDXKHYyDjvK+9dykEEegevLcZ8hvYTXAW0pGIXgSIW57 tXvJNQbjfZbyOPpPoETZMnAo+MXq/kjs9RIhJN6vuOsSyDGdvgv5fKjYA6A8VSzyBR8J 2kgB2tE2FPmBi64WRgOMTyrNxw93RpKTcbz9Op8Z3DLERMwPcbetWoB/VbEEYOS0b+xY 43rDR/ViK80p5OS3jWt9paioh/U9Kr70qaPl2dgDaxRJ3L6xG+T62fncpGuJXcmgudDo WPBw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@suse.cz header.s=susede2_rsa header.b=hRcfG3Bu; dkim=neutral (no key) header.i=@suse.cz header.s=susede2_ed25519 header.b=uJ0MvzKZ; 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 Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id z3si2497756pgv.504.2022.01.17.18.24.23; Mon, 17 Jan 2022 18:24:43 -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=@suse.cz header.s=susede2_rsa header.b=hRcfG3Bu; dkim=neutral (no key) header.i=@suse.cz header.s=susede2_ed25519 header.b=uJ0MvzKZ; 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 Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S237052AbiAQMk3 (ORCPT + 99 others); Mon, 17 Jan 2022 07:40:29 -0500 Received: from smtp-out1.suse.de ([195.135.220.28]:36712 "EHLO smtp-out1.suse.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S237036AbiAQMk2 (ORCPT ); Mon, 17 Jan 2022 07:40:28 -0500 Received: from imap2.suse-dmz.suse.de (imap2.suse-dmz.suse.de [192.168.254.74]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (P-521) server-digest SHA512) (No client certificate requested) by smtp-out1.suse.de (Postfix) with ESMTPS id 915E7212BF; Mon, 17 Jan 2022 12:40:27 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.cz; s=susede2_rsa; t=1642423227; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=ac5nyObxkkedzmWPxZXWjsCjSPwuhnK/aotnvT2TN1I=; b=hRcfG3BuBoCzCulb1co9DL14pIOMcijpy6BZOBmBLCy9VInL7g8rsps1lT0A2/M/xo6H3Q q4dkAo6xrcm+un9Gw4q0q8YKXG6mtOmayfkhgR4rerpFjYgJGk3gaS3o0MmRsE3C8QFb8r +RaqVVJDummCf4UE0ewOgrb/ysbqfRs= DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=suse.cz; s=susede2_ed25519; t=1642423227; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=ac5nyObxkkedzmWPxZXWjsCjSPwuhnK/aotnvT2TN1I=; b=uJ0MvzKZXpjYLQ8mn8jDnvRpNy6oNSXI1K2JyiK/DwFGH5s8ldnn3XYT/xl1xGPg8f/4Gg WZRkfTkZbVFY77CQ== Received: from imap2.suse-dmz.suse.de (imap2.suse-dmz.suse.de [192.168.254.74]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (P-521) server-digest SHA512) (No client certificate requested) by imap2.suse-dmz.suse.de (Postfix) with ESMTPS id 5FE7D13D3C; Mon, 17 Jan 2022 12:40:27 +0000 (UTC) Received: from dovecot-director2.suse.de ([192.168.254.65]) by imap2.suse-dmz.suse.de with ESMTPSA id xdWGFrtj5WEJJwAAMHmgww (envelope-from ); Mon, 17 Jan 2022 12:40:27 +0000 Message-ID: <39a3470f-06ab-cf41-32e4-80edb249c7d3@suse.cz> Date: Mon, 17 Jan 2022 13:40:27 +0100 MIME-Version: 1.0 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:91.0) Gecko/20100101 Thunderbird/91.4.1 Content-Language: en-US To: Sebastian Andrzej Siewior , Xin Long Cc: Hyeonggon Yoo <42.hyeyoo@gmail.com>, LKML , linux-mm@kvack.org, Christoph Lameter , Pekka Enberg , David Rientjes , Joonsoo Kim , Andrew Morton , Antoine Tenart , Clark Williams References: <388098b2c03fbf0a732834fc01b2d875c335bc49.1642170196.git.lucien.xin@gmail.com> From: Vlastimil Babka Subject: Re: [PATCH] mm: slub: fix a deadlock warning in kmem_cache_destroy In-Reply-To: Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 7bit Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org +CC Clark On 1/17/22 10:33, Sebastian Andrzej Siewior wrote: > 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. Yeah. I remember we had some issues with the commit during development, but I'd hope those were resolved and the commit that's ultimately merged got the fixes, see this subthread: https://lore.kernel.org/all/0b36128c-3e12-77df-85fe-a153a714569b@quicinc.com/ >> > > 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. RHEL-8 kernel seems to be 4.18, unless RT uses a newer one. Could be some silently relevant backport is missing? How about e.g. 59450bbc12be ("mm, slab, slub: stop taking cpu hotplug lock") ? > Sebastian