linux-modules.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Petr Pavlu <petr.pavlu@suse.com>
To: Luis Chamberlain <mcgrof@kernel.org>
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
Date: Sat, 15 Oct 2022 11:27:10 +0200	[thread overview]
Message-ID: <aa8d9456-b260-d999-0296-8e6ab876af7a@suse.com> (raw)
In-Reply-To: <YzdR0gRNQI2BGnJ9@bombadil.infradead.org>

On 9/30/22 22:30, Luis Chamberlain wrote:
> 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?

It was possible for me to write some kselftests for this. I will post them as
a separate patch in v3.

>> 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.

The issue was also observed with EDAC drivers which are similarly exclusive.

>> 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.

I touched on this somewhat in my response to review comments on v1 from Petr
Mladek [1] but it looks I failed to appropriately update the commit message
in the new version. I will try to improve it in v3.

The patch does address a regression observed after commit 6e6de3dee51a
("kernel/module.c: Only return -EEXIST for modules that have finished
loading"). I guess it can have a Fixes tag added to the patch.

To add more information, the following is a test from a machine with 288 CPUs
which I performed when preparing this patch. The system had Tumbleweed
20220829 installed on it. The boot process tried to load 288x pcc_cpufreq and
576x acpi_cpufreq modules which all failed because intel_pstate was already
active.

The test used three custom builds. The base was 6.0-rc3, 'revert' is
base + revert of 6e6de3dee51a, 'my' is base + the proposed fix. Compiled
modules were uncompressed and unsigned.

Each configuration had its boot tested 5 times. Time was measured from the
first load attempt of a given module to the last one, by simply looking at
messages such as "Inserted module 'acpi_cpufreq'" in the udev log and their
timestamps. All times are in seconds.

|      |                Configuration                        |
| Boot | base            | revert          | my              |
|   v  | pcc    | acpi   | pcc    | acpi   | pcc    | acpi   |
+------+--------+--------+--------+--------+--------+--------+
|   #1 | 45.374 | 45.462 |  1.992 |  8.509 |  2.190 |  6.931 |
|   #2 | 44.727 | 44.712 |  2.249 | 11.436 |  1.821 |  8.413 |
|   #3 | 45.450 | 45.771 |  1.685 |  8.784 |  1.964 |  6.341 |
|   #4 | 44.306 | 44.840 |  2.469 |  9.611 |  2.362 |  6.856 |
|   #5 | 45.132 | 45.216 |  2.063 |  8.782 |  1.717 |  6.405 |
+------+--------+--------+--------+--------+--------+--------+
|  Avg | 44.998 | 45.200 |  2.092 |  9.424 |  2.011 |  6.989 |

This shows the observed regression and results with the proposed fix.

> 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.

I think it is hard to split this patch into parts because the implemented
"optimization" is the fix.

[1] https://lore.kernel.org/linux-modules/0ccb384f-bbd5-f0fd-3832-c2255df505b2@suse.com/

Thanks,
Petr

  reply	other threads:[~2022-10-15  9:27 UTC|newest]

Thread overview: 43+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-09-19 12:32 [PATCH v2 0/2] module: Merge same-name module load requests Petr Pavlu
2022-09-19 12:32 ` [PATCH v2 1/2] module: Correct wake up of module_wq Petr Pavlu
2022-09-30 20:22   ` Luis Chamberlain
2022-10-14  8:40     ` Petr Mladek
2022-09-19 12:32 ` [PATCH v2 2/2] module: Merge same-name module load requests Petr Pavlu
2022-09-30 20:30   ` Luis Chamberlain
2022-10-15  9:27     ` Petr Pavlu [this message]
2022-10-18 18:33       ` Luis Chamberlain
2022-10-18 19:19         ` Prarit Bhargava
2022-10-18 19:53         ` Prarit Bhargava
2022-10-20  7:19           ` Petr Mladek
2022-10-24 13:22             ` Prarit Bhargava
2022-10-24 17:08               ` Luis Chamberlain
2022-10-24 12:37           ` Petr Pavlu
2022-10-24 14:00             ` Prarit Bhargava
2022-11-13 16:44               ` Petr Pavlu
2022-10-19 12:00         ` Petr Pavlu
2022-10-20  7:03           ` Petr Mladek
2022-10-24 17:53             ` Luis Chamberlain
2022-11-12  1:47           ` Luis Chamberlain
2022-11-14  8:57             ` David Hildenbrand
2022-11-14 15:38               ` Luis Chamberlain
2022-11-14 15:45                 ` David Hildenbrand
2022-11-15 19:29                   ` Luis Chamberlain
2022-11-16 16:03                     ` Prarit Bhargava
2022-11-21 16:00                       ` Petr Pavlu
2022-11-21 19:03                         ` Luis Chamberlain
2022-11-21 19:50                           ` David Hildenbrand
2022-11-21 20:27                             ` Luis Chamberlain
2022-11-22 13:59                           ` Petr Pavlu
2022-11-22 17:58                             ` Luis Chamberlain
2022-11-16 16:04                     ` David Hildenbrand
2022-11-18 17:32                     ` David Hildenbrand
2022-11-28 16:29                   ` Prarit Bhargava
2022-11-29 13:13                     ` Petr Pavlu
2022-12-02 16:36                       ` Petr Mladek
2022-12-06 12:31                         ` Prarit Bhargava
2022-12-07 13:23                           ` Petr Pavlu
2022-12-04 19:58                       ` Prarit Bhargava
2022-10-14  7:54   ` David Hildenbrand
2022-10-15  9:49     ` Petr Pavlu
2022-10-14 13:52   ` Petr Mladek
2022-10-16 12:25     ` Petr Pavlu

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=aa8d9456-b260-d999-0296-8e6ab876af7a@suse.com \
    --to=petr.pavlu@suse.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-modules@vger.kernel.org \
    --cc=mcgrof@kernel.org \
    --cc=pmladek@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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).