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

Re: [PATCH v2 09/12] x86: make mem-paging configuarable and default it to off for being unsupported


  • To: Jan Beulich <jbeulich@xxxxxxxx>
  • From: Roger Pau Monné <roger.pau@xxxxxxxxxx>
  • Date: Fri, 30 Apr 2021 11:55:50 +0200
  • Arc-authentication-results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=citrix.com; dmarc=pass action=none header.from=citrix.com; dkim=pass header.d=citrix.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-SenderADCheck; bh=UhrOKO1pJ0GlrFmkPhTE+RRD16OA/UsRDTxlz5xPP1o=; b=RNdruhn5i+V0RV4A2z1RaQg2LYkfUqae1y3ZTQ/XEv5DQ2QGD6+vKmjYMXcbdJVTh0QWM6fGRT/UU+rhs1DWrU/4uZdUarpIz+htO4Rb4A1/YvKz0W9xjkexUaJEDo0a/IfWpzX1GkHveSBj+/2CbKSQ4WHY1d6k5Js07wG8VZbVsWws9t2idkELdOp2EmwlHh4hXYbuJH7aW0x7Qj1ObNO5JmIz8Ff/KAw5USp66PyCylWtmMwSC6+uiYMQbNLdntoUjcmarHSbDMX8SiKqK0X9xUA50pMHaW3331W9ZOgZbvIA+TsZ7wxb0QLvvOo2VFmaUwl3/3mmP3IyD06kNw==
  • Arc-seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=dSp9XmlDhFAKfvg9qfcQeQ5XN/OGveX9IU22DhYYtB2rHB2vsjr22ue0viIeg0SSLq3OA5xnbj/JaPEwqTxlIHMoc1yWV+HCjwKXHE7BbE81HV5+31TEotHfvxZKUfADfThm6YLLfMNgrKZiR2T6u8jx36GSBD73eYVFh4JyByM+7qpNo/zeXLx03R1/JsJMNw5zV4ocQrXT2ce3fAbxJLYItIeGb1GIkoBH7NFeWJbaqg4v7djuRO2P4M5kfn2WYMhKQsA6AT+Cf2WcYFt0vtbXhnLRt8ABqaFqIb+3WD72LqrhGEcrIG1KjgytvfEKZTNd+nZbS7AV7XjAS3wESw==
  • Authentication-results: esa4.hc3370-68.iphmx.com; dkim=pass (signature verified) header.i=@citrix.onmicrosoft.com
  • Cc: "xen-devel@xxxxxxxxxxxxxxxxxxxx" <xen-devel@xxxxxxxxxxxxxxxxxxxx>, Andrew Cooper <andrew.cooper3@xxxxxxxxxx>, George Dunlap <george.dunlap@xxxxxxxxxx>, Ian Jackson <iwj@xxxxxxxxxxxxxx>, Julien Grall <julien@xxxxxxx>, Stefano Stabellini <sstabellini@xxxxxxxxxx>, Wei Liu <wl@xxxxxxx>, Daniel de Graaf <dgdegra@xxxxxxxxxxxxx>, Paul Durrant <paul@xxxxxxx>, Tamas K Lengyel <tamas@xxxxxxxxxxxxx>, Petre Pircalabu <ppircalabu@xxxxxxxxxxxxxxx>, Alexandru Isaila <aisaila@xxxxxxxxxxxxxxx>
  • Delivery-date: Fri, 30 Apr 2021 09:56:09 +0000
  • Ironport-hdrordr: A9a23:JOiXxarfMs/ewVfvflXw4GQaV5u6KtV00zAX/kB9WHVpW+SivY SHgOkb2RjoiDwYRXEnnpS6NLOdRG7HnKQb3aA4Bp3neAX9omOnIMVZ7YXkyyD9ACGWzIJg/I 9aWexFBNX0ZGIWse/T/BS4H9E8wNOO7aCvgqPkw21wSBxxApsA0y5SIG+gYypLbSNBAoc0E4 fZy8pcvjy7eWkWaMPTPAh+Y8HoodrXmJX6JSMXHhJP0nj0sRqEyp7fVyKZ0BAXTi9Vzd4Zn1 TtvgTl6syYwpOG4zDG0Wu71eUypPLAzZ95CNWImowpLFzX+3uVTaBAf5HHgzwvuuGo7z8R4a jxijMtJd565X+UXkzdm2qV5yDa3Dwj62DvxDaj6BOJy6yJJ0NIN+N7iY1UaRff4UY71esMqJ 5j5G6Fq4FRSSrJgSWV3am3azhRikG2rXA++NRj6UB3bI12Us40kaUvuGlREJsGARvg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6Vm8EChOnGwNJ9bR67tI8Rbkj 9Kp/WJlfSQbSz2xUT5uiZ6OLtH9yKfevyJaTj8b9JgwpidIlSDgqyj/c61gnPWcFKAGjglrL wAU1cRYMRFgiQll6st3EGJO+rKnn4=
  • Ironport-sdr: tPyNNSaIr4QEGJ0pMs2X7zbCyT6AiRqS/Vm1amKplXTT6alQk5dKv14K3YIHEV/BwggRFbCAcH e7/Cp6dAjp4QMF4MDXMHjnA2rWfRWXKnLirPP118Qy3s7gEFzljiw9HtlV16I4dAUR7ylP3p2Z TljYzvE/ocfNaghlcn+/670Zhqyx2QFfcRSeiGrAIhFCv9Hqv/vFaTyRN7YBBXKW0drRORfg1m dnB6SC+t7+ycWkrgH9RoVyniS24F+WYofpwceTVL7mQJn/iI/8tPF2B1234JWKwRCOHqcMGTDD lkg=
  • List-id: Xen developer discussion <xen-devel.lists.xenproject.org>

On Mon, Apr 12, 2021 at 04:12:41PM +0200, Jan Beulich wrote:
> While doing so, make the option dependent upon HVM, which really is the
> main purpose of the change.
> 
> Signed-off-by: Jan Beulich <jbeulich@xxxxxxxx>
> ---
> v2: New.
> 
> --- a/xen/arch/x86/Kconfig
> +++ b/xen/arch/x86/Kconfig
> @@ -15,7 +15,6 @@ config X86
>       select HAS_FAST_MULTIPLY
>       select HAS_IOPORTS
>       select HAS_KEXEC
> -     select HAS_MEM_PAGING
>       select HAS_NS16550
>       select HAS_PASSTHROUGH
>       select HAS_PCI
> @@ -251,6 +250,10 @@ config HYPERV_GUEST
>  
>  endif
>  
> +config MEM_PAGING
> +     bool "Xen memory paging support (UNSUPPORTED)" if UNSUPPORTED
> +     depends on HVM
> +
>  config MEM_SHARING
>       bool "Xen memory sharing support (UNSUPPORTED)" if UNSUPPORTED
>       depends on HVM
> --- a/xen/arch/x86/hvm/hvm.c
> +++ b/xen/arch/x86/hvm/hvm.c
> @@ -1932,9 +1932,11 @@ int hvm_hap_nested_page_fault(paddr_t gp
>          goto out_put_gfn;
>      }
>  
> +#ifdef CONFIG_MEM_PAGING
>      /* Check if the page has been paged out */
>      if ( p2m_is_paged(p2mt) || (p2mt == p2m_ram_paging_out) )
>          paged = 1;
> +#endif
>  
>  #ifdef CONFIG_MEM_SHARING
>      /* Mem sharing: if still shared on write access then its enomem */
> --- a/xen/arch/x86/mm/Makefile
> +++ b/xen/arch/x86/mm/Makefile
> @@ -5,7 +5,7 @@ obj-$(CONFIG_HVM) += altp2m.o
>  obj-$(CONFIG_HVM) += guest_walk_2.o guest_walk_3.o guest_walk_4.o
>  obj-$(CONFIG_SHADOW_PAGING) += guest_walk_4.o
>  obj-$(CONFIG_MEM_ACCESS) += mem_access.o
> -obj-y += mem_paging.o
> +obj-$(CONFIG_MEM_PAGING) += mem_paging.o
>  obj-$(CONFIG_MEM_SHARING) += mem_sharing.o
>  obj-y += p2m.o p2m-pt.o
>  obj-$(CONFIG_HVM) += p2m-ept.o p2m-pod.o
> --- a/xen/arch/x86/x86_64/compat/mm.c
> +++ b/xen/arch/x86/x86_64/compat/mm.c
> @@ -155,8 +155,10 @@ int compat_arch_memory_op(unsigned long
>      case XENMEM_get_sharing_shared_pages:
>          return mem_sharing_get_nr_shared_mfns();
>  
> +#ifdef CONFIG_MEM_PAGING
>      case XENMEM_paging_op:
>          return mem_paging_memop(guest_handle_cast(arg, xen_mem_paging_op_t));
> +#endif
>  
>  #ifdef CONFIG_MEM_SHARING
>      case XENMEM_sharing_op:
> --- a/xen/arch/x86/x86_64/mm.c
> +++ b/xen/arch/x86/x86_64/mm.c
> @@ -994,8 +994,10 @@ long subarch_memory_op(unsigned long cmd
>      case XENMEM_get_sharing_shared_pages:
>          return mem_sharing_get_nr_shared_mfns();
>  
> +#ifdef CONFIG_MEM_PAGING
>      case XENMEM_paging_op:
>          return mem_paging_memop(guest_handle_cast(arg, xen_mem_paging_op_t));
> +#endif

I would create a dummy handler when !CONFIG_MEM_PAGING in
asm-x86/mem_paging.h.

> --- a/xen/include/asm-x86/mem_paging.h
> +++ b/xen/include/asm-x86/mem_paging.h
> @@ -24,6 +24,12 @@
>  
>  int mem_paging_memop(XEN_GUEST_HANDLE_PARAM(xen_mem_paging_op_t) arg);
>  
> +#ifdef CONFIG_MEM_PAGING
> +# define mem_paging_enabled(d) vm_event_check_ring((d)->vm_event_paging)
> +#else
> +# define mem_paging_enabled(d) false
> +#endif
> +
>  #endif /*__ASM_X86_MEM_PAGING_H__ */
>  
>  /*
> --- a/xen/include/asm-x86/p2m.h
> +++ b/xen/include/asm-x86/p2m.h
> @@ -136,11 +136,16 @@ typedef unsigned int p2m_query_t;
>  #define P2M_PAGEABLE_TYPES (p2m_to_mask(p2m_ram_rw) \
>                              | p2m_to_mask(p2m_ram_logdirty) )
>  
> +#ifdef CONFIG_MEM_PAGING
>  #define P2M_PAGING_TYPES (p2m_to_mask(p2m_ram_paging_out)        \
>                            | p2m_to_mask(p2m_ram_paged)           \
>                            | p2m_to_mask(p2m_ram_paging_in))
>  
>  #define P2M_PAGED_TYPES (p2m_to_mask(p2m_ram_paged))
> +#else
> +#define P2M_PAGING_TYPES 0
> +#define P2M_PAGED_TYPES 0
> +#endif

Since you don't guard the p2m related paged types in p2m_type_t is it
worth having diverging P2M_{PAGING/PAGED}_TYPES?

I guess it might be required in order to force the compiler to DCE
without having to add yet more CONFIG_MEM_PAGING guards?

I don't really have a strong opinion on whether the code should be
removed, IMO it's best to start by making it off by default at build
time and remove it in a later release?

Thanks, Roger.



 


Rackspace

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