xen-devel.lists.xenproject.org archive mirror
 help / color / mirror / Atom feed
From: Mukesh Rathor <mukesh.rathor@oracle.com>
To: Mukesh Rathor <mukesh.rathor@oracle.com>
Cc: "Xen-devel@lists.xensource.com" <Xen-devel@lists.xensource.com>,
	Tim Deegan <tim@xen.org>, Jan Beulich <JBeulich@suse.com>
Subject: Re: dom0 pvh: linux: issues without dom0_mem
Date: Tue, 3 Dec 2013 18:39:02 -0800	[thread overview]
Message-ID: <20131203183902.1f02c4a5@mantra.us.oracle.com> (raw)
In-Reply-To: <20131203182040.19c3b81a@mantra.us.oracle.com>

On Tue, 3 Dec 2013 18:20:40 -0800
Mukesh Rathor <mukesh.rathor@oracle.com> wrote:

> Konrad,
> 
> Looks like there are bunch of things in the
> xen_set_identity_and_release code for pvh. Things crap out for dom0
> when dom0_mem is not specified.
> 
> For one, the code in  xen_pvh_adjust_stats():
> 
>                 unsigned long end = min(max_pfn_mapped, end_pfn);
> 
> is wrong. The result is a negative number, and causes released to be
> set improperly:
> 
> [    0.000000] Released 18446744073707253146 pages of unused memory
> 
> This then later causes xen_do_chunk to barf:
> 
> [    0.000000] ------------[ cut here ]------------
> [    0.000000] WARNING: CPU: 0 PID: 0
> at /home/sb/hybrid/linux-v3.12/arch/x86/xen/setup.c:134
> xen_do_chunk+0x1a0/0x247() [    0.000000] Failed to populate pfn
> 271f85 err=0
> 
> 
> Second, I don't remember or understand why we removed the
> xen_release_chunk from pvh path, and now just collect the stats. If
> anything is mapped, it would need to be removed. Oh never mind, i
> remember, because when the iomap is done by xen, it has already
> removed those pages. Hmm... so let me figure how to fix
> xen_pvh_adjust_stats(). I'll send patch. JFYI you and others.
> 

Tim/Jan,

With regard to this, when a PVH maps all iomem upfront, the old mfn's are
discarded. I would have thought, and I think I had that code orginally
somewhere, that set_mmio_p2m_entry would free_domheap_page() at:

    else if ( p2m_is_ram(ot) )
    {
        ASSERT(mfn_valid(omfn));
        set_gpfn_from_mfn(mfn_x(omfn), INVALID_M2P_ENTRY);
          NO free_domheap_page(omfn) <---------
    }

When dom0_mem is not specified, and lotsa pages are freed, that would
be a big memleak. If it can't be done here, then I could add something
to pvh_add_mem_mapping() in domain_build.c (patch 2 of v4 dom0 series):

static __init void pvh_add_mem_mapping(struct domain *d, unsigned long gfn,
                                       unsigned long mfn, unsigned long nr_mfns)
{
    unsigned long i;
    for ( i = 0; i < nr_mfns; i++ )

        if (old mfn && it's type is RAM)
            free_domheap_page(oldmfn);

        if ( !set_mmio_p2m_entry(d, gfn + i, _mfn(mfn + i)) )
            panic("Failed setting p2m. gfn:%lx mfn:%lx i:%ld\n", gfn, mfn, i);
}

Thoughts?

thanks
mukesh

      reply	other threads:[~2013-12-04  2:39 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-12-04  2:20 dom0 pvh: linux: issues without dom0_mem Mukesh Rathor
2013-12-04  2:39 ` Mukesh Rathor [this message]

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=20131203183902.1f02c4a5@mantra.us.oracle.com \
    --to=mukesh.rathor@oracle.com \
    --cc=JBeulich@suse.com \
    --cc=Xen-devel@lists.xensource.com \
    --cc=tim@xen.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).