From: Tianchen Ding <dtcccc@linux.alibaba.com>
To: linux-kernel@vger.kernel.org
Cc: Ingo Molnar <mingo@redhat.com>,
Peter Zijlstra <peterz@infradead.org>,
Juri Lelli <juri.lelli@redhat.com>,
Vincent Guittot <vincent.guittot@linaro.org>,
Dietmar Eggemann <dietmar.eggemann@arm.com>,
Steven Rostedt <rostedt@goodmis.org>,
Ben Segall <bsegall@google.com>, Mel Gorman <mgorman@suse.de>,
Valentin Schneider <vschneid@redhat.com>,
Marcelo Tosatti <mtosatti@redhat.com>,
Mike Galbraith <efault@gmx.de>, Rik van Riel <riel@redhat.com>
Subject: Re: [PATCH] sched: Fix race between yield_to() and try_to_wake_up()
Date: Tue, 31 Dec 2024 13:56:03 +0800 [thread overview]
Message-ID: <ea88aa65-0ddd-474f-bce1-51ea67445cf1@linux.alibaba.com> (raw)
In-Reply-To: <20241231055020.6521-1-dtcccc@linux.alibaba.com>
On 2024/12/31 13:50, Tianchen Ding wrote:
> We met a SCHED_WARN in set_next_buddy():
> __warn_printk
> set_next_buddy
> yield_to_task_fair
> yield_to
> kvm_vcpu_yield_to [kvm]
> ...
>
> After a short dig, we found the rq_lock held by yield_to() may not
> be exactly the rq that the target task belongs to. There is a race
> window against try_to_wake_up().
>
> CPU0 target_task
>
> blocking on CPU1
> lock rq0 & rq1
> double check task_rq == p_rq, ok
> woken to CPU2 (lock task_pi & rq2)
> task_rq = rq2
> yield_to_task_fair (w/o lock rq2)
>
> In this race window, yield_to() is operating the task w/o the currect
Sorry... a typo for "correct"
next prev parent reply other threads:[~2024-12-31 6:01 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-12-31 5:50 [PATCH] sched: Fix race between yield_to() and try_to_wake_up() Tianchen Ding
2024-12-31 5:56 ` Tianchen Ding [this message]
2025-01-06 11:10 ` Peter Zijlstra
2025-01-15 9:17 ` [tip: sched/core] " tip-bot2 for Tianchen Ding
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=ea88aa65-0ddd-474f-bce1-51ea67445cf1@linux.alibaba.com \
--to=dtcccc@linux.alibaba.com \
--cc=bsegall@google.com \
--cc=dietmar.eggemann@arm.com \
--cc=efault@gmx.de \
--cc=juri.lelli@redhat.com \
--cc=linux-kernel@vger.kernel.org \
--cc=mgorman@suse.de \
--cc=mingo@redhat.com \
--cc=mtosatti@redhat.com \
--cc=peterz@infradead.org \
--cc=riel@redhat.com \
--cc=rostedt@goodmis.org \
--cc=vincent.guittot@linaro.org \
--cc=vschneid@redhat.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