Skip to contentSkip to conversation

patches of upstreaming grant table version 2

PATCH In review ANNIE LI 4 participants 21 messages Nov 9, 2011 – Nov 10, 2011

Subsystems (3)
lore
Share & tools
lore

ANNIE LI

author
#0 lore raw

Hi

The following patches introduce and implement grant table version 2, and they are based on v3.1.0-rc9+.

Descriptions for those patches:

1. In those patches, the grant table code supports both grant table v1 and v2 version, v2 is an extension from v1. Grant table of guest domain can be either v1 or v2 version, and every grant table entry on one guest should be the same version.

2. Full page structure of grant table v2 play the same role as grant table v1. Although full page structure is different from v1, grant table 2 is totally backwards compatible with v1. Grant table is shared between guest and Xen, domu and dom0 all have their own grant table shared with Xen, and their grant table version should be set before any grants are activated. When domu grants an entry to dom0 to map a frame, following are steps:
* domu introduces a grant entry by reference
* domu informs dom0 the gref
* dom0 sends hypercall to map frame through this reference, Xen copy shared entry to active entry and update frame
* dom0 does its work and release the frame, Xen releases the entry.
* domu redo those steps for a new cycle.

Xen mapping process can be found in function __gnttab_map_grant_ref in link: http://xenbits.xen.org/hg/xen-4.1-testing.hg/file/81e39a4978ea/xen/common/grant_table.c#l2172

3. If dom0 supports grant table v2, guests run on it can either supports v1 or v2. Xen is responsible to judge what version the guests are using. This is implemented in link: http://xenbits.xen.org/hg/xen-4.1-testing.hg/file/81e39a4978ea/xen/common/grant_table.c#l2172. Key word is: rd->grant_table->gt_version.

4. Grant table2 is a precondition to netchannel2 mechanism. Netchannel2 imports a new device type: vif2. To support this type, we need new netback2, netfront2 driver and modification in Xen. If all are ready, two types of vif can be supported: vif and vif2. vif is for original backend and frontend, vif2 is for netback2 and netfront2.

Thanks
Annie

#1 lore raw

PATCH 1/3 Introducing grant table V2 stucture

From: Annie Li <[email protected]>

This patch introduces new structures of grant table V2, grant table V2 is an extension from V1. Grant table is shared between guest and Xen, and Xen is responsible to do corresponding work for grant operations, such as: figure out guest's grant table version, perform different actions based on different grant table version, etc. Although full-page structure of V2 is different from V1, it play the same role as V1.

This patch also changes existing grant table V1 interfaces into **_V1 style in order to keep consistence with **_V2 interfaces.

---
 arch/x86/xen/grant-table.c          |    7 +-
 drivers/xen/grant-table.c           |  181 ++++++++++++++++++++++++++++++-----
 include/xen/grant_table.h           |    4 +-
 include/xen/interface/grant_table.h |  167 +++++++++++++++++++++++++++++++-
 include/xen/interface/xen.h         |    2 +
 5 files changed, 326 insertions(+), 35 deletions(-)
arch/x86/xen/grant-table.c +3 -4
index 49ba9b5..65ce508 100644
@@ -64,10 +64,10 @@ static int unmap_pte_fn(pte_t *pte, struct page *pmd_page,
 
 int arch_gnttab_map_shared(unsigned long *frames, unsigned long nr_gframes,
 			   unsigned long max_nr_gframes,
-			   struct grant_entry **__shared)
+			   void **__shared)
 {
 	int rc;
-	struct grant_entry *shared = *__shared;
+	void *shared = *__shared;
 
 	if (shared == NULL) {
 		struct vm_struct *area =
@@ -83,8 +83,7 @@ int arch_gnttab_map_shared(unsigned long *frames, unsigned long nr_gframes,
 	return rc;
 }
 
-void arch_gnttab_unmap_shared(struct grant_entry *shared,
-			      unsigned long nr_gframes)
+void arch_gnttab_unmap_shared(void *shared, unsigned long nr_gframes)
 {
 	apply_to_page_range(&init_mm, (unsigned long)shared,
 			    PAGE_SIZE * nr_gframes, unmap_pte_fn, NULL);
drivers/xen/grant-table.c +157 -24

291 lines not on this page · raw message

include/xen/grant_table.h +2 -2
index b1fab6b..405879d 100644
@@ -146,8 +146,8 @@ gnttab_set_unmap_op(struct gnttab_unmap_grant_ref *unmap, phys_addr_t addr,
 
 int arch_gnttab_map_shared(unsigned long *frames, unsigned long nr_gframes,
 			   unsigned long max_nr_gframes,
-			   struct grant_entry **__shared);
-void arch_gnttab_unmap_shared(struct grant_entry *shared,
+			   void **__shared);
+void arch_gnttab_unmap_shared(void *shared,
 			      unsigned long nr_gframes);
 
 extern unsigned long xen_hvm_resume_frames;
include/xen/interface/grant_table.h +162 -5

217 lines not on this page · raw message

include/xen/interface/xen.h +2 -0
index 6acd9ce..9353bdf 100644
@@ -522,6 +522,8 @@ struct tmem_op {
 	} u;
 };
 
+DEFINE_GUEST_HANDLE(uint64_t);
+
 #else /* __ASSEMBLY__ */
 
 /* In assembly code we cannot use C numeric constant suffixes. */
Signature · 1 line
1.7.6
#2 lore raw

RE: [PATCH 1/3] Introducing grant table V2 stucture

Annie,

Comments inline below...

Quoted 1 line

-----Original Message-----

[snip]

drivers/xen/grant-table.c static DEFINE_SPINLOCK(gnttab_list_lock); · line 71

Quoted 6 lines
drivers/xen/grant-table.c +5 -1
-static struct grant_entry *shared;
+static union {
+	struct grant_entry_v1 *v1;
+	void *ring_addr;
+} shared;
+

'ring_addr' seems like the wrong name here; how about 'raw'?

Quoted 10 lines

+/*
+ * This function is null for grant table v1, adding it here in order to

drivers/xen/grant-table.c +6 -0
+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

drivers/xen/grant-table.c static DEFINE_SPINLOCK(gnttab_list_lock); · line 82

Quoted 5 lines
drivers/xen/grant-table.c +5 -0
+keep
+ * consistent with *_v2 interface.
+ */
+static void gnttab_unmap_status_v1(void);
+

I don't really like the idea of having null operations. How about abstracting at the level of gnttab_map/unmap so that you can include the status mapping for v2 but just do the arch_gnttab_map_shared for v1?

Quoted 66 lines

+/*This is a structure of function pointers for grant table v1*/ static

include/xen/interface/grant_table.h +3 -0
+struct {
+	/*
+	 * Mapping a list of frames for storing grant entry status,

this

(quoted diff) +1 -0
+	 * mechanism can allow better synchronization using barriers.

Input

(quoted diff) +1 -0
+	 * parameter is frame number, returning GNTST_okay means

success and

drivers/xen/grant-table.c +5 -0
+	 * negative value means failure.
+	 */
+	int (*_gnttab_map_status)(unsigned int);
+	/*
+	 * Release a list of frames which are mapped in

_gnttab_map_status for

drivers/xen/grant-table.c +5 -0
+	 * grant entry status.
+	 */
+	void (*_gnttab_unmap_status)(void);
+	/*
+	 * Introducing a valid entry into the grant table, granting

the frame

(quoted diff) +1 -0
+	 * of this grant entry to domain for accessing, or

transfering, or

(quoted diff) +1 -0
+	 * transitively accessing. First input parameter is reference

of this

(quoted diff) +1 -0
+	 * introduced grant entry, second one is domid of granted

domain, third

(quoted diff) +1 -0
+	 * one is the frame to be granted, and the last one is status

of the

drivers/xen/grant-table.c +6 -0
+	 * grant entry to be updated.
+	 */
+	void (*_update_grant_entry)(grant_ref_t, domid_t,
+		unsigned long, unsigned);
+	/*
+	 * Stop granting a grant entry to domain for accessing. First

input

(quoted diff) +1 -0
+	 * parameter is reference of a grant entry whose grant access

will be

(quoted diff) +1 -0
+	 * stopped, second one is not in use now. If the grant entry

is

(quoted diff) +1 -0
+	 * currently mapped for reading or writing, just return

failure(==0)

(quoted diff) +1 -0
+	 * directly and don't tear down the grant access. Otherwise,

stop grant

drivers/xen/grant-table.c +5 -0
+	 * access for this entry and return success(==1).
+	 */
+	int (*_gnttab_end_foreign_access_ref)(grant_ref_t, int);
+	/*
+	 * Stop granting a grant entry to domain for transfer. If

tranfer has

(quoted diff) +1 -0
+	 * not started, just reclaim the grant entry and return

failure(==0).

(quoted diff) +1 -0
+	 * Otherwise, wait for the transfer to complete and then

return the

drivers/xen/grant-table.c +3 -0
+	 * frame.
+	 */
+	unsigned long

(*_gnttab_end_foreign_transfer_ref)(grant_ref_t);

(quoted diff) +2 -0
+	/*
+	 * Query the status of a grant entry. Input parameter is

reference of

(quoted diff) +1 -0
+	 * queried grant entry, return value is the status of queried

entry.

(quoted diff) +1 -0
+	 * Detailed status(writing/reading) can be gotten from the

return value

drivers/xen/grant-table.c static DEFINE_SPINLOCK(gnttab_list_lock); · line 131

Quoted 5 lines
drivers/xen/grant-table.c +5 -0
+	 * by bit operations.
+	 */
+	int (*_gnttab_query_foreign_access)(grant_ref_t);
+} gnttab_interface;
+

Why the leading '_' in the names?

Quoted 18 lines
drivers/xen/grant-table.c +9 -0
+static int grant_table_version;
 
 static struct gnttab_free_callback *gnttab_free_callback_list;
@@ -142,6 +207,15 @@ static void put_free_entry(grant_ref_t ref)
 	spin_unlock_irqrestore(&gnttab_list_lock, flags);  }
 
+static void update_grant_entry_v1(grant_ref_t ref, domid_t domid,
+				  unsigned long frame, unsigned flags) {
+	shared.v1[ref].frame = frame;
+	shared.v1[ref].domid = domid;
+	wmb();
+	shared.v1[ref].flags = flags;
+}
+
 static void update_grant_entry(grant_ref_t ref, domid_t domid,
 			       unsigned long frame, unsigned flags)  {

drivers/xen/grant-table.c static void update_grant_entry(grant_ref_t · line 232

Quoted 4 lines
drivers/xen/grant-table.c +0 -0
@@ -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.
 	 */

The comment above probably should be moved into the v1 function itself since the v2 code differs.

drivers/xen/grant-table.c static void update_grant_entry(grant_ref_t ref, domid_t domid, · line 233

Quoted 7 lines
drivers/xen/grant-table.c +1 -4
-	shared[ref].frame = frame;
-	shared[ref].domid = domid;
-	wmb();
-	shared[ref].flags = flags;
+	gnttab_interface._update_grant_entry(ref, domid, frame,
 flags);
 }

[snip]

Paul

#3 lore raw

Re: [PATCH 1/3] Introducing grant table V2 stucture

Quoted 6 lines · Paul Durrant

Annie,

Comments inline below...

Quoted 1 line

-----Original Message-----

[snip]

Quoted 8 lines

drivers/xen/grant-table.c static DEFINE_SPINLOCK(gnttab_list_lock); · line 71

Quoted 6 lines
drivers/xen/grant-table.c +5 -1
-static struct grant_entry *shared;
+static union {
+	struct grant_entry_v1 *v1;
+	void *ring_addr;
+} shared;
+

'ring_addr' seems like the wrong name here; how about 'raw'?

Or 'ring'. I asked Annie to change it from 'raw' to something else and the first thing that came in my mind was 'ring_addr'. But this does not point to a ring, so the 'ring' part is wrong.

Point here is to make it descriptive. 'raw' does not carry meaning of _what_ it is suppose to do.

#4 lore raw

RE: [PATCH 1/3] Introducing grant table V2 stucture

I'd be happy with 'addr' or 'opaque' or somesuch if 'raw' is distasteful.

Paul

Quoted 30 lines

-----Original Message-----
From: Konrad Rzeszutek Wilk [mailto:[email protected]]
Sent: 09 November 2011 14:49
To: Paul Durrant
Cc: [email protected]; [email protected]; linux- [email protected]; [email protected]; [email protected]
Subject: Re: [PATCH 1/3] Introducing grant table V2 stucture

Quoted 6 lines · Paul Durrant

Annie,

Comments inline below...

Quoted 1 line

-----Original Message-----

[snip]

Quoted 8 lines

drivers/xen/grant-table.c static DEFINE_SPINLOCK(gnttab_list_lock); · line 71

Quoted 6 lines
drivers/xen/grant-table.c +5 -1
-static struct grant_entry *shared;
+static union {
+	struct grant_entry_v1 *v1;
+	void *ring_addr;
+} shared;
+

'ring_addr' seems like the wrong name here; how about 'raw'?

Or 'ring'. I asked Annie to change it from 'raw' to something else and the first thing that came in my mind was 'ring_addr'. But this does not point to a ring, so the 'ring' part is wrong.

Point here is to make it descriptive. 'raw' does not carry meaning of _what_ it is suppose to do.

author
#5 lore raw

Re: RE: [PATCH 1/3] Introducing grant table V2 stucture

Maybe addr or gnttab_addr?

Thanks
Annie

Quoted 37 lines · Paul Durrant

I'd be happy with 'addr' or 'opaque' or somesuch if 'raw' is distasteful.

Paul

Quoted 32 lines

-----Original Message-----
From: Konrad Rzeszutek Wilk [mailto:[email protected]]
Sent: 09 November 2011 14:49
To: Paul Durrant
Cc: [email protected]; [email protected]; linux- [email protected]; [email protected]; [email protected]
Subject: Re: [PATCH 1/3] Introducing grant table V2 stucture

Quoted 9 lines · Paul Durrant

Annie,

Comments inline below...

Quoted 2 lines

-----Original Message-----

[snip]

Quoted 9 lines

drivers/xen/grant-table.c static DEFINE_SPINLOCK(gnttab_list_lock); · line 71

Quoted 7 lines
drivers/xen/grant-table.c +5 -1
-static struct grant_entry *shared;
+static union {
+	struct grant_entry_v1 *v1;
+	void *ring_addr;
+} shared;
+

'ring_addr' seems like the wrong name here; how about 'raw'?

Or 'ring'. I asked Annie to change it from 'raw' to something else and the first thing that came in my mind was 'ring_addr'. But this does not point to a ring, so the 'ring' part is wrong.

Quoted 9 lines
Quoted 3 lines

Point here is to make it descriptive. 'raw' does not carry meaning of _what_ it is suppose to do.

_______________________________________________
Xen-devel mailing list
[email protected]
http://lists.xensource.com/xen-devel

_______________________________________________
Xen-devel mailing list
[email protected]
http://lists.xensource.com/xen-devel

#6 lore raw

Re: [Xen-devel] RE: [PATCH 1/3] Introducing grant table V2 stucture

Quoted 1 line · annie li

Maybe addr or gnttab_addr?

IMHO the gnttab_ bit belongs in either (or both) the struct name or the variable names referencing the struct, rather than the fields themselves. It should be obvious from the context that this member is something to do with gnttab. e.g. I think gnttab_shared->addr would be fine, as would shared->addr in the context of gnttab.c etc.

Ian.

author
#7 lore raw

Re: [Xen-devel] RE: [PATCH 1/3] Introducing grant table V2 stucture

Quoted 5 lines · Ian Campbell

IMHO the gnttab_ bit belongs in either (or both) the struct name or the variable names referencing the struct, rather than the fields themselves. It should be obvious from the context that this member is something to do with gnttab. e.g. I think gnttab_shared->addr would be fine, as would shared->addr in the context of gnttab.c etc.

Right.
Thanks you all for the review, I will improve patches based on those suggestions and resend them.

Thanks
Annie

author
#8 lore raw

Re: [PATCH 1/3] Introducing grant table V2 stucture

In reply to Paul Durrant

Thanks, Paul. See following,

Quoted 12 lines · Paul Durrant
Quoted 12 lines

+/*
+ * This function is null for grant table v1, adding it here in order to

drivers/xen/grant-table.c +6 -0
+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

Quoted 9 lines

drivers/xen/grant-table.c static DEFINE_SPINLOCK(gnttab_list_lock); · line 82

Quoted 6 lines
drivers/xen/grant-table.c +5 -0
+keep
+ * consistent with *_v2 interface.
+ */
+static void gnttab_unmap_status_v1(void);
+

I don't really like the idea of having null operations. How about abstracting at the level of gnttab_map/unmap so that you can include the status mapping for v2 but just do the arch_gnttab_map_shared for v1?

I see. v2 function includes mapping and arch_gnttab_map_shared, v1 function only include arch_gnttab_map_sh, right? This will lead to some code duplicated in two functions.

Quoted 67 lines
Quoted 67 lines

+/*This is a structure of function pointers for grant table v1*/ static

include/xen/interface/grant_table.h +3 -0
+struct {
+	/*
+	 * Mapping a list of frames for storing grant entry status,

this

(quoted diff) +1 -0
+	 * mechanism can allow better synchronization using barriers.

Input

(quoted diff) +1 -0
+	 * parameter is frame number, returning GNTST_okay means

success and

drivers/xen/grant-table.c +5 -0
+	 * negative value means failure.
+	 */
+	int (*_gnttab_map_status)(unsigned int);
+	/*
+	 * Release a list of frames which are mapped in

_gnttab_map_status for

drivers/xen/grant-table.c +5 -0
+	 * grant entry status.
+	 */
+	void (*_gnttab_unmap_status)(void);
+	/*
+	 * Introducing a valid entry into the grant table, granting

the frame

(quoted diff) +1 -0
+	 * of this grant entry to domain for accessing, or

transfering, or

(quoted diff) +1 -0
+	 * transitively accessing. First input parameter is reference

of this

(quoted diff) +1 -0
+	 * introduced grant entry, second one is domid of granted

domain, third

(quoted diff) +1 -0
+	 * one is the frame to be granted, and the last one is status

of the

drivers/xen/grant-table.c +6 -0
+	 * grant entry to be updated.
+	 */
+	void (*_update_grant_entry)(grant_ref_t, domid_t,
+		unsigned long, unsigned);
+	/*
+	 * Stop granting a grant entry to domain for accessing. First

input

(quoted diff) +1 -0
+	 * parameter is reference of a grant entry whose grant access

will be

(quoted diff) +1 -0
+	 * stopped, second one is not in use now. If the grant entry

is

(quoted diff) +1 -0
+	 * currently mapped for reading or writing, just return

failure(==0)

(quoted diff) +1 -0
+	 * directly and don't tear down the grant access. Otherwise,

stop grant

drivers/xen/grant-table.c +5 -0
+	 * access for this entry and return success(==1).
+	 */
+	int (*_gnttab_end_foreign_access_ref)(grant_ref_t, int);
+	/*
+	 * Stop granting a grant entry to domain for transfer. If

tranfer has

(quoted diff) +1 -0
+	 * not started, just reclaim the grant entry and return

failure(==0).

(quoted diff) +1 -0
+	 * Otherwise, wait for the transfer to complete and then

return the

drivers/xen/grant-table.c +3 -0
+	 * frame.
+	 */
+	unsigned long

(*_gnttab_end_foreign_transfer_ref)(grant_ref_t);

(quoted diff) +2 -0
+	/*
+	 * Query the status of a grant entry. Input parameter is

reference of

(quoted diff) +1 -0
+	 * queried grant entry, return value is the status of queried

entry.

(quoted diff) +1 -0
+	 * Detailed status(writing/reading) can be gotten from the

return value

Quoted 9 lines

drivers/xen/grant-table.c static DEFINE_SPINLOCK(gnttab_list_lock); · line 131

Quoted 6 lines
drivers/xen/grant-table.c +5 -0
+	 * by bit operations.
+	 */
+	int (*_gnttab_query_foreign_access)(grant_ref_t);
+} gnttab_interface;
+

Why the leading '_' in the names?

Just in order to differ those function pointers from the original functions.

Quoted 18 lines
Quoted 18 lines
drivers/xen/grant-table.c +9 -0
+static int grant_table_version;
 
 static struct gnttab_free_callback *gnttab_free_callback_list;
@@ -142,6 +207,15 @@ static void put_free_entry(grant_ref_t ref)
 	spin_unlock_irqrestore(&gnttab_list_lock, flags);  }
 
+static void update_grant_entry_v1(grant_ref_t ref, domid_t domid,
+				  unsigned long frame, unsigned flags) {
+	shared.v1[ref].frame = frame;
+	shared.v1[ref].domid = domid;
+	wmb();
+	shared.v1[ref].flags = flags;
+}
+
 static void update_grant_entry(grant_ref_t ref, domid_t domid,
 			       unsigned long frame, unsigned flags)  {
Quoted 9 lines

drivers/xen/grant-table.c static void update_grant_entry(grant_ref_t · line 233

Quoted 6 lines
drivers/xen/grant-table.c +0 -0
@@ -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.
 	 */
 

The comment above probably should be moved into the v1 function itself since the v2 code differs.

Yes, you are right. Comments for v2 should be added too.

Thanks
Annie

Quoted 11 lines
Quoted 9 lines
drivers/xen/grant-table.c +1 -4
-	shared[ref].frame = frame;
-	shared[ref].domid = domid;
-	wmb();
-	shared[ref].flags = flags;
+	gnttab_interface._update_grant_entry(ref, domid, frame,
 flags);
 }
 

[snip]

Quoted 2 lines

Paul

_______________________________________________
Xen-devel mailing list
[email protected]
http://lists.xensource.com/xen-devel

#9 lore raw

RE: [PATCH 1/3] Introducing grant table V2 stucture

Annie,

Quoted 2 lines · Paul Durrant

I see. v2 function includes mapping and arch_gnttab_map_shared, v1 function only include arch_gnttab_map_sh, right? This will lead to some code duplicated in two functions.

My preference would be to have duplicated calls to arch_gnttab_map_shared(). I think it's more illustrative of the difference between v1 and v2 having separate status pages.

Paul

author
#10 lore raw

Re: [Xen-devel] RE: [PATCH 1/3] Introducing grant table V2 stucture

Quoted 6 lines · Paul Durrant

Annie,

Quoted 2 lines · Paul Durrant

I see. v2 function includes mapping and arch_gnttab_map_shared, v1 function only include arch_gnttab_map_sh, right? This will lead to some code duplicated in two functions.

My preference would be to have duplicated calls to arch_gnttab_map_shared(). I think it's more illustrative of the difference between v1 and v2 having separate status pages.

Ok, will do as you suggested, thanks.

Thanks
Annie

#11 lore raw

Re: [Xen-devel] [PATCH 1/3] Introducing grant table V2 stucture

In reply to [email protected]

drivers/xen/grant-table.c line 56

Quoted 10 lines · On Wed, 2011-11-09 at 08:14 +0000, [email protected] wrote:
drivers/xen/grant-table.c +1 -1
index 4f44b34..0d481a9 100644
@@ -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?

Quoted 13 lines
drivers/xen/grant-table.c +5 -1
 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;
+

drivers/xen/grant-table.c static DEFINE_SPINLOCK(gnttab_list_lock); · line 81

Quoted 10 lines
drivers/xen/grant-table.c +10 -0
+/*
+ * 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.

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.

drivers/xen/grant-table.c static DEFINE_SPINLOCK(gnttab_list_lock); · line 83

Quoted 2 lines
drivers/xen/grant-table.c +2 -0
+
+/*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*/

drivers/xen/grant-table.c static DEFINE_SPINLOCK(gnttab_list_lock); · line 91

Quoted 8 lines
drivers/xen/grant-table.c +8 -0
+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.

[...]

Quoted 9 lines
drivers/xen/grant-table.c +3 -0
+} 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).

drivers/xen/grant-table.c static void update_grant_entry(grant_ref_t ref, domid_t domid, · line 235

Quoted 10 lines
drivers/xen/grant-table.c +2 -4
         *  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.

drivers/xen/grant-table.c int gnttab_grant_foreign_access(domid_t domid, unsigned long frame, · line 262

Quoted 9 lines
drivers/xen/grant-table.c +1 -1
 /*
  * 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.

Ian.

author
#12 lore raw

Re: [PATCH 1/3] Introducing grant table V2 stucture

Quoted 16 lines · Ian Campbell

drivers/xen/grant-table.c line 57

Quoted 11 lines · On Wed, 2011-11-09 at 08:14 +0000, [email protected] wrote:
drivers/xen/grant-table.c +1 -1
index 4f44b34..0d481a9 100644
@@ -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.

Quoted 20 lines
Quoted 20 lines
drivers/xen/grant-table.c +12 -1
 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
Quoted 9 lines

drivers/xen/grant-table.c static DEFINE_SPINLOCK(gnttab_list_lock); · line 133

Quoted 4 lines
drivers/xen/grant-table.c +3 -0
+ * 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.

Quoted 4 lines

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.

Quoted 9 lines

drivers/xen/grant-table.c static DEFINE_SPINLOCK(gnttab_list_lock); · line 133

Quoted 4 lines
drivers/xen/grant-table.c +2 -0
+
+/*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.

Quoted 10 lines

drivers/xen/grant-table.c static DEFINE_SPINLOCK(gnttab_list_lock); · line 133

Quoted 9 lines
drivers/xen/grant-table.c +8 -0
+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);
 
Quoted 3 lines

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.

Quoted 22 lines

[...]

Quoted 20 lines
drivers/xen/grant-table.c +4 -4
+} 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);
 }
 
Quoted 5 lines

drivers/xen/grant-table.c static void update_grant_entry(grant_ref_t ref, domid_t domid, · line 236

Quoted 2 lines
drivers/xen/grant-table.c +1 -0
+
 

Please avoid unrelated whitespace changes.

Oh, it was ignored. Thanks, i will delete it.

Quoted 8 lines
Quoted 8 lines
drivers/xen/grant-table.c +0 -0
 /*
  * Public grant-issuing interface functions

*/

drivers/xen/grant-table.c +0 -0
@@ -187,31 +259,40 @@ int gnttab_grant_foreign_access(domid_t domid, unsigned long frame,
 }
 EXPORT_SYMBOL_GPL(gnttab_grant_foreign_access);
 
Quoted 6 lines

drivers/xen/grant-table.c int gnttab_grant_foreign_access(domid_t domid, unsigned long frame, · line 266

Quoted 3 lines
drivers/xen/grant-table.c +1 -1
-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

Quoted 3 lines

Ian.

_______________________________________________
Xen-devel mailing list
[email protected]
http://lists.xensource.com/xen-devel

#13 lore raw

PATCH 2/3 Grant tables v2 implementation.

In reply to ANNIE LI

From: Annie Li <[email protected]>

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.

---
 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(-)
arch/x86/xen/grant-table.c +33 -1
index 65ce508..3e9f936 100644
@@ -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*/
+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;
+}
+
 static int unmap_pte_fn(pte_t *pte, struct page *pmd_page,
 			unsigned long addr, void *data)
 {
@@ -83,7 +94,28 @@ int arch_gnttab_map_shared(unsigned long *frames, unsigned long nr_gframes,
 	return rc;
 }
 
-void arch_gnttab_unmap_shared(void *shared, unsigned long nr_gframes)
+int arch_gnttab_map_status(uint64_t *frames, unsigned long nr_gframes,
+			   unsigned long max_nr_gframes,
+			   grant_status_t **__shared)
+{
+	int rc;
+	grant_status_t *shared = *__shared;
+
+	if (shared == NULL) {
+		struct vm_struct *area =
+			xen_alloc_vm_area(PAGE_SIZE * max_nr_gframes);
+		BUG_ON(area == NULL);
+		shared = area->addr;
+		*__shared = shared;
+	}
+
+	rc = apply_to_page_range(&init_mm, (unsigned long)shared,
+				 PAGE_SIZE * nr_gframes,
+				 map_pte_fn_status, &frames);
+	return rc;
+}
+
+void arch_gnttab_unmap(void *shared, unsigned long nr_gframes)
 {
 	apply_to_page_range(&init_mm, (unsigned long)shared,
 			    PAGE_SIZE * nr_gframes, unmap_pte_fn, NULL);
drivers/xen/grant-table.c +183 -11

300 lines not on this page · raw message

include/xen/grant_table.h +4 -2
index 405879d..4568498 100644
@@ -147,8 +147,10 @@ gnttab_set_unmap_op(struct gnttab_unmap_grant_ref *unmap, phys_addr_t addr,
 int arch_gnttab_map_shared(unsigned long *frames, unsigned long nr_gframes,
 			   unsigned long max_nr_gframes,
 			   void **__shared);
-void arch_gnttab_unmap_shared(void *shared,
-			      unsigned long nr_gframes);
+int arch_gnttab_map_status(uint64_t *frames, unsigned long nr_gframes,
+			   unsigned long max_nr_gframes,
+			   grant_status_t **__shared);
+void arch_gnttab_unmap(void *shared, unsigned long nr_gframes);
 
 extern unsigned long xen_hvm_resume_frames;
 unsigned int gnttab_max_grant_frames(void);
Signature · 1 line
1.7.6
#14 lore raw

Re: [Xen-devel] [PATCH 2/3] Grant tables v2 implementation.

Quoted 35 lines · On Wed, 2011-11-09 at 08:15 +0000, [email protected] wrote:

From: Annie Li <[email protected]>

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.

---
 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(-)
arch/x86/xen/grant-table.c +0 -0
index 65ce508..3e9f936 100644

arch/x86/xen/grant-table.c static int map_pte_fn(pte_t *pte, struct page *pmd_page, · line 57

Quoted 4 lines
arch/x86/xen/grant-table.c +1 -0
@@ -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?

arch/x86/xen/grant-table.c static int map_pte_fn(pte_t *pte, struct page *pmd_page, · line 66

Quoted 9 lines
arch/x86/xen/grant-table.c +9 -0
+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?

Quoted 9 lines
arch/x86/xen/grant-table.c +1 -0
+
 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;
 }
 

arch/x86/xen/grant-table.c static int gnttab_map_status_v1(unsigned int nr_gframes) · line 768

Quoted 10 lines
arch/x86/xen/grant-table.c +10 -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

Quoted 32 lines
arch/x86/xen/grant-table.c +28 -0
+        * 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);

arch/x86/xen/grant-table.c static int gnttab_map(unsigned int start_idx, unsigned int end_idx) · line 833

Quoted 4 lines
arch/x86/xen/grant-table.c +1 -0
@@ -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.

author
#15 lore raw

Re: [PATCH 2/3] Grant tables v2 implementation.

Quoted 40 lines · Ian Campbell
Quoted 38 lines · On Wed, 2011-11-09 at 08:15 +0000, [email protected] wrote:

From: Annie Li <[email protected]>

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.

---
 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(-)
arch/x86/xen/grant-table.c +0 -0
index 65ce508..3e9f936 100644
@@ -54,6 +54,17 @@ static int map_pte_fn(pte_t *pte, struct page *pmd_page,
        return 0;
 }
 
Quoted 5 lines

arch/x86/xen/grant-table.c static int map_pte_fn(pte_t *pte, struct page *pmd_page, · line 58

Quoted 2 lines
arch/x86/xen/grant-table.c +1 -0
+/*32bits is not enough since Xen supports sparse physical memory*/
 

What does this mean?

Sorry for the confusion, my comment seems not so precise.
This function is used to map the status frames of grant table 2, and the status definition is uint64_t. So it requires 64bits even on both 32bit guest.

Quoted 15 lines

arch/x86/xen/grant-table.c static int map_pte_fn(pte_t *pte, struct page *pmd_page,

Quoted 11 lines
arch/x86/xen/grant-table.c +9 -0
+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?

Yes, map_pte_fn already exists, but the frames definition is different.

uint64_t **frames in map_pte_fn_status VS unsigned long **frames in map_pte_fn

Grant table 2 added status frames which is defined as uint64_t, so I kept both map_pte_fn and map_pte_fn_status.

Quoted 11 lines
Quoted 11 lines
arch/x86/xen/grant-table.c +1 -0
+
 static int unmap_pte_fn(pte_t *pte, struct page *pmd_page,

unsigned long addr, void *data)
{

arch/x86/xen/grant-table.c +0 -0
@@ -630,6 +756,44 @@ static int gnttab_map_status_v1(unsigned int nr_gframes)
        return 0;
 }
 
Quoted 14 lines

arch/x86/xen/grant-table.c static int gnttab_map_status_v1(unsigned int nr_gframes) · line 769

Quoted 11 lines
arch/x86/xen/grant-table.c +10 -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

Thanks, will fix it.

Quoted 36 lines
Quoted 36 lines
arch/x86/xen/grant-table.c +28 -0
+        * 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);
arch/x86/xen/grant-table.c +0 -0
@@ -666,6 +830,9 @@ static int gnttab_map(unsigned int start_idx, unsigned int end_idx)
                return rc;
        }
 
Quoted 5 lines

arch/x86/xen/grant-table.c static int gnttab_map(unsigned int start_idx, unsigned int end_idx) · line 834

Quoted 2 lines
arch/x86/xen/grant-table.c +1 -0
+       /* No need for kzalloc as it is initialized in following hyercall
 

"hypercall" again

Thanks, will fix it.

Thanks
Annie

Quoted 4 lines

Ian.

_______________________________________________
Xen-devel mailing list
[email protected]
http://lists.xensource.com/xen-devel

#16 lore raw

PATCH 3/3 code clean up

In reply to ANNIE LI

From: Annie Li <[email protected]>

---
 drivers/xen/grant-table.c |    3 ++-
 1 files changed, 2 insertions(+), 1 deletions(-)
drivers/xen/grant-table.c +2 -1
index a3294a26..458c00d 100644
@@ -708,7 +708,8 @@ static void gnttab_request_version(void)
 {
 	int rc;
 	struct gnttab_set_version gsv;
-	const char *str = "we need grant tables version 2, but only version 1 is available\n";
+	const char *str = "we need grant tables version 2, "
+					"but only version 1 is available\n";
 
 	gsv.version = 2;
 	rc = HYPERVISOR_grant_table_op(GNTTABOP_set_version, &gsv, 1);
Signature · 1 line
1.7.6
#17 lore raw

RE: [PATCH 3/3] code clean up

Annie,

Why was this split out as a separate patch? Can it not be folded into patch 2 since the line it re-formats was introduced there?

Paul

Quoted 33 lines

-----Original Message-----
From: [email protected] [mailto:[email protected]]
Sent: 09 November 2011 08:16
To: [email protected]; [email protected]; [email protected]; [email protected]
Cc: [email protected]; Paul Durrant; [email protected]
Subject: [PATCH 3/3] code clean up

From: Annie Li <[email protected]>

---
 drivers/xen/grant-table.c |    3 ++-
 1 files changed, 2 insertions(+), 1 deletions(-)
drivers/xen/grant-table.c +2 -1
index a3294a26..458c00d 100644
@@ -708,7 +708,8 @@ static void gnttab_request_version(void)  {
 	int rc;
 	struct gnttab_set_version gsv;
-	const char *str = "we need grant tables version 2, but only
 version 1 is available\n";
+	const char *str = "we need grant tables version 2, "
+					"but only version 1 is
 available\n";
 
 	gsv.version = 2;

rc = HYPERVISOR_grant_table_op(GNTTABOP_set_version, &gsv,
1);
--
1.7.6

#18 lore raw

Re: [Xen-devel] RE: [PATCH 3/3] code clean up

Quoted 3 lines · Paul Durrant

Annie,

Why was this split out as a separate patch? Can it not be folded into patch 2 since the line it re-formats was introduced there?

It is not generally necessary to split string constants in order to meet the 80 column (soft) limit in Linux code. Some people frown on it because it breaks grep'ability.

Ian.

Quoted 42 lines

Paul

Quoted 29 lines

-----Original Message-----
From: [email protected] [mailto:[email protected]]
Sent: 09 November 2011 08:16
To: [email protected]; [email protected]; [email protected]; [email protected]
Cc: [email protected]; Paul Durrant; [email protected]
Subject: [PATCH 3/3] code clean up

From: Annie Li <[email protected]>

---
 drivers/xen/grant-table.c |    3 ++-
 1 files changed, 2 insertions(+), 1 deletions(-)
drivers/xen/grant-table.c +2 -1
index a3294a26..458c00d 100644
@@ -708,7 +708,8 @@ static void gnttab_request_version(void)  {
 	int rc;
 	struct gnttab_set_version gsv;
-	const char *str = "we need grant tables version 2, but only
 version 1 is available\n";
+	const char *str = "we need grant tables version 2, "
+					"but only version 1 is
 available\n";
 
 	gsv.version = 2;
Quoted 4 lines

rc = HYPERVISOR_grant_table_op(GNTTABOP_set_version, &gsv,
1);
--
1.7.6

_______________________________________________
Xen-devel mailing list
[email protected]
http://lists.xensource.com/xen-devel

author
#19 lore raw

Re: RE: [PATCH 3/3] code clean up

Quoted 11 lines · Ian Campbell
Quoted 4 lines · Paul Durrant

Annie,

Why was this split out as a separate patch? Can it not be folded into patch 2 since the line it re-formats was introduced there?

It is not generally necessary to split string constants in order to meet the 80 column (soft) limit in Linux code. Some people frown on it because it breaks grep'ability.

If so, I'd like to revert the change.

Thanks
Annie

Quoted 48 lines

Ian.

Quoted 42 lines

Paul

Quoted 29 lines

-----Original Message-----
From: [email protected] [mailto:[email protected]]
Sent: 09 November 2011 08:16
To: [email protected]; [email protected]; [email protected]; [email protected]
Cc: [email protected]; Paul Durrant; [email protected]
Subject: [PATCH 3/3] code clean up

From: Annie Li <[email protected]>

---
 drivers/xen/grant-table.c |    3 ++-
 1 files changed, 2 insertions(+), 1 deletions(-)
drivers/xen/grant-table.c +2 -1
index a3294a26..458c00d 100644
@@ -708,7 +708,8 @@ static void gnttab_request_version(void)  {
 	int rc;
 	struct gnttab_set_version gsv;
-	const char *str = "we need grant tables version 2, but only
 version 1 is available\n";
+	const char *str = "we need grant tables version 2, "
+					"but only version 1 is
 available\n";
 
 	gsv.version = 2;
Quoted 5 lines

rc = HYPERVISOR_grant_table_op(GNTTABOP_set_version, &gsv,
1);
--
1.7.6

_______________________________________________
Xen-devel mailing list
[email protected]
http://lists.xensource.com/xen-devel

_______________________________________________
Xen-devel mailing list
[email protected]
http://lists.xensource.com/xen-devel

author
#20 lore raw
In reply to ANNIE LI

Diff and shortlog:

 arch/x86/xen/grant-table.c          |   39 ++++-
 drivers/xen/grant-table.c           |  354 
++++++++++++++++++++++++++++++++---
 include/xen/grant_table.h           |    8 +-
 include/xen/interface/grant_table.h |  167 ++++++++++++++++-
 include/xen/interface/xen.h         |    2 +
 5 files changed, 534 insertions(+), 36 deletions(-)

Annie Li (3):
Introducing grant table V2 stucture
Grant tables v2 implementation.
code clean up

Thanks
Annie