From: Oleksandr Natalenko <oleksandr@natalenko.name>
To: Valentin Schneider <valentin.schneider@arm.com>
Cc: linux-rt-users@vger.kernel.org, linux-kernel@vger.kernel.org,
tglx@linutronix.de, peterz@infradead.org, rostedt@goodmis.org
Subject: Re: WARNING at kernel/sched/core.c:2013 migration_cpu_stop+0x2e3/0x330
Date: Mon, 16 Nov 2020 11:27:09 +0100 [thread overview]
Message-ID: <41d6aca71c6a52df8437cdb7b4a1b1c4@natalenko.name> (raw)
In-Reply-To: <jhj3619y63v.mognet@arm.com>
Hi.
On 16.11.2020 11:00, Valentin Schneider wrote:
> On 15/11/20 22:32, Oleksandr Natalenko wrote:
>> I'm running v5.10-rc3-rt7 for some time, and I came across this splat
>> in
>> dmesg:
>>
>> ```
>> [118769.951010] ------------[ cut here ]------------
>> [118769.951013] WARNING: CPU: 19 PID: 146 at kernel/sched/core.c:2013
>
> Err, I didn't pick up on this back then, but isn't that check bogus? If
> the
> task is enqueued elsewhere, it's valid for it not to be affined
> 'here'. Also that is_migration_disabled() check within is_cpu_allowed()
> makes me think this isn't the best thing to call on a remote task.
>
> ---
> diff --git a/kernel/sched/core.c b/kernel/sched/core.c
> index 1218f3ce1713..47d5b677585f 100644
> --- a/kernel/sched/core.c
> +++ b/kernel/sched/core.c
> @@ -2010,7 +2010,7 @@ static int migration_cpu_stop(void *data)
> * valid again. Nothing to do.
> */
> if (!pending) {
> - WARN_ON_ONCE(!is_cpu_allowed(p, cpu_of(rq)));
> + WARN_ON_ONCE(!cpumask_test_cpu(task_cpu(p), p->cpus_ptr));
> goto out;
> }
Not sure whether the check is legitimate, but FWIW I've managed to put a
test task [1] (it spawns a lot of threads and applies affinity) into a
permanent unkillable D state here:
```
[<0>] affine_move_task+0x2d3/0x620
[<0>] __set_cpus_allowed_ptr+0x164/0x210
[<0>] sched_setaffinity+0x21a/0x300
[<0>] __x64_sys_sched_setaffinity+0x8c/0xc0
[<0>] do_syscall_64+0x33/0x40
[<0>] entry_SYSCALL_64_after_hwframe+0x44/0xa9
```
I think this corresponds to something around here:
```
$ scripts/faddr2line kernel/sched/core.o affine_move_task+0x2d3
affine_move_task+0x2d3/0x620:
arch_atomic_fetch_sub at
/home/pf/linux-pf-edge/src/linux-5.10/./arch/x86/include/asm/atomic.h:190
(inlined by) atomic_fetch_sub_release at
/home/pf/linux-pf-edge/src/linux-5.10/./include/asm-generic/atomic-instrumented.h:221
(inlined by) __refcount_sub_and_test at
/home/pf/linux-pf-edge/src/linux-5.10/./include/linux/refcount.h:272
(inlined by) __refcount_dec_and_test at
/home/pf/linux-pf-edge/src/linux-5.10/./include/linux/refcount.h:315
(inlined by) refcount_dec_and_test at
/home/pf/linux-pf-edge/src/linux-5.10/./include/linux/refcount.h:333
(inlined by) affine_move_task at
/home/pf/linux-pf-edge/src/linux-5.10/kernel/sched/core.c:2334
```
or:
```
2332 wait_for_completion(&pending->done);
2333
2334 if (refcount_dec_and_test(&pending->refs))
2335 wake_up_var(&pending->refs);
```
I'm not positive about this being directly related to the original
report, but I think it is still worth mentioning.
Thanks.
[1] https://gitlab.com/post-factum/burn_scheduler
--
Oleksandr Natalenko (post-factum)
next prev parent reply other threads:[~2020-11-16 11:41 UTC|newest]
Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top
2020-11-15 22:32 WARNING at kernel/sched/core.c:2013 migration_cpu_stop+0x2e3/0x330 Oleksandr Natalenko
2020-11-16 10:00 ` Valentin Schneider
2020-11-16 10:27 ` Oleksandr Natalenko [this message]
2020-11-16 10:31 ` Valentin Schneider
2020-11-16 10:32 ` Oleksandr Natalenko
2020-11-16 10:31 ` Oleksandr Natalenko
2020-11-17 11:06 ` Peter Zijlstra
2020-11-17 11:29 ` Valentin Schneider
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=41d6aca71c6a52df8437cdb7b4a1b1c4@natalenko.name \
--to=oleksandr@natalenko.name \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-rt-users@vger.kernel.org \
--cc=peterz@infradead.org \
--cc=rostedt@goodmis.org \
--cc=tglx@linutronix.de \
--cc=valentin.schneider@arm.com \
/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