From: Nikos Nikoleris <nikos.nikoleris@arm.com>
To: Andrew Jones <drjones@redhat.com>
Cc: kvm@vger.kernel.org, alexandru.elisei@arm.com
Subject: Re: [kvm-unit-tests PATCH 1/4] arm/arm64: Avoid calling cpumask_test_cpu for CPUs above nr_cpu
Date: Mon, 22 Mar 2021 09:45:09 +0000 [thread overview]
Message-ID: <df9a70d0-0129-d3a4-9530-77a7354b8e47@arm.com> (raw)
In-Reply-To: <20210322093125.qlbr3wjvinyu7o6m@kamzik.brq.redhat.com>
Hi Drew,
On 22/03/2021 09:31, Andrew Jones wrote:
> On Fri, Mar 19, 2021 at 12:24:11PM +0000, Nikos Nikoleris wrote:
>> Signed-off-by: Nikos Nikoleris <nikos.nikoleris@arm.com>
>> ---
>> lib/arm/asm/cpumask.h | 2 +-
>> 1 file changed, 1 insertion(+), 1 deletion(-)
>>
>> diff --git a/lib/arm/asm/cpumask.h b/lib/arm/asm/cpumask.h
>> index 6683bb6..02124de 100644
>> --- a/lib/arm/asm/cpumask.h
>> +++ b/lib/arm/asm/cpumask.h
>> @@ -105,7 +105,7 @@ 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))
>> + while (++cpu < nr_cpus && !cpumask_test_cpu(cpu, mask))
>> ;
>> return cpu;
>
Thanks for reviewing this!
> This looks like the right thing to do, but I'm surprised that
> I've never seen an assert in cpumask_test_cpu, even though
> it looks like we call cpumask_next with cpu == nr_cpus - 1
> in several places.
>
cpumask_next() would trigger one of the assertions in the 4th patch in
this series without this fix. The 4th patch is a way to demonstrate (if
we apply it without the rest) the problem of using cpu0's
thread_info->cpu uninitialized.
> Can you please add a commit message explaining how you found
> this bug?
>
Yes I'll do that.
Thanks,
Nikos
> Thanks,
> drew
>
next prev parent reply other threads:[~2021-03-22 9:46 UTC|newest]
Thread overview: 20+ messages / expand[flat|nested] mbox.gz Atom feed top
2021-03-19 12:24 [kvm-unit-tests PATCH 0/4] RFC: Minor arm/arm64 MMU fixes and checks Nikos Nikoleris
2021-03-19 12:24 ` [kvm-unit-tests PATCH 1/4] arm/arm64: Avoid calling cpumask_test_cpu for CPUs above nr_cpu Nikos Nikoleris
2021-03-22 9:31 ` Andrew Jones
2021-03-22 9:45 ` Nikos Nikoleris [this message]
2021-03-22 10:12 ` Andrew Jones
2021-03-22 10:40 ` Nikos Nikoleris
2021-03-22 10:53 ` Andrew Jones
2021-03-19 12:24 ` [kvm-unit-tests PATCH 2/4] arm/arm64: Read system registers to get the state of the MMU Nikos Nikoleris
2021-03-22 10:30 ` Alexandru Elisei
2021-03-22 11:14 ` Nikos Nikoleris
2021-03-22 15:25 ` Alexandru Elisei
2021-03-19 12:24 ` [kvm-unit-tests PATCH 3/4] arm/arm64: Track whether thread_info has been initialized Nikos Nikoleris
2021-03-22 10:34 ` Alexandru Elisei
2021-03-22 10:59 ` Nikos Nikoleris
2021-03-22 12:11 ` Andrew Jones
2021-03-19 12:24 ` [kvm-unit-tests PATCH 4/4] arm/arm64: Add sanity checks to the cpumask API Nikos Nikoleris
2021-03-23 11:24 ` [kvm-unit-tests PATCH 0/4] RFC: Minor arm/arm64 MMU fixes and checks Andrew Jones
2021-03-23 11:40 ` Alexandru Elisei
2021-03-23 11:51 ` Andrew Jones
2021-03-23 12:15 ` Nikos Nikoleris
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=df9a70d0-0129-d3a4-9530-77a7354b8e47@arm.com \
--to=nikos.nikoleris@arm.com \
--cc=alexandru.elisei@arm.com \
--cc=drjones@redhat.com \
--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;
as well as URLs for NNTP newsgroup(s).