From: annie li <annie.li@oracle.com>
To: Ian Campbell <Ian.Campbell@citrix.com>
Cc: "jeremy@goop.org" <jeremy@goop.org>,
"xen-devel@lists.xensource.com" <xen-devel@lists.xensource.com>,
"konrad.wilk@oracle.com" <konrad.wilk@oracle.com>,
"kurt.hackel@oracle.com" <kurt.hackel@oracle.com>,
"linux-kernel@vger.kernel.org" <linux-kernel@vger.kernel.org>,
Paul Durrant <Paul.Durrant@citrix.com>
Subject: Re: [PATCH 1/3] Introducing grant table V2 stucture
Date: Thu, 10 Nov 2011 00:19:25 +0800 [thread overview]
Message-ID: <4EBAA80D.5050300@oracle.com> (raw)
In-Reply-To: <1320845283.955.131.camel@zakaz.uk.xensource.com>
[-- Attachment #1.1: Type: text/plain, Size: 4079 bytes --]
On 2011-11-9 21:28, Ian Campbell wrote:
> On Wed, 2011-11-09 at 08:14 +0000, annie.li@oracle.com wrote:
>
>> diff --git a/drivers/xen/grant-table.c b/drivers/xen/grant-table.c
>> index 4f44b34..0d481a9 100644
>> --- a/drivers/xen/grant-table.c
>> +++ b/drivers/xen/grant-table.c
>> @@ -53,7 +53,7 @@
>> /* External tools reserve first few grant table entries. */
>> #define NR_RESERVED_ENTRIES 8
>> #define GNTTAB_LIST_END 0xffffffff
>> -#define GREFS_PER_GRANT_FRAME (PAGE_SIZE / sizeof(struct grant_entry))
>> +#define GREFS_PER_GRANT_FRAME (PAGE_SIZE / sizeof(struct grant_entry_v1))
>>
>
> Does this need to become GREFS_V1_PER... or something?
>
This is common definition for both V1 and V2, and is used by both v1 and
v2 implementation. If it is changed to GREFS_V1_PER... or something with
v1 tag in this patch, it is necessary to change it back in following
"grant table v2 implementation" patch again. So I just keep it unchanged
here.
>
>> static grant_ref_t **gnttab_list;
>> static unsigned int nr_grant_frames;
>> @@ -64,7 +64,72 @@ static DEFINE_SPINLOCK(gnttab_list_lock);
>> unsigned long xen_hvm_resume_frames;
>> EXPORT_SYMBOL_GPL(xen_hvm_resume_frames);
>>
>> -static struct grant_entry *shared;
>> +static union {
>> + struct grant_entry_v1 *v1;
>> + void *ring_addr;
>> +} shared;
>> +
>> +/*
>> + * This function is null for grant table v1, adding it here in order to keep
>> + * consistent with *_v2 interface.
>> + */
>> +static int gnttab_map_status_v1(unsigned int nr_gframes);
>> +/*
>> + * This function is null for grant table v1, adding it here in order to keep
>> + * consistent with *_v2 interface.
>> + */
>> +static void gnttab_unmap_status_v1(void);
>>
>
> If you reorder the declarations of gnttab_request_version and
> gnttab_(un)map_status_v1 below then you can avoid these forward
> declarations.
>
Yes, you are right, thanks.
> Also I don't think the comment really adds much once you have the empty
> declaration underneath (like you do below). A simple "/* Nothing to do
> for v1 */" in the implementation would be sufficient.
>
I agree.
>
>> +
>> +/*This is a structure of function pointers for grant table v1*/
>>
>
> and eventually v2, right? Actually I think the v1 is unnecessary. e.g.:
> /*This is a structure of function pointers for grant table*/
>
>
Thanks, will change it.
>> +static struct {
>> + /*
>> + * Mapping a list of frames for storing grant entry status, this
>> + * mechanism can allow better synchronization using barriers. Input
>> + * parameter is frame number, returning GNTST_okay means success and
>> + * negative value means failure.
>> + */
>> + int (*_gnttab_map_status)(unsigned int);
>>
>
> I think you can drop the "_gnttab_" prefix from all of these, it'll be
> clear from the gnttab->foo what the namespace is.
>
Ok, no problem.
> [...]
>
>> +} gnttab_interface;
>> +
>> +static int grant_table_version;
>>
>> static struct gnttab_free_callback *gnttab_free_callback_list;
>>
>>
>
>
>> @@ -155,12 +229,10 @@ static void update_grant_entry(grant_ref_t ref, domid_t domid,
>> * 3. Write memory barrier (WMB).
>> * 4. Write ent->flags, inc. valid type.
>> */
>> - shared[ref].frame = frame;
>> - shared[ref].domid = domid;
>> - wmb();
>> - shared[ref].flags = flags;
>> + gnttab_interface._update_grant_entry(ref, domid, frame, flags);
>> }
>>
>> +
>>
>
> Please avoid unrelated whitespace changes.
>
Oh, it was ignored. Thanks, i will delete it.
>
>> /*
>> * Public grant-issuing interface functions
>> */
>> @@ -187,31 +259,40 @@ int gnttab_grant_foreign_access(domid_t domid, unsigned long frame,
>> }
>> EXPORT_SYMBOL_GPL(gnttab_grant_foreign_access);
>>
>> -int gnttab_query_foreign_access(grant_ref_t ref)
>> +int gnttab_query_foreign_access_v1(grant_ref_t ref)
>>
>
> This and all the other similar functions can now be made static.
>
Ok, got it, thanks.
Thanks
Annie
> Ian.
>
>
[-- Attachment #1.2: Type: text/html, Size: 5735 bytes --]
[-- Attachment #2: Type: text/plain, Size: 138 bytes --]
_______________________________________________
Xen-devel mailing list
Xen-devel@lists.xensource.com
http://lists.xensource.com/xen-devel
next prev parent reply other threads:[~2011-11-09 16:19 UTC|newest]
Thread overview: 24+ 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 11:11 ` Paul Durrant
2011-11-09 14:49 ` Konrad Rzeszutek Wilk
2011-11-09 14:56 ` Paul Durrant
2011-11-09 16:00 ` annie li
2011-11-09 16:22 ` [Xen-devel] " Ian Campbell
2011-11-10 1:56 ` ANNIE LI
2011-11-09 16:08 ` annie li
2011-11-09 16:14 ` Paul Durrant
2011-11-10 1:50 ` [Xen-devel] " ANNIE LI
2011-11-10 1:50 ` ANNIE LI
2011-11-09 13:28 ` [Xen-devel] " Ian Campbell
2011-11-09 16:19 ` annie li [this message]
2011-11-09 8:15 ` [PATCH 2/3] Grant tables v2 implementation annie.li
2011-11-09 13:32 ` [Xen-devel] " Ian Campbell
2011-11-09 16:30 ` annie li
2011-11-09 8:16 ` [PATCH 3/3] code clean up annie.li
2011-11-09 11:15 ` Paul Durrant
2011-11-09 11:15 ` Paul Durrant
2011-11-09 12:18 ` [Xen-devel] " Ian Campbell
2011-11-09 16:10 ` annie li
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=4EBAA80D.5050300@oracle.com \
--to=annie.li@oracle.com \
--cc=Ian.Campbell@citrix.com \
--cc=Paul.Durrant@citrix.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 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.