Re: [PATCH] KVM: s390: generate kvm hypercall functions

Heiko Carstens
2021-07-14T11:22:00Z

On Wed, Jul 14, 2021 at 12:03:20PM +0200, Christian Borntraeger wrote:
> > > didn't we want to get rid of asm register allocations?
> > > this would have been a nice time to do such a cleanup
> >
> > I see only two ways to get rid them, both are suboptimal, therefore I
> > decided to keep them at very few places; one of them this one.
> >
> > Alternatively to this approach it would be possible to:
> >
> > a) write the function entirely in assembler (instead of inlining it).
>
> I would like to keep this as is, unless we know that this could break.
> Maybe we should add something like nokasan or whatever?

That would only make sense if the function would not be inlined. For
that we have e.g. __no_kasan_or_inline. But then I'd rather prefer
__always_inline. But that wouldn't solve any problems, if you see any.

From my point of view this should be safe wrt instrumentation. There
are only scalar assignments without memory accesses or anything else
the could be instrumented. If even that wouldn't work then "register
asm" would be completely useless. Even though, given all the potential
pitfalls, it is very close to being useless.

So if you want to go that route (noinstr, or whatever), then we need
those functions in a way that they can't be inlined. But keep in mind
that we also have e.g. call_on_stack() with a similar construct which
I'd like to keep inlined for performance reasons.

Let me know if you want any changes to the hypercall code.