Received: by 2002:a05:6358:3188:b0:123:57c1:9b43 with SMTP id q8csp3880387rwd; Mon, 29 May 2023 19:08:19 -0700 (PDT) X-Google-Smtp-Source: ACHHUZ6MPqUnVxrm/DeO+VOFqxZM1C8oMXB1s1swOdD7bIRVU+wLAAJQyJyZ/RsnJip/8fB6qXO+ X-Received: by 2002:a05:6a00:2e25:b0:646:ec88:998c with SMTP id fc37-20020a056a002e2500b00646ec88998cmr675767pfb.15.1685412499290; Mon, 29 May 2023 19:08:19 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1685412499; cv=none; d=google.com; s=arc-20160816; b=ZfPmTA3zvy5Wbk1Rj8vKo7pALau0dJvCyLLRnqhF/pb4GP5jaXK565CcrVvhaq/Buv G+Z+BV9hmCBzJ8XPXag/9mnVmmiLcWa4BNLmZKfiwBr4PHLgVu08Hvh740xTbziIDOo1 RFJRayUbz2J+C5TG/z/QawoLE/mWvxgHVipXA0CDJoyVFoREems6eoUdQvzj67KeUDB4 7Kfpg5R0KzFkXNTv4uv2nepBy46lwC6mGbq9lbJPtIK4IRCC325HWR3f0TTpRmTW8oxf N42RPiaaFaBHr5aHhv8GsrAy+cBQmLDHNyEasY+EW6g/jBxx177L55kxtGSUxhDivZJM SAQw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:cc:to:subject:message-id:date:from:in-reply-to :references:mime-version:dkim-signature; bh=qep/fhA3jgUMujeeTKyTERwp6K6SL5nBAck6MsjUsdI=; b=gKTy6EEys5hagkkbHVOF6OtafChPiVndDq6ZB19cy27aoM1lr3bTo3hXT7DgK/E0tU ifgnZaG+2yYQzYaTht33HAsyxlV+smEUpdRcUumhnwKzJfkdpiejrnb+v4ABydD59Uvu sq84sfcc5GYc46onReS3X+g7gK4cjhVW5c8VIvOiw7dPpcZWkmDIo+ZXb9zX2zm+y0gM +m8c2TJezvi6St07Oo60QGqm0DU+2tucpMyYENbgvQqdGkoRJCKrZNwvtXxmwjlxOdEK +8db3STiUnd5FHb5pXZHMo0d6mZeZVn4MKHiaXn+c00I4pc+b9lXhqjav/mI1zS1Yf5e h7mg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linux-foundation.org header.s=google header.b=EnbV6tkF; 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 Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id f127-20020a625185000000b0064cce871b49si863833pfb.137.2023.05.29.19.08.07; Mon, 29 May 2023 19:08:19 -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=@linux-foundation.org header.s=google header.b=EnbV6tkF; 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 Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230055AbjE3B6L (ORCPT + 99 others); Mon, 29 May 2023 21:58:11 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:39646 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229895AbjE3B6H (ORCPT ); Mon, 29 May 2023 21:58:07 -0400 Received: from mail-ed1-x536.google.com (mail-ed1-x536.google.com [IPv6:2a00:1450:4864:20::536]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 8DB36120 for ; Mon, 29 May 2023 18:57:34 -0700 (PDT) Received: by mail-ed1-x536.google.com with SMTP id 4fb4d7f45d1cf-5147f4bbfdaso4850304a12.0 for ; Mon, 29 May 2023 18:57:34 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linux-foundation.org; s=google; t=1685411755; x=1688003755; h=cc:to:subject:message-id:date:from:in-reply-to:references :mime-version:from:to:cc:subject:date:message-id:reply-to; bh=qep/fhA3jgUMujeeTKyTERwp6K6SL5nBAck6MsjUsdI=; b=EnbV6tkFbBc2CAQA8IMy/MxWCnRDxz7zBaDq5Hkjzbj2Rif9SoArsIaB+7Locsdl1D dMOUH3IguEpwrMXzczClYnLMN3QhmEHSXhGUMBXNF6E2fHv2wIbq06ANedm42ExC9a72 BBOYlN9NdYMzf+IQ8rz8SSLN+m46FuaSHpswQ= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1685411755; x=1688003755; h=cc:to:subject:message-id:date:from:in-reply-to:references :mime-version:x-gm-message-state:from:to:cc:subject:date:message-id :reply-to; bh=qep/fhA3jgUMujeeTKyTERwp6K6SL5nBAck6MsjUsdI=; b=AT5qqZaOaJQvzerUtG7GHzKV8jFG4SHLQ4ulYrH1caIe/VRXq3jEipSK151dGl1Kpo pktnJhwRdlWjIJMXgQUVulrNdoSyqSWpkoOheXX3m5clsaJPSEVU2t1f04Zv5ctyCX4/ uyHBwNApZxox4bg/TXMyOYcub7d//dTgET/Q/yRkYZwblMIfyF0JhW8ybV7qlLHWjuL6 TSLUORhybEL7WJS91Bt/Xurgtka2XpWM5NA0xCg2f0e0sXElgsV8+R+x9La/ERgTzKgx EN2QiELjTgs6y7hyKHaBC1PHOfIzGgkCcLzmtSCPnN+MgjLFt1wwk/T/lx0RGGrFWZBT sJug== X-Gm-Message-State: AC+VfDzDs5WeedkvmlE9+A5Bg/HQxDKj1l/OCPKidkU0uxnXYxUY9SVj Z9mbdiUgwAHHqF4TdeT7o6XOFPtHzL/TijW/LmdeXGIR X-Received: by 2002:aa7:ce0c:0:b0:514:9422:37db with SMTP id d12-20020aa7ce0c000000b00514942237dbmr346530edv.39.1685411755194; Mon, 29 May 2023 18:55:55 -0700 (PDT) Received: from mail-ej1-f44.google.com (mail-ej1-f44.google.com. [209.85.218.44]) by smtp.gmail.com with ESMTPSA id j2-20020a50ed02000000b0050bc4600d38sm3280406eds.79.2023.05.29.18.55.53 for (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Mon, 29 May 2023 18:55:54 -0700 (PDT) Received: by mail-ej1-f44.google.com with SMTP id a640c23a62f3a-96f6a9131fdso586767266b.1 for ; Mon, 29 May 2023 18:55:53 -0700 (PDT) X-Received: by 2002:a17:907:26c7:b0:973:92d4:9f4e with SMTP id bp7-20020a17090726c700b0097392d49f4emr754163ejc.53.1685411732076; Mon, 29 May 2023 18:55:32 -0700 (PDT) MIME-Version: 1.0 References: <20230524213620.3509138-3-mcgrof@kernel.org> <8fc5b26b-d2f6-0c8f-34a1-af085dbef155@suse.com> <6gwjomw6sxxmlglxfoilelswv4hgygqelomevb4k4wrlrk3gtm@wrakbmwztgeu> In-Reply-To: From: Linus Torvalds Date: Mon, 29 May 2023 21:55:15 -0400 X-Gmail-Original-Message-ID: Message-ID: Subject: Re: [PATCH 2/2] module: add support to avoid duplicates early on load To: Johan Hovold Cc: Luis Chamberlain , Lucas De Marchi , Petr Pavlu , gregkh@linuxfoundation.org, rafael@kernel.org, song@kernel.org, lucas.de.marchi@gmail.com, christophe.leroy@csgroup.eu, peterz@infradead.org, rppt@kernel.org, dave@stgolabs.net, willy@infradead.org, vbabka@suse.cz, mhocko@suse.com, dave.hansen@linux.intel.com, colin.i.king@gmail.com, jim.cromie@gmail.com, catalin.marinas@arm.com, jbaron@akamai.com, rick.p.edgecombe@intel.com, yujie.liu@intel.com, david@redhat.com, tglx@linutronix.de, hch@lst.de, patches@lists.linux.dev, linux-modules@vger.kernel.org, linux-mm@kvack.org, linux-kernel@vger.kernel.org, pmladek@suse.com, prarit@redhat.com, lennart@poettering.net Content-Type: multipart/mixed; boundary="0000000000009785e105fcdf7f38" X-Spam-Status: No, score=-1.8 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS, RCVD_IN_DNSWL_NONE,SPF_HELO_NONE,SPF_PASS,T_SCC_BODY_TEXT_LINE, URIBL_BLOCKED autolearn=no 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 --0000000000009785e105fcdf7f38 Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable On Mon, May 29, 2023 at 11:18=E2=80=AFAM Johan Hovold wr= ote: > > I took a closer look at some of the modules that failed to load and > noticed a pattern in that they have dependencies that are needed by more > than one device. Ok, this is a "maybe something like this" RFC series of two patches - one trivial one to re-organize things a bit so that we can then do the real one which uses a filter based on the inode pointer to return an "idempotent return value" for module loads that share the same inode. It's entirely untested, and since I'm on the road I'm going to not really be able to test it. It compiles for me, and the code looks fairly straightforward, but it's probably buggy. It's very loosely based on Luis' attempt, but it (a) is internal to module loading (b) uses a reliable cookie (c) doesn't leave the cookie around randomly for later (d) has seen absolutely no testing Put another way: if somebody wants to play with this, please treat it as a starting point, not the final thing. You might need to debug things, and fix silly mistakes. The idea is to just have a simple hash list of currently executing module loads, protected by a trivial spinlock. Every module loader adds itself to the right hash list, and if they were the *first* one (ie no other pending module loads for that inode), will actually do the module load. Everybody who *isn't* the first one will just wait for completion and return the same error code that the first one returned. This is technically bogus. The first one might fail due to arguments. So the cookie shouldn't be just the inode, it should be the inode and a hash of the arguments or something like that. But it is what it is, and apart from possible show-stopper bugs this is no worse than the failed "exclusive write deny" attempt. IOW - maybe worth trying? And if *that* didn't sell people on this patch series, I don't know what will. I should be in marketing! Two drink minimums, here I come! Linus --0000000000009785e105fcdf7f38 Content-Type: text/x-patch; charset="US-ASCII"; name="0001-module-split-up-finit_module-into-init_module_from_f.patch" Content-Disposition: attachment; filename="0001-module-split-up-finit_module-into-init_module_from_f.patch" Content-Transfer-Encoding: base64 Content-ID: X-Attachment-Id: f_li9mlfcx0 RnJvbSBiN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ygiZmluaXRfbW9kdWxlOiBmZD0lZCwgdWFyZ3M9 JXAsIGZsYWdzPSVpXG4iLCBmZCwgdWFyZ3MsIGZsYWdzKTsKKworCWlmIChmbGFncyAmIH4oTU9E VUxFX0lOSVRfSUdOT1JFX01PRFZFUlNJT05TCisJCSAgICAgIHxNT0RVTEVfSU5JVF9JR05PUkVf VkVSTUFHSUMKKwkJICAgICAgfE1PRFVMRV9JTklUX0NPTVBSRVNTRURfRklMRSkpCisJCXJldHVy biAtRUlOVkFMOworCisJZiA9IGZkZ2V0KGZkKTsKKwllcnIgPSBpbml0X21vZHVsZV9mcm9tX2Zp bGUoZi5maWxlLCB1YXJncywgZmxhZ3MpOworCWZkcHV0KGYpOworCXJldHVybiBlcnI7Cit9CisK IC8qIEtlZXAgaW4gc3luYyB3aXRoIE1PRFVMRV9GTEFHU19CVUZfU0laRSAhISEgKi8KIGNoYXIg Km1vZHVsZV9mbGFncyhzdHJ1Y3QgbW9kdWxlICptb2QsIGNoYXIgKmJ1ZiwgYm9vbCBzaG93X3N0 YXRlKQogewotLSAKMi40MC4wLnJjMS4yLmdkMTU2NDRmZTAyCgo= --0000000000009785e105fcdf7f38 Content-Type: text/x-patch; charset="US-ASCII"; name="0002-modules-catch-concurrent-module-loads-take-two.patch" Content-Disposition: attachment; filename="0002-modules-catch-concurrent-module-loads-take-two.patch" Content-Transfer-Encoding: base64 Content-ID: X-Attachment-Id: f_li9mlkax1 RnJvbSBjODQ0MDk5YWI0ZDMwMzI0MjRiNGJmODcyMGU3NjFmYmNjZjg4ZWE1IE1vbiBTZXAgMTcg MDA6MDA6MDAgMjAwMQpGcm9tOiBMaW51cyBUb3J2YWxkcyA8dG9ydmFsZHNAbGludXgtZm91bmRh dGlvbi5vcmc+CkRhdGU6IE1vbiwgMjkgTWF5IDIwMjMgMjE6Mzk6NTEgLTA0MDAKU3ViamVjdDog W1BBVENIIDIvMl0gbW9kdWxlczogY2F0Y2ggY29uY3VycmVudCBtb2R1bGUgbG9hZH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