All of lore.kernel.org
 help / color / mirror / Atom feed
From: Heiko Carstens <hca@linux.ibm.com>
To: Claudio Imbrenda <imbrenda@linux.ibm.com>
Cc: Christian Borntraeger <borntraeger@de.ibm.com>,
	Janosch Frank <frankja@linux.vnet.ibm.com>,
	David Hildenbrand <david@redhat.com>,
	Cornelia Huck <cohuck@redhat.com>,
	kvm@vger.kernel.org, linux-s390@vger.kernel.org
Subject: Re: [PATCH] KVM: s390: generate kvm hypercall functions
Date: Wed, 14 Jul 2021 11:50:33 +0200	[thread overview]
Message-ID: <YO6zadbavNXs4Z3+@osiris> (raw)
In-Reply-To: <20210714113843.6daa7e09@p-imbrenda>

On Wed, Jul 14, 2021 at 11:38:43AM +0200, Claudio Imbrenda wrote:
> On Tue, 13 Jul 2021 16:57:13 +0200
> Heiko Carstens <hca@linux.ibm.com> wrote:
> 
> [snip]
> 
> > +#define HYPERCALL_ARGS_0
> > +#define HYPERCALL_ARGS_1 , arg1
> > +#define HYPERCALL_ARGS_2 HYPERCALL_ARGS_1, arg2
> > +#define HYPERCALL_ARGS_3 HYPERCALL_ARGS_2, arg3
> > +#define HYPERCALL_ARGS_4 HYPERCALL_ARGS_3, arg4
> > +#define HYPERCALL_ARGS_5 HYPERCALL_ARGS_4, arg5
> > +#define HYPERCALL_ARGS_6 HYPERCALL_ARGS_5, arg6
> > +
> > +#define GENERATE_KVM_HYPERCALL_FUNC(args)
> > 	\ +static inline
> > 			\ +long __kvm_hypercall##args(unsigned long
> > nr HYPERCALL_PARM_##args)	\ +{
> > 					\
> > +	register unsigned long __nr asm("1") = nr;
> > 	\
> > +	register long __rc asm("2");
> > 	\
> 
> 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).

b) pass a structure with all parameters to the inline assembly and
   clobber a large amount of registers, which _might_ even lead to
   compile errors since the compiler might run out of registers when
   allocating registers for the inline asm.

Given that hypercall is slow anyway a) might be an option. But that's
up to you guys. Otherwise I would consider this the "final" solution
until we get compiler support which allows for something better.

  reply	other threads:[~2021-07-14  9:50 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-07-13 14:57 [PATCH] KVM: s390: generate kvm hypercall functions Heiko Carstens
2021-07-13 15:41 ` Christian Borntraeger
2021-07-13 15:52   ` Heiko Carstens
2021-07-13 15:59     ` Christian Borntraeger
2021-07-13 16:15       ` Heiko Carstens
2021-07-13 18:06 ` Christian Borntraeger
2021-07-14  9:38 ` Claudio Imbrenda
2021-07-14  9:50   ` Heiko Carstens [this message]
2021-07-14 10:03     ` Christian Borntraeger
2021-07-14 11:21       ` Heiko Carstens

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=YO6zadbavNXs4Z3+@osiris \
    --to=hca@linux.ibm.com \
    --cc=borntraeger@de.ibm.com \
    --cc=cohuck@redhat.com \
    --cc=david@redhat.com \
    --cc=frankja@linux.vnet.ibm.com \
    --cc=imbrenda@linux.ibm.com \
    --cc=kvm@vger.kernel.org \
    --cc=linux-s390@vger.kernel.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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.