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: George Dunlap <George.Dunlap@eu.citrix.com>,
	Tim Deegan <tim@xen.org>, Keir Fraser <keir@xen.org>
Subject: Re: [PATCH 2/3] x86/mm: make {cmpxchg, write}_guest_entry() hook shadow mode specific
Date: Fri, 5 Feb 2016 14:59:21 +0000	[thread overview]
Message-ID: <56B4B8C9.9060703@citrix.com> (raw)
In-Reply-To: <56B4650B02000078000CEDBB@prv-mh.provo.novell.com>

On 05/02/16 08:02, Jan Beulich wrote:
> ... as they're being used for PV guests only, which don't use HAP mode.
> This eliminates another pair of NULL callbacks in HAP as well as in 2-
> and 3-guest-level shadow modes.
>
> Signed-off-by: Jan Beulich <jbeulich@suse.com>

Reviewed-by: Andrew Cooper <andrew.cooper3@citrix.com>, but with two
suggestions.

> @@ -299,14 +299,15 @@ static inline void paging_update_paging_
>  /* Write a new value into the guest pagetable, and update the
>   * paging-assistance state appropriately.  Returns 0 if we page-faulted,
>   * 1 for success. */
> -static inline int paging_write_guest_entry(struct vcpu *v, intpte_t *p,
> -                                           intpte_t new, mfn_t gmfn)
> +static inline bool_t paging_write_guest_entry(struct vcpu *v, intpte_t *p,
> +                                              intpte_t new, mfn_t gmfn)
>  {
> -    if ( unlikely(paging_mode_enabled(v->domain) 
> -                  && v->arch.paging.mode != NULL) )
> -        return paging_get_hostmode(v)->write_guest_entry(v, p, new, gmfn);
> -    else 
> -        return (!__copy_to_user(p, &new, sizeof(new)));
> +#ifdef CONFIG_SHADOW_PAGING
> +    if ( unlikely(paging_mode_shadow(v->domain)) && paging_get_hostmode(v) )
> +        return paging_get_hostmode(v)->shadow.write_guest_entry(v, p, new,
> +                                                                gmfn);

I would be tempted to split the line at the -> in this case, to avoid
squashing all the parameters together on the RHS like that, but I
suppose it doesn't matter too much.

> +#endif
> +    return !__copy_to_user(p, &new, sizeof(new));

I realise that the old function behaved the same, but this really should
ASSERT(v == current) before trampling the wrong virtual address space.

~Andrew

  reply	other threads:[~2016-02-05 14:59 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-02-05  7:51 [PATCH 0/3] x86/mm: paging simplifications Jan Beulich
2016-02-05  8:01 ` [PATCH 1/3] x86/mm: drop guest_{map, get_eff}_l1e() hooks Jan Beulich
2016-02-05 14:41   ` Andrew Cooper
2016-02-05 15:24     ` Tim Deegan
2016-02-05 15:30     ` Jan Beulich
2016-02-05  8:02 ` [PATCH 2/3] x86/mm: make {cmpxchg, write}_guest_entry() hook shadow mode specific Jan Beulich
2016-02-05 14:59   ` Andrew Cooper [this message]
2016-02-05  8:02 ` [PATCH 3/3] x86/shadow: remove a few 32-bit hypervisor leftovers Jan Beulich
2016-02-05 15:22 ` [PATCH 0/3] x86/mm: paging simplifications 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=56B4B8C9.9060703@citrix.com \
    --to=andrew.cooper3@citrix.com \
    --cc=George.Dunlap@eu.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.