* [PATCH] pci: endpoint: Replace mdelay with usleep_range in pci_epf_test_write
@ 2018-04-10 13:04 Jia-Ju Bai
2018-05-04 16:29 ` Lorenzo Pieralisi
` (2 more replies)
0 siblings, 3 replies; 5+ messages in thread
From: Jia-Ju Bai @ 2018-04-10 13:04 UTC (permalink / raw)
To: kishon, bhelgaas, nsekhar, john, shawn.lin
Cc: linux-pci, linux-kernel, Jia-Ju Bai
pci_epf_test_write() is never called in atomic context.
The call chain ending up at pci_epf_test_write() is:
[1] pci_epf_test_write() <- pci_epf_test_cmd_handler()
pci_epf_test_cmd_handler() is set as a parameter of INIT_DELAYED_WORK()
in pci_epf_test_probe().
This function is not called in atomic context.
Despite never getting called from atomic context, pci_epf_test_write()
calls mdelay() to busily wait.
This is not necessary and can be replaced with usleep_range() to
avoid busy waiting.
This is found by a static analysis tool named DCNS written by myself.
And I also manually check it.
Signed-off-by: Jia-Ju Bai <baijiaju1990@gmail.com>
---
drivers/pci/endpoint/functions/pci-epf-test.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/drivers/pci/endpoint/functions/pci-epf-test.c b/drivers/pci/endpoint/functions/pci-epf-test.c
index f9308c2..2f0642e 100644
--- a/drivers/pci/endpoint/functions/pci-epf-test.c
+++ b/drivers/pci/endpoint/functions/pci-epf-test.c
@@ -237,7 +237,7 @@ static int pci_epf_test_write(struct pci_epf_test *epf_test)
* wait 1ms inorder for the write to complete. Without this delay L3
* error in observed in the host system.
*/
- mdelay(1);
+ usleep_range(1000, 2000);
kfree(buf);
--
1.9.1
^ permalink raw reply related [flat|nested] 5+ messages in thread
* Re: [PATCH] pci: endpoint: Replace mdelay with usleep_range in pci_epf_test_write
2018-04-10 13:04 [PATCH] pci: endpoint: Replace mdelay with usleep_range in pci_epf_test_write Jia-Ju Bai
@ 2018-05-04 16:29 ` Lorenzo Pieralisi
2018-05-05 10:03 ` Kishon Vijay Abraham I
2018-05-08 10:53 ` Lorenzo Pieralisi
2018-05-11 14:18 ` Lorenzo Pieralisi
2 siblings, 1 reply; 5+ messages in thread
From: Lorenzo Pieralisi @ 2018-05-04 16:29 UTC (permalink / raw)
To: Jia-Ju Bai, kishon
Cc: bhelgaas, nsekhar, john, shawn.lin, linux-pci, linux-kernel
On Tue, Apr 10, 2018 at 09:04:06PM +0800, Jia-Ju Bai wrote:
> pci_epf_test_write() is never called in atomic context.
>
> The call chain ending up at pci_epf_test_write() is:
> [1] pci_epf_test_write() <- pci_epf_test_cmd_handler()
>
> pci_epf_test_cmd_handler() is set as a parameter of INIT_DELAYED_WORK()
> in pci_epf_test_probe().
> This function is not called in atomic context.
>
> Despite never getting called from atomic context, pci_epf_test_write()
> calls mdelay() to busily wait.
> This is not necessary and can be replaced with usleep_range() to
> avoid busy waiting.
>
> This is found by a static analysis tool named DCNS written by myself.
> And I also manually check it.
>
> Signed-off-by: Jia-Ju Bai <baijiaju1990@gmail.com>
> ---
> drivers/pci/endpoint/functions/pci-epf-test.c | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
I'd request Kishon's ACK on this.
Thanks,
Lorenzo
> diff --git a/drivers/pci/endpoint/functions/pci-epf-test.c b/drivers/pci/endpoint/functions/pci-epf-test.c
> index f9308c2..2f0642e 100644
> --- a/drivers/pci/endpoint/functions/pci-epf-test.c
> +++ b/drivers/pci/endpoint/functions/pci-epf-test.c
> @@ -237,7 +237,7 @@ static int pci_epf_test_write(struct pci_epf_test *epf_test)
> * wait 1ms inorder for the write to complete. Without this delay L3
> * error in observed in the host system.
> */
> - mdelay(1);
> + usleep_range(1000, 2000);
>
> kfree(buf);
>
> --
> 1.9.1
>
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [PATCH] pci: endpoint: Replace mdelay with usleep_range in pci_epf_test_write
2018-05-04 16:29 ` Lorenzo Pieralisi
@ 2018-05-05 10:03 ` Kishon Vijay Abraham I
0 siblings, 0 replies; 5+ messages in thread
From: Kishon Vijay Abraham I @ 2018-05-05 10:03 UTC (permalink / raw)
To: Lorenzo Pieralisi, Jia-Ju Bai
Cc: bhelgaas, nsekhar, john, shawn.lin, linux-pci, linux-kernel
On Friday 04 May 2018 09:59 PM, Lorenzo Pieralisi wrote:
> On Tue, Apr 10, 2018 at 09:04:06PM +0800, Jia-Ju Bai wrote:
>> pci_epf_test_write() is never called in atomic context.
>>
>> The call chain ending up at pci_epf_test_write() is:
>> [1] pci_epf_test_write() <- pci_epf_test_cmd_handler()
>>
>> pci_epf_test_cmd_handler() is set as a parameter of INIT_DELAYED_WORK()
>> in pci_epf_test_probe().
>> This function is not called in atomic context.
>>
>> Despite never getting called from atomic context, pci_epf_test_write()
>> calls mdelay() to busily wait.
>> This is not necessary and can be replaced with usleep_range() to
>> avoid busy waiting.
>>
>> This is found by a static analysis tool named DCNS written by myself.
>> And I also manually check it.
>>
>> Signed-off-by: Jia-Ju Bai <baijiaju1990@gmail.com>
>> ---
>> drivers/pci/endpoint/functions/pci-epf-test.c | 2 +-
>> 1 file changed, 1 insertion(+), 1 deletion(-)
>
> I'd request Kishon's ACK on this.
sorry, missed this before.
Acked-by: Kishon Vijay Abraham I <kishon@ti.com>
>
> Thanks,
> Lorenzo
>
>> diff --git a/drivers/pci/endpoint/functions/pci-epf-test.c b/drivers/pci/endpoint/functions/pci-epf-test.c
>> index f9308c2..2f0642e 100644
>> --- a/drivers/pci/endpoint/functions/pci-epf-test.c
>> +++ b/drivers/pci/endpoint/functions/pci-epf-test.c
>> @@ -237,7 +237,7 @@ static int pci_epf_test_write(struct pci_epf_test *epf_test)
>> * wait 1ms inorder for the write to complete. Without this delay L3
>> * error in observed in the host system.
>> */
>> - mdelay(1);
>> + usleep_range(1000, 2000);
>>
>> kfree(buf);
>>
>> --
>> 1.9.1
>>
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [PATCH] pci: endpoint: Replace mdelay with usleep_range in pci_epf_test_write
2018-04-10 13:04 [PATCH] pci: endpoint: Replace mdelay with usleep_range in pci_epf_test_write Jia-Ju Bai
2018-05-04 16:29 ` Lorenzo Pieralisi
@ 2018-05-08 10:53 ` Lorenzo Pieralisi
2018-05-11 14:18 ` Lorenzo Pieralisi
2 siblings, 0 replies; 5+ messages in thread
From: Lorenzo Pieralisi @ 2018-05-08 10:53 UTC (permalink / raw)
To: Jia-Ju Bai
Cc: kishon, bhelgaas, nsekhar, john, shawn.lin, linux-pci, linux-kernel
On Tue, Apr 10, 2018 at 09:04:06PM +0800, Jia-Ju Bai wrote:
> pci_epf_test_write() is never called in atomic context.
>
> The call chain ending up at pci_epf_test_write() is:
> [1] pci_epf_test_write() <- pci_epf_test_cmd_handler()
>
> pci_epf_test_cmd_handler() is set as a parameter of INIT_DELAYED_WORK()
> in pci_epf_test_probe().
> This function is not called in atomic context.
>
> Despite never getting called from atomic context, pci_epf_test_write()
> calls mdelay() to busily wait.
> This is not necessary and can be replaced with usleep_range() to
> avoid busy waiting.
>
> This is found by a static analysis tool named DCNS written by myself.
> And I also manually check it.
>
> Signed-off-by: Jia-Ju Bai <baijiaju1990@gmail.com>
> ---
> drivers/pci/endpoint/functions/pci-epf-test.c | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
Applied to pci/endpoint for v4.18, thanks.
Lorenzo
> diff --git a/drivers/pci/endpoint/functions/pci-epf-test.c b/drivers/pci/endpoint/functions/pci-epf-test.c
> index f9308c2..2f0642e 100644
> --- a/drivers/pci/endpoint/functions/pci-epf-test.c
> +++ b/drivers/pci/endpoint/functions/pci-epf-test.c
> @@ -237,7 +237,7 @@ static int pci_epf_test_write(struct pci_epf_test *epf_test)
> * wait 1ms inorder for the write to complete. Without this delay L3
> * error in observed in the host system.
> */
> - mdelay(1);
> + usleep_range(1000, 2000);
>
> kfree(buf);
>
> --
> 1.9.1
>
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [PATCH] pci: endpoint: Replace mdelay with usleep_range in pci_epf_test_write
2018-04-10 13:04 [PATCH] pci: endpoint: Replace mdelay with usleep_range in pci_epf_test_write Jia-Ju Bai
2018-05-04 16:29 ` Lorenzo Pieralisi
2018-05-08 10:53 ` Lorenzo Pieralisi
@ 2018-05-11 14:18 ` Lorenzo Pieralisi
2 siblings, 0 replies; 5+ messages in thread
From: Lorenzo Pieralisi @ 2018-05-11 14:18 UTC (permalink / raw)
To: Jia-Ju Bai
Cc: kishon, bhelgaas, nsekhar, john, shawn.lin, linux-pci, linux-kernel
On Tue, Apr 10, 2018 at 09:04:06PM +0800, Jia-Ju Bai wrote:
> pci_epf_test_write() is never called in atomic context.
>
> The call chain ending up at pci_epf_test_write() is:
> [1] pci_epf_test_write() <- pci_epf_test_cmd_handler()
>
> pci_epf_test_cmd_handler() is set as a parameter of INIT_DELAYED_WORK()
> in pci_epf_test_probe().
> This function is not called in atomic context.
>
> Despite never getting called from atomic context, pci_epf_test_write()
> calls mdelay() to busily wait.
> This is not necessary and can be replaced with usleep_range() to
> avoid busy waiting.
>
> This is found by a static analysis tool named DCNS written by myself.
> And I also manually check it.
>
> Signed-off-by: Jia-Ju Bai <baijiaju1990@gmail.com>
> ---
> drivers/pci/endpoint/functions/pci-epf-test.c | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
Applied to pci/endpoint for v4.18, thanks.
Lorenzo
> diff --git a/drivers/pci/endpoint/functions/pci-epf-test.c b/drivers/pci/endpoint/functions/pci-epf-test.c
> index f9308c2..2f0642e 100644
> --- a/drivers/pci/endpoint/functions/pci-epf-test.c
> +++ b/drivers/pci/endpoint/functions/pci-epf-test.c
> @@ -237,7 +237,7 @@ static int pci_epf_test_write(struct pci_epf_test *epf_test)
> * wait 1ms inorder for the write to complete. Without this delay L3
> * error in observed in the host system.
> */
> - mdelay(1);
> + usleep_range(1000, 2000);
>
> kfree(buf);
>
> --
> 1.9.1
>
^ permalink raw reply [flat|nested] 5+ messages in thread
end of thread, other threads:[~2018-05-11 14:18 UTC | newest]
Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2018-04-10 13:04 [PATCH] pci: endpoint: Replace mdelay with usleep_range in pci_epf_test_write Jia-Ju Bai
2018-05-04 16:29 ` Lorenzo Pieralisi
2018-05-05 10:03 ` Kishon Vijay Abraham I
2018-05-08 10:53 ` Lorenzo Pieralisi
2018-05-11 14:18 ` Lorenzo Pieralisi
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.