From: Joao Martins <joao.m.martins@oracle.com>
To: kvm@vger.kernel.org, linux-kernel@vger.kernel.org,
xen-devel@lists.xenproject.org
Cc: "Juergen Gross" <jgross@suse.com>,
"Stefano Stabellini" <sstabellini@kernel.org>,
"Radim Krčmář" <rkrcmar@redhat.com>,
"Ankur Arora" <ankur.a.arora@oracle.com>,
"Paolo Bonzini" <pbonzini@redhat.com>,
"Boris Ostrovsky" <boris.ostrovsky@oracle.com>,
"Joao Martins" <joao.m.martins@oracle.com>
Subject: [PATCH RFC 33/39] xen/grant-table: xen_shim_domain() support
Date: Wed, 20 Feb 2019 20:16:03 +0000 [thread overview]
Message-ID: <20190220201609.28290-34-joao.m.martins@oracle.com> (raw)
In-Reply-To: <20190220201609.28290-1-joao.m.martins@oracle.com>
With xen-shim, allocate_xenballooned_pages() only allocates a
place-holder page (pfn 0) expecting a subsequent map_grant_ref to fix
it up.
However, this means that, until the grant operation
(GNTTABOP_map_grant_ref) provides a valid page, we cannot set
PagePrivate or save any state.
This patch elides the setting of that state if xen_shim_domain(). In
addition, gnttab_map_refs() now fills in the appropriate page returned
from the grant operation.
Signed-off-by: Joao Martins <joao.m.martins@oracle.com>
---
drivers/xen/grant-table.c | 15 +++++++++++----
1 file changed, 11 insertions(+), 4 deletions(-)
diff --git a/drivers/xen/grant-table.c b/drivers/xen/grant-table.c
index 7ea6fb6a2e5d..ab05b70d98bb 100644
--- a/drivers/xen/grant-table.c
+++ b/drivers/xen/grant-table.c
@@ -804,7 +804,7 @@ int gnttab_alloc_pages(int nr_pages, struct page **pages)
int ret;
ret = alloc_xenballooned_pages(nr_pages, pages);
- if (ret < 0)
+ if (ret < 0 || xen_shim_domain())
return ret;
ret = gnttab_pages_set_private(nr_pages, pages);
@@ -1045,6 +1045,11 @@ int gnttab_map_refs(struct gnttab_map_grant_ref *map_ops,
{
struct xen_page_foreign *foreign;
+ if (xen_shim_domain()) {
+ pages[i] = virt_to_page(map_ops[i].host_addr);
+ continue;
+ }
+
SetPageForeign(pages[i]);
foreign = xen_page_foreign(pages[i]);
foreign->domid = map_ops[i].dom;
@@ -1085,8 +1090,10 @@ int gnttab_unmap_refs(struct gnttab_unmap_grant_ref *unmap_ops,
if (ret)
return ret;
- for (i = 0; i < count; i++)
- ClearPageForeign(pages[i]);
+ for (i = 0; i < count; i++) {
+ if (!xen_shim_domain())
+ ClearPageForeign(pages[i]);
+ }
return clear_foreign_p2m_mapping(unmap_ops, kunmap_ops, pages, count);
}
@@ -1113,7 +1120,7 @@ static void __gnttab_unmap_refs_async(struct gntab_unmap_queue_data* item)
int pc;
for (pc = 0; pc < item->count; pc++) {
- if (page_count(item->pages[pc]) > 1) {
+ if (page_count(item->pages[pc]) > 1 && !xen_shim_domain()) {
unsigned long delay = GNTTAB_UNMAP_REFS_DELAY * (item->age + 1);
schedule_delayed_work(&item->gnttab_work,
msecs_to_jiffies(delay));
--
2.11.0
_______________________________________________
Xen-devel mailing list
Xen-devel@lists.xenproject.org
https://lists.xenproject.org/mailman/listinfo/xen-devel
next prev parent reply other threads:[~2019-02-20 20:18 UTC|newest]
Thread overview: 43+ messages / expand[flat|nested] mbox.gz Atom feed top
[not found] <20190220201609.28290-1-joao.m.martins@oracle.com>
2019-02-20 20:15 ` [PATCH RFC 17/39] x86/xen: export vcpu_info and shared_info Joao Martins
2019-02-20 20:15 ` [PATCH RFC 18/39] x86/xen: make hypercall_page generic Joao Martins
2019-02-20 20:15 ` [PATCH RFC 19/39] xen/xenbus: xenbus uninit support Joao Martins
2019-02-20 20:15 ` [PATCH RFC 20/39] xen-blkback: module_exit support Joao Martins
2019-02-20 20:16 ` [PATCH RFC 31/39] xen-shim: introduce shim domain driver Joao Martins
2019-02-20 20:16 ` [PATCH RFC 32/39] xen/balloon: xen_shim_domain() support Joao Martins
2019-02-20 20:16 ` Joao Martins [this message]
2019-02-20 20:16 ` [PATCH RFC 34/39] xen/gntdev: " Joao Martins
2019-02-20 20:16 ` [PATCH RFC 35/39] xen/xenbus: " Joao Martins
2019-02-20 20:16 ` [PATCH RFC 36/39] drivers/xen: " Joao Martins
2019-02-20 20:16 ` [PATCH RFC 38/39] xen-blkback: " Joao Martins
2019-02-20 21:09 ` [PATCH RFC 00/39] x86/KVM: Xen HVM guest support Paolo Bonzini
2019-02-20 23:39 ` Marek Marczykowski-Górecki
[not found] ` <35051310-c497-8ad5-4434-1b8426a317d2@redhat.com>
2019-02-21 0:29 ` Ankur Arora
2019-02-21 11:45 ` Joao Martins
[not found] ` <8b1f4912-4f92-69ae-ae01-d899d5640572@oracle.com>
2019-02-22 16:59 ` Paolo Bonzini
[not found] ` <3ee91f33-2973-c2db-386f-afbf138081b4@redhat.com>
2019-03-12 17:14 ` Joao Martins
2019-04-08 6:44 ` [Xen-devel] " Juergen Gross
2019-04-08 10:36 ` Joao Martins
2019-04-08 10:36 ` [Xen-devel] " Joao Martins
2019-04-08 10:42 ` Juergen Gross
2019-04-08 17:31 ` Joao Martins
2019-04-09 0:35 ` Stefano Stabellini
2019-04-09 0:35 ` [Xen-devel] " Stefano Stabellini
2019-04-10 5:50 ` Ankur Arora
2019-04-10 20:45 ` Stefano Stabellini
2019-04-10 20:45 ` Stefano Stabellini
2019-04-10 5:50 ` Ankur Arora
2019-04-09 5:04 ` [Xen-devel] " Juergen Gross
2019-04-10 6:55 ` Ankur Arora
2019-04-10 7:14 ` Juergen Gross
2019-04-10 7:14 ` Juergen Gross
2019-04-10 6:55 ` Ankur Arora
2019-04-09 5:04 ` Juergen Gross
2019-04-08 17:31 ` Joao Martins
2019-04-08 10:42 ` Juergen Gross
2019-04-08 6:44 ` Juergen Gross
[not found] ` <20190220233941.GA5279@mail-itl>
2019-02-21 0:31 ` Ankur Arora
2019-02-21 7:57 ` Juergen Gross
2019-02-21 11:55 ` Joao Martins
[not found] ` <58ff93e1-6c91-c1a6-4273-531c28101569@suse.com>
2019-02-21 12:00 ` Joao Martins
[not found] ` <20190220201609.28290-21-joao.m.martins@oracle.com>
2019-02-25 18:57 ` [PATCH RFC 20/39] xen-blkback: module_exit support Konrad Rzeszutek Wilk
[not found] ` <20190225185719.GA16013@char.us.oracle.com>
2019-02-26 11:20 ` Joao Martins
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=20190220201609.28290-34-joao.m.martins@oracle.com \
--to=joao.m.martins@oracle.com \
--cc=ankur.a.arora@oracle.com \
--cc=boris.ostrovsky@oracle.com \
--cc=jgross@suse.com \
--cc=kvm@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=pbonzini@redhat.com \
--cc=rkrcmar@redhat.com \
--cc=sstabellini@kernel.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 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).