linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [RFC][PATCH 1/2] remoteproc: Reduce asynchronous request_firmware to auto-boot only
@ 2017-01-24 23:13 Sarangdhar Joshi
  2017-01-24 23:13 ` [PATCH 2/2] remoteproc: Modify the function names Sarangdhar Joshi
  2017-02-06 21:08 ` [RFC][PATCH 1/2] remoteproc: Reduce asynchronous request_firmware to auto-boot only Bjorn Andersson
  0 siblings, 2 replies; 4+ messages in thread
From: Sarangdhar Joshi @ 2017-01-24 23:13 UTC (permalink / raw)
  To: Ohad Ben-Cohen, Bjorn Andersson, Loic Pallardy, Santosh Shilimkar
  Cc: Sarangdhar Joshi, linux-remoteproc, linux-kernel,
	linux-arm-kernel, linux-arm-msm, Dave Gerlach, Suman Anna,
	Stephen Boyd, Trilok Soni

The rproc_add_virtio_devices() requests firmware asynchronously and
triggers boot if the auto_boot flag is set. However, this
asynchronous call seems to be redundant for non auto-boot scenario
since the rproc_boot() would call request_firmware() anyways. Move
the auto_boot check to rproc_add() so that a redundant call to
_request_firmware can be avoided for non auto-boot case.

Signed-off-by: Sarangdhar Joshi <spjoshi@codeaurora.org>
---

I'm requesting RFC on this patch since I'm not aware of any scenario
where we might need asynchronous firmware loading for non auto-boot case.

 drivers/remoteproc/remoteproc_core.c | 14 ++++++++------
 1 file changed, 8 insertions(+), 6 deletions(-)

diff --git a/drivers/remoteproc/remoteproc_core.c b/drivers/remoteproc/remoteproc_core.c
index f58e634..16242b0 100644
--- a/drivers/remoteproc/remoteproc_core.c
+++ b/drivers/remoteproc/remoteproc_core.c
@@ -970,9 +970,7 @@ static void rproc_fw_config_virtio(const struct firmware *fw, void *context)
 {
 	struct rproc *rproc = context;
 
-	/* if rproc is marked always-on, request it to boot */
-	if (rproc->auto_boot)
-		rproc_boot(rproc);
+	rproc_boot(rproc);
 
 	release_firmware(fw);
 }
@@ -1286,9 +1284,13 @@ int rproc_add(struct rproc *rproc)
 
 	/* create debugfs entries */
 	rproc_create_debug_dir(rproc);
-	ret = rproc_add_virtio_devices(rproc);
-	if (ret < 0)
-		return ret;
+
+	/* if rproc is marked always-on, request it to boot */
+	if (rproc->auto_boot) {
+		ret = rproc_add_virtio_devices(rproc);
+		if (ret < 0)
+			return ret;
+	}
 
 	/* expose to rproc_get_by_phandle users */
 	mutex_lock(&rproc_list_mutex);
-- 
The Qualcomm Innovation Center, Inc. is a member of the Code Aurora Forum,
a Linux Foundation Collaborative Project

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

* [PATCH 2/2] remoteproc: Modify the function names
  2017-01-24 23:13 [RFC][PATCH 1/2] remoteproc: Reduce asynchronous request_firmware to auto-boot only Sarangdhar Joshi
@ 2017-01-24 23:13 ` Sarangdhar Joshi
  2017-02-06 21:08 ` [RFC][PATCH 1/2] remoteproc: Reduce asynchronous request_firmware to auto-boot only Bjorn Andersson
  1 sibling, 0 replies; 4+ messages in thread
From: Sarangdhar Joshi @ 2017-01-24 23:13 UTC (permalink / raw)
  To: Ohad Ben-Cohen, Bjorn Andersson, Loic Pallardy, Santosh Shilimkar
  Cc: Sarangdhar Joshi, linux-remoteproc, linux-kernel,
	linux-arm-kernel, linux-arm-msm, Dave Gerlach, Suman Anna,
	Stephen Boyd, Trilok Soni

The functions rproc_add_virtio_devices() and
rproc_fw_config_virtio() are reduced to trigger auto-boot
only. Modify these function names and related comments to
reflect their current state.

This patch does not add any functional change.

Signed-off-by: Sarangdhar Joshi <spjoshi@codeaurora.org>
---
 drivers/remoteproc/remoteproc_core.c | 14 +++++---------
 1 file changed, 5 insertions(+), 9 deletions(-)

diff --git a/drivers/remoteproc/remoteproc_core.c b/drivers/remoteproc/remoteproc_core.c
index 16242b0..c6b1d4a 100644
--- a/drivers/remoteproc/remoteproc_core.c
+++ b/drivers/remoteproc/remoteproc_core.c
@@ -959,14 +959,14 @@ static int rproc_fw_boot(struct rproc *rproc, const struct firmware *fw)
 }
 
 /*
- * take a firmware and look for virtio devices to register.
+ * take a firmware and boot it up.
  *
  * Note: this function is called asynchronously upon registration of the
  * remote processor (so we must wait until it completes before we try
  * to unregister the device. one other option is just to use kref here,
  * that might be cleaner).
  */
-static void rproc_fw_config_virtio(const struct firmware *fw, void *context)
+static void rproc_auto_boot_callback(const struct firmware *fw, void *context)
 {
 	struct rproc *rproc = context;
 
@@ -975,21 +975,17 @@ static void rproc_fw_config_virtio(const struct firmware *fw, void *context)
 	release_firmware(fw);
 }
 
-static int rproc_add_virtio_devices(struct rproc *rproc)
+static int rproc_trigger_auto_boot(struct rproc *rproc)
 {
 	int ret;
 
 	/*
-	 * We must retrieve early virtio configuration info from
-	 * the firmware (e.g. whether to register a virtio device,
-	 * what virtio features does it support, ...).
-	 *
 	 * We're initiating an asynchronous firmware loading, so we can
 	 * be built-in kernel code, without hanging the boot process.
 	 */
 	ret = request_firmware_nowait(THIS_MODULE, FW_ACTION_HOTPLUG,
 				      rproc->firmware, &rproc->dev, GFP_KERNEL,
-				      rproc, rproc_fw_config_virtio);
+				      rproc, rproc_auto_boot_callback);
 	if (ret < 0)
 		dev_err(&rproc->dev, "request_firmware_nowait err: %d\n", ret);
 
@@ -1287,7 +1283,7 @@ int rproc_add(struct rproc *rproc)
 
 	/* if rproc is marked always-on, request it to boot */
 	if (rproc->auto_boot) {
-		ret = rproc_add_virtio_devices(rproc);
+		ret = rproc_trigger_auto_boot(rproc);
 		if (ret < 0)
 			return ret;
 	}
-- 
The Qualcomm Innovation Center, Inc. is a member of the Code Aurora Forum,
a Linux Foundation Collaborative Project

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

* Re: [RFC][PATCH 1/2] remoteproc: Reduce asynchronous request_firmware to auto-boot only
  2017-01-24 23:13 [RFC][PATCH 1/2] remoteproc: Reduce asynchronous request_firmware to auto-boot only Sarangdhar Joshi
  2017-01-24 23:13 ` [PATCH 2/2] remoteproc: Modify the function names Sarangdhar Joshi
@ 2017-02-06 21:08 ` Bjorn Andersson
  2017-02-07 18:55   ` Sarangdhar Joshi
  1 sibling, 1 reply; 4+ messages in thread
From: Bjorn Andersson @ 2017-02-06 21:08 UTC (permalink / raw)
  To: Sarangdhar Joshi
  Cc: Ohad Ben-Cohen, Loic Pallardy, Santosh Shilimkar,
	linux-remoteproc, linux-kernel, linux-arm-kernel, linux-arm-msm,
	Dave Gerlach, Suman Anna, Stephen Boyd, Trilok Soni

On Tue 24 Jan 15:13 PST 2017, Sarangdhar Joshi wrote:

> The rproc_add_virtio_devices() requests firmware asynchronously and
> triggers boot if the auto_boot flag is set. However, this
> asynchronous call seems to be redundant for non auto-boot scenario
> since the rproc_boot() would call request_firmware() anyways. Move
> the auto_boot check to rproc_add() so that a redundant call to
> _request_firmware can be avoided for non auto-boot case.
> 
> Signed-off-by: Sarangdhar Joshi <spjoshi@codeaurora.org>

Looks good, applied both patches.

Regards,
Bjorn

> ---
> 
> I'm requesting RFC on this patch since I'm not aware of any scenario
> where we might need asynchronous firmware loading for non auto-boot case.
> 
>  drivers/remoteproc/remoteproc_core.c | 14 ++++++++------
>  1 file changed, 8 insertions(+), 6 deletions(-)
> 
> diff --git a/drivers/remoteproc/remoteproc_core.c b/drivers/remoteproc/remoteproc_core.c
> index f58e634..16242b0 100644
> --- a/drivers/remoteproc/remoteproc_core.c
> +++ b/drivers/remoteproc/remoteproc_core.c
> @@ -970,9 +970,7 @@ static void rproc_fw_config_virtio(const struct firmware *fw, void *context)
>  {
>  	struct rproc *rproc = context;
>  
> -	/* if rproc is marked always-on, request it to boot */
> -	if (rproc->auto_boot)
> -		rproc_boot(rproc);
> +	rproc_boot(rproc);
>  
>  	release_firmware(fw);
>  }
> @@ -1286,9 +1284,13 @@ int rproc_add(struct rproc *rproc)
>  
>  	/* create debugfs entries */
>  	rproc_create_debug_dir(rproc);
> -	ret = rproc_add_virtio_devices(rproc);
> -	if (ret < 0)
> -		return ret;
> +
> +	/* if rproc is marked always-on, request it to boot */
> +	if (rproc->auto_boot) {
> +		ret = rproc_add_virtio_devices(rproc);
> +		if (ret < 0)
> +			return ret;
> +	}
>  
>  	/* expose to rproc_get_by_phandle users */
>  	mutex_lock(&rproc_list_mutex);
> -- 
> The Qualcomm Innovation Center, Inc. is a member of the Code Aurora Forum,
> a Linux Foundation Collaborative Project
> 

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

* Re: [RFC][PATCH 1/2] remoteproc: Reduce asynchronous request_firmware to auto-boot only
  2017-02-06 21:08 ` [RFC][PATCH 1/2] remoteproc: Reduce asynchronous request_firmware to auto-boot only Bjorn Andersson
@ 2017-02-07 18:55   ` Sarangdhar Joshi
  0 siblings, 0 replies; 4+ messages in thread
From: Sarangdhar Joshi @ 2017-02-07 18:55 UTC (permalink / raw)
  To: Bjorn Andersson
  Cc: Ohad Ben-Cohen, Loic Pallardy, Santosh Shilimkar,
	linux-remoteproc, linux-kernel, linux-arm-kernel, linux-arm-msm,
	Dave Gerlach, Suman Anna, Stephen Boyd, Trilok Soni

Hi Bjorn,

On 02/06/2017 01:08 PM, Bjorn Andersson wrote:
> On Tue 24 Jan 15:13 PST 2017, Sarangdhar Joshi wrote:
>
>> The rproc_add_virtio_devices() requests firmware asynchronously and
>> triggers boot if the auto_boot flag is set. However, this
>> asynchronous call seems to be redundant for non auto-boot scenario
>> since the rproc_boot() would call request_firmware() anyways. Move
>> the auto_boot check to rproc_add() so that a redundant call to
>> _request_firmware can be avoided for non auto-boot case.
>>
>> Signed-off-by: Sarangdhar Joshi <spjoshi@codeaurora.org>
>
> Looks good, applied both patches.

Thanks for the review and applying these(and couple others) patches.

Regards,
Sarang
>
> Regards,
> Bjorn
>
>> ---
>>
>> I'm requesting RFC on this patch since I'm not aware of any scenario
>> where we might need asynchronous firmware loading for non auto-boot case.
>>
>>  drivers/remoteproc/remoteproc_core.c | 14 ++++++++------
>>  1 file changed, 8 insertions(+), 6 deletions(-)
>>
>> diff --git a/drivers/remoteproc/remoteproc_core.c b/drivers/remoteproc/remoteproc_core.c
>> index f58e634..16242b0 100644
>> --- a/drivers/remoteproc/remoteproc_core.c
>> +++ b/drivers/remoteproc/remoteproc_core.c
>> @@ -970,9 +970,7 @@ static void rproc_fw_config_virtio(const struct firmware *fw, void *context)
>>  {
>>  	struct rproc *rproc = context;
>>
>> -	/* if rproc is marked always-on, request it to boot */
>> -	if (rproc->auto_boot)
>> -		rproc_boot(rproc);
>> +	rproc_boot(rproc);
>>
>>  	release_firmware(fw);
>>  }
>> @@ -1286,9 +1284,13 @@ int rproc_add(struct rproc *rproc)
>>
>>  	/* create debugfs entries */
>>  	rproc_create_debug_dir(rproc);
>> -	ret = rproc_add_virtio_devices(rproc);
>> -	if (ret < 0)
>> -		return ret;
>> +
>> +	/* if rproc is marked always-on, request it to boot */
>> +	if (rproc->auto_boot) {
>> +		ret = rproc_add_virtio_devices(rproc);
>> +		if (ret < 0)
>> +			return ret;
>> +	}
>>
>>  	/* expose to rproc_get_by_phandle users */
>>  	mutex_lock(&rproc_list_mutex);
>> --
>> The Qualcomm Innovation Center, Inc. is a member of the Code Aurora Forum,
>> a Linux Foundation Collaborative Project
>>
> --
> To unsubscribe from this list: send the line "unsubscribe linux-remoteproc" in
> the body of a message to majordomo@vger.kernel.org
> More majordomo info at  http://vger.kernel.org/majordomo-info.html
>


-- 
The Qualcomm Innovation Center, Inc. is a member of the Code Aurora Forum,
a Linux Foundation Collaborative Project

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

end of thread, other threads:[~2017-02-07 19:08 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2017-01-24 23:13 [RFC][PATCH 1/2] remoteproc: Reduce asynchronous request_firmware to auto-boot only Sarangdhar Joshi
2017-01-24 23:13 ` [PATCH 2/2] remoteproc: Modify the function names Sarangdhar Joshi
2017-02-06 21:08 ` [RFC][PATCH 1/2] remoteproc: Reduce asynchronous request_firmware to auto-boot only Bjorn Andersson
2017-02-07 18:55   ` Sarangdhar Joshi

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