Received: by 2002:a05:6358:1087:b0:cb:c9d3:cd90 with SMTP id j7csp4559842rwi; Mon, 17 Oct 2022 07:50:20 -0700 (PDT) X-Google-Smtp-Source: AMsMyM7E6nrPz+NS9T39DoPf+8o+KRwexO7B/MWRZXrS6RVWTd/DfNlMw6OeOUG529b6TtEeQRcg X-Received: by 2002:a63:1348:0:b0:440:5c6e:aedf with SMTP id 8-20020a631348000000b004405c6eaedfmr11050605pgt.613.1666018219863; Mon, 17 Oct 2022 07:50:19 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666018219; cv=none; d=google.com; s=arc-20160816; b=GBtIH9hr8sCxdRzsomveKiFnqWJA1HL8FaHcraR/Q1UMnbGPpjbEkKS1cmiMPItUST UPkorefi2yvaBPByE/p6Gp4VMLi5u7k1Bd904mE5OKBGOjYshmij+X1WMjFUWfHPDAZ6 0EUR2iQ8o1Ng4QlWRoD7qMVCvBDLud6Ke750AG3rJUzTwr5NFSD+Y+rn961/fm6oUsmK fahu5H7iFrO2D5c5ro/UmC82SsDUMZwIfpY3cXD0SkT8e+XTpzJh6v/ocrMwrOeMzhce JCC0MrSODB1FCN9+HKFw17WhG6/hDZ6i65dsNwY4YQD98cMEPgCUIKCqm72Y4VQxpvQb mNqg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:in-reply-to:content-disposition:mime-version :references:message-id:subject:cc:to:from:date:dkim-signature; bh=wsWr+Ep+EK7rnuxntXQBk+r8nFSCsmWYWDo+ktsF+E8=; b=duBUu24OIn7q48RFWdP/kWUu3jkyUmt8ViG8yynyV6ZsfVc+hTjJNsCPRV4xsLdWBL wPsmZ6r3kdRIQZZeewL+LekrfKk8wfImViAVe/DOd63pOn6c5bUBD0L2gGzYUXOM4G2V SQ0VhKdrxhJBJ5CqXfHElgflTumVDPD2mY0dX3B6NvPXjFv6zRN8eZ+VhqE+BjMfBrVl g2dOJeSeuwoCHBlwhHMiluO7a4JnJLMv/QYaBBaipYMJghayY/GjEtzqZOautmXHUfG+ XTrSZFj64MD2JciZJOaCMwYiVNvoMJCLeaP8v+93hS1n5oh+L8h242uhzZ8kO1OQP+MR aV7w== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@suse.com header.s=susede1 header.b="A0yN/V4q"; 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 v184-20020a6389c1000000b00439fb921f8fsi9238408pgd.460.2022.10.17.07.49.57; Mon, 17 Oct 2022 07:50: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=@suse.com header.s=susede1 header.b="A0yN/V4q"; 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 S230096AbiJQNvn (ORCPT + 99 others); Mon, 17 Oct 2022 09:51:43 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:53342 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229822AbiJQNvl (ORCPT ); Mon, 17 Oct 2022 09:51:41 -0400 Received: from smtp-out1.suse.de (smtp-out1.suse.de [IPv6:2001:67c:2178:6::1c]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id DE3081C125; Mon, 17 Oct 2022 06:51:37 -0700 (PDT) Received: from relay2.suse.de (relay2.suse.de [149.44.160.134]) by smtp-out1.suse.de (Postfix) with ESMTP id 81BF73400A; Mon, 17 Oct 2022 13:51:36 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.com; s=susede1; t=1666014696; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version:content-type:content-type: in-reply-to:in-reply-to:references:references; bh=wsWr+Ep+EK7rnuxntXQBk+r8nFSCsmWYWDo+ktsF+E8=; b=A0yN/V4qtthZpmxpz2jrPEuoGvck4A9nlmJIVT00d+XsIa9YkV9RRAh7dlAU12gj57j/et Ie33KUNQee6OtTH2SX9985b1hwXSlJiJLxOKuR2pGXuDPWzurg2TI0KvHPsnGY60+qold2 FyjQ9PvxSYI+6yHGT4vvpiojZPaiCT8= Received: from suse.cz (unknown [10.100.208.146]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by relay2.suse.de (Postfix) with ESMTPS id 6226D2C141; Mon, 17 Oct 2022 13:51:36 +0000 (UTC) Date: Mon, 17 Oct 2022 15:51:35 +0200 From: Petr Mladek To: Petr Pavlu Cc: mcgrof@kernel.org, david@redhat.com, linux-modules@vger.kernel.org, linux-kernel@vger.kernel.org Subject: Re: [PATCH v3 4/4] selftests: kmod: Add tests for merging same-name module load requests Message-ID: References: <20221016123031.3963-1-petr.pavlu@suse.com> <20221016123031.3963-5-petr.pavlu@suse.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20221016123031.3963-5-petr.pavlu@suse.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_NONE, 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 Sun 2022-10-16 14:30:31, Petr Pavlu wrote: > Add two tests to check that loading the same module multiple times in > parallel results only in one real attempt to initialize it. > Synchronization of the loads is done by waiting 1000 ms in the init I do not have a good experience with this kind of synchronization. It usually is not reliable. The test might be very slow especially when false positives are solved by prolonging the delay. Alternative solution would be to have two modules: 1st module would provide a counter, for example: int modB_load_cnt; module_param(modB_load_cnt, int, 0444); EXPORT_SYMBOL(modB_load_cnt); EXPORT_SYMBOL() should allow to directly increment the counter from the 2nd module. module_param() should make the value readable via /sys/module/modA/parameters/modB_load_cnt. It can be checked by kmod_sh. > function of a sample module kmod_test_0014. The tests measure time > needed to perform all inserts to verify that the loads get merged by the > module loader and are not serialized. > > * Case 0014 checks a situation when the load is successful. It should > result in one insert returning 0 and remaining inserts returning > EEXIST. > * Case 0015 checks a situation when the load is failing because the > module init function returns ENODEV. It should result in one insert > returning this error code and remaining inserts returning EBUSY. > > The tests use a simple init_module program to load kmod_test_0014.ko. It > enables to obtain directly a return code from the finit_module syscall. The tested scenarios look good. Best Regards, Petr