* Re: [PATCH] regulator: core: Add option to prevent disabling unused regulators
2023-10-28 10:24 [PATCH] regulator: core: Add option to prevent disabling unused regulators Javier Martinez Canillas
@ 2023-10-28 16:04 ` Randy Dunlap
2023-10-30 14:53 ` Brian Masney
` (2 subsequent siblings)
3 siblings, 0 replies; 7+ messages in thread
From: Randy Dunlap @ 2023-10-28 16:04 UTC (permalink / raw)
To: Javier Martinez Canillas, linux-kernel
Cc: Manivannan Sadhasivam, Jonathan Corbet, Liam Girdwood, Mark Brown,
Paul E. McKenney, Rafael J. Wysocki, Steven Rostedt (Google),
Tejun Heo, linux-doc
Hi,
On 10/28/23 03:24, Javier Martinez Canillas wrote:
> This may be useful for debugging and develompent purposes, when there are
> drivers that depend on regulators to be enabled but do not request them.
>
> It is inspired from the clk_ignore_unused and pd_ignore_unused parameters,
> that are used to keep firmware-enabled clocks and power domains on even if
> these are not used by drivers.
>
> The parameter is not expected to be used in normal cases and should not be
> needed on a platform with proper driver support.
>
> Signed-off-by: Javier Martinez Canillas <javierm@redhat.com>
> ---
>
> Documentation/admin-guide/kernel-parameters.txt | 7 +++++++
> drivers/regulator/core.c | 17 +++++++++++++++++
> 2 files changed, 24 insertions(+)
>
> diff --git a/Documentation/admin-guide/kernel-parameters.txt b/Documentation/admin-guide/kernel-parameters.txt
> index 0a1731a0f0ef..91b58d767c2c 100644
> --- a/Documentation/admin-guide/kernel-parameters.txt
> +++ b/Documentation/admin-guide/kernel-parameters.txt
> @@ -5461,6 +5461,13 @@
> print every Nth verbose statement, where N is the value
> specified.
>
> + regulator_ignore_unused
> + [REGULATOR]
> + Prevents the regulator framework to disable regulators
from disabling regulators
> + that are unused due not driver claiming them. This may
no driver claiming them.
> + be useful for debug and development, but should not be
> + needed on a platform with proper driver support.
> +
> relax_domain_level=
> [KNL, SMP] Set scheduler's default relax_domain_level.
> See Documentation/admin-guide/cgroup-v1/cpusets.rst.
> diff --git a/drivers/regulator/core.c b/drivers/regulator/core.c
> index 3137e40fcd3e..220034ff0273 100644
> --- a/drivers/regulator/core.c
> +++ b/drivers/regulator/core.c
> @@ -6234,6 +6234,14 @@ static int regulator_late_cleanup(struct device *dev, void *data)
> return 0;
> }
>
> +static bool regulator_ignore_unused;
> +static int __init regulator_ignore_unused_setup(char *__unused)
> +{
> + regulator_ignore_unused = true;
> + return 1;
> +}
> +__setup("regulator_ignore_unused", regulator_ignore_unused_setup);
> +
> static void regulator_init_complete_work_function(struct work_struct *work)
> {
> /*
> @@ -6246,6 +6254,15 @@ static void regulator_init_complete_work_function(struct work_struct *work)
> class_for_each_device(®ulator_class, NULL, NULL,
> regulator_register_resolve_supply);
>
> + /*
> + * For debugging purposes, it may be useful to prevent unused
> + * regulators to be disabled.
from being disabled.
> + */
> + if (regulator_ignore_unused) {
> + pr_warn("regulator: Not disabling unused regulators\n");
> + return;
> + }
> +
> /* If we have a full configuration then disable any regulators
> * we have permission to change the status for and which are
> * not in use or always_on. This is effectively the default
HTH.
--
~Randy
^ permalink raw reply [flat|nested] 7+ messages in thread* Re: [PATCH] regulator: core: Add option to prevent disabling unused regulators
2023-10-28 10:24 [PATCH] regulator: core: Add option to prevent disabling unused regulators Javier Martinez Canillas
2023-10-28 16:04 ` Randy Dunlap
@ 2023-10-30 14:53 ` Brian Masney
2023-11-01 4:56 ` Manivannan Sadhasivam
2023-11-13 19:40 ` Mark Brown
3 siblings, 0 replies; 7+ messages in thread
From: Brian Masney @ 2023-10-30 14:53 UTC (permalink / raw)
To: Javier Martinez Canillas
Cc: linux-kernel, Manivannan Sadhasivam, Jonathan Corbet,
Liam Girdwood, Mark Brown, Paul E. McKenney, Rafael J. Wysocki,
Randy Dunlap, Steven Rostedt (Google), Tejun Heo, linux-doc
On Sat, Oct 28, 2023 at 12:24:03PM +0200, Javier Martinez Canillas wrote:
> This may be useful for debugging and develompent purposes, when there are
> drivers that depend on regulators to be enabled but do not request them.
>
> It is inspired from the clk_ignore_unused and pd_ignore_unused parameters,
> that are used to keep firmware-enabled clocks and power domains on even if
> these are not used by drivers.
>
> The parameter is not expected to be used in normal cases and should not be
> needed on a platform with proper driver support.
>
> Signed-off-by: Javier Martinez Canillas <javierm@redhat.com>
Thanks for posting this! I've had a need for this. With Randy's feedback
addressed:
Reviewed-by: Brian Masney <bmasney@redhat.com>
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: [PATCH] regulator: core: Add option to prevent disabling unused regulators
2023-10-28 10:24 [PATCH] regulator: core: Add option to prevent disabling unused regulators Javier Martinez Canillas
2023-10-28 16:04 ` Randy Dunlap
2023-10-30 14:53 ` Brian Masney
@ 2023-11-01 4:56 ` Manivannan Sadhasivam
2023-11-01 13:09 ` Mark Brown
2023-11-13 19:40 ` Mark Brown
3 siblings, 1 reply; 7+ messages in thread
From: Manivannan Sadhasivam @ 2023-11-01 4:56 UTC (permalink / raw)
To: Javier Martinez Canillas
Cc: linux-kernel, Manivannan Sadhasivam, Jonathan Corbet,
Liam Girdwood, Mark Brown, Paul E. McKenney, Rafael J. Wysocki,
Randy Dunlap, Steven Rostedt (Google), Tejun Heo, linux-doc
On Sat, Oct 28, 2023 at 12:24:03PM +0200, Javier Martinez Canillas wrote:
> This may be useful for debugging and develompent purposes, when there are
> drivers that depend on regulators to be enabled but do not request them.
>
> It is inspired from the clk_ignore_unused and pd_ignore_unused parameters,
> that are used to keep firmware-enabled clocks and power domains on even if
> these are not used by drivers.
>
> The parameter is not expected to be used in normal cases and should not be
> needed on a platform with proper driver support.
>
> Signed-off-by: Javier Martinez Canillas <javierm@redhat.com>
Acked-by: Manivannan Sadhasivam <manivannan.sadhasivam@linaro.org>
Thanks for looking into this. This patch is very handy to debug display related
issues on platforms without serial console.
On the other note, I'm wondering if we could use sync_state() for handling the
regulator_init_complete() work. This would ensure that the regulators are only
disabled when all the consumers are probed.
- Mani
> ---
>
> Documentation/admin-guide/kernel-parameters.txt | 7 +++++++
> drivers/regulator/core.c | 17 +++++++++++++++++
> 2 files changed, 24 insertions(+)
>
> diff --git a/Documentation/admin-guide/kernel-parameters.txt b/Documentation/admin-guide/kernel-parameters.txt
> index 0a1731a0f0ef..91b58d767c2c 100644
> --- a/Documentation/admin-guide/kernel-parameters.txt
> +++ b/Documentation/admin-guide/kernel-parameters.txt
> @@ -5461,6 +5461,13 @@
> print every Nth verbose statement, where N is the value
> specified.
>
> + regulator_ignore_unused
> + [REGULATOR]
> + Prevents the regulator framework to disable regulators
> + that are unused due not driver claiming them. This may
> + be useful for debug and development, but should not be
> + needed on a platform with proper driver support.
> +
> relax_domain_level=
> [KNL, SMP] Set scheduler's default relax_domain_level.
> See Documentation/admin-guide/cgroup-v1/cpusets.rst.
> diff --git a/drivers/regulator/core.c b/drivers/regulator/core.c
> index 3137e40fcd3e..220034ff0273 100644
> --- a/drivers/regulator/core.c
> +++ b/drivers/regulator/core.c
> @@ -6234,6 +6234,14 @@ static int regulator_late_cleanup(struct device *dev, void *data)
> return 0;
> }
>
> +static bool regulator_ignore_unused;
> +static int __init regulator_ignore_unused_setup(char *__unused)
> +{
> + regulator_ignore_unused = true;
> + return 1;
> +}
> +__setup("regulator_ignore_unused", regulator_ignore_unused_setup);
> +
> static void regulator_init_complete_work_function(struct work_struct *work)
> {
> /*
> @@ -6246,6 +6254,15 @@ static void regulator_init_complete_work_function(struct work_struct *work)
> class_for_each_device(®ulator_class, NULL, NULL,
> regulator_register_resolve_supply);
>
> + /*
> + * For debugging purposes, it may be useful to prevent unused
> + * regulators to be disabled.
> + */
> + if (regulator_ignore_unused) {
> + pr_warn("regulator: Not disabling unused regulators\n");
> + return;
> + }
> +
> /* If we have a full configuration then disable any regulators
> * we have permission to change the status for and which are
> * not in use or always_on. This is effectively the default
> --
> 2.41.0
>
--
மணிவண்ணன் சதாசிவம்
^ permalink raw reply [flat|nested] 7+ messages in thread* Re: [PATCH] regulator: core: Add option to prevent disabling unused regulators
2023-11-01 4:56 ` Manivannan Sadhasivam
@ 2023-11-01 13:09 ` Mark Brown
2023-11-02 9:33 ` Javier Martinez Canillas
0 siblings, 1 reply; 7+ messages in thread
From: Mark Brown @ 2023-11-01 13:09 UTC (permalink / raw)
To: Manivannan Sadhasivam
Cc: Javier Martinez Canillas, linux-kernel, Jonathan Corbet,
Liam Girdwood, Paul E. McKenney, Rafael J. Wysocki, Randy Dunlap,
Steven Rostedt (Google), Tejun Heo, linux-doc
[-- Attachment #1: Type: text/plain, Size: 447 bytes --]
On Wed, Nov 01, 2023 at 10:26:52AM +0530, Manivannan Sadhasivam wrote:
> On the other note, I'm wondering if we could use sync_state() for handling the
> regulator_init_complete() work. This would ensure that the regulators are only
> disabled when all the consumers are probed.
That assumes that everything defined in the DT both has a driver and has
the driver available for the currently running kernel neither of which
is a good assumption.
[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 488 bytes --]
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: [PATCH] regulator: core: Add option to prevent disabling unused regulators
2023-11-01 13:09 ` Mark Brown
@ 2023-11-02 9:33 ` Javier Martinez Canillas
0 siblings, 0 replies; 7+ messages in thread
From: Javier Martinez Canillas @ 2023-11-02 9:33 UTC (permalink / raw)
To: Mark Brown, Manivannan Sadhasivam
Cc: linux-kernel, Jonathan Corbet, Liam Girdwood, Paul E. McKenney,
Rafael J. Wysocki, Randy Dunlap, Steven Rostedt (Google),
Tejun Heo, linux-doc
Mark Brown <broonie@kernel.org> writes:
> On Wed, Nov 01, 2023 at 10:26:52AM +0530, Manivannan Sadhasivam wrote:
>
>> On the other note, I'm wondering if we could use sync_state() for handling the
>> regulator_init_complete() work. This would ensure that the regulators are only
>> disabled when all the consumers are probed.
>
> That assumes that everything defined in the DT both has a driver and has
> the driver available for the currently running kernel neither of which
> is a good assumption.
Agreed. I believe the current logic of disabling all regulators using a
workqueue is the correct thing to do.
The only better option I think is to make user-space notify the kernel
that it won't load kernel modules anymore. But the delayed work would
sill be needed, since the kernel can't make an assumption on whether
user-space will notify of this or not.
--
Best regards,
Javier Martinez Canillas
Core Platforms
Red Hat
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: [PATCH] regulator: core: Add option to prevent disabling unused regulators
2023-10-28 10:24 [PATCH] regulator: core: Add option to prevent disabling unused regulators Javier Martinez Canillas
` (2 preceding siblings ...)
2023-11-01 4:56 ` Manivannan Sadhasivam
@ 2023-11-13 19:40 ` Mark Brown
3 siblings, 0 replies; 7+ messages in thread
From: Mark Brown @ 2023-11-13 19:40 UTC (permalink / raw)
To: linux-kernel, Javier Martinez Canillas
Cc: Manivannan Sadhasivam, Jonathan Corbet, Liam Girdwood,
Paul E. McKenney, Rafael J. Wysocki, Randy Dunlap,
Steven Rostedt (Google), Tejun Heo, linux-doc
On Sat, 28 Oct 2023 12:24:03 +0200, Javier Martinez Canillas wrote:
> This may be useful for debugging and develompent purposes, when there are
> drivers that depend on regulators to be enabled but do not request them.
>
> It is inspired from the clk_ignore_unused and pd_ignore_unused parameters,
> that are used to keep firmware-enabled clocks and power domains on even if
> these are not used by drivers.
>
> [...]
Applied to
https://git.kernel.org/pub/scm/linux/kernel/git/broonie/regulator.git for-next
Thanks!
[1/1] regulator: core: Add option to prevent disabling unused regulators
commit: c986968fe92f20f2db26fa6bce27795b2e9ebe22
All being well this means that it will be integrated into the linux-next
tree (usually sometime in the next 24 hours) and sent to Linus during
the next merge window (or sooner if it is a bug fix), however if
problems are discovered then the patch may be dropped or reverted.
You may get further e-mails resulting from automated or manual testing
and review of the tree, please engage with people reporting problems and
send followup patches addressing any issues that are reported if needed.
If any updates are required or you are submitting further changes they
should be sent as incremental updates against current git, existing
patches will not be replaced.
Please add any relevant lists and maintainers to the CCs when replying
to this mail.
Thanks,
Mark
^ permalink raw reply [flat|nested] 7+ messages in thread