[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [PATCH 2/2] x86/hvm: Rework nested hap functions to reduce parameters


  • To: Andrew Cooper <andrew.cooper3@xxxxxxxxxx>
  • From: Jan Beulich <jbeulich@xxxxxxxx>
  • Date: Wed, 1 Dec 2021 10:14:01 +0100
  • Arc-authentication-results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=suse.com; dmarc=pass action=none header.from=suse.com; dkim=pass header.d=suse.com; arc=none
  • Arc-message-signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=92nX0NpUIZgB14Meh7c6HXGtrdKnqZBaQ6cnYmWqbJ0=; b=HejIxc4gXm0AzpdEFJbj7Ox6n5zWD7KiZ1SZm9oO7/px9gCojLSH2xByEEMBTAk1UM74b9q/4qsZx9yrlu1qaZAQN8mY2kjueIq8qTbG7T6JZGiXtxRvI977YMUXGQyE/LUCvgwj5RT9WmeMgADPAnfLY3TKapJA/5dFAUeGKIqiki6+lyACILNjX+tSMqqq4/dUwhf7CMG3gaYXqZIuO+izQxJ+emDZDiaiYhEBvXDEkW1+BeCp92elKKJB0Zkvm5Zftky+6oYglR89Ii6aIn3Roe6m7IwrN4Eo4/4HDypXtfQH2LFXYrVOojxWYap3i6N6QK5lRMiLmvxD9B51tA==
  • Arc-seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=b1YoReuJgpFBdB/sA0dVmvec9Mb9sCoPn8ToIFO8wQY+B2TrBpmwumZ7Ve1LoJVOAzux/D2aZI4Lm/LkMH9OcloMg9n3fGqDE3XpUJvlACZrO6sGJezMInrJfNONwlL2GgPg29MZxcF9zp3jr0T5jVKiStypgV8BqJ0jlncnhth8obNxto+lyrIDwxMdYWgXWunztbh1UIX3bA7JIA3DeIntJ14QYMuRtO1JHOuTgW6y60UziTeqTjAJwM3PjYYqrZ03Ro4sxuw1TLjyV79oQVhhPzJsjmZzMLylwqZ6gUwgmpzLJE75A/C53X00tpbegjmIsifbdEvi50DVD0oJew==
  • Authentication-results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=suse.com;
  • Cc: Roger Pau Monné <roger.pau@xxxxxxxxxx>, Wei Liu <wl@xxxxxxx>, Tamas K Lengyel <tamas@xxxxxxxxxxxxx>, Alexandru Isaila <aisaila@xxxxxxxxxxxxxxx>, Petre Pircalabu <ppircalabu@xxxxxxxxxxxxxxx>, Xen-devel <xen-devel@xxxxxxxxxxxxxxxxxxxx>
  • Delivery-date: Wed, 01 Dec 2021 09:15:13 +0000
  • List-id: Xen developer discussion <xen-devel.lists.xenproject.org>

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@xxxxxxxxxx>
> ---
> CC: Jan Beulich <JBeulich@xxxxxxxx>
> CC: Roger Pau Monné <roger.pau@xxxxxxxxxx>
> CC: Wei Liu <wl@xxxxxxx>
> CC: Tamas K Lengyel <tamas@xxxxxxxxxxxxx>
> CC: Alexandru Isaila <aisaila@xxxxxxxxxxxxxxx>
> CC: Petre Pircalabu <ppircalabu@xxxxxxxxxxxxxxx>
> 
> 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




 


Rackspace

Lists.xenproject.org is hosted with RackSpace, monitoring our
servers 24x7x365 and backed by RackSpace's Fanatical Support®.