From: George Dunlap <george.dunlap@citrix.com>
To: Paul Durrant <pdurrant@amazon.com>, <xen-devel@lists.xenproject.org>
Cc: "Kevin Tian" <kevin.tian@intel.com>,
"Stefano Stabellini" <sstabellini@kernel.org>,
"Julien Grall" <julien@xen.org>,
"Jun Nakajima" <jun.nakajima@intel.com>, "Wei Liu" <wl@xen.org>,
"Konrad Rzeszutek Wilk" <konrad.wilk@oracle.com>,
"George Dunlap" <George.Dunlap@eu.citrix.com>,
"Andrew Cooper" <andrew.cooper3@citrix.com>,
"Ian Jackson" <ian.jackson@eu.citrix.com>,
"Roger Pau Monné" <roger.pau@citrix.com>
Subject: Re: [Xen-devel] [PATCH v3 3/3] x86 / vmx: use a 'normal' domheap page for APIC_DEFAULT_PHYS_BASE
Date: Thu, 23 Jan 2020 14:45:38 +0000 [thread overview]
Message-ID: <dbdeec02-3a69-7262-fed6-2b280faf2b8e@citrix.com> (raw)
In-Reply-To: <20200123140305.21050-4-pdurrant@amazon.com>
On 1/23/20 2:03 PM, Paul Durrant wrote:
> vmx_alloc_vlapic_mapping() currently contains some very odd looking code
> that allocates a MEMF_no_owner domheap page and then shares with the guest
> as if it were a xenheap page. This then requires vmx_free_vlapic_mapping()
> to call a special function in the mm code: free_shared_domheap_page().
>
> By using a 'normal' domheap page (i.e. by not passing MEMF_no_owner to
> alloc_domheap_page()), the odd looking code in vmx_alloc_vlapic_mapping()
> can simply use get_page_and_type() to set up a writable mapping before
> insertion in the P2M and vmx_free_vlapic_mapping() can simply release the
> page using put_page_alloc_ref() followed by put_page_and_type(). This
> then allows free_shared_domheap_page() to be purged.
>
> There is, however, some fall-out from this simplification:
>
> - alloc_domheap_page() will now call assign_pages() and run into the fact
> that 'max_pages' is not set until some time after domain_create(). To
> avoid an allocation failure, domain_create() is modified to set
> max_pages to an initial value, sufficient to cover any domheap
> allocations required to complete domain creation. The value will be
> set to the 'real' max_pages when the tool-stack later performs the
> XEN_DOMCTL_max_mem operation, thus allowing the rest of the domain's
> memory to be allocated.
>
> - Because the domheap page is no longer a pseudo-xenheap page, the
> reference counting will prevent the domain from being destroyed. Thus
> the call to vmx_free_vlapic_mapping() is moved from the
> domain_destroy() method into the domain_relinquish_resources() method.
> Whilst in the area, make the domain_destroy() method an optional
> alternative_vcall() (since it will no longer peform any function in VMX
> and is stubbed in SVM anyway).
>
> Signed-off-by: Paul Durrant <pdurrant@amazon.com>
This is an excellent change, thank you:
Reviewed-by: George Dunlap <george.dunlap@citrix.com>
My only comment is that this would have been a bit easier to review
broken down into probably three patches: 1) making domain_destroy
optional, 2) moving vmx teardown to a relinquish_resources call 3) using
"normal" pages". But I don't think it's worth a re-send just for that.
-George
_______________________________________________
Xen-devel mailing list
Xen-devel@lists.xenproject.org
https://lists.xenproject.org/mailman/listinfo/xen-devel
next prev parent reply other threads:[~2020-01-23 14:46 UTC|newest]
Thread overview: 16+ messages / expand[flat|nested] mbox.gz Atom feed top
2020-01-23 14:03 [Xen-devel] [PATCH v3 0/3] purge free_shared_domheap_page() Paul Durrant
2020-01-23 14:03 ` [Xen-devel] [PATCH v3 1/3] x86 / vmx: make apic_access_mfn type-safe Paul Durrant
2020-01-23 15:31 ` Andrew Cooper
2020-01-23 14:03 ` [Xen-devel] [PATCH v3 2/3] x86 / hvm: add domain_relinquish_resources() method Paul Durrant
2020-01-23 15:13 ` Jan Beulich
2020-01-23 14:03 ` [Xen-devel] [PATCH v3 3/3] x86 / vmx: use a 'normal' domheap page for APIC_DEFAULT_PHYS_BASE Paul Durrant
2020-01-23 14:45 ` George Dunlap [this message]
2020-01-24 11:02 ` Durrant, Paul
2020-01-23 15:26 ` Julien Grall
2020-01-23 15:46 ` Durrant, Paul
2020-01-23 15:48 ` George Dunlap
2020-01-23 15:48 ` Julien Grall
2020-01-23 15:32 ` Jan Beulich
2020-01-23 15:41 ` George Dunlap
2020-01-23 15:56 ` Durrant, Paul
2020-01-23 16:07 ` Jan Beulich
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=dbdeec02-3a69-7262-fed6-2b280faf2b8e@citrix.com \
--to=george.dunlap@citrix.com \
--cc=George.Dunlap@eu.citrix.com \
--cc=andrew.cooper3@citrix.com \
--cc=ian.jackson@eu.citrix.com \
--cc=julien@xen.org \
--cc=jun.nakajima@intel.com \
--cc=kevin.tian@intel.com \
--cc=konrad.wilk@oracle.com \
--cc=pdurrant@amazon.com \
--cc=roger.pau@citrix.com \
--cc=sstabellini@kernel.org \
--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.