Linux Test Project
 help / color / mirror / Atom feed
From: Cyril Hrubis <chrubis@suse.cz>
To: "Li Wang (Hieco)" <li.wang@linux.dev>
Cc: wakel@google.com, ltp@lists.linux.it
Subject: Re: [LTP] [PATCH v8 2/4] tst_kconfig: load and unload kernel modules for CONFIG_*=m
Date: Wed, 25 Nov 2026 11:48:58 +0100	[thread overview]
Message-ID: <awa9GnSOwUvDo-HE@yuki.lan> (raw)
In-Reply-To: <20261125030529.907385-3-li.wang@linux.dev>

Hi!
> +void tst_kconfig_module_unload(void)
> +{
> +	const char *name;
> +
> +	if (!loaded_module_count)
> +		return;

This if is not really needed here.

> +	while (loaded_module_count > 0) {
> +		name = loaded_modules[--loaded_module_count];
> +
> +		tst_res(TDEBUG, "Unloading module '%s'", name);
> +
> +		if (!syscall(__NR_delete_module, name, O_NONBLOCK))
> +			continue;
> +
> +		switch (errno) {
> +		case ENOENT:		/* already unloaded */
> +		case EWOULDBLOCK:	/* in use */
> +		case EBUSY:		/* still loading or unloading */
> +		case ENOSYS:		/* no CONFIG_MODULE_UNLOAD */
> +			break;
> +		default:
> +			tst_res(TWARN | TERRNO, "Failed to unload module '%s'", name);
> +		}
> +	}
> +
> +	loaded_module_count = 0;
> +}
> +
>  static size_t array_len(const char *const kconfigs[])
>  {
>  	size_t i = 0;

Reviewed-by: Cyril Hrubis <chrubis@suse.cz>

-- 
Cyril Hrubis
chrubis@suse.cz

-- 
Mailing list info: https://lists.linux.it/listinfo/ltp

  reply	other threads:[~2026-11-25 10:48 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-11-25  3:05 [LTP] [PATCH v8 0/4] tst_kconfig: automatic module load/unload for CONFIG_*=m Li Wang (Hieco)
2026-11-25  3:05 ` [LTP] [PATCH v8 1/4] lib: add module is loaded check Li Wang (Hieco)
2026-11-25 10:34   ` Cyril Hrubis
2026-11-25 10:43   ` [LTP] " linuxtestproject.agent
2026-11-25  3:05 ` [LTP] [PATCH v8 2/4] tst_kconfig: load and unload kernel modules for CONFIG_*=m Li Wang (Hieco)
2026-11-25 10:48   ` Cyril Hrubis [this message]
2026-11-26  3:12     ` Li Wang
2026-11-25  3:05 ` [LTP] [PATCH v8 3/4] tst_kconfig: add module mappings for vsock/vsock_loopback Li Wang (Hieco)
2026-11-25 10:53   ` Cyril Hrubis
2026-11-26  3:58     ` Li Wang
2026-11-25  3:05 ` [LTP] [PATCH v8 4/4] testcases: drop manual tst_modprobe() now handled by tst_kconfig Li Wang (Hieco)
2026-11-25 11:00   ` Cyril Hrubis

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=awa9GnSOwUvDo-HE@yuki.lan \
    --to=chrubis@suse.cz \
    --cc=li.wang@linux.dev \
    --cc=ltp@lists.linux.it \
    --cc=wakel@google.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