All of lore.kernel.org
 help / color / mirror / Atom feed
From: Andrew Cooper <andrew.cooper3@citrix.com>
To: Jan Beulich <JBeulich@suse.com>,
	xen-devel <xen-devel@lists.xenproject.org>
Cc: Tim Deegan <tim@xen.org>, Keir Fraser <keir@xen.org>
Subject: Re: [PATCH 2/4] x86/mm: allow for building without shadow mode support
Date: Wed, 28 Jan 2015 11:10:11 +0000	[thread overview]
Message-ID: <54C8C393.5010000@citrix.com> (raw)
In-Reply-To: <54C8A7AB020000780005A2D2@mail.emea.novell.com>

On 28/01/15 08:11, Jan Beulich wrote:
> Considering the complexity of the code, it seems to be a reasonable
> thing to allow people to disable that code entirely even outside the
> immediate need for this by the next patch.
>
> Signed-off-by: Jan Beulich <jbeulich@suse.com>
> ---
> There is one XXX being added to the code - while it doesn't look like
> we need to set v->arch.paging.mode in shadow_vcpu_init(), it may be
> deemed more secure to set up a table with stub function pointers.

I would agree that setting up a function pointer table is the safer
course of action to take.

>
> --- a/xen/arch/x86/Rules.mk
> +++ b/xen/arch/x86/Rules.mk
> @@ -32,9 +32,13 @@ x86 := y
>  x86_32 := n
>  x86_64 := y
>  
> +shadow-paging ?= y
> +
>  CFLAGS += -mno-red-zone -mno-sse -fpic
>  CFLAGS += -fno-asynchronous-unwind-tables
>  # -fvisibility=hidden reduces -fpic cost, if it's available
>  ifneq ($(call cc-option,$(CC),-fvisibility=hidden,n),n)
>  CFLAGS += -DGCC_HAS_VISIBILITY_ATTRIBUTE
>  endif
> +
> +CFLAGS-$(shadow-paging) += -DCONFIG_SHADOW_PAGING
> --- a/xen/arch/x86/mm/paging.c
> +++ b/xen/arch/x86/mm/paging.c
> @@ -635,16 +635,16 @@ int paging_domain_init(struct domain *d,
>       * don't want to leak any active log-dirty bitmaps */
>      d->arch.paging.log_dirty.top = _mfn(INVALID_MFN);
>  
> -    /* The order of the *_init calls below is important, as the later
> -     * ones may rewrite some common fields.  Shadow pagetables are the
> -     * default... */
> -    shadow_domain_init(d, domcr_flags);
> -
> -    /* ... but we will use hardware assistance if it's available. */
> +    /*
> +     * Shadow pagetables are the default, but we will use
> +     * hardware assistance if it's available and enabled.
> +     */
>      if ( hap_enabled(d) )
>          hap_domain_init(d);
> +    else
> +        rc = shadow_domain_init(d, domcr_flags);
>  
> -    return 0;
> +    return rc;
>  }
>  
>  /* vcpu paging struct initialization goes here */
> @@ -822,12 +822,16 @@ int paging_enable(struct domain *d, u32 
>   * and therefore its pagetables will soon be discarded */
>  void pagetable_dying(struct domain *d, paddr_t gpa)
>  {
> +#ifdef CONFIG_SHADOW_PAGING
>      struct vcpu *v;
>  
>      ASSERT(paging_mode_shadow(d));
>  
>      v = d->vcpu[0];
>      v->arch.paging.mode->shadow.pagetable_dying(v, gpa);
> +#else
> +    BUG();
> +#endif
>  }
>  
>  /* Print paging-assistance info to the console */
> --- a/xen/arch/x86/mm/shadow/Makefile
> +++ b/xen/arch/x86/mm/shadow/Makefile
> @@ -1,4 +1,5 @@
> -obj-$(x86_64) += common.o guest_2.o guest_3.o guest_4.o
> +obj-y                := none.o
> +obj-$(shadow-paging) := common.o guest_2.o guest_3.o guest_4.o
>  

Can this be

ifeq($(shadow-paging),y)
obj-y := common.o guest_2.o guest_3.o guest_4.o
else
obj-y := none.o
endif

Rather than relying on the double := to clobber none.o and prevent a
link failure ?

~Andrew

  reply	other threads:[~2015-01-28 11:10 UTC|newest]

Thread overview: 13+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-01-28  8:00 [PATCH 0/4] x86: allow for more memory to be used Jan Beulich
2015-01-28  8:10 ` [PATCH 1/4] x86: skip further initialization for idle domains Jan Beulich
2015-01-28 11:00   ` Andrew Cooper
2015-01-28  8:11 ` [PATCH 2/4] x86/mm: allow for building without shadow mode support Jan Beulich
2015-01-28 11:10   ` Andrew Cooper [this message]
2015-01-29 17:34     ` Tim Deegan
2015-01-30  9:28       ` Jan Beulich
2015-01-28  8:11 ` [PATCH 3/4] x86: provide build time option to support up to 123Tb of memory Jan Beulich
2015-01-28 12:10   ` Andrew Cooper
2015-01-28 14:16     ` Jan Beulich
2015-01-28  8:12 ` [PATCH 4/4] x86/shadow: make some log‑dirty handling functions static Jan Beulich
2015-01-28 11:18   ` Andrew Cooper
2015-01-29 11:21   ` [PATCH 4/4] x86/shadow: make some log?dirty " Tim Deegan

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=54C8C393.5010000@citrix.com \
    --to=andrew.cooper3@citrix.com \
    --cc=JBeulich@suse.com \
    --cc=keir@xen.org \
    --cc=tim@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.