From: Ankur Arora <ankur.a.arora@oracle.com>
To: Juergen Gross <jgross@suse.com>,
linux-kernel@vger.kernel.org, xen-devel@lists.xenproject.org
Cc: pbonzini@redhat.com, boris.ostrovsky@oracle.com,
sstabellini@kernel.org, joao.m.martins@oracle.com,
konrad.wilk@oracle.com
Subject: Re: [Xen-devel] [RFC PATCH 10/16] xen/balloon: support ballooning in xenhost_t
Date: Tue, 18 Jun 2019 19:24:59 -0700 [thread overview]
Message-ID: <aa050a5f-1897-64c0-d19d-d0f31b8d6c62@oracle.com> (raw)
In-Reply-To: <c67f2fd9-c837-bc13-492f-f3bed7f01f05@suse.com>
On 6/17/19 2:28 AM, Juergen Gross wrote:
> On 09.05.19 19:25, Ankur Arora wrote:
>> Xen ballooning uses hollow struct pages (with the underlying GFNs being
>> populated/unpopulated via hypercalls) which are used by the grant logic
>> to map grants from other domains.
>>
>> This patch allows the default xenhost to provide an alternate ballooning
>> allocation mechanism. This is expected to be useful for local xenhosts
>> (type xenhost_r0) because unlike Xen, where there is an external
>> hypervisor which can change the memory underneath a GFN, that is not
>> possible when the hypervisor is running in the same address space
>> as the entity doing the ballooning.
>>
>> Co-developed-by: Ankur Arora <ankur.a.arora@oracle.com>
>> Signed-off-by: Joao Martins <joao.m.martins@oracle.com>
>> Signed-off-by: Ankur Arora <ankur.a.arora@oracle.com>
>> ---
>> arch/x86/xen/enlighten_hvm.c | 7 +++++++
>> arch/x86/xen/enlighten_pv.c | 8 ++++++++
>> drivers/xen/balloon.c | 19 ++++++++++++++++---
>> drivers/xen/grant-table.c | 4 ++--
>> drivers/xen/privcmd.c | 4 ++--
>> drivers/xen/xen-selfballoon.c | 2 ++
>> drivers/xen/xenbus/xenbus_client.c | 6 +++---
>> drivers/xen/xlate_mmu.c | 4 ++--
>> include/xen/balloon.h | 4 ++--
>> include/xen/xenhost.h | 19 +++++++++++++++++++
>> 10 files changed, 63 insertions(+), 14 deletions(-)
>>
>> diff --git a/drivers/xen/balloon.c b/drivers/xen/balloon.c
>> index 5ef4d6ad920d..08becf574743 100644
>> --- a/drivers/xen/balloon.c
>> +++ b/drivers/xen/balloon.c
>> @@ -63,6 +63,7 @@
>> #include <asm/tlb.h>
>> #include <xen/interface/xen.h>
>> +#include <xen/xenhost.h>
>> #include <asm/xen/hypervisor.h>
>> #include <asm/xen/hypercall.h>
>> @@ -583,12 +584,21 @@ static int add_ballooned_pages(int nr_pages)
>> * @pages: pages returned
>> * @return 0 on success, error otherwise
>> */
>> -int alloc_xenballooned_pages(int nr_pages, struct page **pages)
>> +int alloc_xenballooned_pages(xenhost_t *xh, int nr_pages, struct page
>> **pages)
>> {
>> int pgno = 0;
>> struct page *page;
>> int ret;
>> + /*
>> + * xenmem transactions for remote xenhost are disallowed.
>> + */
>> + if (xh->type == xenhost_r2)
>> + return -EINVAL;
>
> Why don't you set a dummy function returning -EINVAL into the xenhost_r2
> structure instead?
Will do. And, same for the two comments below.
Ankur
>
>> +
>> + if (xh->ops->alloc_ballooned_pages)
>> + return xh->ops->alloc_ballooned_pages(xh, nr_pages, pages);
>> +
>
> Please make alloc_xenballooned_pages() an inline wrapper and use the
> current implmentaion as the default. This avoids another if ().
>
>> mutex_lock(&balloon_mutex);
>> balloon_stats.target_unpopulated += nr_pages;
>> @@ -620,7 +630,7 @@ int alloc_xenballooned_pages(int nr_pages, struct
>> page **pages)
>> return 0;
>> out_undo:
>> mutex_unlock(&balloon_mutex);
>> - free_xenballooned_pages(pgno, pages);
>> + free_xenballooned_pages(xh, pgno, pages);
>> return ret;
>> }
>> EXPORT_SYMBOL(alloc_xenballooned_pages);
>> @@ -630,10 +640,13 @@ EXPORT_SYMBOL(alloc_xenballooned_pages);
>> * @nr_pages: Number of pages
>> * @pages: pages to return
>> */
>> -void free_xenballooned_pages(int nr_pages, struct page **pages)
>> +void free_xenballooned_pages(xenhost_t *xh, int nr_pages, struct page
>> **pages)
>> {
>> int i;
>> + if (xh->ops->free_ballooned_pages)
>> + return xh->ops->free_ballooned_pages(xh, nr_pages, pages);
>> +
>
> Same again: please use an inline wrapper.
>
>
> Juergen
_______________________________________________
Xen-devel mailing list
Xen-devel@lists.xenproject.org
https://lists.xenproject.org/mailman/listinfo/xen-devel
next prev parent reply other threads:[~2019-06-19 2:25 UTC|newest]
Thread overview: 66+ messages / expand[flat|nested] mbox.gz Atom feed top
2019-05-09 17:25 [Xen-devel] [RFC PATCH 00/16] xenhost support Ankur Arora
2019-05-09 17:25 ` [Xen-devel] [RFC PATCH 01/16] x86/xen: add xenhost_t interface Ankur Arora
2019-06-07 15:04 ` Juergen Gross
2019-06-11 7:16 ` Ankur Arora
2019-06-14 11:52 ` Juergen Gross
2019-05-09 17:25 ` Ankur Arora
2019-05-09 17:25 ` [RFC PATCH 02/16] x86/xen: cpuid support in xenhost_t Ankur Arora
2019-05-09 17:25 ` [Xen-devel] " Ankur Arora
2019-06-12 21:09 ` Andrew Cooper
2019-05-09 17:25 ` [Xen-devel] [RFC PATCH 03/16] x86/xen: make hypercall_page generic Ankur Arora
2019-05-09 17:25 ` Ankur Arora
2019-05-09 17:25 ` [RFC PATCH 04/16] x86/xen: hypercall support for xenhost_t Ankur Arora
2019-05-09 17:25 ` [Xen-devel] " Ankur Arora
2019-06-12 21:15 ` Andrew Cooper
2019-06-14 7:20 ` Ankur Arora
2019-06-14 7:35 ` Juergen Gross
2019-06-14 8:00 ` Andrew Cooper
2019-05-09 17:25 ` [RFC PATCH 05/16] x86/xen: add feature support in xenhost_t Ankur Arora
2019-05-09 17:25 ` [Xen-devel] " Ankur Arora
2019-05-09 17:25 ` [Xen-devel] [RFC PATCH 06/16] x86/xen: add shared_info support to xenhost_t Ankur Arora
2019-06-07 15:08 ` Juergen Gross
2019-06-08 5:01 ` Ankur Arora
2019-05-09 17:25 ` Ankur Arora
2019-05-09 17:25 ` [RFC PATCH 07/16] x86/xen: make vcpu_info part of xenhost_t Ankur Arora
2019-05-09 17:25 ` [Xen-devel] " Ankur Arora
2019-06-14 11:53 ` Juergen Gross
2019-06-17 6:28 ` Ankur Arora
2019-05-09 17:25 ` [RFC PATCH 08/16] x86/xen: irq/upcall handling with multiple xenhosts Ankur Arora
2019-05-09 17:25 ` [Xen-devel] " Ankur Arora
2019-06-14 12:01 ` Juergen Gross
2019-05-09 17:25 ` [RFC PATCH 09/16] xen/evtchn: support evtchn in xenhost_t Ankur Arora
2019-05-09 17:25 ` [Xen-devel] " Ankur Arora
2019-06-14 12:04 ` Juergen Gross
2019-06-17 6:09 ` Ankur Arora
2019-05-09 17:25 ` [RFC PATCH 10/16] xen/balloon: support ballooning " Ankur Arora
2019-05-09 17:25 ` [Xen-devel] " Ankur Arora
2019-06-17 9:28 ` Juergen Gross
2019-06-19 2:24 ` Ankur Arora [this message]
2019-05-09 17:25 ` [RFC PATCH 11/16] xen/grant-table: make grant-table xenhost aware Ankur Arora
2019-05-09 17:25 ` [Xen-devel] " Ankur Arora
2019-06-17 9:36 ` Juergen Gross
2019-06-19 2:25 ` Ankur Arora
2019-05-09 17:25 ` [RFC PATCH 12/16] xen/xenbus: support xenbus frontend/backend with xenhost_t Ankur Arora
2019-05-09 17:25 ` [Xen-devel] " Ankur Arora
2019-06-17 9:50 ` Juergen Gross
2019-06-19 2:38 ` Ankur Arora
2019-05-09 17:25 ` [Xen-devel] [RFC PATCH 13/16] drivers/xen: gnttab, evtchn, xenbus API changes Ankur Arora
2019-06-17 10:07 ` Juergen Gross
2019-06-19 2:55 ` Ankur Arora
2019-05-09 17:25 ` Ankur Arora
2019-05-09 17:25 ` [Xen-devel] [RFC PATCH 14/16] xen/blk: " Ankur Arora
2019-06-17 10:14 ` Juergen Gross
2019-06-19 2:59 ` Ankur Arora
2019-05-09 17:25 ` Ankur Arora
2019-05-09 17:25 ` [RFC PATCH 15/16] xen/net: " Ankur Arora
2019-05-09 17:25 ` [Xen-devel] " Ankur Arora
2019-06-17 10:14 ` Juergen Gross
2019-05-09 17:25 ` [Xen-devel] [RFC PATCH 16/16] xen/grant-table: host_addr fixup in mapping on xenhost_r0 Ankur Arora
2019-06-17 10:55 ` Juergen Gross
2019-06-19 3:02 ` Ankur Arora
2019-05-09 17:25 ` Ankur Arora
2019-06-07 14:51 ` [Xen-devel] [RFC PATCH 00/16] xenhost support Juergen Gross
2019-06-07 15:22 ` Joao Martins
2019-06-07 16:21 ` Juergen Gross
2019-06-08 5:50 ` Ankur Arora
2019-06-08 5:33 ` Ankur Arora
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=aa050a5f-1897-64c0-d19d-d0f31b8d6c62@oracle.com \
--to=ankur.a.arora@oracle.com \
--cc=boris.ostrovsky@oracle.com \
--cc=jgross@suse.com \
--cc=joao.m.martins@oracle.com \
--cc=konrad.wilk@oracle.com \
--cc=linux-kernel@vger.kernel.org \
--cc=pbonzini@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).