All of lore.kernel.org
 help / color / mirror / Atom feed
From: Lucas De Marchi <lucas.demarchi@intel.com>
To: Andrea Righi <andrea.righi@canonical.com>
Cc: Lucas De Marchi <lucas.de.marchi@gmail.com>,
	Luis Chamberlain <mcgrof@kernel.org>,
	<linux-modules@vger.kernel.org>
Subject: Re: [PATCH] libkmod: allow to fallback to user-space decompression
Date: Tue, 29 Aug 2023 07:47:05 -0700	[thread overview]
Message-ID: <yxq5obi4rh2k54xw3fm6mtg36gmvluophe7slmc352wwccak27@2azm6bid2l5r> (raw)
In-Reply-To: <20230829123808.325202-1-andrea.righi@canonical.com>

On Tue, Aug 29, 2023 at 02:38:08PM +0200, Andrea Righi wrote:
>Fallback to user-space decompression when the kernel cannot allocate
>enough memory to perform the decompression.
>
>This can happen with large modules, such as xfs on linux 6.5 for
>example, an ENOMEM would be returned and the module fails to load.
>
>It seems more reliable to try again with user-space decompression
>rather than reporting an error and failing to load the module.
>
>Fixes: 09c9f8c ("libkmod: Use kernel decompression when available")
>Signed-off-by: Andrea Righi <andrea.righi@canonical.com>
>---
> libkmod/libkmod-module.c | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
>
>diff --git a/libkmod/libkmod-module.c b/libkmod/libkmod-module.c
>index 585da41..d2d4815 100644
>--- a/libkmod/libkmod-module.c
>+++ b/libkmod/libkmod-module.c
>@@ -978,7 +978,7 @@ KMOD_EXPORT int kmod_module_insert_module(struct kmod_module *mod,
> 	}
>
> 	err = do_finit_module(mod, flags, args);
>-	if (err == -ENOSYS)
>+	if (err == -ENOSYS || err == -ENOMEM)

oh... ENOMEM can be returned in several places. I don't think it's a great
interface to just retry in userspace.

Luis, can we do better on the kernel side?

Andrea, did you track the exact location triggering the ENOMEM? Is it
the return of kvmalloc_array() or alloc_page() from
module_get_next_page()?  Or one of the previous kmalloc we use for the
different deflate methods?


thanks
Lucas De Marchi

> 		err = do_init_module(mod, flags, args);
>
> 	if (err < 0)
>-- 
>2.40.1
>

  reply	other threads:[~2023-08-29 14:48 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-08-29 12:38 [PATCH] libkmod: allow to fallback to user-space decompression Andrea Righi
2023-08-29 14:47 ` Lucas De Marchi [this message]
2023-08-29 15:23   ` Andrea Righi
2023-08-29 16:42     ` Luis Chamberlain
2023-08-29 17:10       ` Andrea Righi
2023-08-29 16:49     ` Lucas De Marchi

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=yxq5obi4rh2k54xw3fm6mtg36gmvluophe7slmc352wwccak27@2azm6bid2l5r \
    --to=lucas.demarchi@intel.com \
    --cc=andrea.righi@canonical.com \
    --cc=linux-modules@vger.kernel.org \
    --cc=lucas.de.marchi@gmail.com \
    --cc=mcgrof@kernel.org \
    /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.