From: "Michael S. Tsirkin" <mst@redhat.com>
To: "Seth Forshee (DigitalOcean)" <sforshee@digitalocean.com>
Cc: Petr Mladek <pmladek@suse.com>,
Joe Lawrence <joe.lawrence@redhat.com>,
kvm@vger.kernel.org, netdev@vger.kernel.org,
Jiri Kosina <jikos@kernel.org>,
linux-kernel@vger.kernel.org,
virtualization@lists.linux-foundation.org,
"Seth Forshee \(DigitalOcean\)" <sforshee@kernel.org>,
live-patching@vger.kernel.org, Miroslav Benes <mbenes@suse.cz>,
Josh Poimboeuf <jpoimboe@kernel.org>
Subject: Re: [PATCH 0/2] vhost: improve livepatch switching for heavily loaded vhost worker kthreads
Date: Sun, 22 Jan 2023 03:34:26 -0500 [thread overview]
Message-ID: <20230122032944-mutt-send-email-mst@kernel.org> (raw)
In-Reply-To: <20230120-vhost-klp-switching-v1-0-7c2b65519c43@kernel.org>
On Fri, Jan 20, 2023 at 04:12:20PM -0600, Seth Forshee (DigitalOcean) wrote:
> We've fairly regularaly seen liveptches which cannot transition within kpatch's
> timeout period due to busy vhost worker kthreads. In looking for a solution the
> only answer I found was to call klp_update_patch_state() from a safe location.
> I tried adding this call to vhost_worker(), and it works, but this creates the
> potential for problems if a livepatch attempted to patch vhost_worker().
> Without a call to klp_update_patch_state() fully loaded vhost kthreads can
> never switch because vhost_worker() will always appear on the stack, but with
> the call these kthreads can switch but will still be running the old version of
> vhost_worker().
>
> To avoid this situation I've added a new function, klp_switch_current(), which
> switches the current task only if its stack does not include any function being
> patched. This allows kthreads to safely attempt switching themselves if a patch
> is pending. There is at least one downside, however. Since there's no way for
> the kthread to track whether it has already tried to switch for a pending patch
> it can end up calling klp_switch_current() repeatedly when it can never be
> safely switched.
>
> I don't know whether this is the right solution, and I'm happy to try out other
> suggestions. But in my testing these patches proved effective in consistently
> switching heavily loaded vhost kthreads almost immediately.
>
> To: Josh Poimboeuf <jpoimboe@kernel.org>
> To: Jiri Kosina <jikos@kernel.org>
> To: Miroslav Benes <mbenes@suse.cz>
> To: Petr Mladek <pmladek@suse.com>
> To: Joe Lawrence <joe.lawrence@redhat.com>
> To: "Michael S. Tsirkin" <mst@redhat.com>
> To: Jason Wang <jasowang@redhat.com>
> Cc: live-patching@vger.kernel.org
> Cc: linux-kernel@vger.kernel.org
> Cc: kvm@vger.kernel.org
> Cc: virtualization@lists.linux-foundation.org
> Cc: netdev@vger.kernel.org
> Signed-off-by: Seth Forshee (DigitalOcean) <sforshee@kernel.org>
Don't know enough about live patching to judge this.
I'll let livepatch maintainers judge this, and merge through
the livepatch tree if appropriate. For that:
Acked-by: Michael S. Tsirkin <mst@redhat.com>
but pls underestand this is more a 'looks ok superficially and
I don't have better ideas' than 'I have reviewed this thoroughly'.
>
> ---
> Seth Forshee (DigitalOcean) (2):
> livepatch: add an interface for safely switching kthreads
> vhost: check for pending livepatches from vhost worker kthreads
>
> drivers/vhost/vhost.c | 4 ++++
> include/linux/livepatch.h | 2 ++
> kernel/livepatch/transition.c | 11 +++++++++++
> 3 files changed, 17 insertions(+)
> ---
> base-commit: 5dc4c995db9eb45f6373a956eb1f69460e69e6d4
> change-id: 20230120-vhost-klp-switching-ba9a3ae38b8a
>
> Best regards,
> --
> Seth Forshee (DigitalOcean) <sforshee@kernel.org>
_______________________________________________
Virtualization mailing list
Virtualization@lists.linux-foundation.org
https://lists.linuxfoundation.org/mailman/listinfo/virtualization
next parent reply other threads:[~2023-01-22 8:34 UTC|newest]
Thread overview: 16+ messages / expand[flat|nested] mbox.gz Atom feed top
[not found] <20230120-vhost-klp-switching-v1-0-7c2b65519c43@kernel.org>
2023-01-22 8:34 ` Michael S. Tsirkin [this message]
[not found] ` <20230120-vhost-klp-switching-v1-2-7c2b65519c43@kernel.org>
2023-01-24 14:17 ` [PATCH 2/2] vhost: check for pending livepatches from vhost worker kthreads Petr Mladek via Virtualization
[not found] ` <Y9ATo5FukOhphwqT@do-x1extreme>
2023-01-25 11:34 ` Petr Mladek via Virtualization
[not found] ` <Y9FfenH/p3qzRlar@do-x1extreme>
2023-01-26 11:16 ` Petr Mladek via Virtualization
2023-01-26 11:49 ` Petr Mladek via Virtualization
2023-01-26 17:03 ` [PATCH 0/2] vhost: improve livepatch switching for heavily loaded " Petr Mladek via Virtualization
[not found] ` <Y9LswwnPAf+nOVFG@do-x1extreme>
[not found] ` <20230127044355.frggdswx424kd5dq@treble>
2023-01-27 10:37 ` Peter Zijlstra
2023-01-27 12:09 ` Petr Mladek via Virtualization
[not found] ` <20230127165236.rjcp6jm6csdta6z3@treble>
[not found] ` <20230127170946.zey6xbr4sm4kvh3x@treble>
[not found] ` <20230127221131.sdneyrlxxhc4h3fa@treble>
2023-01-30 12:40 ` Peter Zijlstra
2023-01-30 18:36 ` Mark Rutland
[not found] ` <20230130194823.6y3rc227bvsgele4@treble>
2023-01-31 10:22 ` Mark Rutland
[not found] ` <20230131163832.z46ihurbmjcwuvck@treble>
2023-02-01 11:10 ` Mark Rutland
[not found] ` <20230201165727.lnywx6zyefbqbrke@treble>
2023-02-01 17:11 ` Mark Rutland
[not found] ` <20230130195930.s5iu76e56j4q5bra@treble>
2023-01-31 10:02 ` Peter Zijlstra
2023-01-27 11:19 ` Petr Mladek via Virtualization
[not found] ` <Y9PmZFBEwUBwV3s/@do-x1extreme>
2023-01-30 9:55 ` Petr Mladek via Virtualization
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=20230122032944-mutt-send-email-mst@kernel.org \
--to=mst@redhat.com \
--cc=jikos@kernel.org \
--cc=joe.lawrence@redhat.com \
--cc=jpoimboe@kernel.org \
--cc=kvm@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=live-patching@vger.kernel.org \
--cc=mbenes@suse.cz \
--cc=netdev@vger.kernel.org \
--cc=pmladek@suse.com \
--cc=sforshee@digitalocean.com \
--cc=sforshee@kernel.org \
--cc=virtualization@lists.linux-foundation.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).