Received: by 2002:a05:6358:701b:b0:131:369:b2a3 with SMTP id 27csp3021834rwo; Mon, 24 Jul 2023 05:14:48 -0700 (PDT) X-Google-Smtp-Source: APBJJlFQwW1+EG9nQ/BSvbAA6xGhWQjA7nzOYvNIK/4r01vpPMQ00UHrfTfqtgsj4Ubec0cC+LsU X-Received: by 2002:a05:6a20:8e1a:b0:134:8d7f:f4d9 with SMTP id y26-20020a056a208e1a00b001348d7ff4d9mr13837256pzj.52.1690200888170; Mon, 24 Jul 2023 05:14:48 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1690200888; cv=none; d=google.com; s=arc-20160816; b=a3swe6SS5cZYrKhX11BEHfPvp+PHuTFuvi1ixNyAEOYateF3nLJCQzgzR+Oc0hM84X 9bJqOX6LvWWnvH9ytbeE0JQspY8f7y0Ur6XnCgGvjeDif6aYX2FXhHmpsEuhWDIgoCLr Gwotor6zH81mJvR0KvDQMBP9pEj3W9GBS32pDDTJFeUyBhlErIyQGSUUyIgD2EoTOZfR VzUVJLdKCe9ypFSFylLYDT8LU1sRCcfccBd1JytXThyJwdPwh5BAn1g2FI+Fqita0hAR 2fxskmQr7p+dw9OnEy7auhZLtT+3JQVVwLp348rHOiwwc5o7OqfprJEVwy6SS2mMSQ0s 2+/w== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :organization:references:in-reply-to:message-id:subject:cc:to:from :date:dkim-signature; bh=swBC1u58UcJrYvXzFzmEWYLfz7PfdG+uUqjDujcLpw8=; fh=81ndZ6+RHoV/lOtCpv+hQ26DSIlyEmTsnhcNK2Oj4x8=; b=UiyuBvD7JrFvPMc2HjJ4T0ofFT+7WQBgK3Mk3Qkc5J3Y2UbbEadA2Gi/W87rK0gdi8 bz5tSK+aQYyjkfNq7uhpSvP6bda+Y5hfZ/ccVyX1z5e/uczyWn5YkV99PG65XOR3XMDs sbaBNiE8AVGD6Ap7oBtOH6ADu3AJSXdwIwdfw/kNQwURubNLj2jBLZZ/IIyIvyNhTMZ2 GthzXrF5m9p0295y/lH3HUYYUc/PuWKV32QDiyJNVLgBU3XU0cmFsU2vok/oQIhh0ejt 6EOVIfvr2E/O1TMjP5Q6kqAAZrYwz1yxrgeEG3qbwhWtFzMLovw280E/4+8O1Kt5t6CI ifZQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@bootlin.com header.s=gm1 header.b=jwUbBSov; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=REJECT sp=REJECT dis=NONE) header.from=bootlin.com Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id k11-20020a170902c40b00b001b8c6890595si9393727plk.310.2023.07.24.05.14.35; Mon, 24 Jul 2023 05:14:48 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@bootlin.com header.s=gm1 header.b=jwUbBSov; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=REJECT sp=REJECT dis=NONE) header.from=bootlin.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230021AbjGXLv2 (ORCPT + 99 others); Mon, 24 Jul 2023 07:51:28 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:34244 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229547AbjGXLv0 (ORCPT ); Mon, 24 Jul 2023 07:51:26 -0400 Received: from relay7-d.mail.gandi.net (relay7-d.mail.gandi.net [IPv6:2001:4b98:dc4:8::227]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id E6A81E54; Mon, 24 Jul 2023 04:51:24 -0700 (PDT) Received: by mail.gandi.net (Postfix) with ESMTPSA id 13E6A2000B; Mon, 24 Jul 2023 11:51:18 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=bootlin.com; s=gm1; t=1690199482; 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: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=swBC1u58UcJrYvXzFzmEWYLfz7PfdG+uUqjDujcLpw8=; b=jwUbBSovrWXMt0eCf+HkdZX7N0TFiGd0HubR783jyVrAgPnQbPXrbhEdpWE8Xxk4eo09Kg QsnOipFtXqnjPamqsXHMrCzF0aotO/SGslxxUn4+VxO37tLz2INw2m0X2DFoJbeuOJrqDa tc8QcPRrSGSPbd7bQ/8VuTz3TB2Sya1mAtyvsGCCwpHqTJ+LELrhjfSX+w6GmhhYVYbZnO LENWRsxmvoCqSUpvIS9sS458ZNCtMkTec+iK2kREIIxkrur/qe4Kh2ri7jNWGjGUWA+Lp3 Cp2lOrxtXcLKwW2yVNOCFFv6R4A5fNa0HtvC6mSEA+sIcdmmaHPYwbosp/gb1w== Date: Mon, 24 Jul 2023 13:51:18 +0200 From: Miquel Raynal To: "Usyskin, Alexander" Cc: Fabrizio Castro , Richard Weinberger , Vignesh Raghavendra , "linux-mtd@lists.infradead.org" , "linux-kernel@vger.kernel.org" , "Winkler, Tomas" , "Lubart, Vitaly" , Andy Shevchenko , Geert Uytterhoeven , Biju Das , "linux-renesas-soc@vger.kernel.org" , Chris Paterson Subject: Re: [PATCH 1/2] mtd: use refcount to prevent corruption Message-ID: <20230724135118.54e39faf@xps-13> In-Reply-To: References: <20230620131905.648089-1-alexander.usyskin@intel.com> <20230620131905.648089-2-alexander.usyskin@intel.com> <20230715174112.3909e43f@xps-13> <20230716153926.5e975231@xps-13> Organization: Bootlin X-Mailer: Claws Mail 4.0.0 (GTK+ 3.24.33; x86_64-pc-linux-gnu) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: quoted-printable X-GND-Sasl: miquel.raynal@bootlin.com X-Spam-Status: No, score=-2.8 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_LOW,SPF_HELO_PASS, SPF_PASS,T_SCC_BODY_TEXT_LINE autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Hi Alexander, alexander.usyskin@intel.com wrote on Mon, 24 Jul 2023 11:43:59 +0000: > > > > > With this patch applied, when I load up the module, I get the sam= e 3 > > > > > devices: > > > > > /dev/mtd0 > > > > > /dev/mtd0ro > > > > > /dev/mtdblock0 > > > > > > > > > > Upon removal, the below 2 devices still hang around: > > > > > /dev/mtd0 > > > > > /dev/mtd0ro =20 > > > > =20 > > > Our use-case do not produce mtdblock, maybe there are some imbalances= =20 > > of get/put? =20 > > > I have somewhere version with pr_debug after every kref_get/put. That= may =20 > > help to catch where =20 > > > it missed, I hope. =20 > >=20 > > I believe mtdblock is the good citizen here. Just disable > > CONFIG_MTD_BLOCK from your configuration and you will likely observe > > the same issue, just a bit narrowed, perhaps. Indeed, if you manage to > > follow all the get/put calls it can help to find an imbalance. > >=20 > > Thanks, > > Miqu=C3=A8l =20 >=20 > Miquel, do you have CONFIG_MTD_PARTITIONED_MASTER set in your config? Not sure I get your question. You can enable or disable it, it should work in both cases (yet, the handling is of course a bit different as the top level device will be retained/not retained). Thanks, Miqu=C3=A8l