Kernel KVM virtualization development
 help / color / mirror / Atom feed
* [kvm-unit-tests PATCH] Changed cpumask_next to wrap instead of terminating after nr_cpus.
@ 2024-08-26  5:40 Cade Richard
  2024-08-27 15:21 ` Andrew Jones
  0 siblings, 1 reply; 2+ messages in thread
From: Cade Richard @ 2024-08-26  5:40 UTC (permalink / raw)
  To: kvm, kvm-riscv; +Cc: andrew.jones, atishp, cade.richard, jamestiotio

Changed cpumask_next() to wrap instead of terminating after nr_cpus.

Signed-off-by: Cade Richard <cade.richard@berkeley.edu>
---
 lib/cpumask.h | 6 ++++--
 1 file changed, 4 insertions(+), 2 deletions(-)

diff --git a/lib/cpumask.h b/lib/cpumask.h
index be191923..5105c3bd 100644
--- a/lib/cpumask.h
+++ b/lib/cpumask.h
@@ -109,8 +109,10 @@ static inline void cpumask_copy(cpumask_t *dst, const cpumask_t *src)
 
 static inline int cpumask_next(int cpu, const cpumask_t *mask)
 {
-	while (++cpu < nr_cpus && !cpumask_test_cpu(cpu, mask))
-		;
+	do {
+		if (++cpu > nr_cpus)
+			cpu = 0;
+	} while (!cpumask_test_cpu(cpu, mask));
 	return cpu;
 }
 
-- 
2.43.0


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

* Re: [kvm-unit-tests PATCH] Changed cpumask_next to wrap instead of terminating after nr_cpus.
  2024-08-26  5:40 [kvm-unit-tests PATCH] Changed cpumask_next to wrap instead of terminating after nr_cpus Cade Richard
@ 2024-08-27 15:21 ` Andrew Jones
  0 siblings, 0 replies; 2+ messages in thread
From: Andrew Jones @ 2024-08-27 15:21 UTC (permalink / raw)
  To: Cade Richard; +Cc: kvm, kvm-riscv, atishp, cade.richard, jamestiotio


Patch summaries shouldn't have periods and they should be concise.

On Sun, Aug 25, 2024 at 10:40:38PM GMT, Cade Richard wrote:
> Changed cpumask_next() to wrap instead of terminating after nr_cpus.
> 
> Signed-off-by: Cade Richard <cade.richard@berkeley.edu>
> ---
>  lib/cpumask.h | 6 ++++--
>  1 file changed, 4 insertions(+), 2 deletions(-)
> 
> diff --git a/lib/cpumask.h b/lib/cpumask.h
> index be191923..5105c3bd 100644
> --- a/lib/cpumask.h
> +++ b/lib/cpumask.h
> @@ -109,8 +109,10 @@ static inline void cpumask_copy(cpumask_t *dst, const cpumask_t *src)
>  
>  static inline int cpumask_next(int cpu, const cpumask_t *mask)
>  {
> -	while (++cpu < nr_cpus && !cpumask_test_cpu(cpu, mask))
> -		;
> +	do {
> +		if (++cpu > nr_cpus)

Should be ++cpu == nr_cpus, but...

> +			cpu = 0;
> +	} while (!cpumask_test_cpu(cpu, mask));

...this will break everything. See for_each_cpu().

Nack

drew

>  	return cpu;
>  }
>  
> -- 
> 2.43.0
> 
> 
> -- 
> kvm-riscv mailing list
> kvm-riscv@lists.infradead.org
> http://lists.infradead.org/mailman/listinfo/kvm-riscv

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

end of thread, other threads:[~2024-08-27 15:21 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2024-08-26  5:40 [kvm-unit-tests PATCH] Changed cpumask_next to wrap instead of terminating after nr_cpus Cade Richard
2024-08-27 15:21 ` Andrew Jones

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox