All of lore.kernel.org
 help / color / mirror / Atom feed
From: Petr Mladek <pmladek@suse.com>
To: Petr Pavlu <petr.pavlu@suse.com>
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
Date: Mon, 17 Oct 2022 15:51:35 +0200	[thread overview]
Message-ID: <Y01d50Z2DK3f9V+Q@alley> (raw)
In-Reply-To: <20221016123031.3963-5-petr.pavlu@suse.com>

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

  reply	other threads:[~2022-10-17 13:51 UTC|newest]

Thread overview: 17+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-10-16 12:30 [PATCH v3 0/4] module: Merge same-name module load requests Petr Pavlu
2022-10-16 12:30 ` [PATCH v3 1/4] module: Correct wake up of module_wq Petr Pavlu
2022-10-17  7:26   ` David Hildenbrand
2022-10-16 12:30 ` [PATCH v3 2/4] module: Update a comment describing what is protected by module_mutex Petr Pavlu
2022-10-17  7:27   ` David Hildenbrand
2022-10-17 12:22   ` Petr Mladek
2022-10-16 12:30 ` [PATCH v3 3/4] module: Merge same-name module load requests Petr Pavlu
2022-10-17  7:43   ` David Hildenbrand
2022-10-18  8:52     ` Petr Pavlu
2022-10-18  9:18       ` David Hildenbrand
2022-10-17 12:54   ` Petr Mladek
2022-10-16 12:30 ` [PATCH v3 4/4] selftests: kmod: Add tests for merging " Petr Pavlu
2022-10-17 13:51   ` Petr Mladek [this message]
2023-01-12  9:03     ` Petr Pavlu
2023-01-13 14:45       ` Petr Mladek
2022-10-25 17:51   ` Luis Chamberlain
2022-10-25 23:01     ` Luis Chamberlain

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=Y01d50Z2DK3f9V+Q@alley \
    --to=pmladek@suse.com \
    --cc=david@redhat.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-modules@vger.kernel.org \
    --cc=mcgrof@kernel.org \
    --cc=petr.pavlu@suse.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.