Received: by 2002:a05:7412:b10a:b0:f3:1519:9f41 with SMTP id az10csp1606523rdb; Sat, 2 Dec 2023 02:40:57 -0800 (PST) X-Google-Smtp-Source: AGHT+IERqMcJmuQ/bBpNP8inDRqEU1QbMvIgxglbJX1ibiMUVTA+BEOd/W1/HRKDEHx6NDDSNlvJ X-Received: by 2002:a05:620a:2613:b0:77e:fba3:81d7 with SMTP id z19-20020a05620a261300b0077efba381d7mr1225317qko.109.1701513656764; Sat, 02 Dec 2023 02:40:56 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1701513656; cv=none; d=google.com; s=arc-20160816; b=aUYMWQ4Ez4qncOoZrRMqhhvIcoaVAqccp2kmGjxt6z9VkCd9OC61p7YgyrDP9rXOuK vXd994ibMpMbsne3IFQWj406rwZDTpsHx06OPv7NHclAmgzoc8q0QhsfwTKEwNPd06Tq l8JOQcShNbEzlhQRw/hBdw6obkmMX8m7W0K1JMY3eehLjneB9qACpyNoHzQBL1YZ1tfu YyrxfX+P3hAyOHsZWw/okRGscmQgho5Vi+w8Zzem6rVz/zO5JCHrua++WsxA8/ZCho6V f85lf3xh6wsSA3s85dFuKCcu73RK/uErdhAiiwD1m0kUe07VOfc4MJoUqIpslUb0Xuv9 znWA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=mime-version:list-unsubscribe:list-subscribe:list-id:precedence :user-agent:content-transfer-encoding:references:in-reply-to:date:cc :to:from:subject:message-id:dkim-signature; bh=UrYSUWtR9hmePrOrhJRLWibt7ZulRWhgkGXJBEj7lv8=; fh=D/kt7t6fpVKqBYky+dc3jBPl27K1qNyGNqZUbKlmXGo=; b=H1uD3Nh9EcBBiM4Fqwpq7tatQyXL3QEi+48XDlxXzRuwNhlRiRr8FG6vz5hT3ItLQK DSbiNYM+m1ejdS9sHyb34uBdTfH9myr0cihR8+TbX6vvcuy9M5v3kgW6g8szzHVVmKvQ lcwmqobPpddOcEyFwQ27Lv7DLIdomq5LacXW1vP8ww1hpErNhKTz4Oc+s9B2mFRMkuLx x8BdQLCuBZM7y9IdnMr4OR+6aUgrNDTZ/5tqx8I1TlHb1PptT9U+NPwcMsbcWmHAWQbE P7I+/rZOCPuWlaSlfuYc1x43YZ3+Njh5VGFk6tPx1YY9OCRR+kSgtFJUTbdGObLM0N42 APYg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@sipsolutions.net header.s=mail header.b=w0SVGWs5; spf=pass (google.com: domain of linux-wireless+bounces-324-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.199.223 as permitted sender) smtp.mailfrom="linux-wireless+bounces-324-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=REJECT dis=NONE) header.from=sipsolutions.net Return-Path: Received: from ny.mirrors.kernel.org (ny.mirrors.kernel.org. [147.75.199.223]) by mx.google.com with ESMTPS id dt43-20020a05620a47ab00b007742b030641si5022161qkb.753.2023.12.02.02.40.56 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 02 Dec 2023 02:40:56 -0800 (PST) Received-SPF: pass (google.com: domain of linux-wireless+bounces-324-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.199.223 as permitted sender) client-ip=147.75.199.223; Authentication-Results: mx.google.com; dkim=pass header.i=@sipsolutions.net header.s=mail header.b=w0SVGWs5; spf=pass (google.com: domain of linux-wireless+bounces-324-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.199.223 as permitted sender) smtp.mailfrom="linux-wireless+bounces-324-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=REJECT dis=NONE) header.from=sipsolutions.net Received: from smtp.subspace.kernel.org (wormhole.subspace.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ny.mirrors.kernel.org (Postfix) with ESMTPS id 6F4021C2095C for ; Sat, 2 Dec 2023 10:40:56 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id DC1F6156E0; Sat, 2 Dec 2023 10:40:51 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=sipsolutions.net header.i=@sipsolutions.net header.b="w0SVGWs5" X-Original-To: linux-wireless@vger.kernel.org Received: from sipsolutions.net (s3.sipsolutions.net [IPv6:2a01:4f8:242:246e::2]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 6A5F2123; Sat, 2 Dec 2023 02:40:47 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=sipsolutions.net; s=mail; h=MIME-Version:Content-Transfer-Encoding: Content-Type:References:In-Reply-To:Date:Cc:To:From:Subject:Message-ID:Sender :Reply-To:Content-ID:Content-Description:Resent-Date:Resent-From:Resent-To: Resent-Cc:Resent-Message-ID; bh=UrYSUWtR9hmePrOrhJRLWibt7ZulRWhgkGXJBEj7lv8=; t=1701513647; x=1702723247; b=w0SVGWs5JzHgMg2UK6rKAhmOL+wtjJmRoNMsdmOIf71WAzw luxjkHbWQbQ16TmIdKxMxqDiMs+V6o6gY6BII6TSK0VntOw+MJCIAAOBP8v40qFdvcGZEOOHzjwOi dJSRMW5jBuAHYSXmk0+8epVOzF6Hm4Wawfa7LCoeKe2ZwBB98tukI+0s1TZUyvGGc/Ope8bXzj4FV oQqKF19T7IX2jR++MHPIMsrVreDGuDn7H4ja0qFo8ACdlsjPRWFkJPJq2XNATFC/FzUAbxYUF3vAu k49ru1dc2zpsmW3Qe6HgZ3lm1bzmbyx/oV6PWv8phm4JGOYd9OVpae8vpsilE8+A==; Received: by sipsolutions.net with esmtpsa (TLS1.3:ECDHE_X25519__RSA_PSS_RSAE_SHA256__AES_256_GCM:256) (Exim 4.97) (envelope-from ) id 1r9NQS-0000000CQpO-49ZI; Sat, 02 Dec 2023 11:40:45 +0100 Message-ID: <9ffaef32a70d3ba5cd015ec22cf8437cd7c80e79.camel@sipsolutions.net> Subject: Re: [RFC PATCH 2/6] debugfs: annotate debugfs handlers vs. removal with lockdep From: Johannes Berg To: Sergey Senozhatsky Cc: linux-wireless@vger.kernel.org, linux-kernel@vger.kernel.org, linux-fsdevel@vger.kernel.org, Greg Kroah-Hartman , "Rafael J. Wysocki" , Nicolai Stange , Ben Greear , Minchan Kim Date: Sat, 02 Dec 2023 11:40:43 +0100 In-Reply-To: <20231202063735.GD404241@google.com> References: <20231109212251.213873-7-johannes@sipsolutions.net> <20231109222251.a62811ebde9b.Ia70a49792c448867fd61b0234e1da507b0f75086@changeid> <20231202063735.GD404241@google.com> Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable User-Agent: Evolution 3.48.4 (3.48.4-1.fc38) Precedence: bulk X-Mailing-List: linux-wireless@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-malware-bazaar: not-scanned On Sat, 2023-12-02 at 15:37 +0900, Sergey Senozhatsky wrote: > On (23/11/09 22:22), Johannes Berg wrote: > > From: Johannes Berg > >=20 > > When you take a lock in a debugfs handler but also try > > to remove the debugfs file under that lock, things can > > deadlock since the removal has to wait for all users > > to finish. > >=20 > > Add lockdep annotations in debugfs_file_get()/_put() > > to catch such issues. >=20 > So this triggers when I reset zram device (zsmalloc compiled with > CONFIG_ZSMALLOC_STAT). I shouldn't have put that into the rc, that was more or less an accident. I think I'll do a revert. > debugfs_create_file() and debugfs_remove_recursive() are called > under zram->init_lock, and zsmalloc never calls into zram code. > What I don't really get is where does the > `debugfs::classes -> zram->init_lock` > dependency come from? "debugfs:classes" means a file is being accessed and "classes" is the name, so that's=20 static int zs_stats_size_show(struct seq_file *s, void *v) which uses seq_file, so there we have a seq_file lock. I think eventually the issue is that lockdep isn't telling the various seq_file instances apart, and you have one that's removed under lock (classes) and another one that's taking the lock (reset). Anyway, I'll send a revert, don't think this is ready yet. I was fixing the wireless debugfs lockdep and had used that to debug it. johannes