From: oliver.upton@linux.dev
To: "Gavin Shan" <gshan@redhat.com>, kvmarm@lists.cs.columbia.edu
Cc: shan.gavin@gmail.com, kvm@vger.kernel.org,
linux-kernel@vger.kernel.org, linux-kselftest@vger.kernel.org,
maz@kernel.org, pbonzini@redhat.com, shuah@kernel.org
Subject: Re: [PATCH v2] KVM: selftests: Fix target thread to be migrated in rseq_test
Date: Sat, 16 Jul 2022 21:48:13 +0000 [thread overview]
Message-ID: <385aa28ad559874da8429c40a68570df@linux.dev> (raw)
In-Reply-To: <20220716144537.3436743-1-gshan@redhat.com>
Hi Gavin,
Thanks for cleaning this up.
July 16, 2022 7:45 AM, "Gavin Shan" <gshan@redhat.com> wrote:
> In rseq_test, there are two threads, which are thread group leader
> and migration worker. The migration worker relies on sched_setaffinity()
> to force migration on the thread group leader.
It may be clearer to describe it as a vCPU thread and a migration worker
thread. The meat of this test is to catch a regression in KVM.
> Unfortunately, we have
s/we have/the test has the/
> wrong parameter (0) passed to sched_getaffinity().
wrong PID
> It's actually
> forcing migration on the migration worker instead of the thread group
> leader.
What's missing is _why_ the migration worker is getting moved around by
the call. Perhaps instead it is better to state what a PID of 0 implies,
for those of us who haven't read their manpages in a while ;-)
> It also means migration can happen on the thread group leader
> at any time, which eventually leads to failure as the following logs
> show.
>
> host# uname -r
> 5.19.0-rc6-gavin+
> host# # cat /proc/cpuinfo | grep processor | tail -n 1
> processor : 223
> host# pwd
> /home/gavin/sandbox/linux.main/tools/testing/selftests/kvm
> host# for i in `seq 1 100`; \
> do echo "--------> $i"; ./rseq_test; done
> --------> 1
> --------> 2
> --------> 3
> --------> 4
> --------> 5
> --------> 6
> ==== Test Assertion Failure ====
> rseq_test.c:265: rseq_cpu == cpu
> pid=3925 tid=3925 errno=4 - Interrupted system call
> 1 0x0000000000401963: main at rseq_test.c:265 (discriminator 2)
> 2 0x0000ffffb044affb: ?? ??:0
> 3 0x0000ffffb044b0c7: ?? ??:0
> 4 0x0000000000401a6f: _start at ??:?
> rseq CPU = 4, sched CPU = 27
>
> This fixes the issue by passing correct parameter, tid of the group
> thread leader, to sched_setaffinity().
Kernel commit messages should have an imperative tone:
Fix the issue by ...
> Fixes: 61e52f1630f5 ("KVM: selftests: Add a test for KVM_RUN+rseq to detect task migration bugs")
> Signed-off-by: Gavin Shan <gshan@redhat.com>
With the comments on the commit message addressed:
Reviewed-by: Oliver Upton <oliver.upton@linux.dev>
_______________________________________________
kvmarm mailing list
kvmarm@lists.cs.columbia.edu
https://lists.cs.columbia.edu/mailman/listinfo/kvmarm
WARNING: multiple messages have this Message-ID (diff)
From: oliver.upton@linux.dev
To: "Gavin Shan" <gshan@redhat.com>, kvmarm@lists.cs.columbia.edu
Cc: kvm@vger.kernel.org, linux-kernel@vger.kernel.org,
linux-kselftest@vger.kernel.org, seanjc@google.com,
pbonzini@redhat.com, maz@kernel.org, shuah@kernel.org,
shan.gavin@gmail.com
Subject: Re: [PATCH v2] KVM: selftests: Fix target thread to be migrated in rseq_test
Date: Sat, 16 Jul 2022 21:48:13 +0000 [thread overview]
Message-ID: <385aa28ad559874da8429c40a68570df@linux.dev> (raw)
In-Reply-To: <20220716144537.3436743-1-gshan@redhat.com>
Hi Gavin,
Thanks for cleaning this up.
July 16, 2022 7:45 AM, "Gavin Shan" <gshan@redhat.com> wrote:
> In rseq_test, there are two threads, which are thread group leader
> and migration worker. The migration worker relies on sched_setaffinity()
> to force migration on the thread group leader.
It may be clearer to describe it as a vCPU thread and a migration worker
thread. The meat of this test is to catch a regression in KVM.
> Unfortunately, we have
s/we have/the test has the/
> wrong parameter (0) passed to sched_getaffinity().
wrong PID
> It's actually
> forcing migration on the migration worker instead of the thread group
> leader.
What's missing is _why_ the migration worker is getting moved around by
the call. Perhaps instead it is better to state what a PID of 0 implies,
for those of us who haven't read their manpages in a while ;-)
> It also means migration can happen on the thread group leader
> at any time, which eventually leads to failure as the following logs
> show.
>
> host# uname -r
> 5.19.0-rc6-gavin+
> host# # cat /proc/cpuinfo | grep processor | tail -n 1
> processor : 223
> host# pwd
> /home/gavin/sandbox/linux.main/tools/testing/selftests/kvm
> host# for i in `seq 1 100`; \
> do echo "--------> $i"; ./rseq_test; done
> --------> 1
> --------> 2
> --------> 3
> --------> 4
> --------> 5
> --------> 6
> ==== Test Assertion Failure ====
> rseq_test.c:265: rseq_cpu == cpu
> pid=3925 tid=3925 errno=4 - Interrupted system call
> 1 0x0000000000401963: main at rseq_test.c:265 (discriminator 2)
> 2 0x0000ffffb044affb: ?? ??:0
> 3 0x0000ffffb044b0c7: ?? ??:0
> 4 0x0000000000401a6f: _start at ??:?
> rseq CPU = 4, sched CPU = 27
>
> This fixes the issue by passing correct parameter, tid of the group
> thread leader, to sched_setaffinity().
Kernel commit messages should have an imperative tone:
Fix the issue by ...
> Fixes: 61e52f1630f5 ("KVM: selftests: Add a test for KVM_RUN+rseq to detect task migration bugs")
> Signed-off-by: Gavin Shan <gshan@redhat.com>
With the comments on the commit message addressed:
Reviewed-by: Oliver Upton <oliver.upton@linux.dev>
next prev parent reply other threads:[~2022-07-17 9:28 UTC|newest]
Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-07-16 14:45 [PATCH v2] KVM: selftests: Fix target thread to be migrated in rseq_test Gavin Shan
2022-07-16 14:45 ` Gavin Shan
2022-07-16 21:48 ` oliver.upton [this message]
2022-07-16 21:48 ` oliver.upton
2022-07-17 3:11 ` Gavin Shan
2022-07-17 3:11 ` Gavin Shan
2022-07-19 1:40 ` Gavin Shan
2022-07-19 1:40 ` Gavin Shan
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=385aa28ad559874da8429c40a68570df@linux.dev \
--to=oliver.upton@linux.dev \
--cc=gshan@redhat.com \
--cc=kvm@vger.kernel.org \
--cc=kvmarm@lists.cs.columbia.edu \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-kselftest@vger.kernel.org \
--cc=maz@kernel.org \
--cc=pbonzini@redhat.com \
--cc=shan.gavin@gmail.com \
--cc=shuah@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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.