Received: by 2002:a05:6359:c8b:b0:c7:702f:21d4 with SMTP id go11csp4174173rwb; Fri, 30 Sep 2022 14:08:42 -0700 (PDT) X-Google-Smtp-Source: AMsMyM64Oj6Lxq/rDanh/wJ3mxfggxFwKlO52N6k9EvQnLtJtKBkdfcxEBnKyW/ld52XDR/WEbUU X-Received: by 2002:a17:90b:4c8f:b0:202:bcbb:1984 with SMTP id my15-20020a17090b4c8f00b00202bcbb1984mr185859pjb.64.1664572122649; Fri, 30 Sep 2022 14:08:42 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1664572122; cv=none; d=google.com; s=arc-20160816; b=xPS6cV98C53e7+D3PF65e/Kxds5WUcQRsM1pLh4jiOd82vbhrbhZOJOIyISTss79Ln Icr0u3i1xk8eAgBblviVhzfoZqpTEtM31hPPjTmaXjgRdcQw6P0SXMtVxmPV84+rj1zb rxXzDYCd+1Wtezny+wndvaymMZyPJ2rH435dQ0wWy9lCYJ4r0N8/Oaj/o/dyDcy50ztK 1p/c/aHSXeHlSXkm7gZUEGKm921yQ7bLV1Y9z6WoxBoOAgPS9HthffLeFH9v2bo5IuLK zZumvQ6k571nN5LFwqXZcdYlOLqqxkDyflfUg88VkXXfiOgJHMzbjv1lDV3V8WUn0M0v 599w== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:in-reply-to:content-disposition :mime-version:references:message-id:subject:cc:to:from:date :dkim-signature; bh=GJcHGfGVCmktBV+LdVjLjV4qA2kilpmpBXZeIc/9ch0=; b=NN1oAk8IQ/wLLEJ2gWLpwEZNOLxp5/Hc43zeL4Qsjnd/JeYweZnVtXAhdK9fUs2CED Hn2KxBakDhRJex/xn7vzm/A9CqE7GDCiYU03UxY5HOWxl0UyihIDXDjd4FG7KJcfJt/4 31Lk9fKK/7n/Q7kR6sp5sXEclc825PFRiGe5StgoqI5WrwXhpIMHryLucEATBNbYwyiY uVaZl6ZH37Q14cqO73rRl585cu71PJR7sQmsMbbWArnigmsUGpdFXKda0Qfi/ocVAXKx gmwXLPlvrnO1VGh8ZDKLfuz9wrCYCgPHy9qX0HBlEJbHQHZof2bCTsJ11kfQDMBZ+myn zKNQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@infradead.org header.s=bombadil.20210309 header.b=MGpB9o6Q; 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=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id rm4-20020a17090b3ec400b002024f3f1f8bsi3779903pjb.70.2022.09.30.14.08.14; Fri, 30 Sep 2022 14:08:42 -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=@infradead.org header.s=bombadil.20210309 header.b=MGpB9o6Q; 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=NONE sp=NONE dis=NONE) header.from=kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231779AbiI3UaS (ORCPT + 99 others); Fri, 30 Sep 2022 16:30:18 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:49116 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231906AbiI3UaN (ORCPT ); Fri, 30 Sep 2022 16:30:13 -0400 Received: from bombadil.infradead.org (bombadil.infradead.org [IPv6:2607:7c80:54:3::133]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 98B517DF62; Fri, 30 Sep 2022 13:30:10 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=infradead.org; s=bombadil.20210309; h=Sender:In-Reply-To:Content-Type: MIME-Version:References:Message-ID:Subject:Cc:To:From:Date:Reply-To: Content-Transfer-Encoding:Content-ID:Content-Description; bh=GJcHGfGVCmktBV+LdVjLjV4qA2kilpmpBXZeIc/9ch0=; b=MGpB9o6QlKmJMZVXYY8TvYeEVc I3bdvalSwDMM3NfVDsGbWF9Tq0fMC1ddMhysrewEUkkY27tIk9TuS0Q9NqTKy+aPxrV3V+BfMnKA0 NsJeLAqL9O5ShJ8UbcuwmTmhK99Kk1CcdNqIHA+0OYZ4oZHZgcxqA9/mq/y8rff9BWVkjFKMMRUdY eLfu3FGMcSRQKwJMl4sDnokfVyQ4MiovexHBpOxFXDPK5tywGximpws7sZq9mss+HMnVF4SQJyPBW zC07nMnxRp/Ih2TkOkm48O9+XSj/A66VmgcMzQupSipZYBJUSQEy/2ZKnHc/RWx3iMwNXzvWdHyHU 70c0GF1A==; Received: from mcgrof by bombadil.infradead.org with local (Exim 4.94.2 #2 (Red Hat Linux)) id 1oeMeA-00BQ0O-6x; Fri, 30 Sep 2022 20:30:10 +0000 Date: Fri, 30 Sep 2022 13:30:10 -0700 From: Luis Chamberlain To: Petr Pavlu Cc: pmladek@suse.com, linux-modules@vger.kernel.org, linux-kernel@vger.kernel.org Subject: Re: [PATCH v2 2/2] module: Merge same-name module load requests Message-ID: References: <20220919123233.8538-1-petr.pavlu@suse.com> <20220919123233.8538-3-petr.pavlu@suse.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20220919123233.8538-3-petr.pavlu@suse.com> Sender: Luis Chamberlain X-Spam-Status: No, score=-4.0 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_EF,HEADER_FROM_DIFFERENT_DOMAINS, RCVD_IN_DNSWL_MED,SPF_HELO_NONE,SPF_NONE 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 On Mon, Sep 19, 2022 at 02:32:33PM +0200, Petr Pavlu wrote: > During a system boot, it can happen that the kernel receives a burst of > requests to insert the same module but loading it eventually fails > during its init call. Please take a look at kmod selftest lib/test_kmod.c and the respective shell selftest tools/testing/selftests/kmod/kmod.sh. Can you modify it to add support to reproduce this issue? > For instance, udev can make a request to insert > a frequency module for each individual CPU That seems stupid indeed, it would seem we should be able for sure to prevent such cases, it can't just be happening for frequency modules. > when another frequency module > is already loaded which causes the init function of the new module to > return an error. Holy smokes. > The module loader currently serializes all such requests, with the > barrier in add_unformed_module(). This creates a lot of unnecessary work > and delays the boot. Sure.. > This patch improves the behavior as follows: > * A check whether a module load matches an already loaded module is > moved right after a module name is determined. -EEXIST continues to be > returned if the module exists and is live, -EBUSY is returned if > a same-name module is going. OK nice. > * A new reference-counted shared_load_info structure is introduced to > keep track of duplicate load requests. Two loads are considered > equivalent if their module name matches. In case a load duplicates > another running insert, the code waits for its completion and then > returns -EEXIST or -EBUSY depending on whether it succeeded. Groovy. > Note that prior to 6e6de3dee51a ("kernel/module.c: Only return -EEXIST > for modules that have finished loading"), the kernel already did merge > some of same load requests but it was more by accident and relied on > specific timing. The patch brings this behavior back in a more explicit > form. I'm having a hard time with this, because it is not clear if you are suggesting this is a regression introduced by 6e6de3dee51a or not. I'd like you to evaluate the impact of *not* merging a fix to older kernels. In practice I think we'd end up with delays on boot, but is that all? Would boot ever fail? The commit log does not make that clear. The commit log should make it clear if this a regression or not and the impact of not having these fixes merged. Please not that bots will try to scrape for fixes and I suspect bots will pour their heart out on this commit log and identify and assume this if a fix already as-is. If this *is* a regression, we should try to see how perhaps we can split this up into a part which is mergable to stable and then a secondary part which does some new fancy optimizations. Luis