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: Kevin Tian <kevin.tian@intel.com>, Keir Fraser <keir@xen.org>,
	suravee.suthikulpanit@amd.com, Eddie Dong <eddie.dong@intel.com>,
	Jun Nakajima <jun.nakajima@intel.com>,
	xen-devel <xen-devel@lists.xenproject.org>,
	Boris Ostrovsky <boris.ostrovsky@oracle.com>
Subject: Re: [PATCH v2 4/6] x86/NPT: don't walk entire page tables when changing types on a range
Date: Fri, 25 Apr 2014 10:43:21 +0200	[thread overview]
Message-ID: <20140425084321.GA33897@deinos.phlegethon.org> (raw)
In-Reply-To: <535A192E020000780000C234@nat28.tlf.novell.com>

At 07:13 +0100 on 25 Apr (1398406414), Jan Beulich wrote:
> >>> On 24.04.14 at 18:25, <tim@xen.org> wrote:
> > At 13:30 +0100 on 22 Apr (1398169846), Jan Beulich wrote:
> >> This builds on the fact that in order for no NPF VM exit to occur,
> >> _PAGE_USER must always be set. I.e. by clearing the flag we can force a
> >> VM exit allowing us to do similar lazy type changes as on EPT.
> >> 
> >> That way, the generic entry-wise code can go away, and we could remove
> >> the range restriction in enforced on HVMOP_track_dirty_vram for XSA-27.
> >> 
> >> Signed-off-by: Jan Beulich <jbeulich@suse.com>
> >> 
> >> --- a/xen/arch/x86/hvm/svm/svm.c
> >> +++ b/xen/arch/x86/hvm/svm/svm.c
> >> @@ -2557,7 +2557,16 @@ void svm_vmexit_handler(struct cpu_user_
> >>          perfc_incra(svmexits, VMEXIT_NPF_PERFC);
> >>          if ( cpu_has_svm_decode )
> >>              v->arch.hvm_svm.cached_insn_len = vmcb->guest_ins_len & 0xf;
> >> -        svm_do_nested_pgfault(v, regs, vmcb->exitinfo1, vmcb->exitinfo2);
> >> +        rc = p2m_npt_fault(vmcb->exitinfo2);
> > 
> > Can we limit the classes of fault that we need to check for
> > recalc on?  e.g. if bit 0 of the error code is clear, then the page is
> > not mapped at all. 
> 
> That's a good suggestion (albeit I'm not sure if there really are
> frequent faults with P clear - with paging perhaps, but that's a slow
> path anyway). Ideally we would have an indication that the fault
> was because of the U bit clear, but sadly that doesn't exist.

Yeah, that's a shame.

> > I'm unsure about having two different fixup paths here anyway -- one
> > for log-dirty and one for everything else (PoD, sharing &c).  This
> > call should probably go _inside_ svm_do_nested_pgfault() at least.
> 
> I intentionally kept it separate, so it's not getting farther away than
> necessary from how EPT handling is structured.

Hmm.  Well, in that case I guess it's OK here.  The alternative would
be to put it right into the HVM nested fault handler and replumb the
ERPT path to go the same way, but I can see that would be inefficient...

> > Also, maybe it wants a more descriptive name than p2m_npt_fault().
> > p2m_pt_hnadle_misconfig(), to match the EPT equivalent?
> 
> I first considered naming it that way, but it's not really a mis-
> configuration. But if you think that's a better name despite not
> describing what it really does, I'm okay changing it...

I think I do prefer it, but maybe we can find a better name for both
of them: {p2m_pt,ept}_handle_deferred_changes()?

> > This looks like it could be merged with the EPT equivalent.  Or would
> > that be too unwieldy?
> 
> I considered unifying both this and/or the helpers of it, but decided
> that the result would be uglier (too many parameters just to tell one
> from the other) than the duplication that results from this approach.

OK, fair enough.

Tim.

  reply	other threads:[~2014-04-25  8:43 UTC|newest]

Thread overview: 21+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-04-22 12:22 [PATCH v2 0/6] x86/P2M: reduce time bulk type changes take Jan Beulich
2014-04-22 12:28 ` [PATCH v2 1/6] x86/EPT: don't walk entire page tables when globally changing types Jan Beulich
2014-04-24 15:41   ` Tim Deegan
2014-04-24 16:20     ` Jan Beulich
2014-04-25  8:44       ` Tim Deegan
2014-04-25 19:37   ` Konrad Rzeszutek Wilk
2014-04-28  7:19     ` Jan Beulich
2014-04-22 12:29 ` [PATCH v2 2/6] x86/EPT: don't walk entire page tables when changing types on a range Jan Beulich
2014-04-24 16:00   ` Tim Deegan
2014-04-22 12:30 ` [PATCH v2 3/6] x86/P2M: simplify write_p2m_entry() Jan Beulich
2014-04-24 16:00   ` Tim Deegan
2014-04-24 16:22     ` Jan Beulich
2014-04-22 12:30 ` [PATCH v2 4/6] x86/NPT: don't walk entire page tables when changing types on a range Jan Beulich
2014-04-24 16:25   ` Tim Deegan
2014-04-25  6:13     ` Jan Beulich
2014-04-25  8:43       ` Tim Deegan [this message]
2014-04-22 12:31 ` [PATCH v2 5/6] x86/NPT: don't walk entire page tables when globally changing types Jan Beulich
2014-04-24 16:28   ` Tim Deegan
2014-04-22 12:32 ` [PATCH v2 6/6] x86/P2M: cleanup Jan Beulich
2014-04-22 12:37   ` Andrew Cooper
2014-04-24 16:30   ` 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=20140425084321.GA33897@deinos.phlegethon.org \
    --to=tim@xen.org \
    --cc=JBeulich@suse.com \
    --cc=boris.ostrovsky@oracle.com \
    --cc=eddie.dong@intel.com \
    --cc=jun.nakajima@intel.com \
    --cc=keir@xen.org \
    --cc=kevin.tian@intel.com \
    --cc=suravee.suthikulpanit@amd.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).