linux-modules.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH v2] module: Add support for default value for module async_probe
@ 2022-06-04  1:01 Saravana Kannan
  2022-06-16  3:19 ` Saravana Kannan
                   ` (2 more replies)
  0 siblings, 3 replies; 4+ messages in thread
From: Saravana Kannan @ 2022-06-04  1:01 UTC (permalink / raw)
  To: Jonathan Corbet, Luis Chamberlain
  Cc: Saravana Kannan, kernel-team, linux-doc, linux-kernel, linux-modules

Add a module.async_probe kernel command line option that allows enabling
async probing for all modules. When this command line option is used,
there might still be some modules for which we want to explicitly force
synchronous probing, so extend <modulename>.async_probe to take an
optional bool input so that async probing can be disabled for a specific
module.

Signed-off-by: Saravana Kannan <saravanak@google.com>
---
v1->v2:
- Updated the documentation to capture all the details/changes.

 Documentation/admin-guide/kernel-parameters.txt | 17 +++++++++++++++--
 kernel/module/main.c                            | 11 ++++++++++-
 2 files changed, 25 insertions(+), 3 deletions(-)

diff --git a/Documentation/admin-guide/kernel-parameters.txt b/Documentation/admin-guide/kernel-parameters.txt
index 710b52d87bdd..5174a08e20b0 100644
--- a/Documentation/admin-guide/kernel-parameters.txt
+++ b/Documentation/admin-guide/kernel-parameters.txt
@@ -1147,8 +1147,12 @@
 	nopku		[X86] Disable Memory Protection Keys CPU feature found
 			in some Intel CPUs.
 
-	<module>.async_probe [KNL]
-			Enable asynchronous probe on this module.
+	<module>.async_probe[=<bool>] [KNL]
+			If no <bool> value is specified or if the value
+			specified is not a valid <bool>, enable asynchronous
+			probe on this module.  Otherwise, enable/disable
+			asynchronous probe on this module as indicated by the
+			<bool> value. See also: module.async_probe
 
 	early_ioremap_debug [KNL]
 			Enable debug messages in early_ioremap support. This
@@ -3201,6 +3205,15 @@
 			log everything. Information is printed at KERN_DEBUG
 			so loglevel=8 may also need to be specified.
 
+	module.async_probe=<bool>
+			[KNL] When set to true, modules will use async probing
+			by default. To enable/disable async probing for a
+			specific module, use the module specific control that
+			is documented under <module>.async_probe. When both
+			module.async_probe and <module>.async_probe are
+			specified, <module>.async_probe takes precedence for
+			the specific module.
+
 	module.sig_enforce
 			[KNL] When CONFIG_MODULE_SIG is set, this means that
 			modules without (valid) signatures will fail to load.
diff --git a/kernel/module/main.c b/kernel/module/main.c
index fed58d30725d..47085795f037 100644
--- a/kernel/module/main.c
+++ b/kernel/module/main.c
@@ -2410,6 +2410,12 @@ static void do_free_init(struct work_struct *w)
 	}
 }
 
+#undef MODULE_PARAM_PREFIX
+#define MODULE_PARAM_PREFIX "module."
+/* Default value for module->async_probe_requested */
+static bool async_probe;
+module_param(async_probe, bool, 0644);
+
 /*
  * This is where the real work happens.
  *
@@ -2630,7 +2636,8 @@ static int unknown_module_param_cb(char *param, char *val, const char *modname,
 	int ret;
 
 	if (strcmp(param, "async_probe") == 0) {
-		mod->async_probe_requested = true;
+		if (strtobool(val, &mod->async_probe_requested))
+			mod->async_probe_requested = true;
 		return 0;
 	}
 
@@ -2797,6 +2804,8 @@ static int load_module(struct load_info *info, const char __user *uargs,
 	if (err)
 		goto bug_cleanup;
 
+	mod->async_probe_requested = async_probe;
+
 	/* Module is ready to execute: parsing args may do that. */
 	after_dashes = parse_args(mod->name, mod->args, mod->kp, mod->num_kp,
 				  -32768, 32767, mod,
-- 
2.36.1.255.ge46751e96f-goog


^ permalink raw reply related	[flat|nested] 4+ messages in thread

* Re: [PATCH v2] module: Add support for default value for module async_probe
  2022-06-04  1:01 [PATCH v2] module: Add support for default value for module async_probe Saravana Kannan
@ 2022-06-16  3:19 ` Saravana Kannan
  2022-06-21 20:25 ` Aaron Tomlin
  2022-07-01 21:54 ` Luis Chamberlain
  2 siblings, 0 replies; 4+ messages in thread
From: Saravana Kannan @ 2022-06-16  3:19 UTC (permalink / raw)
  To: Jonathan Corbet, Luis Chamberlain
  Cc: kernel-team, linux-doc, linux-kernel, linux-modules

On Fri, Jun 3, 2022 at 6:01 PM Saravana Kannan <saravanak@google.com> wrote:
>
> Add a module.async_probe kernel command line option that allows enabling
> async probing for all modules. When this command line option is used,
> there might still be some modules for which we want to explicitly force
> synchronous probing, so extend <modulename>.async_probe to take an
> optional bool input so that async probing can be disabled for a specific
> module.
>
> Signed-off-by: Saravana Kannan <saravanak@google.com>
> ---
> v1->v2:
> - Updated the documentation to capture all the details/changes.

Luis,

Gentle reminder.

-Saravana

>
>  Documentation/admin-guide/kernel-parameters.txt | 17 +++++++++++++++--
>  kernel/module/main.c                            | 11 ++++++++++-
>  2 files changed, 25 insertions(+), 3 deletions(-)
>
> diff --git a/Documentation/admin-guide/kernel-parameters.txt b/Documentation/admin-guide/kernel-parameters.txt
> index 710b52d87bdd..5174a08e20b0 100644
> --- a/Documentation/admin-guide/kernel-parameters.txt
> +++ b/Documentation/admin-guide/kernel-parameters.txt
> @@ -1147,8 +1147,12 @@
>         nopku           [X86] Disable Memory Protection Keys CPU feature found
>                         in some Intel CPUs.
>
> -       <module>.async_probe [KNL]
> -                       Enable asynchronous probe on this module.
> +       <module>.async_probe[=<bool>] [KNL]
> +                       If no <bool> value is specified or if the value
> +                       specified is not a valid <bool>, enable asynchronous
> +                       probe on this module.  Otherwise, enable/disable
> +                       asynchronous probe on this module as indicated by the
> +                       <bool> value. See also: module.async_probe
>
>         early_ioremap_debug [KNL]
>                         Enable debug messages in early_ioremap support. This
> @@ -3201,6 +3205,15 @@
>                         log everything. Information is printed at KERN_DEBUG
>                         so loglevel=8 may also need to be specified.
>
> +       module.async_probe=<bool>
> +                       [KNL] When set to true, modules will use async probing
> +                       by default. To enable/disable async probing for a
> +                       specific module, use the module specific control that
> +                       is documented under <module>.async_probe. When both
> +                       module.async_probe and <module>.async_probe are
> +                       specified, <module>.async_probe takes precedence for
> +                       the specific module.
> +
>         module.sig_enforce
>                         [KNL] When CONFIG_MODULE_SIG is set, this means that
>                         modules without (valid) signatures will fail to load.
> diff --git a/kernel/module/main.c b/kernel/module/main.c
> index fed58d30725d..47085795f037 100644
> --- a/kernel/module/main.c
> +++ b/kernel/module/main.c
> @@ -2410,6 +2410,12 @@ static void do_free_init(struct work_struct *w)
>         }
>  }
>
> +#undef MODULE_PARAM_PREFIX
> +#define MODULE_PARAM_PREFIX "module."
> +/* Default value for module->async_probe_requested */
> +static bool async_probe;
> +module_param(async_probe, bool, 0644);
> +
>  /*
>   * This is where the real work happens.
>   *
> @@ -2630,7 +2636,8 @@ static int unknown_module_param_cb(char *param, char *val, const char *modname,
>         int ret;
>
>         if (strcmp(param, "async_probe") == 0) {
> -               mod->async_probe_requested = true;
> +               if (strtobool(val, &mod->async_probe_requested))
> +                       mod->async_probe_requested = true;
>                 return 0;
>         }
>
> @@ -2797,6 +2804,8 @@ static int load_module(struct load_info *info, const char __user *uargs,
>         if (err)
>                 goto bug_cleanup;
>
> +       mod->async_probe_requested = async_probe;
> +
>         /* Module is ready to execute: parsing args may do that. */
>         after_dashes = parse_args(mod->name, mod->args, mod->kp, mod->num_kp,
>                                   -32768, 32767, mod,
> --
> 2.36.1.255.ge46751e96f-goog
>

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH v2] module: Add support for default value for module async_probe
  2022-06-04  1:01 [PATCH v2] module: Add support for default value for module async_probe Saravana Kannan
  2022-06-16  3:19 ` Saravana Kannan
@ 2022-06-21 20:25 ` Aaron Tomlin
  2022-07-01 21:54 ` Luis Chamberlain
  2 siblings, 0 replies; 4+ messages in thread
From: Aaron Tomlin @ 2022-06-21 20:25 UTC (permalink / raw)
  To: Saravana Kannan
  Cc: Jonathan Corbet, Luis Chamberlain, kernel-team, linux-doc,
	linux-kernel, linux-modules

On Fri 2022-06-03 18:01 -0700, Saravana Kannan wrote:
> Add a module.async_probe kernel command line option that allows enabling
> async probing for all modules. When this command line option is used,
> there might still be some modules for which we want to explicitly force
> synchronous probing, so extend <modulename>.async_probe to take an
> optional bool input so that async probing can be disabled for a specific
> module.
> 
> Signed-off-by: Saravana Kannan <saravanak@google.com>
> ---
> v1->v2:
> - Updated the documentation to capture all the details/changes.
> 
>  Documentation/admin-guide/kernel-parameters.txt | 17 +++++++++++++++--
>  kernel/module/main.c                            | 11 ++++++++++-
>  2 files changed, 25 insertions(+), 3 deletions(-)
> 
> diff --git a/Documentation/admin-guide/kernel-parameters.txt b/Documentation/admin-guide/kernel-parameters.txt
> index 710b52d87bdd..5174a08e20b0 100644
> --- a/Documentation/admin-guide/kernel-parameters.txt
> +++ b/Documentation/admin-guide/kernel-parameters.txt
> @@ -1147,8 +1147,12 @@
>  	nopku		[X86] Disable Memory Protection Keys CPU feature found
>  			in some Intel CPUs.
>  
> -	<module>.async_probe [KNL]
> -			Enable asynchronous probe on this module.
> +	<module>.async_probe[=<bool>] [KNL]
> +			If no <bool> value is specified or if the value
> +			specified is not a valid <bool>, enable asynchronous
> +			probe on this module.  Otherwise, enable/disable
> +			asynchronous probe on this module as indicated by the
> +			<bool> value. See also: module.async_probe
>  
>  	early_ioremap_debug [KNL]
>  			Enable debug messages in early_ioremap support. This
> @@ -3201,6 +3205,15 @@
>  			log everything. Information is printed at KERN_DEBUG
>  			so loglevel=8 may also need to be specified.
>  
> +	module.async_probe=<bool>
> +			[KNL] When set to true, modules will use async probing
> +			by default. To enable/disable async probing for a
> +			specific module, use the module specific control that
> +			is documented under <module>.async_probe. When both
> +			module.async_probe and <module>.async_probe are
> +			specified, <module>.async_probe takes precedence for
> +			the specific module.
> +
>  	module.sig_enforce
>  			[KNL] When CONFIG_MODULE_SIG is set, this means that
>  			modules without (valid) signatures will fail to load.
> diff --git a/kernel/module/main.c b/kernel/module/main.c
> index fed58d30725d..47085795f037 100644
> --- a/kernel/module/main.c
> +++ b/kernel/module/main.c
> @@ -2410,6 +2410,12 @@ static void do_free_init(struct work_struct *w)
>  	}
>  }
>  
> +#undef MODULE_PARAM_PREFIX
> +#define MODULE_PARAM_PREFIX "module."
> +/* Default value for module->async_probe_requested */
> +static bool async_probe;
> +module_param(async_probe, bool, 0644);
> +
>  /*
>   * This is where the real work happens.
>   *
> @@ -2630,7 +2636,8 @@ static int unknown_module_param_cb(char *param, char *val, const char *modname,
>  	int ret;
>  
>  	if (strcmp(param, "async_probe") == 0) {
> -		mod->async_probe_requested = true;
> +		if (strtobool(val, &mod->async_probe_requested))
> +			mod->async_probe_requested = true;
>  		return 0;
>  	}
>  
> @@ -2797,6 +2804,8 @@ static int load_module(struct load_info *info, const char __user *uargs,
>  	if (err)
>  		goto bug_cleanup;
>  
> +	mod->async_probe_requested = async_probe;
> +
>  	/* Module is ready to execute: parsing args may do that. */
>  	after_dashes = parse_args(mod->name, mod->args, mod->kp, mod->num_kp,
>  				  -32768, 32767, mod,
> -- 
> 2.36.1.255.ge46751e96f-goog

Reviewed-by: Aaron Tomlin <atomlin@redhat.com>

-- 
Aaron Tomlin


^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH v2] module: Add support for default value for module async_probe
  2022-06-04  1:01 [PATCH v2] module: Add support for default value for module async_probe Saravana Kannan
  2022-06-16  3:19 ` Saravana Kannan
  2022-06-21 20:25 ` Aaron Tomlin
@ 2022-07-01 21:54 ` Luis Chamberlain
  2 siblings, 0 replies; 4+ messages in thread
From: Luis Chamberlain @ 2022-07-01 21:54 UTC (permalink / raw)
  To: Saravana Kannan
  Cc: Jonathan Corbet, kernel-team, linux-doc, linux-kernel, linux-modules

On Fri, Jun 03, 2022 at 06:01:00PM -0700, Saravana Kannan wrote:
> Add a module.async_probe kernel command line option that allows enabling
> async probing for all modules. When this command line option is used,
> there might still be some modules for which we want to explicitly force
> synchronous probing, so extend <modulename>.async_probe to take an
> optional bool input so that async probing can be disabled for a specific
> module.
> 
> Signed-off-by: Saravana Kannan <saravanak@google.com>
> ---

Queued up thanks!

  Luis

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2022-07-01 21:54 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-06-04  1:01 [PATCH v2] module: Add support for default value for module async_probe Saravana Kannan
2022-06-16  3:19 ` Saravana Kannan
2022-06-21 20:25 ` Aaron Tomlin
2022-07-01 21:54 ` Luis Chamberlain

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