From: Ian Campbell <Ian.Campbell@citrix.com>
To: "annie.li@oracle.com" <annie.li@oracle.com>
Cc: "xen-devel@lists.xensource.com" <xen-devel@lists.xensource.com>,
"linux-kernel@vger.kernel.org" <linux-kernel@vger.kernel.org>,
"konrad.wilk@oracle.com" <konrad.wilk@oracle.com>,
"jeremy@goop.org" <jeremy@goop.org>,
"kurt.hackel@oracle.com" <kurt.hackel@oracle.com>,
Paul Durrant <Paul.Durrant@citrix.com>
Subject: Re: [Xen-devel] [PATCH 2/3] Grant tables v2 implementation.
Date: Wed, 9 Nov 2011 13:32:48 +0000 [thread overview]
Message-ID: <1320845568.955.134.camel@zakaz.uk.xensource.com> (raw)
In-Reply-To: <1320826541-29398-1-git-send-email-annie.li@oracle.com>
On Wed, 2011-11-09 at 08:15 +0000, annie.li@oracle.com wrote:
> From: Annie Li <annie.li@oracle.com>
>
> Receiver-side copying of packets is based on this implementation, it gives
> better performance and better CPU accounting. It totally supports three types:
> full-page, sub-page and transitive grants.
>
> However this patch does not cover sub-page and transitive grants, it mainly
> focus on Full-page part and implements grant table V2 interfaces corresponding
> to what already exists in grant table V1, such as: grant table V2
> initialization, mapping, releasing and exported interfaces.
>
> Each guest can only supports one type of grant table type, every entry in grant
> table should be the same version. It is necessary to set V1 or V2 version before
> initializing the grant table.
>
> Grant table exported interfaces of V2 are same with those of V1, Xen is
> responsible to judge what grant table version guests are using in every grant
> operation.
>
> V2 fulfills the same role of V1, and it is totally backwards compitable with V1.
> If dom0 support grant table V2, the guests runing on it can run with either V1
> or V2.
>
> Signed-off-by: Annie Li <annie.li@oracle.com>
> ---
> arch/x86/xen/grant-table.c | 34 ++++++++-
> drivers/xen/grant-table.c | 194 +++++++++++++++++++++++++++++++++++++++++---
> include/xen/grant_table.h | 6 +-
> 3 files changed, 220 insertions(+), 14 deletions(-)
>
> diff --git a/arch/x86/xen/grant-table.c b/arch/x86/xen/grant-table.c
> index 65ce508..3e9f936 100644
> --- a/arch/x86/xen/grant-table.c
> +++ b/arch/x86/xen/grant-table.c
> @@ -54,6 +54,17 @@ static int map_pte_fn(pte_t *pte, struct page *pmd_page,
> return 0;
> }
>
> +/*32bits is not enough since Xen supports sparse physical memory*/
What does this mean?
> +static int map_pte_fn_status(pte_t *pte, struct page *pmd_page,
> + unsigned long addr, void *data)
> +{
> + uint64_t **frames = (uint64_t **)data;
> +
> + set_pte_at(&init_mm, addr, pte, mfn_pte((*frames)[0], PAGE_KERNEL));
> + (*frames)++;
> + return 0;
> +}
Isn't this function identical to map_pte_fn?
> +
> static int unmap_pte_fn(pte_t *pte, struct page *pmd_page,
> unsigned long addr, void *data)
> {
> @@ -630,6 +756,44 @@ static int gnttab_map_status_v1(unsigned int nr_gframes)
> return 0;
> }
>
> +static int gnttab_map_status_v2(unsigned int nr_gframes)
> +{
> + uint64_t *sframes;
> + unsigned int nr_sframes;
> + struct gnttab_get_status_frames getframes;
> + int rc;
> +
> + nr_sframes = nr_status_frames(nr_gframes);
> +
> + /* No need for kzalloc as it is initialized in following hyercall
hypercall
> + * GNTTABOP_get_status_frames.
> + */
> + sframes = kmalloc(nr_sframes * sizeof(uint64_t), GFP_ATOMIC);
> + if (!sframes)
> + return -ENOMEM;
> +
> + getframes.dom = DOMID_SELF;
> + getframes.nr_frames = nr_sframes;
> + set_xen_guest_handle(getframes.frame_list, sframes);
> +
> + rc = HYPERVISOR_grant_table_op(GNTTABOP_get_status_frames,
> + &getframes, 1);
> + if (rc == -ENOSYS) {
> + kfree(sframes);
> + return -ENOSYS;
> + }
> +
> + BUG_ON(rc || getframes.status);
> +
> + rc = arch_gnttab_map_status(sframes, nr_sframes,
> + nr_status_frames(gnttab_max_grant_frames()),
> + &grstatus);
> + BUG_ON(rc);
> + kfree(sframes);
> +
> + return 0;
> +}
> +
> static int gnttab_map_status(unsigned int nr_gframes)
> {
> return gnttab_interface._gnttab_map_status(nr_gframes);
> @@ -666,6 +830,9 @@ static int gnttab_map(unsigned int start_idx, unsigned int end_idx)
> return rc;
> }
>
> + /* No need for kzalloc as it is initialized in following hyercall
"hypercall" again
Ian.
next prev parent reply other threads:[~2011-11-09 13:32 UTC|newest]
Thread overview: 16+ messages / expand[flat|nested] mbox.gz Atom feed top
2011-11-09 8:12 patches of upstreaming grant table version 2 ANNIE LI
2011-11-09 8:14 ` [PATCH 1/3] Introducing grant table V2 stucture annie.li
2011-11-09 11:11 ` Paul Durrant
2011-11-09 14:49 ` Konrad Rzeszutek Wilk
2011-11-09 14:56 ` Paul Durrant
[not found] ` <4EBAA3B1.8010401@oracle.com>
2011-11-09 16:22 ` [Xen-devel] " Ian Campbell
2011-11-10 1:56 ` ANNIE LI
[not found] ` <4EBAA566.80909@oracle.com>
2011-11-09 16:14 ` Paul Durrant
2011-11-10 1:50 ` [Xen-devel] " ANNIE LI
2011-11-09 13:28 ` [Xen-devel] " Ian Campbell
2011-11-09 8:15 ` [PATCH 2/3] Grant tables v2 implementation annie.li
2011-11-09 13:32 ` Ian Campbell [this message]
2011-11-09 8:16 ` [PATCH 3/3] code clean up annie.li
2011-11-09 11:15 ` Paul Durrant
2011-11-09 12:18 ` [Xen-devel] " Ian Campbell
2011-11-09 9:05 ` [Xen-devel] patches of upstreaming grant table version 2 ANNIE LI
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=1320845568.955.134.camel@zakaz.uk.xensource.com \
--to=ian.campbell@citrix.com \
--cc=Paul.Durrant@citrix.com \
--cc=annie.li@oracle.com \
--cc=jeremy@goop.org \
--cc=konrad.wilk@oracle.com \
--cc=kurt.hackel@oracle.com \
--cc=linux-kernel@vger.kernel.org \
--cc=xen-devel@lists.xensource.com \
/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
all inboxes | Powered by JetHome®