From: Konrad Rzeszutek Wilk <konrad.wilk@oracle.com>
To: Stefano Stabellini <stefano.stabellini@eu.citrix.com>
Cc: xen-devel@lists.xenproject.org, linux-kernel@vger.kernel.org,
boris.ostrovsky@oracle.com, david.vrabel@citrix.com,
mukesh.rathor@oracle.com, jbeulich@suse.com
Subject: Re: [Xen-devel] [PATCH v11 05/12] xen/pvh: Update E820 to work with PVH
Date: Wed, 18 Dec 2013 15:30:37 -0500 [thread overview]
Message-ID: <20131218203037.GA9698@phenom.dumpdata.com> (raw)
In-Reply-To: <alpine.DEB.2.02.1312181813260.8667@kaball.uk.xensource.com>
On Wed, Dec 18, 2013 at 06:25:15PM +0000, Stefano Stabellini wrote:
> On Tue, 17 Dec 2013, Konrad Rzeszutek Wilk wrote:
> > From: Mukesh Rathor <mukesh.rathor@oracle.com>
> >
> > In xen_add_extra_mem() we can skip updating P2M as it's managed
> > by Xen. PVH maps the entire IO space, but only RAM pages need
> > to be repopulated.
> >
> > Signed-off-by: Mukesh Rathor <mukesh.rathor@oracle.com>
> > Signed-off-by: Konrad Rzeszutek Wilk <konrad.wilk@oracle.com>
> > ---
> > arch/x86/xen/setup.c | 19 +++++++++++++++++--
> > 1 file changed, 17 insertions(+), 2 deletions(-)
> >
> > diff --git a/arch/x86/xen/setup.c b/arch/x86/xen/setup.c
> > index 2137c51..f93bca1 100644
> > --- a/arch/x86/xen/setup.c
> > +++ b/arch/x86/xen/setup.c
> > @@ -27,6 +27,7 @@
> > #include <xen/interface/memory.h>
> > #include <xen/interface/physdev.h>
> > #include <xen/features.h>
> > +#include "mmu.h"
> > #include "xen-ops.h"
> > #include "vdso.h"
> >
> > @@ -81,6 +82,9 @@ static void __init xen_add_extra_mem(u64 start, u64 size)
> >
> > memblock_reserve(start, size);
> >
> > + if (xen_feature(XENFEAT_auto_translated_physmap))
> > + return;
> > +
> > xen_max_p2m_pfn = PFN_DOWN(start + size);
> > for (pfn = PFN_DOWN(start); pfn < xen_max_p2m_pfn; pfn++) {
> > unsigned long mfn = pfn_to_mfn(pfn);
> > @@ -103,6 +107,7 @@ static unsigned long __init xen_do_chunk(unsigned long start,
> > .domid = DOMID_SELF
> > };
> > unsigned long len = 0;
> > + int xlated_phys = xen_feature(XENFEAT_auto_translated_physmap);
> > unsigned long pfn;
> > int ret;
> >
> > @@ -116,7 +121,7 @@ static unsigned long __init xen_do_chunk(unsigned long start,
> > continue;
> > frame = mfn;
> > } else {
> > - if (mfn != INVALID_P2M_ENTRY)
> > + if (!xlated_phys && mfn != INVALID_P2M_ENTRY)
> > continue;
> > frame = pfn;
> > }
> > @@ -154,6 +159,13 @@ static unsigned long __init xen_do_chunk(unsigned long start,
> > static unsigned long __init xen_release_chunk(unsigned long start,
> > unsigned long end)
> > {
> > + /*
> > + * Xen already ballooned out the E820 non RAM regions for us
> > + * and set them up properly in EPT.
> > + */
> > + if (xen_feature(XENFEAT_auto_translated_physmap))
> > + return end - start;
> > +
> > return xen_do_chunk(start, end, true);
> > }
> >
> > @@ -222,6 +234,9 @@ static void __init xen_set_identity_and_release_chunk(
> > * (except for the ISA region which must be 1:1 mapped) to
> > * release the refcounts (in Xen) on the original frames.
> > */
> > + if (xen_feature(XENFEAT_auto_translated_physmap))
> > + goto skip;
> > +
> > for (pfn = start_pfn; pfn <= max_pfn_mapped && pfn < end_pfn; pfn++) {
> > pte_t pte = __pte_ma(0);
> >
> > @@ -231,7 +246,7 @@ static void __init xen_set_identity_and_release_chunk(
> > (void)HYPERVISOR_update_va_mapping(
> > (unsigned long)__va(pfn << PAGE_SHIFT), pte, 0);
> > }
> > -
> > +skip:
> > if (start_pfn < nr_pages)
> > *released += xen_release_chunk(
> > start_pfn, min(end_pfn, nr_pages));
>
> A goto? Really? What's wrong with an if?
Moves too much code.
> Also considering that you are turning xen_release_chunk into a nop, the
> only purpose of this function on PVH is to call set_phys_range_identity.
> Can't we just do that?
And set_phys_range_identity ends up just doing:
769 if (unlikely(xen_feature(XENFEAT_auto_translated_physmap)))
770 return pfn_e - pfn_s;
So what we really could do (which is what Mukesh's patch had):
if (xen_feature(XENFEAT..) {
if (start_pfn < nr_pages)
*released += min(end_pfn, nr_pages) - start_pfn;
*identity += end_pfn - start_pfn;
}
in its own function. We could do that.
next prev parent reply other threads:[~2013-12-20 3:10 UTC|newest]
Thread overview: 83+ messages / expand[flat|nested] mbox.gz Atom feed top
2013-12-17 20:51 [PATCH v11] PVH support for Linux kernel Konrad Rzeszutek Wilk
2013-12-17 20:51 ` [PATCH v11 01/12] xen/p2m: Check for auto-xlat when doing mfn_to_local_pfn Konrad Rzeszutek Wilk
2013-12-18 14:10 ` [Xen-devel] " Stefano Stabellini
2013-12-18 14:10 ` Stefano Stabellini
2013-12-17 20:51 ` [PATCH v11 02/12] xen/pvh: Define what an PVH guest is Konrad Rzeszutek Wilk
2013-12-18 14:22 ` [Xen-devel] " Stefano Stabellini
2013-12-18 14:55 ` Stefano Stabellini
2013-12-18 16:01 ` Ian Campbell
2013-12-18 16:58 ` Konrad Rzeszutek Wilk
2013-12-18 16:58 ` [Xen-devel] " Konrad Rzeszutek Wilk
2013-12-18 17:03 ` Ian Campbell
2013-12-18 17:03 ` [Xen-devel] " Ian Campbell
2013-12-18 16:01 ` Ian Campbell
2013-12-18 14:55 ` Stefano Stabellini
2013-12-18 14:57 ` Konrad Rzeszutek Wilk
2013-12-18 14:57 ` [Xen-devel] " Konrad Rzeszutek Wilk
2013-12-18 14:22 ` Stefano Stabellini
2013-12-17 20:51 ` Konrad Rzeszutek Wilk
2013-12-17 20:51 ` [PATCH v11 03/12] xen/pvh: Early bootup changes in PV code Konrad Rzeszutek Wilk
2013-12-18 14:27 ` Stefano Stabellini
2013-12-18 14:27 ` [Xen-devel] " Stefano Stabellini
2013-12-18 14:58 ` Konrad Rzeszutek Wilk
2013-12-18 14:58 ` [Xen-devel] " Konrad Rzeszutek Wilk
2013-12-18 15:05 ` Stefano Stabellini
2013-12-18 15:05 ` Stefano Stabellini
2013-12-17 20:51 ` [PATCH v11 04/12] xen/pvh: Don't setup P2M tree Konrad Rzeszutek Wilk
2013-12-18 14:39 ` Stefano Stabellini
2013-12-18 14:39 ` [Xen-devel] " Stefano Stabellini
2013-12-18 15:05 ` Konrad Rzeszutek Wilk
2013-12-18 15:05 ` Konrad Rzeszutek Wilk
2013-12-17 20:51 ` [PATCH v11 05/12] xen/pvh: Update E820 to work with PVH Konrad Rzeszutek Wilk
2013-12-18 18:25 ` Stefano Stabellini
2013-12-18 18:25 ` [Xen-devel] " Stefano Stabellini
2013-12-18 20:30 ` Konrad Rzeszutek Wilk
2013-12-18 20:30 ` Konrad Rzeszutek Wilk [this message]
2013-12-18 23:44 ` Mukesh Rathor
2013-12-18 23:44 ` [Xen-devel] " Mukesh Rathor
2013-12-19 11:25 ` Stefano Stabellini
2013-12-19 11:25 ` [Xen-devel] " Stefano Stabellini
2013-12-17 20:51 ` Konrad Rzeszutek Wilk
2013-12-17 20:51 ` [PATCH v11 06/12] xen/pvh: Load GDT/GS in early PV bootup code for BSP Konrad Rzeszutek Wilk
2013-12-17 20:51 ` [PATCH v11 07/12] xen/pvh: Secondary VCPU bringup (non-bootup CPUs) Konrad Rzeszutek Wilk
2013-12-17 20:51 ` [PATCH v11 08/12] xen/pvh: MMU changes for PVH Konrad Rzeszutek Wilk
2013-12-17 20:51 ` Konrad Rzeszutek Wilk
2013-12-18 14:48 ` [Xen-devel] " Stefano Stabellini
2013-12-18 15:10 ` Konrad Rzeszutek Wilk
2013-12-18 15:15 ` Stefano Stabellini
2013-12-18 15:15 ` [Xen-devel] " Stefano Stabellini
2013-12-18 15:10 ` Konrad Rzeszutek Wilk
2013-12-18 14:48 ` Stefano Stabellini
2013-12-17 20:51 ` [PATCH v11 09/12] xen/pvh: Piggyback on PVHVM XenBus and event channels " Konrad Rzeszutek Wilk
2013-12-18 18:31 ` [Xen-devel] " Stefano Stabellini
2013-12-18 21:17 ` Konrad Rzeszutek Wilk
2013-12-18 21:17 ` [Xen-devel] " Konrad Rzeszutek Wilk
2014-01-04 0:48 ` Mukesh Rathor
2014-01-04 0:48 ` [Xen-devel] " Mukesh Rathor
2014-01-05 17:18 ` Stefano Stabellini
2014-01-05 17:18 ` Stefano Stabellini
2013-12-31 18:56 ` [Xen-devel] " Konrad Rzeszutek Wilk
2014-01-03 15:04 ` Stefano Stabellini
2014-01-03 15:04 ` [Xen-devel] " Stefano Stabellini
2014-01-04 0:29 ` Mukesh Rathor
2014-01-04 0:29 ` [Xen-devel] " Mukesh Rathor
2013-12-31 18:56 ` Konrad Rzeszutek Wilk
2013-12-18 18:31 ` Stefano Stabellini
2013-12-17 20:51 ` [PATCH v11 10/12] xen/pvh: Piggyback on PVHVM for grant driver Konrad Rzeszutek Wilk
2013-12-18 18:46 ` Stefano Stabellini
2013-12-18 18:46 ` [Xen-devel] " Stefano Stabellini
2013-12-18 21:21 ` Konrad Rzeszutek Wilk
2014-01-03 15:10 ` Stefano Stabellini
2014-01-03 15:10 ` Stefano Stabellini
2013-12-18 21:21 ` Konrad Rzeszutek Wilk
2013-12-17 20:51 ` [PATCH v11 11/12] xen/pvh: Disable PV code that does not work with PVH Konrad Rzeszutek Wilk
2013-12-17 20:51 ` Konrad Rzeszutek Wilk
2013-12-18 14:19 ` Stefano Stabellini
2013-12-18 14:19 ` [Xen-devel] " Stefano Stabellini
2013-12-18 14:56 ` Konrad Rzeszutek Wilk
2013-12-18 14:56 ` [Xen-devel] " Konrad Rzeszutek Wilk
2013-12-18 15:22 ` Stefano Stabellini
2013-12-18 15:22 ` Stefano Stabellini
2013-12-17 20:51 ` [PATCH v11 12/12] xen/pvh: Support ParaVirtualized Hardware extensions Konrad Rzeszutek Wilk
2013-12-18 14:52 ` [Xen-devel] " Stefano Stabellini
2013-12-18 14:52 ` Stefano Stabellini
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=20131218203037.GA9698@phenom.dumpdata.com \
--to=konrad.wilk@oracle.com \
--cc=boris.ostrovsky@oracle.com \
--cc=david.vrabel@citrix.com \
--cc=jbeulich@suse.com \
--cc=linux-kernel@vger.kernel.org \
--cc=mukesh.rathor@oracle.com \
--cc=stefano.stabellini@eu.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 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.