Re: [RFC PATCH] livepatch: Speed up transition retries

From: Petr Mladek
Date: Thu Jul 08 2021 - 10:57:07 EST


On Thu 2021-07-08 15:19:25, Vasily Gorbik wrote:
> On Thu, Jul 08, 2021 at 12:35:24PM +0200, Petr Mladek wrote:
> > On Wed 2021-07-07 14:49:41, Vasily Gorbik wrote:
> > > That's just a racy hack for now for demonstration purposes.
> > >
> > > For s390 LPAR with 128 cpu this reduces livepatch kselftest run time
> > > from
> > > real 1m11.837s
> > > user 0m0.603s
> > > sys 0m10.940s
> > >
> > > to
> > > real 0m14.550s
> > > user 0m0.420s
> > > sys 0m5.779s
> > >
> > > Would smth like that be useful for production use cases?
> > > Any ideas how to approach that more gracefully?
> >
> > Honestly, I do not see a real life use case for this, except maybe
> > speeding up a test suite.
> >
> > The livepatch transition is more about reliability than about speed.
> > In the real life, a livepatch will be applied only once in a while.
>
> That's what I thought. Thanks for looking. Dropping this one.

If you still wanted to speed up the transition from some reason
then an easy win might be to call klp_send_signals() earlier.

Well, my view is the following. The primary livepatching task is
to fix some broken/vulnerable functionality on a running kernel.
It should ideally happen on background and do not affect or slow
down the existing work load.

klp_send_signals() is not ideal. The fake signal interrupts syscalls
and they need to get restarted. Also the function wakes up a lot of
tasks and might increase load. Hence, it is used as a last resort that
allows to finish the transition in a reasonable time frame.

That said, the current timeouts are arbitrary chosen values based
rather on a common sense than on some measurement. I could imagine that
we could modify them or allow to trigger klp_send_signal() via
sysfs when there is a good reason.

Best Regards,
Petr