All of lore.kernel.org
 help / color / mirror / Atom feed
From: "Durrant, Paul" <pdurrant@amazon.co.uk>
To: Jan Beulich <jbeulich@suse.com>
Cc: "Wei Liu" <wl@xen.org>,
	"Andrew Cooper" <andrew.cooper3@citrix.com>,
	"George Dunlap" <george.dunlap@citrix.com>,
	"xen-devel@lists.xenproject.org" <xen-devel@lists.xenproject.org>,
	"pdurrant@amzn.com" <pdurrant@amzn.com>,
	"Roger Pau Monné" <roger.pau@citrix.com>
Subject: Re: [Xen-devel] [PATCH v3 2/6] x86 / p2m: remove page_list check in p2m_alloc_table
Date: Fri, 6 Mar 2020 12:50:49 +0000	[thread overview]
Message-ID: <cddc7c8d65b6444a9c44f075fdca3b93@EX13D32EUC003.ant.amazon.com> (raw)
In-Reply-To: <9beb5129-68c0-ce68-2778-748a4485f6fb@suse.com>

> -----Original Message-----
> From: Jan Beulich <jbeulich@suse.com>
> Sent: 06 March 2020 12:47
> To: Durrant, Paul <pdurrant@amazon.co.uk>
> Cc: pdurrant@amzn.com; xen-devel@lists.xenproject.org; Andrew Cooper <andrew.cooper3@citrix.com>;
> George Dunlap <george.dunlap@citrix.com>; Wei Liu <wl@xen.org>; Roger Pau Monné <roger.pau@citrix.com>
> Subject: Re: [PATCH v3 2/6] x86 / p2m: remove page_list check in p2m_alloc_table
> 
> On 06.03.2020 13:07, Durrant, Paul wrote:
> >> -----Original Message-----
> >> From: Jan Beulich <jbeulich@suse.com>
> >> Sent: 06 March 2020 11:46
> >> To: pdurrant@amzn.com
> >> Cc: xen-devel@lists.xenproject.org; Durrant, Paul <pdurrant@amazon.co.uk>; Andrew Cooper
> >> <andrew.cooper3@citrix.com>; George Dunlap <george.dunlap@citrix.com>; Wei Liu <wl@xen.org>; Roger
> Pau
> >> Monné <roger.pau@citrix.com>
> >> Subject: Re: [PATCH v3 2/6] x86 / p2m: remove page_list check in p2m_alloc_table
> >>
> >> On 05.03.2020 13:45, pdurrant@amzn.com wrote:
> >>> From: Paul Durrant <pdurrant@amazon.com>
> >>>
> >>> There does not seem to be any justification for refusing to create the
> >>> domain's p2m table simply because it may have assigned pages.
> >>
> >> I think there is: If any such allocation had happened before, how
> >> would it be represented in the domain's p2m?
> >
> > Insertion into the p2m is a separate action from page allocation. Why should they be linked?
> 
> They are, because of how XENMEM_populate_physmap works. Yes,
> they _could_ be separate steps, but that's only a theoretical
> consideration.

Then surely the check should be in the XENMEM_populate_physmap code?

> 
> >>> Particularly
> >>> it prevents the prior allocation of PGC_extra pages.
> >>
> >> That's unfortunate, but will need taking care of differently then:
> >>
> >>> --- a/xen/arch/x86/mm/p2m.c
> >>> +++ b/xen/arch/x86/mm/p2m.c
> >>> @@ -695,14 +695,6 @@ int p2m_alloc_table(struct p2m_domain *p2m)
> >>>
> >>>      p2m_lock(p2m);
> >>>
> >>> -    if ( p2m_is_hostp2m(p2m)
> >>> -         && !page_list_empty(&d->page_list) )
> >>> -    {
> >>> -        P2M_ERROR("dom %d already has memory allocated\n", d->domain_id);
> >>> -        p2m_unlock(p2m);
> >>> -        return -EINVAL;
> >>> -    }
> >>
> >> Instead of checking the list to be empty, how about checking
> >> domain_tot_pages() to return zero?
> >
> > I could do that, and in fact my original code did, but with more
> > consideration the whole test just didn't make sense to me. Yes,
> > clearly the p2m has to be there before pages can be added into it,
> > but I can't see any reason why you couldn't even allocate the
> > entire guest RAM, then create the p2m and then add the pages into
> > it.
> 
> Right - more hypercalls (XENMEM_increase_reservation + operations
> like XENMAPSPACE_gmfn), and hence slower overall domain creation.
> Plus - XENMEM_increase_reservation is not very useful for
> translated domains, as it won't return the MFNs allocated, and
> there's no way to specify where they should appear in GFN space.
> Hence in practice I don't see how this whole operation could
> work without XENMEM_populate_physmap.
> 

Oh, it would mean a big change in the tools etc. so I'm not saying it's a good idea or even possible at the moment. I was just pointing out that, as far as the lower layers of code in Xen go, page allocation and p2m insertion are distinct actions.

  Paul

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

  reply	other threads:[~2020-03-06 12:51 UTC|newest]

Thread overview: 37+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-03-05 12:44 [Xen-devel] [PATCH v3 0/6] remove one more shared xenheap page: shared_info pdurrant
2020-03-05 12:44 ` [Xen-devel] [PATCH v3 1/6] domain: introduce alloc/free_shared_info() helpers pdurrant
2020-03-05 13:23   ` Xia, Hongyan
2020-03-05 13:25     ` Xia, Hongyan
2020-03-06 11:41   ` Jan Beulich
2020-03-05 12:45 ` [Xen-devel] [PATCH v3 2/6] x86 / p2m: remove page_list check in p2m_alloc_table pdurrant
2020-03-06 11:45   ` Jan Beulich
2020-03-06 12:07     ` Durrant, Paul
2020-03-06 12:46       ` Jan Beulich
2020-03-06 12:50         ` Durrant, Paul [this message]
2020-03-06 13:06           ` Jan Beulich
2020-03-06 13:11             ` [Xen-devel] [EXTERNAL][PATCH " Paul Durrant
2020-03-06 13:19               ` Jan Beulich
2020-03-06 13:25                 ` Paul Durrant
2020-03-05 12:45 ` [Xen-devel] [PATCH v3 3/6] x86 / pv: do not treat PGC_extra pages as RAM when constructing dom0 pdurrant
2020-03-06 11:56   ` Jan Beulich
2020-03-06 12:03     ` Durrant, Paul
2020-03-06 13:39       ` Jan Beulich
2020-03-06 13:45         ` Paul Durrant
2020-03-06 13:47           ` Jan Beulich
2020-03-05 12:45 ` [Xen-devel] [PATCH v3 4/6] x86 / ioreq: use a MEMF_no_refcount allocation for server pages pdurrant
2020-03-06 12:03   ` Jan Beulich
2020-03-05 12:45 ` [Xen-devel] [PATCH v3 5/6] mm: add 'is_special_page' macro pdurrant
2020-03-05 15:09   ` Tamas K Lengyel
2020-03-05 15:38     ` Durrant, Paul
2020-03-05 15:58       ` Tamas K Lengyel
2020-03-06  7:02   ` Alan Robinson
2020-03-06  9:22     ` Durrant, Paul
2020-03-06 12:20   ` Jan Beulich
2020-03-06 12:35     ` Paul Durrant
2020-03-06 13:44       ` Jan Beulich
2020-03-06 13:48         ` Paul Durrant
2020-03-06 13:52           ` Jan Beulich
2020-03-06 13:57             ` Paul Durrant
2020-03-06 14:26         ` Julien Grall
2020-03-06 14:50           ` Jan Beulich
2020-03-05 12:45 ` [Xen-devel] [PATCH v3 6/6] domain: use PGC_extra domheap page for shared_info pdurrant

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=cddc7c8d65b6444a9c44f075fdca3b93@EX13D32EUC003.ant.amazon.com \
    --to=pdurrant@amazon.co.uk \
    --cc=andrew.cooper3@citrix.com \
    --cc=george.dunlap@citrix.com \
    --cc=jbeulich@suse.com \
    --cc=pdurrant@amzn.com \
    --cc=roger.pau@citrix.com \
    --cc=wl@xen.org \
    --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.