From: Evgenii Shatokhin <eshatokhin@virtuozzo.com>
To: Nicolai Stange <nstange@suse.de>
Cc: Miroslav Benes <mbenes@suse.cz>,
live-patching@vger.kernel.org, pmladek@suse.com
Subject: Re: Patching kthread functions
Date: Thu, 1 Oct 2020 16:18:24 +0300 [thread overview]
Message-ID: <c2a4f36b-d974-2fa6-65d6-0d058a8773d6@virtuozzo.com> (raw)
In-Reply-To: <87lfgqt8tt.fsf@suse.de>
Hi,
On 01.10.2020 15:43, Nicolai Stange wrote:
> Miroslav Benes <mbenes@suse.cz> writes:
>
>> On Wed, 30 Sep 2020, Evgenii Shatokhin wrote:
>
>>> Is that so? Are there any workarounds?
>>
>> Petr, do you remember the crazy workarounds we talked about? My head is
>> empty now. And I am sure, Nicolai could come up with something.
>
> There might be some clever tricks ycou could play, but that depends on
> the diff you want to turn into a livepatch. For example, sometimes it's
> possible to livepatch a callee and make it trick the unpatchable caller
> into the desired behaviour.
In this particular case, we needed to add a kind of lock/unlock pair
around the request processing part of the function. Unfortunately, there
is no suitable callee there.
>
> However, in your case it might be easier to simply kill the running
> kthread and start it again, e.g. from a ->post_patch() callback. Note
> that KLP's callbacks are a bit subtle though, at a minimum you'd
> probably also want to implement ->pre_unpatch() to roll everything back
> and perhaps also disable (->replace) downgrades by means of the klp_state API.
Interesting.
Something like: block submitting of new requests to the thread, wait for
the old requests to be processed, kill the thread, then start it again,
unblock the requests.
Thanks for the idea!
>
> You can find some good docs on callbacks and klp_state at
> Documentation/livepatch/.
>
> Thanks,
>
> Nicolai
>
Evgenii
next prev parent reply other threads:[~2020-10-01 13:18 UTC|newest]
Thread overview: 10+ messages / expand[flat|nested] mbox.gz Atom feed top
2020-09-30 15:44 Patching kthread functions Evgenii Shatokhin
2020-10-01 11:13 ` Miroslav Benes
2020-10-01 12:43 ` Nicolai Stange
2020-10-01 13:18 ` Evgenii Shatokhin [this message]
2020-10-01 13:12 ` Evgenii Shatokhin
2020-10-02 11:53 ` Miroslav Benes
2020-10-02 12:52 ` Evgenii Shatokhin
2020-10-02 13:06 ` Miroslav Benes
2020-10-01 14:46 ` Petr Mladek
2020-10-01 16:34 ` Evgenii Shatokhin
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=c2a4f36b-d974-2fa6-65d6-0d058a8773d6@virtuozzo.com \
--to=eshatokhin@virtuozzo.com \
--cc=live-patching@vger.kernel.org \
--cc=mbenes@suse.cz \
--cc=nstange@suse.de \
--cc=pmladek@suse.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).