xen-devel.lists.xenproject.org archive mirror
 help / color / mirror / Atom feed
From: Mukesh Rathor <mukesh.rathor@oracle.com>
To: George Dunlap <dunlapg@umich.edu>
Cc: xen-devel <xen-devel@lists.xenproject.org>,
	Jan Beulich <JBeulich@suse.com>
Subject: Re: PVH and mtrr/PAT.........
Date: Wed, 20 Nov 2013 14:24:50 -0800	[thread overview]
Message-ID: <20131120142450.537a3a3d@mantra.us.oracle.com> (raw)
In-Reply-To: <CAFLBxZaJ80c+UsKUvK+dfA847FYeX0ejDkKekmAVae5p9yiFeg@mail.gmail.com>

On Wed, 20 Nov 2013 18:12:13 +0000
George Dunlap <dunlapg@umich.edu> wrote:

> On Wed, Nov 20, 2013 at 8:42 AM, Jan Beulich <JBeulich@suse.com>
> wrote:
> >>>> On 20.11.13 at 03:11, Mukesh Rathor <mukesh.rathor@oracle.com>
> >>>> wrote:
> >> After rebasing my dom0 on latest, it didn't boot. After debugging
> >> couple days, it turned out to be :
> >>
> >> +    if ( is_pvh_domain(d) )
> >> +    {
> >> +        if ( direct_mmio )
> >> +            return MTRR_TYPE_UNCACHABLE;
> >> +        return MTRR_TYPE_WRBACK;
> >> +    }
> >> +
> >>
> >> I had in my patches, missing in epte_get_entry_emt() in latest.
> >>
> >> So, since I don't know much about this, is an HVM guest setting
> >> MTRR range types? Looking for suggestions on best way to do this
> >> for PVH.
> >
> > A HVM guest is permitted to write to (virtual) MTRRs, whereas a PV
> > guest isn't. I'm inclined to prefer PV behavior here to be used for
> > PVH (since, as explained by Dongxiao, MTRRs don't really matter
> > for VMX guests anyway, i.e. the setting of (virtual) MTRRs needs to
> > get translated to EPT memory types anyway, hence a PVH guest
> > ought to be fine ignoring the MTRRs altogether and handling memory
> > types exclusively via PAT mechanisms).
> 
> Mukesh,
> 
> Do you know why this line is having this effect?  For one, is it a
> matter of direct_mmio pages being given something other than
> UNCACHEABLE, or a matter of non-direct_mmio pages given something
> other than WRBACK?
> 
> And is the problem that the guest is *not* setting MTRRs, or that the
> guest *is* setting MTRRs?
> 
> I'd prefer to avoid having a special case for PVH in this path if
> possible.

Without any changes to epte_get_entry_emt(), all types are being returned 
as MTRR_TYPE_WRBACK for PVH because of:

    if ( !v->domain->arch.hvm_domain.params[HVM_PARAM_IDENT_PT] )
            return MTRR_TYPE_WRBACK;

This is problem for low level non-ram pages being accessed in dom0,
(which interesting gave MCE errors). non-ram IO pages have to be
MTRR_TYPE_UNCACHABLE.

After changing this to, 
    if ( !is_pvh_vcpu(v) &&
         !v->domain->arch.hvm_domain.params[HVM_PARAM_IDENT_PT] )

I started hitting if ( direct_mmio ), and getting proper UNCACHABLE
for io pages, but RAM pages started being returned as UNCACHABLE also 
thru get_mtrr_type() which I've not investigated.

For domU, it's incorrect, but happens to work because of:

    if ( !v->domain->arch.hvm_domain.params[HVM_PARAM_IDENT_PT] )
            return MTRR_TYPE_WRBACK;

as domU only has RAM pages, and thus WRBACK is correct for all.

My quick fix while we come up with better solution was:
-----------
+    /* PVH fixme: Add support for more memory types. */
+    if ( is_pvh_domain(d) )
+    {
+        if ( direct_mmio )
+            return MTRR_TYPE_UNCACHABLE;
+        return MTRR_TYPE_WRBACK;
+    }
+
     if ( !v->domain->arch.hvm_domain.params[HVM_PARAM_IDENT_PT] )
---------------

It appears you didn't check all places where params was being used
before adding it for PVH.

thanks
Mukesh

  reply	other threads:[~2013-11-20 22:24 UTC|newest]

Thread overview: 18+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-11-20  2:11 PVH and mtrr/PAT Mukesh Rathor
2013-11-20  7:22 ` Xu, Dongxiao
2013-11-20  8:42 ` Jan Beulich
2013-11-20 18:12   ` George Dunlap
2013-11-20 22:24     ` Mukesh Rathor [this message]
2013-11-21 15:47       ` George Dunlap
2013-11-21 23:41         ` Mukesh Rathor
2013-11-22 10:43           ` George Dunlap
2013-11-22 11:09             ` Jan Beulich
2013-11-22 12:16               ` George Dunlap
2013-11-22 12:30                 ` Jan Beulich
2013-11-22 10:29         ` Jan Beulich
2013-12-03  7:20           ` Xu, Dongxiao
2013-12-03 13:54             ` George Dunlap
2013-11-21  2:42   ` Mukesh Rathor
2013-11-21  7:50     ` konrad wilk
2013-11-21 11:40     ` Jan Beulich
2013-11-22  0:42       ` Mukesh Rathor

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=20131120142450.537a3a3d@mantra.us.oracle.com \
    --to=mukesh.rathor@oracle.com \
    --cc=JBeulich@suse.com \
    --cc=dunlapg@umich.edu \
    --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).