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 alsa0.perex.cz (alsa0.perex.cz [77.48.224.243]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 67D14C433F5 for ; Sat, 30 Apr 2022 13:39:28 +0000 (UTC) Received: from alsa1.perex.cz (alsa1.perex.cz [207.180.221.201]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by alsa0.perex.cz (Postfix) with ESMTPS id B83E4F3; Sat, 30 Apr 2022 15:38:35 +0200 (CEST) DKIM-Filter: OpenDKIM Filter v2.11.0 alsa0.perex.cz B83E4F3 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=alsa-project.org; s=default; t=1651325965; bh=FzJFz5nQnOEB7AB6Bbc1j8nS92uMjFglrLsFGFrMKzw=; h=Date:From:To:Subject:In-Reply-To:References:Cc:List-Id: List-Unsubscribe:List-Archive:List-Post:List-Help:List-Subscribe: From; b=dh9e8rHOT4b9MLQAAqq3ugWgnVqHh1yYO94//lEMDZBSbw5JCg64GRHjbKoIgnEVl +7Ru6z039kD69xj9nFXpPWUof5TvrW3tWBwt8v58XRLUh+RZAUkg3tjOFIWSDB3x9s 6ZxLDB5mmXRhgUGgC4dFczfIQwkkHEFy+91V/85Y= Received: from alsa1.perex.cz (localhost.localdomain [127.0.0.1]) by alsa1.perex.cz (Postfix) with ESMTP id 377C8F80128; Sat, 30 Apr 2022 15:38:35 +0200 (CEST) Received: by alsa1.perex.cz (Postfix, from userid 50401) id 86732F8012A; Sat, 30 Apr 2022 15:38:33 +0200 (CEST) Received: from dfw.source.kernel.org (dfw.source.kernel.org [IPv6:2604:1380:4641:c500::1]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by alsa1.perex.cz (Postfix) with ESMTPS id 5AFB3F80121 for ; Sat, 30 Apr 2022 15:38:26 +0200 (CEST) DKIM-Filter: OpenDKIM Filter v2.11.0 alsa1.perex.cz 5AFB3F80121 Authentication-Results: alsa1.perex.cz; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b="jlSMgCul" Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id 9088260B43; Sat, 30 Apr 2022 13:38:24 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id CA220C385AA; Sat, 30 Apr 2022 13:38:18 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1651325904; bh=FzJFz5nQnOEB7AB6Bbc1j8nS92uMjFglrLsFGFrMKzw=; h=Date:From:To:Cc:Subject:In-Reply-To:References:From; b=jlSMgCulySK0sR8W6lTjvw+WKsHy9h2dvPSn/5YMc2Ov1/C/vSQeLPrh3/hxq3C2S 3IgkIw0WSNTct9hBvrXmgMyELaYee9X3mtIvkZ2yTAPC2v3ej3vzF8gFH8UU44MXbw KAqWgwhvW5Kb+28/T9aQZOdeMKDQxhCoyaDM5Rc4HmIJ7hWl19h6P1Gfv/gEy6VuWa AFwi7dJptexzaE2VQYSiaVEgvKpTyAV4wyKOTlFHh6sphvpGPBihxxB6k6TaJew2RL kkHhZDiMzx49PBfmL29bVUZATY3SHGlyUfdYempi/ByrrXPMeyQ9uc+WWBkNDMAlQp uxkJBLqr/FN2w== Date: Sat, 30 Apr 2022 14:38:14 +0100 From: Mauro Carvalho Chehab To: Greg KH Subject: Re: [PATCH v2 1/2] module: update dependencies at try_module_get() Message-ID: <20220430143814.7184bd93@sal.lan> In-Reply-To: References: <3c7547d551558c9da02038dda45992f91b1f5141.1651314499.git.mchehab@kernel.org> X-Mailer: Claws Mail 4.0.0 (GTK+ 3.24.31; x86_64-redhat-linux-gnu) MIME-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit Cc: alsa-devel@alsa-project.org, mauro.chehab@linux.intel.com, David Airlie , linux-kernel@vger.kernel.org, intel-gfx@lists.freedesktop.org, Lucas De Marchi , Takashi Iwai , dri-devel@lists.freedesktop.org, Kai Vehmanen , Luis Chamberlain , Daniel Vetter , Dan Williams , linux-modules@vger.kernel.org, Pierre-Louis Bossart X-BeenThere: alsa-devel@alsa-project.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: "Alsa-devel mailing list for ALSA developers - http://www.alsa-project.org" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: alsa-devel-bounces@alsa-project.org Sender: "Alsa-devel" Em Sat, 30 Apr 2022 14:04:59 +0200 Greg KH escreveu: > On Sat, Apr 30, 2022 at 11:30:58AM +0100, Mauro Carvalho Chehab wrote: > Did you run checkpatch on this? Please do :) > > > + > > + if (mod == this) > > + return 0; > > How can this happen? > When people mistakenly call try_module_get(THIS_MODULE)? Yes. There are lots of place where this is happening: $ git grep try_module_get\(THIS_MODULE|wc -l 82 > We should > throw up a big warning when that happens anyway as that's always wrong. > > But that's a different issue from this change, sorry for the noise. It sounds very weird to use try_module_get(THIS_MODULE). We could add a WARN_ON() there - or something similar - but I would do it on a separate patch. > > > + > > + mutex_lock(&module_mutex); > > + > > + ret = ref_module(this, mod); > > + > > +#ifdef CONFIG_MODULE_UNLOAD > > + if (ret) > > + goto ret; > > + > > + ret = sysfs_create_link(mod->holders_dir, > > + &this->mkobj.kobj, this->name); > > Meta comment, why do we only create links if we can unload things? Good question. I don't know for certain. This is the already existing pattern at add_usage_links() - see kernel/module/sysfs.c. Also, lsmod uses sysfs links when showing dependencies. Regards, Mauro