Kernel KVM virtualization development
 help / color / mirror / Atom feed
From: Andrew Jones <andrew.jones@linux.dev>
To: Cade Richard <cade.richard@gmail.com>
Cc: kvm@vger.kernel.org, kvm-riscv@lists.infradead.org,
	 atishp@rivosinc.com, cade.richard@berkeley.edu,
	jamestiotio@gmail.com
Subject: Re: [kvm-unit-tests PATCH] Changed cpumask_next to wrap instead of terminating after nr_cpus.
Date: Tue, 27 Aug 2024 17:21:43 +0200	[thread overview]
Message-ID: <20240827-a3f2014b839d6c39c110e15b@orel> (raw)
In-Reply-To: <20240826054038.11584-1-cade.richard@berkeley.edu>


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

      reply	other threads:[~2024-08-27 15:21 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
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 message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20240827-a3f2014b839d6c39c110e15b@orel \
    --to=andrew.jones@linux.dev \
    --cc=atishp@rivosinc.com \
    --cc=cade.richard@berkeley.edu \
    --cc=cade.richard@gmail.com \
    --cc=jamestiotio@gmail.com \
    --cc=kvm-riscv@lists.infradead.org \
    --cc=kvm@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox