From: Petr Mladek <pmladek@suse.com>
To: Vasily Gorbik <gor@linux.ibm.com>
Cc: Josh Poimboeuf <jpoimboe@redhat.com>,
Jiri Kosina <jikos@kernel.org>, Miroslav Benes <mbenes@suse.cz>,
Joe Lawrence <joe.lawrence@redhat.com>,
Heiko Carstens <hca@linux.ibm.com>,
Sven Schnelle <svens@linux.ibm.com>,
Sumanth Korikkar <sumanthk@linux.ibm.com>,
live-patching@vger.kernel.org, linux-kernel@vger.kernel.org
Subject: Re: [RFC PATCH] livepatch: Kick idle cpu's tasks to perform transition
Date: Thu, 8 Jul 2021 12:12:20 +0200 [thread overview]
Message-ID: <YObPhPkzRSqnzgK3@alley> (raw)
In-Reply-To: <patch.git-b76842ceb035.your-ad-here.call-01625661932-ext-1304@work.hours>
On Wed 2021-07-07 14:49:38, Vasily Gorbik wrote:
> On an idle system with large amount of cpus it might happen that
> klp_update_patch_state() is not reached in do_idle() for a long periods
> of time. With debug messages enabled log is filled with:
> [ 499.442643] livepatch: klp_try_switch_task: swapper/63:0 is running
I see. I guess that the problem is only when CONFIG_NO_HZ is enabled.
Do I get it correctly, please?
> without any signs of progress. Ending up with "failed to complete
> transition".
>
> On s390 LPAR with 128 cpus not a single transition is able to complete
> and livepatch kselftests fail.
>
> To deal with that, make sure we break out of do_idle() inner loop to
> reach klp_update_patch_state() by marking idle tasks as NEED_RESCHED
> as well as kick cpus out of idle state.
>
> Signed-off-by: Vasily Gorbik <gor@linux.ibm.com>
> ---
> kernel/livepatch/transition.c | 5 ++++-
> 1 file changed, 4 insertions(+), 1 deletion(-)
>
> diff --git a/kernel/livepatch/transition.c b/kernel/livepatch/transition.c
> index 3a4beb9395c4..793eba46e970 100644
> --- a/kernel/livepatch/transition.c
> +++ b/kernel/livepatch/transition.c
> @@ -415,8 +415,11 @@ void klp_try_complete_transition(void)
> for_each_possible_cpu(cpu) {
> task = idle_task(cpu);
> if (cpu_online(cpu)) {
> - if (!klp_try_switch_task(task))
> + if (!klp_try_switch_task(task)) {
> complete = false;
> + set_tsk_need_resched(task);
> + kick_process(task);
First, we should kick the idle threads in klp_send_signals().
It already solves similar problem when normal threads and kthreads
stay in the incorruptible sleep for too long.
Second, the way looks a bit hacky to me. need_resched() depends on
the currect implementation of the idle loop. kick_process() has
a completely different purpose and does checks that do not fit well
this use-case.
I wonder if wake_up_nohz_cpu() would fit better here. Please, add
scheduler people into CC, namely:
Ingo Molnar <mingo@redhat.com>
Peter Zijlstra <peterz@infradead.org>
and NOHZ guys:
Frederic Weisbecker <fweisbec@gmail.com>
Thomas Gleixner <tglx@linutronix.de>
Best Regards,
Petr
next prev parent reply other threads:[~2021-07-08 10:12 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2021-07-07 12:49 [RFC PATCH] livepatch: Kick idle cpu's tasks to perform transition Vasily Gorbik
2021-07-08 10:12 ` Petr Mladek [this message]
2021-08-06 23:59 ` Suraj Jitindar Singh
2021-08-27 12:54 ` Petr Mladek
2021-09-09 8:54 ` Vasily Gorbik
2021-09-10 8:08 ` Petr Mladek
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=YObPhPkzRSqnzgK3@alley \
--to=pmladek@suse.com \
--cc=gor@linux.ibm.com \
--cc=hca@linux.ibm.com \
--cc=jikos@kernel.org \
--cc=joe.lawrence@redhat.com \
--cc=jpoimboe@redhat.com \
--cc=linux-kernel@vger.kernel.org \
--cc=live-patching@vger.kernel.org \
--cc=mbenes@suse.cz \
--cc=sumanthk@linux.ibm.com \
--cc=svens@linux.ibm.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;
as well as URLs for NNTP newsgroup(s).