linux-arm-kernel.lists.infradead.org archive mirror
 help / color / mirror / Atom feed
* [PATCH 01/20] arm/bL_switcher: Use kthread_run_on_cpu()
       [not found] <20240726215701.19459-1-frederic@kernel.org>
@ 2024-07-26 21:56 ` Frederic Weisbecker
  2024-08-05 14:44   ` Dave Martin
  2024-07-26 21:56 ` [PATCH 07/20] soc/qman: test: " Frederic Weisbecker
  1 sibling, 1 reply; 5+ messages in thread
From: Frederic Weisbecker @ 2024-07-26 21:56 UTC (permalink / raw)
  To: LKML
  Cc: Frederic Weisbecker, Russell King, linux-arm-kernel,
	Andrew Morton, Peter Zijlstra, Thomas Gleixner

Use the proper API instead of open coding it.

Signed-off-by: Frederic Weisbecker <frederic@kernel.org>
---
 arch/arm/common/bL_switcher.c | 10 ++++------
 1 file changed, 4 insertions(+), 6 deletions(-)

diff --git a/arch/arm/common/bL_switcher.c b/arch/arm/common/bL_switcher.c
index 9a9aa53547a6..d1e82a318e3b 100644
--- a/arch/arm/common/bL_switcher.c
+++ b/arch/arm/common/bL_switcher.c
@@ -307,13 +307,11 @@ static struct task_struct *bL_switcher_thread_create(int cpu, void *arg)
 {
 	struct task_struct *task;
 
-	task = kthread_create_on_node(bL_switcher_thread, arg,
-				      cpu_to_node(cpu), "kswitcher_%d", cpu);
-	if (!IS_ERR(task)) {
-		kthread_bind(task, cpu);
-		wake_up_process(task);
-	} else
+	task = kthread_run_on_cpu(bL_switcher_thread, arg,
+				  cpu, "kswitcher_%d");
+	if (IS_ERR(task))
 		pr_err("%s failed for CPU %d\n", __func__, cpu);
+
 	return task;
 }
 
-- 
2.45.2



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

* [PATCH 07/20] soc/qman: test: Use kthread_run_on_cpu()
       [not found] <20240726215701.19459-1-frederic@kernel.org>
  2024-07-26 21:56 ` [PATCH 01/20] arm/bL_switcher: Use kthread_run_on_cpu() Frederic Weisbecker
@ 2024-07-26 21:56 ` Frederic Weisbecker
  1 sibling, 0 replies; 5+ messages in thread
From: Frederic Weisbecker @ 2024-07-26 21:56 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.45.2



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

* Re: [PATCH 01/20] arm/bL_switcher: Use kthread_run_on_cpu()
  2024-07-26 21:56 ` [PATCH 01/20] arm/bL_switcher: Use kthread_run_on_cpu() Frederic Weisbecker
@ 2024-08-05 14:44   ` Dave Martin
  2024-08-05 14:53     ` Nicolas Pitre
  0 siblings, 1 reply; 5+ messages in thread
From: Dave Martin @ 2024-08-05 14:44 UTC (permalink / raw)
  To: Frederic Weisbecker
  Cc: LKML, Russell King, linux-arm-kernel, Andrew Morton,
	Peter Zijlstra, Thomas Gleixner, Nicolas Pitre

Hi,

On Fri, Jul 26, 2024 at 11:56:37PM +0200, Frederic Weisbecker wrote:
> Use the proper API instead of open coding it.
> 
> Signed-off-by: Frederic Weisbecker <frederic@kernel.org>
> ---
>  arch/arm/common/bL_switcher.c | 10 ++++------
>  1 file changed, 4 insertions(+), 6 deletions(-)
> 
> diff --git a/arch/arm/common/bL_switcher.c b/arch/arm/common/bL_switcher.c
> index 9a9aa53547a6..d1e82a318e3b 100644
> --- a/arch/arm/common/bL_switcher.c
> +++ b/arch/arm/common/bL_switcher.c
> @@ -307,13 +307,11 @@ static struct task_struct *bL_switcher_thread_create(int cpu, void *arg)
>  {
>  	struct task_struct *task;
>  
> -	task = kthread_create_on_node(bL_switcher_thread, arg,
> -				      cpu_to_node(cpu), "kswitcher_%d", cpu);
> -	if (!IS_ERR(task)) {
> -		kthread_bind(task, cpu);
> -		wake_up_process(task);
> -	} else
> +	task = kthread_run_on_cpu(bL_switcher_thread, arg,
> +				  cpu, "kswitcher_%d");
> +	if (IS_ERR(task))
>  		pr_err("%s failed for CPU %d\n", __func__, cpu);
> +
>  	return task;
>  }

It's ages since I worked on this, but it looks like this is pure
refactoring.  So far as I can see, it does the right thing, so, FWIW:

Reviewed-by: Dave Martin <Dave.Martin@arm.com>

I don't currently have hardware I can test this on, though.

Nico (Cc added) might just possibly have an opinion on it, though this
looks uncontroversial.

Cheers
---Dave


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

* Re: [PATCH 01/20] arm/bL_switcher: Use kthread_run_on_cpu()
  2024-08-05 14:44   ` Dave Martin
@ 2024-08-05 14:53     ` Nicolas Pitre
  0 siblings, 0 replies; 5+ messages in thread
From: Nicolas Pitre @ 2024-08-05 14:53 UTC (permalink / raw)
  To: Dave Martin
  Cc: Frederic Weisbecker, LKML, Russell King, linux-arm-kernel,
	Andrew Morton, Peter Zijlstra, Thomas Gleixner

On Mon, 5 Aug 2024, Dave Martin wrote:

> Hi,
> 
> On Fri, Jul 26, 2024 at 11:56:37PM +0200, Frederic Weisbecker wrote:
> > Use the proper API instead of open coding it.
> > 
> > Signed-off-by: Frederic Weisbecker <frederic@kernel.org>
> > ---
> >  arch/arm/common/bL_switcher.c | 10 ++++------
> >  1 file changed, 4 insertions(+), 6 deletions(-)
> > 
> > diff --git a/arch/arm/common/bL_switcher.c b/arch/arm/common/bL_switcher.c
> > index 9a9aa53547a6..d1e82a318e3b 100644
> > --- a/arch/arm/common/bL_switcher.c
> > +++ b/arch/arm/common/bL_switcher.c
> > @@ -307,13 +307,11 @@ static struct task_struct *bL_switcher_thread_create(int cpu, void *arg)
> >  {
> >  	struct task_struct *task;
> >  
> > -	task = kthread_create_on_node(bL_switcher_thread, arg,
> > -				      cpu_to_node(cpu), "kswitcher_%d", cpu);
> > -	if (!IS_ERR(task)) {
> > -		kthread_bind(task, cpu);
> > -		wake_up_process(task);
> > -	} else
> > +	task = kthread_run_on_cpu(bL_switcher_thread, arg,
> > +				  cpu, "kswitcher_%d");
> > +	if (IS_ERR(task))
> >  		pr_err("%s failed for CPU %d\n", __func__, cpu);
> > +
> >  	return task;
> >  }
> 
> It's ages since I worked on this, but it looks like this is pure
> refactoring.  So far as I can see, it does the right thing, so, FWIW:
> 
> Reviewed-by: Dave Martin <Dave.Martin@arm.com>
> 
> I don't currently have hardware I can test this on, though.
> 
> Nico (Cc added) might just possibly have an opinion on it, though this
> looks uncontroversial.

No strong opinion.

Acked-by: Nicolas Pitre <nico@fluxnic.net>


Nicolas


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

* [PATCH 01/20] arm/bL_switcher: Use kthread_run_on_cpu()
       [not found] <20240926224910.11106-1-frederic@kernel.org>
@ 2024-09-26 22:48 ` Frederic Weisbecker
  0 siblings, 0 replies; 5+ messages in thread
From: Frederic Weisbecker @ 2024-09-26 22:48 UTC (permalink / raw)
  To: LKML
  Cc: Frederic Weisbecker, Russell King, linux-arm-kernel,
	Andrew Morton, Peter Zijlstra, Thomas Gleixner, Dave Martin,
	Nicolas Pitre

Use the proper API instead of open coding it.

Reviewed-by: Dave Martin <Dave.Martin@arm.com>
Acked-by: Nicolas Pitre <nico@fluxnic.net>
Signed-off-by: Frederic Weisbecker <frederic@kernel.org>
---
 arch/arm/common/bL_switcher.c | 10 ++++------
 1 file changed, 4 insertions(+), 6 deletions(-)

diff --git a/arch/arm/common/bL_switcher.c b/arch/arm/common/bL_switcher.c
index 9a9aa53547a6..d1e82a318e3b 100644
--- a/arch/arm/common/bL_switcher.c
+++ b/arch/arm/common/bL_switcher.c
@@ -307,13 +307,11 @@ static struct task_struct *bL_switcher_thread_create(int cpu, void *arg)
 {
 	struct task_struct *task;
 
-	task = kthread_create_on_node(bL_switcher_thread, arg,
-				      cpu_to_node(cpu), "kswitcher_%d", cpu);
-	if (!IS_ERR(task)) {
-		kthread_bind(task, cpu);
-		wake_up_process(task);
-	} else
+	task = kthread_run_on_cpu(bL_switcher_thread, arg,
+				  cpu, "kswitcher_%d");
+	if (IS_ERR(task))
 		pr_err("%s failed for CPU %d\n", __func__, cpu);
+
 	return task;
 }
 
-- 
2.46.0



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

end of thread, other threads:[~2024-09-26 22:50 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
     [not found] <20240726215701.19459-1-frederic@kernel.org>
2024-07-26 21:56 ` [PATCH 01/20] arm/bL_switcher: Use kthread_run_on_cpu() Frederic Weisbecker
2024-08-05 14:44   ` Dave Martin
2024-08-05 14:53     ` Nicolas Pitre
2024-07-26 21:56 ` [PATCH 07/20] soc/qman: test: " Frederic Weisbecker
     [not found] <20240926224910.11106-1-frederic@kernel.org>
2024-09-26 22:48 ` [PATCH 01/20] arm/bL_switcher: " 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).