linuxppc-dev.lists.ozlabs.org archive mirror
 help / color / mirror / Atom feed
* [PATCH 06/19] soc/qman: test: Use kthread_run_on_cpu()
       [not found] <20241211154035.75565-1-frederic@kernel.org>
@ 2024-12-11 15:40 ` Frederic Weisbecker
  2024-12-13  7:27   ` LEROY Christophe
  0 siblings, 1 reply; 3+ messages in thread
From: Frederic Weisbecker @ 2024-12-11 15:40 UTC (permalink / raw)
  To: LKML
  Cc: Frederic Weisbecker, linuxppc-dev, linux-arm-kernel,
	Andrew Morton, Peter Zijlstra, Thomas Gleixner

Use the proper API instead of open coding it.

However it looks like kthreads here could be replaced by the use of a
per-cpu workqueue instead.

Signed-off-by: Frederic Weisbecker <frederic@kernel.org>
---
 drivers/soc/fsl/qbman/qman_test_stash.c | 6 ++----
 1 file changed, 2 insertions(+), 4 deletions(-)

diff --git a/drivers/soc/fsl/qbman/qman_test_stash.c b/drivers/soc/fsl/qbman/qman_test_stash.c
index b7e8e5ec884c..f4d3c2146f4f 100644
--- a/drivers/soc/fsl/qbman/qman_test_stash.c
+++ b/drivers/soc/fsl/qbman/qman_test_stash.c
@@ -108,14 +108,12 @@ static int on_all_cpus(int (*fn)(void))
 			.fn = fn,
 			.started = ATOMIC_INIT(0)
 		};
-		struct task_struct *k = kthread_create(bstrap_fn, &bstrap,
-			"hotpotato%d", cpu);
+		struct task_struct *k = kthread_run_on_cpu(bstrap_fn, &bstrap,
+							   cpu, "hotpotato%d");
 		int ret;
 
 		if (IS_ERR(k))
 			return -ENOMEM;
-		kthread_bind(k, cpu);
-		wake_up_process(k);
 		/*
 		 * If we call kthread_stop() before the "wake up" has had an
 		 * effect, then the thread may exit with -EINTR without ever
-- 
2.46.0



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

* Re: [PATCH 06/19] soc/qman: test: Use kthread_run_on_cpu()
  2024-12-11 15:40 ` [PATCH 06/19] soc/qman: test: Use kthread_run_on_cpu() Frederic Weisbecker
@ 2024-12-13  7:27   ` LEROY Christophe
  2024-12-13 11:46     ` Frederic Weisbecker
  0 siblings, 1 reply; 3+ messages in thread
From: LEROY Christophe @ 2024-12-13  7:27 UTC (permalink / raw)
  To: Frederic Weisbecker, LKML
  Cc: linuxppc-dev@lists.ozlabs.org,
	linux-arm-kernel@lists.infradead.org, Andrew Morton,
	Peter Zijlstra, Thomas Gleixner



Le 11/12/2024 à 16:40, Frederic Weisbecker a écrit :
> Use the proper API instead of open coding it.
> 
> However it looks like kthreads here could be replaced by the use of a
> per-cpu workqueue instead.
> 
> Signed-off-by: Frederic Weisbecker <frederic@kernel.org>

Acked-by: Christophe Leroy <christophe.leroy@csgroup.eu>

> ---
>   drivers/soc/fsl/qbman/qman_test_stash.c | 6 ++----
>   1 file changed, 2 insertions(+), 4 deletions(-)
> 
> diff --git a/drivers/soc/fsl/qbman/qman_test_stash.c b/drivers/soc/fsl/qbman/qman_test_stash.c
> index b7e8e5ec884c..f4d3c2146f4f 100644
> --- a/drivers/soc/fsl/qbman/qman_test_stash.c
> +++ b/drivers/soc/fsl/qbman/qman_test_stash.c
> @@ -108,14 +108,12 @@ static int on_all_cpus(int (*fn)(void))
>   			.fn = fn,
>   			.started = ATOMIC_INIT(0)
>   		};
> -		struct task_struct *k = kthread_create(bstrap_fn, &bstrap,
> -			"hotpotato%d", cpu);
> +		struct task_struct *k = kthread_run_on_cpu(bstrap_fn, &bstrap,
> +							   cpu, "hotpotato%d");
>   		int ret;
>   
>   		if (IS_ERR(k))
>   			return -ENOMEM;
> -		kthread_bind(k, cpu);
> -		wake_up_process(k);
>   		/*
>   		 * If we call kthread_stop() before the "wake up" has had an
>   		 * effect, then the thread may exit with -EINTR without ever


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

* Re: [PATCH 06/19] soc/qman: test: Use kthread_run_on_cpu()
  2024-12-13  7:27   ` LEROY Christophe
@ 2024-12-13 11:46     ` Frederic Weisbecker
  0 siblings, 0 replies; 3+ messages in thread
From: Frederic Weisbecker @ 2024-12-13 11:46 UTC (permalink / raw)
  To: LEROY Christophe
  Cc: LKML, linuxppc-dev@lists.ozlabs.org,
	linux-arm-kernel@lists.infradead.org, Andrew Morton,
	Peter Zijlstra, Thomas Gleixner

Le Fri, Dec 13, 2024 at 07:27:03AM +0000, LEROY Christophe a écrit :
> 
> 
> Le 11/12/2024 à 16:40, Frederic Weisbecker a écrit :
> > Use the proper API instead of open coding it.
> > 
> > However it looks like kthreads here could be replaced by the use of a
> > per-cpu workqueue instead.
> > 
> > Signed-off-by: Frederic Weisbecker <frederic@kernel.org>
> 
> Acked-by: Christophe Leroy <christophe.leroy@csgroup.eu>

Thanks! Feel free to apply this patch to your tree as it's a pretty
standalone change.


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

end of thread, other threads:[~2024-12-13 11:46 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
     [not found] <20241211154035.75565-1-frederic@kernel.org>
2024-12-11 15:40 ` [PATCH 06/19] soc/qman: test: Use kthread_run_on_cpu() Frederic Weisbecker
2024-12-13  7:27   ` LEROY Christophe
2024-12-13 11:46     ` Frederic Weisbecker

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