Received: by 2002:a05:6358:1087:b0:cb:c9d3:cd90 with SMTP id j7csp1792629rwi; Sat, 15 Oct 2022 03:12:17 -0700 (PDT) X-Google-Smtp-Source: AMsMyM7PHJQqi214fuqlBXs1Ff+ebVv05oUQNlvUaeEvMafbGlG0DVMZCqumTfOiI1PV3+4b6hf4 X-Received: by 2002:a17:907:6ea1:b0:78d:4c16:a68b with SMTP id sh33-20020a1709076ea100b0078d4c16a68bmr1523682ejc.447.1665828737352; Sat, 15 Oct 2022 03:12:17 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1665828737; cv=pass; d=google.com; s=arc-20160816; b=UchCnwk0Vcluc/m2IMQu/OkrQ4SKlGmgZO81JT2vsfviW8Uzg8M2lYyJV5zcrCoE06 A8m4eLSuQ0IwTzWtkDa2beHs65EE8OwyOrQpxS5RwsFtKUuxB27L20tWepkmADHIp7zD S+YAHZT6lW/MTn+x9/meZwfgy8qdZ8XhQL0a2rPPMvhoYOvw5Y6a78sqjfEt6T201n53 KvZ/qqe/z4DR6kxs1esnszWJ7mEXUnzsve2ltz/Lnyn3mCOdHvKZWQFpdj7REWmkbOoa mS8W/qZZNclSuCwbI0mjU1qQt/kabBHbBTQ4Puh18TIQDvruQ4YQHnpbAUHeReYTo8ei QKyQ== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:mime-version:content-transfer-encoding :in-reply-to:from:references:cc:to:content-language:subject :user-agent:date:message-id:dkim-signature; bh=b0q3cEL5CmMh9a8UEAFrTkmT6aShTa8n3uwryV4bUaU=; b=Rmnk784T3FcclhYSy5VpiatkpxmxYt1UGPXDANfaAldbqkexnCeh69nT1O+mGXpGYz GpA3nK3vFC66E0XZ1MjibM29Hg9vqtHsg78AkUxRuIw1YHarfulH9chhU+d+Vrc+vApS 8zEEqfyJpBkEzqyxdFrnw3QWuqbTQp11WFe1GdNpGLyvbzwGp0AGS2JzsF1SghUff0rL 3LMx60fgCBLo39dgRcA7J6uvJDjPwIoi/3H8R/Uu6kracX2CdyRbgnUq6i7twSlIFbO1 yh1s+1kXjHxOz/B0GFZu7/OG0plrCZhjO770sNrHO4+KJmCrZvJ5hWhIeAS7+wlOMOOo 8R/g== ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@suse.com header.s=selector1 header.b=pA26s6YJ; arc=pass (i=1 spf=pass spfdomain=suse.com dkim=pass dkdomain=suse.com dmarc=pass fromdomain=suse.com); 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=QUARANTINE sp=QUARANTINE dis=NONE) header.from=suse.com Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id sd42-20020a1709076e2a00b0078dcdbb3e87si4372124ejc.530.2022.10.15.03.11.40; Sat, 15 Oct 2022 03:12:17 -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=@suse.com header.s=selector1 header.b=pA26s6YJ; arc=pass (i=1 spf=pass spfdomain=suse.com dkim=pass dkdomain=suse.com dmarc=pass fromdomain=suse.com); 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=QUARANTINE sp=QUARANTINE dis=NONE) header.from=suse.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229748AbiJOJtz (ORCPT + 99 others); Sat, 15 Oct 2022 05:49:55 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:50730 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229573AbiJOJtx (ORCPT ); Sat, 15 Oct 2022 05:49:53 -0400 Received: from EUR05-AM6-obe.outbound.protection.outlook.com (mail-am6eur05on2045.outbound.protection.outlook.com [40.107.22.45]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id D1EB2101CE; Sat, 15 Oct 2022 02:49:50 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=GUWkKLpq0gHov4fEpr8k9myj6j6YOcgSxTe4VcXMkWvQrXA6qVlXmCJtns8j+kiEBd1IDPWZTM9o1HysN5BHb3s866CA0EsAHXTx3PvFZcYbQ84RAASOMpZaOz0BxZtup7VbqLw7GmmnwRmNLqpzSlgg3GXzmsBcZNvSL9oEXxVTwls0Wg5yxTM051wnYfEbXz9j1E7he+Nwrkq1VdgN+E7uo6uldsgUgIqWIu5Vn3KOmJT6DZp1IY1WFgIIyRFryHsKHB8fSD3qxvs2C3ZKfuLt6XAhKyu02fvepKdu/o7KV7nXdNVQ1acO66rz5qDdRjUIpHpA3ad7SUlS6iVpQA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=b0q3cEL5CmMh9a8UEAFrTkmT6aShTa8n3uwryV4bUaU=; b=Nbd+XAAb/IkmjLEjdYAsh6w7GcmREGffSxvP3SuyPs45nmYfohXnM1IJ3PqhCcUZaOx60KBvzBaWIZIrEiKLQmyguVCb9nHAsFGGG8S9FrCfjcNNdcg6usPm/SX0ov3wGOpOex5dcqJ8G7CU72cGxDFCW6JDEeJVOBC0pVUNdWkw8JVM/RonrV6zNdIHXJpGIwjPgmTwLYOzQyelKSaNfQiNyB3JV5MRRcSzIvUY70EhdEa5tT4PMyTZDlFr90h5sZvibNyNEaGq7F6sqlsYxDS9itZZsulLoxu3j45zEil3yGIBUkxKZpGJ6A0xvtIfy4FQahVrFqOtEhcDlQzg0g== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=suse.com; dmarc=pass action=none header.from=suse.com; dkim=pass header.d=suse.com; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.com; s=selector1; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=b0q3cEL5CmMh9a8UEAFrTkmT6aShTa8n3uwryV4bUaU=; b=pA26s6YJsoB1X7EPWx52joNorIbP8wRLDu1Rd4HsERahReiOo078mWsHDozVpkISpycVjwo7+VhqNJJxBiGhcZeA1XOqd6e9JRhII6ExjxKB2kj/DPsLqIwnsk6jJrH37OdGx8CnBgKg6Y9ttW/xagTlpQs8+rK7M8SrhPN7w0gjJL7Vf2OSEPolQ77Oeug/Iusdf3PUGO9yhECaRpiHZx1soak2gUAI2usoIuXAzg2oHV1/6gIxgKAlDUCmWUpQaBcIv4LLFMb+94VJ844/34wE0ZvzSRY+WSrM9V2gR3ExRWUgTlE3mZ+3wxcAIwjY8hhNrSBHqObNSYVM2XbV1w== Authentication-Results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=suse.com; Received: from AM0PR0402MB3395.eurprd04.prod.outlook.com (2603:10a6:208:1a::16) by DB9PR04MB9554.eurprd04.prod.outlook.com (2603:10a6:10:302::10) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5723.26; Sat, 15 Oct 2022 09:49:47 +0000 Received: from AM0PR0402MB3395.eurprd04.prod.outlook.com ([fe80::7f81:2760:2539:7115]) by AM0PR0402MB3395.eurprd04.prod.outlook.com ([fe80::7f81:2760:2539:7115%2]) with mapi id 15.20.5723.029; Sat, 15 Oct 2022 09:49:29 +0000 Message-ID: <21491c35-a9b8-9161-311d-a01507dc296f@suse.com> Date: Sat, 15 Oct 2022 11:49:27 +0200 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:91.0) Gecko/20100101 Thunderbird/91.12.0 Subject: Re: [PATCH v2 2/2] module: Merge same-name module load requests Content-Language: en-US To: David Hildenbrand Cc: mcgrof@kernel.org, pmladek@suse.com, linux-modules@vger.kernel.org, linux-kernel@vger.kernel.org References: <20220919123233.8538-1-petr.pavlu@suse.com> <20220919123233.8538-3-petr.pavlu@suse.com> From: Petr Pavlu In-Reply-To: Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 7bit X-ClientProxiedBy: FR3P281CA0105.DEUP281.PROD.OUTLOOK.COM (2603:10a6:d10:a1::6) To AM0PR0402MB3395.eurprd04.prod.outlook.com (2603:10a6:208:1a::16) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: AM0PR0402MB3395:EE_|DB9PR04MB9554:EE_ X-MS-Office365-Filtering-Correlation-Id: 206dda53-f6f5-43d5-81f7-08daae928d7c X-LD-Processed: f7a17af6-1c5c-4a36-aa8b-f5be247aa4ba,ExtFwd X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: 0aH+4cq9p3chetXimTH/hx0f5GZGCKwtinyeIfiBzQXLQ3mB+nIiZ+WEU09Dh/7c3N91CcVQq9GTSSuxMDHE5OfN8JZj5b9J8s4TBgjOGDmHwK2mHYukZIvVLmP4h5irEaa06T8fOuIrHnHDm2/Z5xU5uqxTOgVZvWAQv/kTtjJOCNWs5zGp1551gz+FFm7jB0Azp5znhJjcIkJi8UthkBJ1QLqp8HVHpdAWQPiIXZvJsOWvTOC++mxaDzZiifL5erDEMyVz4L7Kqu/B1b0XhUdPlMdfQw17G5fKYLhMZdCT5iQArN3/8tsfeevO2uendD34NOQLnfuOK+YXupThzgddytrI/8hLe26opbVPCii5WjE/cfN7x30miSUPmRd8rvj9dcP7SNT7wBQ8l3nOVP147z3p7vEns5AYIGXf6qbcpqeLthk/ziwLqfoEVZNOdY8bDT6b5kFeQ8pauLU+mH5OF3As4zeNwgrHwQqWoJO86T/BdIxBNjaUDVlWJHyQSm3i4hrzHVQb7Tgo/Im2at9Oxp3ftzTqHGJGalLzdkY6A/4acAXqy83dNZ7iRZ117pbqy49oxss0CtVQ3X3pffYqjzZwzdgJEaCh49TdN0rZvbwVvrhP0TRwKNXT/oSx/D3I1HSWe0PQ6l9vbQDweKh6ZuUZ07w1lnBWdZV4t8iuaH3/NhJvfMkJtTck2qOwcPeqQHP8PMYSsnHjThRatf1qf56u+VLFyQGVo4XZ7bByIvsN+TwBU1QAo5bdKMzB1MCep9oIyhgQ0borCFZbkqPsGgM2IWhbdLZ+pU1Xl0xZjBQAh+YGeT9mVzaBlr8xnnimbMo/+lvKqjd2y1RQ8g== X-Forefront-Antispam-Report: CIP:255.255.255.255;CTRY:;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:AM0PR0402MB3395.eurprd04.prod.outlook.com;PTR:;CAT:NONE;SFS:(13230022)(136003)(396003)(346002)(376002)(366004)(39860400002)(451199015)(31686004)(2906002)(44832011)(36756003)(5660300002)(186003)(2616005)(4326008)(6486002)(8936002)(6916009)(41300700001)(66946007)(478600001)(966005)(66556008)(316002)(8676002)(31696002)(83380400001)(6512007)(26005)(53546011)(6506007)(86362001)(55236004)(66476007)(38100700002)(43740500002)(45980500001);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: =?utf-8?B?WnRITzcwQ1NBWDBvbUl4UWQ5WTBZNjVtZzRlWkxPT2pWb1RpeC9CQmxXakps?= =?utf-8?B?RFdkQkJ2aENrRUVsY08wVERnc0lBNndhaThlWVV6cXd3eFBMakRqcmhsc3JI?= =?utf-8?B?aG5VdnlqeWJTNVkydDkwS0xUelg2cjFtN29ldUxBeUhHMGc1UzhDY2ltTHFD?= =?utf-8?B?QzFxT1R4eVM3eE1yVzhONWRNZEdUUUNTNEJFcHZUTjRpNkJ4VDdWVEtS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mZUVzUFBxL3pueEsydzBtalpIbndQT0pzcW84a3Zqd0haN1ArM2RR?= =?utf-8?B?eWhpQWZrNENockZhN1F3Njk4c05BTmlIdS84SXJNZVQrblpOMDM0azE2VnZZ?= =?utf-8?Q?ucKxath32vFZBJTp9YB8+VJSo?= X-OriginatorOrg: suse.com X-MS-Exchange-CrossTenant-Network-Message-Id: 206dda53-f6f5-43d5-81f7-08daae928d7c X-MS-Exchange-CrossTenant-AuthSource: AM0PR0402MB3395.eurprd04.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 15 Oct 2022 09:49:28.9801 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: f7a17af6-1c5c-4a36-aa8b-f5be247aa4ba X-MS-Exchange-CrossTenant-MailboxType: HOSTED X-MS-Exchange-CrossTenant-UserPrincipalName: 7D5fV09i09FG151gLhc79XiOEkrBrNsnPzu0feyq2BsGoNfoLiVlwyZwqzL0hy6g11U3R5yayibV6Ebw8bITzQ== X-MS-Exchange-Transport-CrossTenantHeadersStamped: DB9PR04MB9554 X-Spam-Status: No, score=-5.1 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,NICE_REPLY_A,RCVD_IN_DNSWL_NONE, RCVD_IN_MSPIKE_H2,SPF_HELO_PASS,SPF_PASS 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 10/14/22 09:54, David Hildenbrand wrote: > On Mon, Sep 19, 2022 at 2:33 PM 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. For instance, udev can make a request to insert >> a frequency module for each individual CPU when another frequency module >> is already loaded which causes the init function of the new module to >> return an error. >> >> 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. >> >> 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. >> * 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. >> >> 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. >> >> Signed-off-by: Petr Pavlu >> --- > > Hi Petr, > > as you might have seen I sent a patch/fix yesterday (not being aware > of this patch and that > this is also a performance issue, which is interesting), that > similarly makes sure that modules > are unique early. > > https://lkml.kernel.org/r/20221013180518.217405-1-david@redhat.com > > It doesn't perform the -EBUSY changes or use something like > shared_load_info/refcounts; > it simply uses a second list while the module cannot be placed onto > the module list yet. > > Not sure if that part is really required (e.g., for performance > reasons). Like Luis, I feel like > some of these parts could be split into separate patches, if the other > parts are really required. The shared_load_info/refcounts/-EBUSY logic is actually an important part which addresses the regression mentioned in the commit message and which I'm primarily trying to fix. > I just tested your patch in the environment where I can reproduce the > vmap allocation issue, and > (unsurprisingly) this patch similarly seems to fix the issue. > > So if your patch ends up upstream, it would be good to add some details > of my patch description (vmap allocation issue) to this patch description. Thanks for testing this patch. I will add a note about the vmap allocation issue to the patch description. Petr