linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] firmware_class: make firmware caching configurable
@ 2019-11-13 21:01 Mark Salyzyn
  2019-11-13 21:31 ` Luis Chamberlain
                   ` (2 more replies)
  0 siblings, 3 replies; 9+ messages in thread
From: Mark Salyzyn @ 2019-11-13 21:01 UTC (permalink / raw)
  To: linux-kernel
  Cc: kernel-team, Mark Salyzyn, Tim Murray,
	Venkata Narendra Kumar Gutta, Greg Kroah-Hartman,
	Rafael J. Wysocki, Luis Chamberlain

Because firmware caching generates uevent messages that are sent over
a netlink socket, it can prevent suspend on many platforms.  It's
also not always useful, so make it a configurable option.

Signed-off-by: Mark Salyzyn <salyzyn@android.com>
Cc: Tim Murray <timmurray@google.com>
Cc: Venkata Narendra Kumar Gutta <vnkgutta@codeaurora.org>
---
 drivers/base/Kconfig                | 13 +++++++++++++
 drivers/base/firmware_loader/main.c |  6 +++---
 2 files changed, 16 insertions(+), 3 deletions(-)

diff --git a/drivers/base/Kconfig b/drivers/base/Kconfig
index 28b92e3cc570..36351c3a62b0 100644
--- a/drivers/base/Kconfig
+++ b/drivers/base/Kconfig
@@ -89,6 +89,19 @@ config PREVENT_FIRMWARE_BUILD
 
 source "drivers/base/firmware_loader/Kconfig"
 
+config FW_CACHE
+	bool "Enable firmware caching during suspend"
+	depends on PM_SLEEP
+	default y
+	help
+	  Because firmware caching generates uevent messages that are sent
+	  over a netlink socket, it can prevent suspend on many platforms.
+	  It is also not always useful, so on such platforms we have the
+	  option.
+
+	  If unsure, say Y.
+
+
 config WANT_DEV_COREDUMP
 	bool
 	help
diff --git a/drivers/base/firmware_loader/main.c b/drivers/base/firmware_loader/main.c
index bf44c79beae9..1c9f03514a47 100644
--- a/drivers/base/firmware_loader/main.c
+++ b/drivers/base/firmware_loader/main.c
@@ -51,7 +51,7 @@ struct firmware_cache {
 	struct list_head head;
 	int state;
 
-#ifdef CONFIG_PM_SLEEP
+#ifdef CONFIG_FW_CACHE
 	/*
 	 * Names of firmware images which have been cached successfully
 	 * will be added into the below list so that device uncache
@@ -556,7 +556,7 @@ static void fw_set_page_data(struct fw_priv *fw_priv, struct firmware *fw)
 		 (unsigned int)fw_priv->size);
 }
 
-#ifdef CONFIG_PM_SLEEP
+#ifdef CONFIG_FW_CACHE
 static void fw_name_devm_release(struct device *dev, void *res)
 {
 	struct fw_name_devm *fwn = res;
@@ -1046,7 +1046,7 @@ request_firmware_nowait(
 }
 EXPORT_SYMBOL(request_firmware_nowait);
 
-#ifdef CONFIG_PM_SLEEP
+#ifdef CONFIG_FW_CACHE
 static ASYNC_DOMAIN_EXCLUSIVE(fw_cache_domain);
 
 /**
-- 
2.24.0.rc1.363.gb1bccd3e3d-goog


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

* Re: [PATCH] firmware_class: make firmware caching configurable
  2019-11-13 21:01 [PATCH] firmware_class: make firmware caching configurable Mark Salyzyn
@ 2019-11-13 21:31 ` Luis Chamberlain
  2019-11-13 21:50 ` Greg Kroah-Hartman
  2019-11-13 22:54 ` [PATCH v2] " Mark Salyzyn
  2 siblings, 0 replies; 9+ messages in thread
From: Luis Chamberlain @ 2019-11-13 21:31 UTC (permalink / raw)
  To: Mark Salyzyn
  Cc: linux-kernel, kernel-team, Tim Murray,
	Venkata Narendra Kumar Gutta, Greg Kroah-Hartman,
	Rafael J. Wysocki

On Wed, Nov 13, 2019 at 01:01:13PM -0800, Mark Salyzyn wrote:
> Because firmware caching generates uevent messages that are sent over
> a netlink socket, it can prevent suspend on many platforms.  It's
> also not always useful, so make it a configurable option.
> 
> Signed-off-by: Mark Salyzyn <salyzyn@android.com>
> Cc: Tim Murray <timmurray@google.com>
> Cc: Venkata Narendra Kumar Gutta <vnkgutta@codeaurora.org>

Looks good.

Acked-by: Luis Chamberlain <mcgrof@kernel.org>

  Luis

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

* Re: [PATCH] firmware_class: make firmware caching configurable
  2019-11-13 21:01 [PATCH] firmware_class: make firmware caching configurable Mark Salyzyn
  2019-11-13 21:31 ` Luis Chamberlain
@ 2019-11-13 21:50 ` Greg Kroah-Hartman
  2019-11-13 22:13   ` Luis Chamberlain
  2019-11-13 22:33   ` Mark Salyzyn
  2019-11-13 22:54 ` [PATCH v2] " Mark Salyzyn
  2 siblings, 2 replies; 9+ messages in thread
From: Greg Kroah-Hartman @ 2019-11-13 21:50 UTC (permalink / raw)
  To: Mark Salyzyn
  Cc: linux-kernel, kernel-team, Tim Murray,
	Venkata Narendra Kumar Gutta, Rafael J. Wysocki,
	Luis Chamberlain

On Wed, Nov 13, 2019 at 01:01:13PM -0800, Mark Salyzyn wrote:
> Because firmware caching generates uevent messages that are sent over
> a netlink socket, it can prevent suspend on many platforms.  It's
> also not always useful, so make it a configurable option.
> 
> Signed-off-by: Mark Salyzyn <salyzyn@android.com>
> Cc: Tim Murray <timmurray@google.com>
> Cc: Venkata Narendra Kumar Gutta <vnkgutta@codeaurora.org>
> Acked-by: Luis Chamberlain <mcgrof@kernel.org>
> ---
>  drivers/base/Kconfig                | 13 +++++++++++++
>  drivers/base/firmware_loader/main.c |  6 +++---
>  2 files changed, 16 insertions(+), 3 deletions(-)
> 
> diff --git a/drivers/base/Kconfig b/drivers/base/Kconfig
> index 28b92e3cc570..36351c3a62b0 100644
> --- a/drivers/base/Kconfig
> +++ b/drivers/base/Kconfig
> @@ -89,6 +89,19 @@ config PREVENT_FIRMWARE_BUILD
>  
>  source "drivers/base/firmware_loader/Kconfig"
>  
> +config FW_CACHE
> +	bool "Enable firmware caching during suspend"
> +	depends on PM_SLEEP
> +	default y
> +	help
> +	  Because firmware caching generates uevent messages that are sent
> +	  over a netlink socket, it can prevent suspend on many platforms.
> +	  It is also not always useful, so on such platforms we have the
> +	  option.
> +
> +	  If unsure, say Y.
> +
> +

Shouldn't this entry go into drivers/base/firmware_loader/Kconfig
instead and depend on FW_LOADER by putting it in the correct location in
that file?

Also, no need for two blank lines.

And finally, 'default y' is only a good idea if your machine can not
boot without the option.  I don't think that's the case here, correct?

thanks,

greg k-h

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

* Re: [PATCH] firmware_class: make firmware caching configurable
  2019-11-13 21:50 ` Greg Kroah-Hartman
@ 2019-11-13 22:13   ` Luis Chamberlain
  2019-11-13 22:33   ` Mark Salyzyn
  1 sibling, 0 replies; 9+ messages in thread
From: Luis Chamberlain @ 2019-11-13 22:13 UTC (permalink / raw)
  To: Greg Kroah-Hartman
  Cc: Mark Salyzyn, linux-kernel, kernel-team, Tim Murray,
	Venkata Narendra Kumar Gutta, Rafael J. Wysocki

On Thu, Nov 14, 2019 at 05:50:31AM +0800, Greg Kroah-Hartman wrote:
> On Wed, Nov 13, 2019 at 01:01:13PM -0800, Mark Salyzyn wrote:
> > +config FW_CACHE
> > +	bool "Enable firmware caching during suspend"
> > +	depends on PM_SLEEP
> > +	default y
> And finally, 'default y' is only a good idea if your machine can not
> boot without the option.  I don't think that's the case here, correct?

default y if PM_SLEEP

Would try to enable this if PM_SLEEP was disabled. So the depends on
will force this on for all systems by default if PM_SLEEP is enabled,
which is what how this works today.

We enable this feature today by default if you have PM_SLEEP.

  Luis

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

* Re: [PATCH] firmware_class: make firmware caching configurable
  2019-11-13 21:50 ` Greg Kroah-Hartman
  2019-11-13 22:13   ` Luis Chamberlain
@ 2019-11-13 22:33   ` Mark Salyzyn
  1 sibling, 0 replies; 9+ messages in thread
From: Mark Salyzyn @ 2019-11-13 22:33 UTC (permalink / raw)
  To: Greg Kroah-Hartman
  Cc: linux-kernel, kernel-team, Tim Murray,
	Venkata Narendra Kumar Gutta, Rafael J. Wysocki,
	Luis Chamberlain

On 11/13/19 1:50 PM, Greg Kroah-Hartman wrote:
> On Wed, Nov 13, 2019 at 01:01:13PM -0800, Mark Salyzyn wrote:
>> Because firmware caching generates uevent messages that are sent over
>> a netlink socket, it can prevent suspend on many platforms.  It's
>> also not always useful, so make it a configurable option.
>>
>> Signed-off-by: Mark Salyzyn <salyzyn@android.com>
>> Cc: Tim Murray <timmurray@google.com>
>> Cc: Venkata Narendra Kumar Gutta <vnkgutta@codeaurora.org>
>> Acked-by: Luis Chamberlain <mcgrof@kernel.org>
>> ---
>>   drivers/base/Kconfig                | 13 +++++++++++++
>>   drivers/base/firmware_loader/main.c |  6 +++---
>>   2 files changed, 16 insertions(+), 3 deletions(-)
>>
>> diff --git a/drivers/base/Kconfig b/drivers/base/Kconfig
>> index 28b92e3cc570..36351c3a62b0 100644
>> --- a/drivers/base/Kconfig
>> +++ b/drivers/base/Kconfig
>> @@ -89,6 +89,19 @@ config PREVENT_FIRMWARE_BUILD
>>   
>>   source "drivers/base/firmware_loader/Kconfig"
>>   
>> +config FW_CACHE
>> +	bool "Enable firmware caching during suspend"
>> +	depends on PM_SLEEP
>> +	default y
>> +	help
>> +	  Because firmware caching generates uevent messages that are sent
>> +	  over a netlink socket, it can prevent suspend on many platforms.
>> +	  It is also not always useful, so on such platforms we have the
>> +	  option.
>> +
>> +	  If unsure, say Y.
>> +
>> +
> Shouldn't this entry go into drivers/base/firmware_loader/Kconfig
> instead and depend on FW_LOADER by putting it in the correct location in
> that file?

Good point, respin on its way.

>
> Also, no need for two blank lines.
<not sure how the double lines showed up, checkpatch,pl should look for 
this>
>
> And finally, 'default y' is only a good idea if your machine can not
> boot without the option.  I don't think that's the case here, correct?
>
> thanks,
>
> greg k-h

I am concerned about the change in user space behavior and to prevent 
defconfig churn.


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

* [PATCH v2] firmware_class: make firmware caching configurable
  2019-11-13 21:01 [PATCH] firmware_class: make firmware caching configurable Mark Salyzyn
  2019-11-13 21:31 ` Luis Chamberlain
  2019-11-13 21:50 ` Greg Kroah-Hartman
@ 2019-11-13 22:54 ` Mark Salyzyn
  2019-11-13 23:16   ` Luis Chamberlain
  2 siblings, 1 reply; 9+ messages in thread
From: Mark Salyzyn @ 2019-11-13 22:54 UTC (permalink / raw)
  To: linux-kernel
  Cc: kernel-team, Mark Salyzyn, Tim Murray,
	Venkata Narendra Kumar Gutta, Luis Chamberlain,
	Greg Kroah-Hartman, Rafael J . Wysocki

Because firmware caching generates uevent messages that are sent over
a netlink socket, it can prevent suspend on many platforms.  It's
also not always useful, so make it a configurable option.

Signed-off-by: Mark Salyzyn <salyzyn@android.com>
Cc: Tim Murray <timmurray@google.com>
Cc: Venkata Narendra Kumar Gutta <vnkgutta@codeaurora.org>
Cc: Luis Chamberlain <mcgrof@kernel.org>
Cc: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Cc: Rafael J. Wysocki <rafael@kernel.org>
Cc: linux-kernel@vger.kernel.org
Cc: kernel-team@android.com
---
v2
- move config from drivers/base/Kconfig to
  drivers/base/firmware_loader/Kconfig
- drop blank line
- default yes conditional on PM_SLEEP
---
 drivers/base/firmware_loader/Kconfig | 12 ++++++++++++
 drivers/base/firmware_loader/main.c  |  6 +++---
 2 files changed, 15 insertions(+), 3 deletions(-)

diff --git a/drivers/base/firmware_loader/Kconfig b/drivers/base/firmware_loader/Kconfig
index 3f9e274e2ed3..33e6552ddbb6 100644
--- a/drivers/base/firmware_loader/Kconfig
+++ b/drivers/base/firmware_loader/Kconfig
@@ -169,5 +169,17 @@ config FW_LOADER_COMPRESS
 	  be compressed with either none or crc32 integrity check type (pass
 	  "-C crc32" option to xz command).
 
+config FW_CACHE
+	bool "Enable firmware caching during suspend"
+	depends on PM_SLEEP
+	default y if PM_SLEEP
+	help
+	  Because firmware caching generates uevent messages that are sent
+	  over a netlink socket, it can prevent suspend on many platforms.
+	  It is also not always useful, so on such platforms we have the
+	  option.
+
+	  If unsure, say Y.
+
 endif # FW_LOADER
 endmenu
diff --git a/drivers/base/firmware_loader/main.c b/drivers/base/firmware_loader/main.c
index bf44c79beae9..1c9f03514a47 100644
--- a/drivers/base/firmware_loader/main.c
+++ b/drivers/base/firmware_loader/main.c
@@ -51,7 +51,7 @@ struct firmware_cache {
 	struct list_head head;
 	int state;
 
-#ifdef CONFIG_PM_SLEEP
+#ifdef CONFIG_FW_CACHE
 	/*
 	 * Names of firmware images which have been cached successfully
 	 * will be added into the below list so that device uncache
@@ -556,7 +556,7 @@ static void fw_set_page_data(struct fw_priv *fw_priv, struct firmware *fw)
 		 (unsigned int)fw_priv->size);
 }
 
-#ifdef CONFIG_PM_SLEEP
+#ifdef CONFIG_FW_CACHE
 static void fw_name_devm_release(struct device *dev, void *res)
 {
 	struct fw_name_devm *fwn = res;
@@ -1046,7 +1046,7 @@ request_firmware_nowait(
 }
 EXPORT_SYMBOL(request_firmware_nowait);
 
-#ifdef CONFIG_PM_SLEEP
+#ifdef CONFIG_FW_CACHE
 static ASYNC_DOMAIN_EXCLUSIVE(fw_cache_domain);
 
 /**
-- 
2.24.0.rc1.363.gb1bccd3e3d-goog


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

* Re: [PATCH v2] firmware_class: make firmware caching configurable
  2019-11-13 22:54 ` [PATCH v2] " Mark Salyzyn
@ 2019-11-13 23:16   ` Luis Chamberlain
  2019-11-14  0:16     ` Mark Salyzyn
  0 siblings, 1 reply; 9+ messages in thread
From: Luis Chamberlain @ 2019-11-13 23:16 UTC (permalink / raw)
  To: Mark Salyzyn
  Cc: linux-kernel, kernel-team, Tim Murray,
	Venkata Narendra Kumar Gutta, Greg Kroah-Hartman,
	Rafael J . Wysocki

On Wed, Nov 13, 2019 at 02:54:26PM -0800, Mark Salyzyn wrote:
> +config FW_CACHE
> +	bool "Enable firmware caching during suspend"
> +	depends on PM_SLEEP
> +	default y if PM_SLEEP

I think the default y would suffice given you have depends on PM_SLEEP,
however this also works. So, again:

Acked-by: Luis Chamberlain <mcgrof@kernel.org>

  Luis

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

* Re: [PATCH v2] firmware_class: make firmware caching configurable
  2019-11-13 23:16   ` Luis Chamberlain
@ 2019-11-14  0:16     ` Mark Salyzyn
  2019-11-14  0:26       ` Luis Chamberlain
  0 siblings, 1 reply; 9+ messages in thread
From: Mark Salyzyn @ 2019-11-14  0:16 UTC (permalink / raw)
  To: Luis Chamberlain
  Cc: linux-kernel, kernel-team, Tim Murray,
	Venkata Narendra Kumar Gutta, Greg Kroah-Hartman,
	Rafael J . Wysocki

On 11/13/19 3:16 PM, Luis Chamberlain wrote:
> On Wed, Nov 13, 2019 at 02:54:26PM -0800, Mark Salyzyn wrote:
>> +config FW_CACHE
>> +	bool "Enable firmware caching during suspend"
>> +	depends on PM_SLEEP
>> +	default y if PM_SLEEP
> I think the default y would suffice given you have depends on PM_SLEEP,
> however this also works. So, again:
>
> Acked-by: Luis Chamberlain <mcgrof@kernel.org>
>
>    Luis

Worried about setting FW_CACHE w/o PM_SLEEP, this enforces it.

--Mark


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

* Re: [PATCH v2] firmware_class: make firmware caching configurable
  2019-11-14  0:16     ` Mark Salyzyn
@ 2019-11-14  0:26       ` Luis Chamberlain
  0 siblings, 0 replies; 9+ messages in thread
From: Luis Chamberlain @ 2019-11-14  0:26 UTC (permalink / raw)
  To: Mark Salyzyn
  Cc: linux-kernel, kernel-team, Tim Murray,
	Venkata Narendra Kumar Gutta, Greg Kroah-Hartman,
	Rafael J . Wysocki

On Wed, Nov 13, 2019 at 04:16:38PM -0800, Mark Salyzyn wrote:
> On 11/13/19 3:16 PM, Luis Chamberlain wrote:
> > On Wed, Nov 13, 2019 at 02:54:26PM -0800, Mark Salyzyn wrote:
> > > +config FW_CACHE
> > > +	bool "Enable firmware caching during suspend"
> > > +	depends on PM_SLEEP
> > > +	default y if PM_SLEEP
> > I think the default y would suffice given you have depends on PM_SLEEP,
> > however this also works. So, again:
> > 
> > Acked-by: Luis Chamberlain <mcgrof@kernel.org>
> > 
> >    Luis
> 
> Worried about setting FW_CACHE w/o PM_SLEEP, this enforces it.

I understand, but its an impossibility to turn on FW_CACHE without
PM_SLEEP since it depends on it. How would one do that?

However, since it makes no difference we can leave it.

  Luis

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

end of thread, other threads:[~2019-11-14  0:26 UTC | newest]

Thread overview: 9+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-11-13 21:01 [PATCH] firmware_class: make firmware caching configurable Mark Salyzyn
2019-11-13 21:31 ` Luis Chamberlain
2019-11-13 21:50 ` Greg Kroah-Hartman
2019-11-13 22:13   ` Luis Chamberlain
2019-11-13 22:33   ` Mark Salyzyn
2019-11-13 22:54 ` [PATCH v2] " Mark Salyzyn
2019-11-13 23:16   ` Luis Chamberlain
2019-11-14  0:16     ` Mark Salyzyn
2019-11-14  0:26       ` 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).