xen-devel.lists.xenproject.org archive mirror
 help / color / mirror / Atom feed
From: Tim Deegan <tim@xen.org>
To: Jan Beulich <JBeulich@suse.com>
Cc: Andrew Cooper <andrew.cooper3@citrix.com>,
	Wei Liu <wei.liu2@citrix.com>,
	Xen-devel <xen-devel@lists.xenproject.org>
Subject: Re: [PATCH v6 3/9] x86/mm: add disallow_mask parameter to get_page_from_l1e
Date: Mon, 19 Mar 2018 12:10:29 +0000	[thread overview]
Message-ID: <20180319121029.GA31437@deinos.phlegethon.org> (raw)
In-Reply-To: <5AA8024702000078001B117F@prv-mh.provo.novell.com>

At 09:54 -0600 on 13 Mar (1520934871), Jan Beulich wrote:
> >>> On 13.02.18 at 21:04, <wei.liu2@citrix.com> wrote:
> > --- a/xen/arch/x86/mm/shadow/multi.c
> > +++ b/xen/arch/x86/mm/shadow/multi.c
> > @@ -858,13 +858,21 @@ shadow_get_page_from_l1e(shadow_l1e_t sl1e, struct domain *d, p2m_type_t type)
> >      int res;
> >      mfn_t mfn;
> >      struct domain *owner;
> > +    /* The disallow mask is taken from arch/x86/mm.c for HVM guest */
> > +    uint32_t disallow_mask =
> > +        ~(_PAGE_PRESENT | _PAGE_RW | _PAGE_USER | _PAGE_ACCESSED |
> > +          _PAGE_DIRTY | _PAGE_AVAIL | _PAGE_AVAIL_HIGH | _PAGE_NX);
> >  
> > +    disallow_mask = (disallow_mask | _PAGE_GNTTAB) & ~_PAGE_GLOBAL;
> > +    disallow_mask &= ~PAGE_CACHE_ATTRS;
> 
> If any of this is needed in the first place (see below), at least this
> last line could be folded into the variable's initializer as it looks.

Building it piecewise is fine by me, but since this is a constant it
should probably be declared once in some header file rather than here.
In any case it needs a comment that describes what it is, and not that
it used to live in mm.c. :)

Like Jan, I'm not convinced that having this be an argument to
get_page_from_l1e is super-useful -- it seems like an opportunity for
one of the callers to get it wrong and fail to enforce our invariants.

> > +    ASSERT(is_hvm_domain(d));

This assertion isn't particularly helpful IMO (because it's
shadow_mode_refcounts that's relevant here, not is_hvm) but I don't
object to it.

Cheers,

Tim.

_______________________________________________
Xen-devel mailing list
Xen-devel@lists.xenproject.org
https://lists.xenproject.org/mailman/listinfo/xen-devel

  reply	other threads:[~2018-03-19 12:10 UTC|newest]

Thread overview: 21+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-02-13 20:03 [PATCH v6 0/9] x86: refactor mm.c Wei Liu
2018-02-13 20:04 ` [PATCH v6 1/9] x86/mm: add pv prefix to {alloc, free}_page_type Wei Liu
2018-03-08 17:03   ` Jan Beulich
2018-03-08 17:05   ` Jan Beulich
2018-02-13 20:04 ` [PATCH v6 2/9] x86/mm: move disallow masks to pv/mm.h Wei Liu
2018-02-13 20:04 ` [PATCH v6 3/9] x86/mm: add disallow_mask parameter to get_page_from_l1e Wei Liu
2018-03-13 15:54   ` Jan Beulich
2018-03-19 12:10     ` Tim Deegan [this message]
2018-02-13 20:04 ` [PATCH v6 4/9] x86/mm: add pv prefix to _put_final_page_type Wei Liu
2018-03-13 15:55   ` Jan Beulich
2018-02-13 20:04 ` [PATCH v6 5/9] x86/mm: factor out pv_dec_linear_pt Wei Liu
2018-03-13 15:59   ` Jan Beulich
2018-02-13 20:04 ` [PATCH v6 6/9] x86/mm: export set_tlbflush_timestamp Wei Liu
2018-03-13 16:06   ` Jan Beulich
2018-02-13 20:04 ` [PATCH v6 7/9] x86/mm: provide put_page_type_ptpg{, _preemptible} Wei Liu
2018-03-13 16:10   ` Jan Beulich
2018-03-13 16:17   ` Jan Beulich
2018-02-13 20:04 ` [PATCH v6 8/9] x86/mm: move PV code to pv/mm.c Wei Liu
2018-02-13 20:04 ` [PATCH v6 9/9] x86/mm: remove now unused inclusion of pv/mm.h Wei Liu
2018-03-08 12:17 ` [PATCH v6 0/9] x86: refactor mm.c Wei Liu
2018-03-08 12:36   ` Jan Beulich

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=20180319121029.GA31437@deinos.phlegethon.org \
    --to=tim@xen.org \
    --cc=JBeulich@suse.com \
    --cc=andrew.cooper3@citrix.com \
    --cc=wei.liu2@citrix.com \
    --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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).