All of lore.kernel.org
 help / color / mirror / Atom feed
From: Jan Beulich <jbeulich@suse.com>
To: Andrew Cooper <andrew.cooper3@citrix.com>
Cc: "Roger Pau Monné" <roger.pau@citrix.com>, "Wei Liu" <wl@xen.org>,
	"Tamas K Lengyel" <tamas@tklengyel.com>,
	"Alexandru Isaila" <aisaila@bitdefender.com>,
	"Petre Pircalabu" <ppircalabu@bitdefender.com>,
	Xen-devel <xen-devel@lists.xenproject.org>
Subject: Re: [PATCH 2/2] x86/hvm: Rework nested hap functions to reduce parameters
Date: Wed, 1 Dec 2021 10:14:01 +0100	[thread overview]
Message-ID: <037802f4-d28b-62bc-e830-78149f1cc2ff@suse.com> (raw)
In-Reply-To: <20211130181139.14398-3-andrew.cooper3@citrix.com>

On 30.11.2021 19:11, Andrew Cooper wrote:
> Most functions in this call chain have 8 parameters, meaning that the final
> two booleans are spilled to the stack for for calls.
> 
> First, delete nestedhap_walk_L1_p2m and introduce nhvm_hap_walk_L1_p2m() as a
> thin wrapper around hvm_funcs just like all the other nhvm_*() hooks.  This
> involves including xen/mm.h as the forward declaration of struct npfec is no
> longer enough.
> 
> Next, replace the triple of booleans with struct npfec, which contains the
> same information in the bottom 3 bits.
> 
> No functional change.
> 
> Signed-off-by: Andrew Cooper <andrew.cooper3@citrix.com>
> ---
> CC: Jan Beulich <JBeulich@suse.com>
> CC: Roger Pau Monné <roger.pau@citrix.com>
> CC: Wei Liu <wl@xen.org>
> CC: Tamas K Lengyel <tamas@tklengyel.com>
> CC: Alexandru Isaila <aisaila@bitdefender.com>
> CC: Petre Pircalabu <ppircalabu@bitdefender.com>
> 
> I don't much like this, but I think it's the least bad option in the short
> term.  npfec is horribly mis-named/mis-used (at best, it should be considered
> npf_info, and probably inherits from the same API/ABI mistakes our regular
> pagewalk functions have) and is going to have to be untangled to make nested
> virt a maintainable option.

So why use struct npfec here then in the first place? It could as well
be "unsigned int" with constants defined for X, R, and W, couldn't it?

> --- a/xen/include/asm-x86/hvm/hvm.h
> +++ b/xen/include/asm-x86/hvm/hvm.h
> @@ -25,6 +25,7 @@
>  #include <asm/current.h>
>  #include <asm/x86_emulate.h>
>  #include <asm/hvm/asid.h>
> +#include <xen/mm.h>

Nit: Typically we have xen/ includes ahead of asm/ ones.

> @@ -631,6 +630,14 @@ static inline enum hvm_intblk nhvm_interrupt_blocked(struct vcpu *v)
>      return hvm_funcs.nhvm_intr_blocked(v);
>  }
>  
> +static inline int nhvm_hap_walk_L1_p2m(
> +    struct vcpu *v, paddr_t L2_gpa, paddr_t *L1_gpa, unsigned int *page_order,
> +    uint8_t *p2m_acc, struct npfec npfec)
> +{
> +    return hvm_funcs.nhvm_hap_walk_L1_p2m(
> +        v, L2_gpa, L1_gpa, page_order, p2m_acc, npfec);
> +}

Is there a specific reason you don't switch to altcall right in
this patch, making a follow-on change unnecessary?

Jan



  reply	other threads:[~2021-12-01  9:15 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-11-30 18:11 [PATCH 0/2] x86/hvm: Cleanup Andrew Cooper
2021-11-30 18:11 ` [PATCH 1/2] x86/hvm: Simplify hvm_enable_msr_interception() Andrew Cooper
2021-12-01  9:06   ` Jan Beulich
2021-11-30 18:11 ` [PATCH 2/2] x86/hvm: Rework nested hap functions to reduce parameters Andrew Cooper
2021-12-01  9:14   ` Jan Beulich [this message]
2021-12-01 20:13     ` Andrew Cooper
2021-12-02  8:06       ` Jan Beulich
2022-01-13 15:21 ` [PATCH 0/2] x86/hvm: Cleanup Andrew Cooper

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=037802f4-d28b-62bc-e830-78149f1cc2ff@suse.com \
    --to=jbeulich@suse.com \
    --cc=aisaila@bitdefender.com \
    --cc=andrew.cooper3@citrix.com \
    --cc=ppircalabu@bitdefender.com \
    --cc=roger.pau@citrix.com \
    --cc=tamas@tklengyel.com \
    --cc=wl@xen.org \
    --cc=xen-devel@lists.xenproject.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.