[PATCH] xen-blk: persistent-grants fixes

2012-11-02 Thread Roger Pau Monne
segments that have not been set. Signed-off-by: Roger Pau Monne roger@citrix.com Cc: konrad.w...@oracle.com Cc: linux-kernel@vger.kernel.org --- drivers/block/xen-blkback/blkback.c | 15 +-- drivers/block/xen-blkback/xenbus.c |2 +- drivers/block/xen-blkfront.c|3

[PATCH v2] Persistent grant maps for xen blk drivers

2012-10-24 Thread Roger Pau Monne
of using persistent grants. There is perhaps a small saving, from the reduced number of hypercalls performed in granting, and ending foreign access. Signed-off-by: Oliver Chick oliver.ch...@citrix.com Signed-off-by: Roger Pau Monne roger@citrix.com Cc: konrad.w...@oracle.com Cc: linux-kernel

[PATCH RFC] Persistent grant maps for xen blk drivers

2012-10-18 Thread Roger Pau Monne
saving, from the reduced number of hypercalls performed in granting, and ending foreign access. Signed-off-by: Oliver Chick oliver.ch...@citrix.com Signed-off-by: Roger Pau Monne roger@citrix.com Cc: konrad.w...@oracle.com Cc: linux-kernel@vger.kernel.org --- Benchmarks showing the impact

[PATCH v2 4/7] xen-blkback: move pending handles list from blkbk to pending_req

2013-04-17 Thread Roger Pau Monne
Moving grant ref handles from blkbk to pending_req will allow us to get rid of the shared blkbk structure. Signed-off-by: Roger Pau Monné roger@citrix.com Cc: Konrad Rzeszutek Wilk konrad.w...@oracle.com Cc: xen-de...@lists.xen.org --- drivers/block/xen-blkback/blkback.c | 16

[PATCH v2 0/7] xen-block: indirect descriptors

2013-04-17 Thread Roger Pau Monne
Implementation of indirect descriptors v2, addressing Konrad's comments. A graph on performance can be found at: http://xenbits.xen.org/people/royger/plot_indirect_read4k.png Thanks for the review, Roger. Roger Pau Monne (7): xen-blkback: print stats about persistent grants xen

[PATCH v2 2/7] xen-blkback: use balloon pages for all mappings

2013-04-17 Thread Roger Pau Monne
Using balloon pages for all granted pages allows us to simplify the logic in blkback, especially in the xen_blkbk_map function, since now we can decide if we want to map a grant persistently or not after we have actually mapped it. This could not be done before because persistent grants used

[PATCH v2 1/7] xen-blkback: print stats about persistent grants

2013-04-17 Thread Roger Pau Monne
Signed-off-by: Roger Pau Monné roger@citrix.com Cc: xen-de...@lists.xen.org Cc: Konrad Rzeszutek Wilk konrad.w...@oracle.com --- drivers/block/xen-blkback/blkback.c |6 -- 1 files changed, 4 insertions(+), 2 deletions(-) diff --git a/drivers/block/xen-blkback/blkback.c

[PATCH v2 7/7] xen-block: implement indirect descriptors

2013-04-17 Thread Roger Pau Monne
Indirect descriptors introduce a new block operation (BLKIF_OP_INDIRECT) that passes grant references instead of segments in the request. This grant references are filled with arrays of blkif_request_segment_aligned, this way we can send more segments in a request. The proposed implementation

[PATCH v2 6/7] xen-blkback: expand map/unmap functions

2013-04-17 Thread Roger Pau Monne
Preparatory change for implementing indirect descriptors. Change xen_blkbk_{map/unmap} in order to be able to map/unmap a random amount of grants (previously it was limited to BLKIF_MAX_SEGMENTS_PER_REQUEST). Also, remove the usage of pending_req in the map/unmap functions, so we can map/unmap

[PATCH v2 3/7] xen-blkback: implement LRU mechanism for persistent grants

2013-04-17 Thread Roger Pau Monne
This mechanism allows blkback to change the number of grants persistently mapped at run time. The algorithm uses a simple LRU mechanism that removes (if needed) the persistent grants that have not been used since the last LRU run, or if all grants have been used it removes the first grants in the

[PATCH v2 5/7] xen-blkback: make the queue of free requests per backend

2013-04-17 Thread Roger Pau Monne
Remove the last dependency from blkbk by moving the list of free requests to blkif. This change reduces the contention on the list of available requests. Signed-off-by: Roger Pau Monné roger@citrix.com Cc: Konrad Rzeszutek Wilk konrad.w...@oracle.com Cc: xen-de...@lists.xen.org --- Changes

[PATCH v3] xen-block: implement indirect descriptors

2013-04-18 Thread Roger Pau Monne
Indirect descriptors introduce a new block operation (BLKIF_OP_INDIRECT) that passes grant references instead of segments in the request. This grant references are filled with arrays of blkif_request_segment_aligned, this way we can send more segments in a request. The proposed implementation

[PATCH 0/5] xen-block: cleanup and fixes

2013-03-18 Thread Roger Pau Monne
This series contains the cleanups and fixes found in my previous indirect descriptors series, that are aimed for linux 3.9. Available in the git repository at: git://xenbits.xen.org/people/royger/linux.git blk-for-3.9 Roger Pau Monne (5): xen-blkback: don't store dev_bus_addr xen

[PATCH 1/5] xen-blkback: don't store dev_bus_addr

2013-03-18 Thread Roger Pau Monne
dev_bus_addr returned in the grant ref map operation is the mfn of the passed page, there's no need to store it in the persistent grant entry, since we can always get it provided that we have the page. This reduces the memory overhead of persistent grants in blkback. Signed-off-by: Roger Pau

[PATCH 2/5] xen-blkback: fix foreach_grant_safe to handle empty lists

2013-03-18 Thread Roger Pau Monne
We may use foreach_grant_safe in the future with empty lists, so make sure we can handle them. Signed-off-by: Roger Pau Monné roger@citrix.com Cc: xen-de...@lists.xen.org Cc: Konrad Rzeszutek Wilk konrad.w...@oracle.com --- drivers/block/xen-blkback/blkback.c |2 +- 1 files changed, 1

[PATCH 5/5] xen-blkfront: remove frame list from blk_shadow

2013-03-18 Thread Roger Pau Monne
We already have the frame (pfn of the grant page) stored inside struct grant, so there's no need to keep an aditional list of mapped frames for a specific request. This reduces memory usage in blkfront. Signed-off-by: Roger Pau Monné roger@citrix.com Cc: Konrad Rzeszutek Wilk

[PATCH 4/5] xen-blkfront: pre-allocate pages for requests

2013-03-18 Thread Roger Pau Monne
This prevents us from having to call alloc_page while we are preparing the request. Since blkfront was calling alloc_page with a spinlock held we used GFP_ATOMIC, which can fail if we are requesting a lot of pages since it is using the emergency memory pools. Allocating all the pages at init

[PATCH 3/5] xen-blkfront: switch from llist to list

2013-03-18 Thread Roger Pau Monne
Replace the use of llist with list. llist_for_each_entry_safe can trigger a bug in GCC 4.1, so it's best to remove it and use a doubly linked list, which is used extensively in the kernel already. Specifically this bug can be triggered by hot-unplugging a disk, either by doing xm block-detach or

[PATCH v1 0/7] xen-block: indirect descriptors

2013-03-27 Thread Roger Pau Monne
accurate comparison: http://xenbits.xen.org/people/royger/plot_indirect_read4k.png Also, the default number of segments per indirect request has been set to 32 in order to map them all persistently, but this can be changed at runtime by the user. Roger Pau Monne (7): xen-blkback: print

[PATCH v1 3/7] xen-blkback: implement LRU mechanism for persistent grants

2013-03-27 Thread Roger Pau Monne
This mechanism allows blkback to change the number of grants persistently mapped at run time. The algorithm uses a simple LRU mechanism that removes (if needed) the persistent grants that have not been used since the last LRU run, or if all grants have been used it removes the first grants in the

[PATCH v1 2/7] xen-blkback: use balloon pages for all mappings

2013-03-27 Thread Roger Pau Monne
Using balloon pages for all granted pages allows us to simplify the logic in blkback, especially in the xen_blkbk_map function, since now we can decide if we want to map a grant persistently or not after we have actually mapped it. This could not be done before because persistent grants used

[PATCH v1 4/7] xen-blkback: move pending handles list from blkbk to pending_req

2013-03-27 Thread Roger Pau Monne
Moving grant ref handles from blkbk to pending_req will allow us to get rid of the shared blkbk structure. Signed-off-by: Roger Pau Monné roger@citrix.com Cc: Konrad Rzeszutek Wilk konrad.w...@oracle.com Cc: xen-de...@lists.xen.org --- drivers/block/xen-blkback/blkback.c | 16

[PATCH v1 7/7] xen-block: implement indirect descriptors

2013-03-27 Thread Roger Pau Monne
Indirect descriptors introduce a new block operation (BLKIF_OP_INDIRECT) that passes grant references instead of segments in the request. This grant references are filled with arrays of blkif_request_segment_aligned, this way we can send more segments in a request. The proposed implementation

[PATCH v1 6/7] xen-blkback: expand map/unmap functions

2013-03-27 Thread Roger Pau Monne
Preparatory change for implementing indirect descriptors. Change xen_blkbk_{map/unmap} in order to be able to map/unmap a random amount of grants (previously it was limited to BLKIF_MAX_SEGMENTS_PER_REQUEST). Also, remove the usage of pending_req in the map/unmap functions, so we can map/unmap

[PATCH v1 5/7] xen-blkback: make the queue of free requests per backend

2013-03-27 Thread Roger Pau Monne
Remove the last dependency from blkbk by moving the list of free requests to blkif. This change reduces the contention on the list of available requests. Signed-off-by: Roger Pau Monné roger@citrix.com Cc: Konrad Rzeszutek Wilk konrad.w...@oracle.com Cc: xen-de...@lists.xen.org --- Changes

[PATCH v1 1/7] xen-blkback: print stats about persistent grants

2013-03-27 Thread Roger Pau Monne
Signed-off-by: Roger Pau Monné roger@citrix.com Cc: xen-de...@lists.xen.org Cc: Konrad Rzeszutek Wilk konrad.w...@oracle.com --- drivers/block/xen-blkback/blkback.c |6 -- 1 files changed, 4 insertions(+), 2 deletions(-) diff --git a/drivers/block/xen-blkback/blkback.c

[PATCH 1/2] xen-blkback: implement safe iterator for the list of persistent grants

2012-12-04 Thread Roger Pau Monne
Change foreach_grant iterator to a safe version, that allows freeing the element while iterating. Also move the free code in free_persistent_gnts to prevent freeing the element before the rb_next call. Reported-by: Dan Carpenter dan.carpen...@oracle.com Signed-off-by: Roger Pau Monné

[PATCH 2/2] xen-blkfront: implement safe version of llist_for_each_entry

2012-12-04 Thread Roger Pau Monne
Implement a safe version of llist_for_each_entry, and use it in blkif_free. Previously grants where freed while iterating the list, which lead to dereferences when trying to fetch the next item. Reported-by: Dan Carpenter dan.carpen...@oracle.com Signed-off-by: Roger Pau Monné

[PATCH] xen-blkfront: drop the use of llist_for_each_entry_safe

2013-02-11 Thread Roger Pau Monne
Replace llist_for_each_entry_safe with a while loop and llist_del_first. llist_for_each_entry_safe can trigger a bug in GCC 4.1, so it's best to remove it and use a while loop and llist_del_first (which is already in llist.h). Since xen-blkfront is the only user of the llist_for_each_entry_safe

[PATCH RFC 01/12] xen-blkback: don't store dev_bus_addr

2013-02-28 Thread Roger Pau Monne
dev_bus_addr returned in the grant ref map operation is the mfn of the passed page, there's no need to store it in the persistent grant entry, since we can always get it provided that we have the page. This reduces the memory overhead of persistent grants in blkback. Signed-off-by: Roger Pau

[PATCH RFC 09/12] xen-blkback: move pending handles list from blkbk to pending_req

2013-02-28 Thread Roger Pau Monne
Moving grant ref handles from blkbk to pending_req will allow us to get rid of the shared blkbk structure. Signed-off-by: Roger Pau Monné roger@citrix.com Cc: Konrad Rzeszutek Wilk konrad.w...@oracle.com Cc: xen-de...@lists.xen.org --- drivers/block/xen-blkback/blkback.c | 16

[PATCH RFC 12/12] xen-block: implement indirect descriptors

2013-02-28 Thread Roger Pau Monne
Indirect descriptors introduce a new block operation (BLKIF_OP_INDIRECT) that passes grant references instead of segments in the request. This grant references are filled with arrays of blkif_request_segment_aligned, this way we can send more segments in a request. The proposed implementation

[PATCH RFC 11/12] xen-blkback: expand map/unmap functions

2013-02-28 Thread Roger Pau Monne
Preparatory change for implementing indirect descriptors. Change xen_blkbk_{map/unmap} in order to be able to map/unmap a random amount of grants (previously it was limited to BLKIF_MAX_SEGMENTS_PER_REQUEST). Also, remove the usage of pending_req in the map/unmap functions, so we can map/unmap

[PATCH RFC 10/12] xen-blkback: make the queue of free requests per backend

2013-02-28 Thread Roger Pau Monne
Remove the last dependency from blkbk by moving the list of free requests to blkif. This change reduces the contention on the list of available requests. Signed-off-by: Roger Pau Monné roger@citrix.com Cc: Konrad Rzeszutek Wilk konrad.w...@oracle.com Cc: xen-de...@lists.xen.org ---

[PATCH RFC 08/12] xen-blkback: use balloon pages for all mappings

2013-02-28 Thread Roger Pau Monne
Using balloon pages for all granted pages allows us to simplify the logic in blkback, specially in the xen_blkbk_map function, since now we can decide if we want to map a grant persistently or not after we have actually mapped it. This could not be done before because persistent grants used

[PATCH RFC 06/12] xen-blkback: implement LRU mechanism for persistent grants

2013-02-28 Thread Roger Pau Monne
This mechanism allows blkback to change the number of grants persistently mapped at run time. The algorithm uses a simple LRU mechanism that removes (if needed) the persistent grants that have not been used since the last LRU run, or if all grants have been used it removes the first grants in the

[PATCH RFC 00/12] xen-block: indirect descriptors

2013-02-28 Thread Roger Pau Monne
This series contains the initial implementation of indirect descriptors for Linux blkback/blkfront. Patches 1, 2, 3, 4 and 5 are bug fixes and minor optimizations. Patch 6 contains a LRU implementation for blkback that will be needed when using indirect descriptors (since we are no longer able

[PATCH RFC 07/12] xen-blkback: print stats about persistent grants

2013-02-28 Thread Roger Pau Monne
Signed-off-by: Roger Pau Monné roger@citrix.com Cc: xen-de...@lists.xen.org Cc: Konrad Rzeszutek Wilk konrad.w...@oracle.com --- drivers/block/xen-blkback/blkback.c |5 +++-- 1 files changed, 3 insertions(+), 2 deletions(-) diff --git a/drivers/block/xen-blkback/blkback.c

[PATCH RFC 04/12] xen-blkfront: pre-allocate pages for requests

2013-02-28 Thread Roger Pau Monne
This prevents us from having to call alloc_page while we are preparing the request. Since blkfront was calling alloc_page with a spinlock held we used GFP_ATOMIC, which can fail if we are requesting a lot of pages since it is using the emergency memory pools. Allocating all the pages at init

[PATCH RFC 05/12] xen-blkfront: remove frame list from blk_shadow

2013-02-28 Thread Roger Pau Monne
We already have the frame (pfn of the grant page) stored inside struct grant, so there's no need to keep an aditional list of mapped frames for a specific request. This reduces memory usage in blkfront. Signed-off-by: Roger Pau Monné roger@citrix.com Cc: Konrad Rzeszutek Wilk

[PATCH RFC 03/12] xen-blkfront: switch from llist to list

2013-02-28 Thread Roger Pau Monne
Replace the use of llist with list. llist_for_each_entry_safe can trigger a bug in GCC 4.1, so it's best to remove it and use a doubly linked list, which is used extensively in the kernel already. Specifically this bug can be triggered by hot-unplugging a disk, either by doing xm block-detach or

[PATCH RFC 02/12] xen-blkback: fix foreach_grant_safe to handle empty lists

2013-02-28 Thread Roger Pau Monne
We may use foreach_grant_safe in the future with empty lists, so make sure we can handle them. Signed-off-by: Roger Pau Monné roger@citrix.com Cc: xen-de...@lists.xen.org Cc: Konrad Rzeszutek Wilk konrad.w...@oracle.com --- drivers/block/xen-blkback/blkback.c |2 +- 1 files changed, 1

[PATCH] xen-blkback: use balloon pages for persistent grants

2013-02-14 Thread Roger Pau Monne
With current persistent grants implementation we are not freeing the persistent grants after we disconnect the device. Since grant map operations change the mfn of the allocated page, and we can no longer pass it to __free_page without setting the mfn to a sane value, use balloon grant pages

[PATCH] xen-blkfront: switch from llist to list

2013-02-15 Thread Roger Pau Monne
Replace the use of llist with list. llist_for_each_entry_safe can trigger a bug in GCC 4.1, so it's best to remove it and use a doubly linked list, which is used extensively in the kernel already. Specifically this bug can be triggered by hot-unplugging a disk, either by doing xm block-detach or

Re: [Xen-devel] [PATCH WIP 2/6] xen/arm: Introduce xen_guest_init

2012-07-12 Thread Roger Pau Monne
David Vrabel wrote: On 09/07/12 15:45, Konrad Rzeszutek Wilk wrote: On Fri, Jun 22, 2012 at 05:14:41PM +0100, Stefano Stabellini wrote: We used to rely on a core_initcall to initialize Xen on ARM, however core_initcalls are actually called after early consoles are initialized. That means that

[PATCH] xen-blkfront: handle bvecs with partial data

2012-12-07 Thread Roger Pau Monne
Currently blkfront fails to handle cases in blkif_completion like the following: 1st loop in rq_for_each_segment * bv_offset: 3584 * bv_len: 512 * offset += bv_len * i: 0 2nd loop: * bv_offset: 0 * bv_len: 512 * i: 0 In the second loop i should be 1, since we assume we only wanted to

[PATCH v2 2/3] llist: add a safe version of llist_for_each_entry

2012-12-10 Thread Roger Pau Monne
Signed-off-by: Roger Pau Monné roger@citrix.com Cc: Huang Ying ying.hu...@intel.com Cc: Konrad Rzeszutek Wilk kon...@kernel.org --- include/linux/llist.h | 27 +++ 1 files changed, 27 insertions(+), 0 deletions(-) diff --git a/include/linux/llist.h

[PATCH v2 1/3] xen-blkback: implement safe iterator for the list of persistent grants

2012-12-10 Thread Roger Pau Monne
Change foreach_grant iterator to a safe version, that allows freeing the element while iterating. Also move the free code in free_persistent_gnts to prevent freeing the element before the rb_next call. Reported-by: Dan Carpenter dan.carpen...@oracle.com Signed-off-by: Roger Pau Monné

[PATCH v2 3/3] xen-blkfront: transverse list of persistent grants safely

2012-12-10 Thread Roger Pau Monne
Use llist_for_each_entry_safe in blkif_free. Previously grants where freed while iterating the list, which lead to dereferences when trying to fetch the next item. Reported-by: Dan Carpenter dan.carpen...@oracle.com Signed-off-by: Roger Pau Monné roger@citrix.com Cc: Konrad Rzeszutek Wilk

[PATCH v3] llist: add a safe version of llist_for_each_entry

2012-12-11 Thread Roger Pau Monne
Signed-off-by: Roger Pau Monné roger@citrix.com Cc: Huang Ying ying.hu...@intel.com Cc: Konrad Rzeszutek Wilk kon...@kernel.org --- Changes since v2: * Allow to pass a NULL node as the first entry of deleted list entries. --- include/linux/llist.h | 27 +++ 1

[PATCH v4 3/3] xen-blkfront: transverse list of persistent grants safely

2012-12-13 Thread Roger Pau Monne
Use llist_for_each_entry_safe in blkif_free. Previously grants where freed while iterating the list, which lead to dereferences when trying to fetch the next item. Reported-by: Dan Carpenter dan.carpen...@oracle.com Signed-off-by: Roger Pau Monné roger@citrix.com Cc: Konrad Rzeszutek Wilk

[PATCH v4 1/3] xen-blkback: implement safe iterator for the list of persistent grants

2012-12-13 Thread Roger Pau Monne
Change foreach_grant iterator to a safe version, that allows freeing the element while iterating. Also move the free code in free_persistent_gnts to prevent freeing the element before the rb_next call. Reported-by: Dan Carpenter dan.carpen...@oracle.com Signed-off-by: Roger Pau Monné

[PATCH v4 2/3] llist: add a safe version of llist_for_each_entry

2012-12-13 Thread Roger Pau Monne
Signed-off-by: Roger Pau Monné roger@citrix.com Cc: Huang Ying ying.hu...@intel.com Cc: Konrad Rzeszutek Wilk kon...@kernel.org --- Changes since v3: * Change n to use type *, to keep the same semantics as list_for_each_entry_safe. Changes since v2: * Allow to pass a NULL node as the

[PATCH 1/2] xen-blkfront: free allocated page

2012-11-16 Thread Roger Pau Monne
Free the page allocated for the persistent grant. Signed-off-by: Roger Pau Monné roger@citrix.com --- drivers/block/xen-blkfront.c |1 + 1 files changed, 1 insertions(+), 0 deletions(-) diff --git a/drivers/block/xen-blkfront.c b/drivers/block/xen-blkfront.c index f1de806..96e9b00

[PATCH 2/2] xen-blkback: move free persistent grants code

2012-11-16 Thread Roger Pau Monne
Move the code that frees persistent grants from the red-black tree to a function. This will make it easier for other consumers to move this to a common place. Signed-off-by: Roger Pau Monné roger@citrix.com --- drivers/block/xen-blkback/blkback.c | 68 +++ 1

[PATCH v2] p2m: use GNTTABOP_unmap_and_duplicate if available

2013-08-27 Thread Roger Pau Monne
The new GNTTABOP_unmap_and_duplicate operation doesn't zero the mapping passed in new_addr, allowing us to perform batch unmaps in p2m code without requiring the use of a multicall. Signed-off-by: Roger Pau Monné roger@citrix.com Cc: Stefano Stabellini stefano.stabell...@eu.citrix.com Cc:

[PATCH 1/4] xen-blkback: workaround compiler bug in gcc 4.1

2013-06-21 Thread Roger Pau Monne
The code generat with gcc (GCC) 4.1.2 20080704 (Red Hat 4.1.2-54) creates an unbound loop for the second foreach_grant_safe loop in purge_persistent_gnt. The workaround is to avoid having this second loop and instead perform all the work inside the first loop by adding a new variable, clean_used,

[PATCH 2/4] xen-blkfront: set blk_queue_max_hw_sectors correctly

2013-06-21 Thread Roger Pau Monne
Now that indirect segments are enabled blk_queue_max_hw_sectors must be set to match the maximum number of sectors we can handle in a request. Signed-off-by: Roger Pau Monné roger@citrix.com Reported-by: Felipe Franciosi felipe.franci...@citrix.com Cc: Konrad Rzeszutek Wilk

[PATCH 4/4] xen-blkfront: increase the default number of indirect segments

2013-06-21 Thread Roger Pau Monne
When using certain storage devices (like RAID) having a bigger number of segments per request provides better performance. Signed-off-by: Roger Pau Monné roger@citrix.com Reported-by: Steven Haigh net...@crc.id.au Cc: Konrad Rzeszutek Wilk konrad.w...@oracle.com ---

[PATCH 0/4] xen-block: bug fixes for indirect-descriptors

2013-06-21 Thread Roger Pau Monne
This series contains a small number of bug fixes and improvements for xen-block indirect descriptors. -- To unsubscribe from this list: send the line unsubscribe linux-kernel in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html

[PATCH 3/4] xen-blkback: check the number of iovecs before allocating a bios

2013-06-21 Thread Roger Pau Monne
With the introduction of indirect segments we can receive requests with a number of segments bigger than the maximum number of allowed iovecs in a bios, so make sure that blkback doesn't try to allocate a bios with more iovecs than BIO_MAX_PAGES Signed-off-by: Roger Pau Monné roger@citrix.com

[PATCH 0/3] xen: fixes for gnt and block

2013-07-31 Thread Roger Pau Monne
This series contain a small bugfix for the grant table code (patch 1) and a couple of improvements to blkfront (patches 2 and 3) to make it work better if there's a shortage on available free grants. -- To unsubscribe from this list: send the line unsubscribe linux-kernel in the body of a

[PATCH 3/3] xen-blkfront: revoke foreign access for grants not mapped by the backend

2013-07-31 Thread Roger Pau Monne
There's no need to keep the foreign access in a grant if it is not persistently mapped by the backend. This allows us to free grants that are not mapped by the backend, thus preventing blkfront from hoarding all grants. The main effect of this is that blkfront will only persistently map the same

[PATCH 2/3] xen-blkfront: improve aproximation of required grants per request

2013-07-31 Thread Roger Pau Monne
Improve the calculation of required grants to process a request by using nr_phys_segments instead of always assuming a request is going to use all posible segments. nr_phys_segments contains the number of scatter-gather DMA addr+len pairs, which is basically what we put at every granted page.

[PATCH 1/3] xen-gnt: prevent adding duplicate gnt callbacks

2013-07-31 Thread Roger Pau Monne
With the current implementation, the callback in the tail of the list can be added twice, because the check done in gnttab_request_free_callback is bogus, callback-next can be NULL if it is the last callback in the list. If we add the same callback twice we end up with an infinite loop, were

[PATCH RFC] p2m: use GNTTABOP_unmap_and_duplicate if available

2013-07-31 Thread Roger Pau Monne
The new GNTTABOP_unmap_and_duplicate operation doesn't zero the mapping passed in new_addr, allowing us to perform batch unmaps in p2m code without requiring the use of a multicall. Signed-off-by: Roger Pau Monné roger@citrix.com Cc: Stefano Stabellini stefano.stabell...@eu.citrix.com Cc:

[PATCH v1] p2m: use GNTTABOP_unmap_and_duplicate if available

2013-08-01 Thread Roger Pau Monne
The new GNTTABOP_unmap_and_duplicate operation doesn't zero the mapping passed in new_addr, allowing us to perform batch unmaps in p2m code without requiring the use of a multicall. Signed-off-by: Roger Pau Monné roger@citrix.com Cc: Stefano Stabellini stefano.stabell...@eu.citrix.com Cc:

[PATCH] xen-blkback: use bigger array for batch gnt operations

2013-08-01 Thread Roger Pau Monne
Right now the maximum number of grant operations that can be batched in a single request is BLKIF_MAX_SEGMENTS_PER_REQUEST (11). This was OK before indirect descriptors because the maximum number of segments in a request was 11, but with the introduction of indirect descriptors the maximum number

[PATCH] grant-table: don't set m2p override if kmap_ops is not set

2013-11-05 Thread Roger Pau Monne
IMHO there's no reason to set a m2p override if the mapping is done in kernel space, so only set the m2p override when kmap_ops is set. When kmap_ops is not set, just set the correct p2m translation, this avoids touching the m2p lock, reducing contention around it. Signed-off-by: Roger Pau Monné

[PATCH RFC] xen-block: correctly define structures in public headers

2013-12-03 Thread Roger Pau Monne
Using __packed__ on the public interface is not correct, this structures should be compiled using the native ABI, and __packed__ should only be used in the backend counterpart of those structures (which needs to handle different ABIs). This was even worse in the ARM case, where the Linux kernel

[PATCH] xen: add support for MSI message groups

2014-02-26 Thread Roger Pau Monne
Add support for MSI message groups for Xen Dom0 using the MAP_PIRQ_TYPE_MULTI_MSI pirq map type. In order to keep track of which pirq is the first one in the group all pirqs in the MSI group except for the first one have the newly introduced PIRQ_MSI_GROUP flag set. This prevents calling

[PATCH v2] xen: add support for MSI message groups

2014-02-27 Thread Roger Pau Monne
Add support for MSI message groups for Xen Dom0 using the MAP_PIRQ_TYPE_MULTI_MSI pirq map type. In order to keep track of which pirq is the first one in the group all pirqs in the MSI group except for the first one have the newly introduced PIRQ_MSI_GROUP flag set. This prevents calling

[PATCH v3] xen-blkback: allocate list of pending reqs in small chunks

2013-05-02 Thread Roger Pau Monne
Allocate pending requests in smaller chunks instead of allocating them all at the same time. This change also removes the global array of pending_reqs, it is no longer necessay. Variables related to the grant mapping have been grouped into a struct called grant_page, this allows to allocate them

[PATCH v2 3/4] xen-blkback: check the number of iovecs before allocating a bios

2013-06-22 Thread Roger Pau Monne
With the introduction of indirect segments we can receive requests with a number of segments bigger than the maximum number of allowed iovecs in a bios, so make sure that blkback doesn't try to allocate a bios with more iovecs than BIO_MAX_PAGES Signed-off-by: Roger Pau Monné roger@citrix.com

[PATCH] xen-blkback: allocate list of pending reqs in small chunks

2013-04-26 Thread Roger Pau Monne
Allocate pending requests in smaller chunks instead of allocating them all at the same time. This change also removes the global array of pending_reqs, it is no longer necessay. Variables related to the grant mapping have been grouped into a struct called grant_page, this allows to allocate them

[PATCH v2] xen-blkback: allocate list of pending reqs in small chunks

2013-04-26 Thread Roger Pau Monne
Allocate pending requests in smaller chunks instead of allocating them all at the same time. This change also removes the global array of pending_reqs, it is no longer necessay. Variables related to the grant mapping have been grouped into a struct called grant_page, this allows to allocate them

[PATCH] xen-blkfront: restore the non-persistent data path

2013-10-29 Thread Roger Pau Monne
When persistent grants were added they were always used, even if the backend doesn't have this feature (there's no harm in always using the same set of pages). This restores the old data path when the backend doesn't have persistent grants, removing the burden of doing a memcpy when it is not

[PATCH v3] p2m: use GNTTABOP_unmap_and_duplicate if available

2013-11-04 Thread Roger Pau Monne
The new GNTTABOP_unmap_and_duplicate operation doesn't zero the mapping passed in new_addr, allowing us to perform batch unmaps in p2m code without requiring the use of a multicall. Signed-off-by: Roger Pau Monné roger@citrix.com Cc: Stefano Stabellini stefano.stabell...@eu.citrix.com Cc:

[PATCH RFC 4/4] xen-block: introduce a new request type to unmap grants

2013-07-08 Thread Roger Pau Monne
Right now blkfront has no way to unmap grant refs, if using persistent grants once a grant is used blkfront cannot assure if blkback will have this grant mapped or not. To solve this problem, a new request type (BLKIF_OP_UNMAP) that allows requesting blkback to unmap certain grants is introduced.

[PATCH RFC 1/4] xen-gnt: prevent adding duplicate gnt callbacks

2013-07-08 Thread Roger Pau Monne
With the current implementation, the callback in the tail of the list can be added twice, because the check done in gnttab_request_free_callback is bogus, callback-next can be NULL if it is the last callback in the list. If we add the same callback twice we end up with an infinite loop, were

[PATCH RFC 2/4] xen-blkfront: improve aproximation of required grants per request

2013-07-08 Thread Roger Pau Monne
Improve the calculation of required grants to process a request by using nr_phys_segments instead of always assuming a request is going to use all posible segments. Signed-off-by: Roger Pau Monné roger@citrix.com Cc: Konrad Rzeszutek Wilk konrad.w...@oracle.com ---

[PATCH RFC 0/4] xen-block: prevent blkfront for hoarding grants

2013-07-08 Thread Roger Pau Monne
The following patches prevent blkfront from hoarding all grants in the system by allowing blkfront to request blkback to unmap certain grants so they can be freed by blkfront. This is done periodically by blkfront, unmapping a certain amount of unused persistent grants. This series also

[PATCH RFC 3/4] xen-blkfront: prevent hoarding all grants

2013-07-08 Thread Roger Pau Monne
Prevent blkfront from hoarding all grants by adding a minimum number of grants that must be free at all times. We still need a way to free unused grants in blkfront, but this patch will mitigate the problem in the meantime. Signed-off-by: Roger Pau Monné roger@citrix.com Cc: Konrad Rzeszutek

[PATCH] xen-blkfront: check feature-persitent on resume

2014-05-22 Thread Roger Pau Monne
We are missing a check to see if the backend supports persistent grants on resume, meaning we will always run with the value fetched from the firsts host on which we run on. Signed-off-by: Roger Pau Monné roger@citrix.com Cc: Konrad Rzeszutek Wilk konrad.w...@oracle.com Cc: David Vrabel

[PATCH v2 0/4] xen-blk: bug fixes

2014-02-04 Thread Roger Pau Monne
This series contain blkback bug fixes for memory leaks (patches 1 and 2) and a race (patch 3). Patch 4 removes blkif_request_segment_aligned since its memory layout is exactly the same as blkif_request_segment and should introduce no functional change. All patches should be backported to

[PATCH v2 2/4] xen-blkback: fix memory leaks

2014-02-04 Thread Roger Pau Monne
I've at least identified two possible memory leaks in blkback, both related to the shutdown path of a VBD: - blkback doesn't wait for any pending purge work to finish before cleaning the list of free_pages. The purge work will call put_free_pages and thus we might end up with pages being

[PATCH v2 4/4] xen-blkif: drop struct blkif_request_segment_aligned

2014-02-04 Thread Roger Pau Monne
This was wrongly introduced in commit 402b27f9, the only difference between blkif_request_segment_aligned and blkif_request_segment is that the former has a named padding, while both share the same memory layout. Also correct a few minor glitches in the description, including for it to no longer

[PATCH v2 1/4] xen-blkback: fix memory leak when persistent grants are used

2014-02-04 Thread Roger Pau Monne
From: Matt Rushton mrush...@amazon.com Currently shrink_free_pagepool() is called before the pages used for persistent grants are released via free_persistent_gnts(). This results in a memory leak when a VBD that uses persistent grants is torn down. Cc: Konrad Rzeszutek Wilk

[PATCH v2 3/4] xen-blkback: fix shutdown race

2014-02-04 Thread Roger Pau Monne
Introduce a new variable to keep track of the number of in-flight requests. We need to make sure that when xen_blkif_put is called the request has already been freed and we can safely free xen_blkif, which was not the case before. Signed-off-by: Roger Pau Monné roger@citrix.com Cc: Konrad

[PATCH] xen-blkback: fix memory leaks

2014-01-27 Thread Roger Pau Monne
I've at least identified two possible memory leaks in blkback, both related to the shutdown path of a VBD: - We don't wait for any pending purge work to finish before cleaning the list of free_pages. The purge work will call put_free_pages and thus we might end up with pages being added to

[PATCH 1/3] xen-blkback: fix memory leak when persistent grants are used

2014-01-28 Thread Roger Pau Monne
From: Matt Rushton mrush...@amazon.com Currently shrink_free_pagepool() is called before the pages used for persistent grants are released via free_persistent_gnts(). This results in a memory leak when a VBD that uses persistent grants is torn down. Cc: Konrad Rzeszutek Wilk

[PATCH 3/3] xen-blkback: fix shutdown race

2014-01-28 Thread Roger Pau Monne
Move the call to xen_blkif_put after we have freed the request, otherwise we have a race between the release of the request and the cleanup done in xen_blkif_free. Signed-off-by: Roger Pau Monné roger@citrix.com Cc: Konrad Rzeszutek Wilk konrad.w...@oracle.com Cc: David Vrabel

[PATCH 2/3] xen-blkback: fix memory leaks

2014-01-28 Thread Roger Pau Monne
I've at least identified two possible memory leaks in blkback, both related to the shutdown path of a VBD: - blkback doesn't wait for any pending purge work to finish before cleaning the list of free_pages. The purge work will call put_free_pages and thus we might end up with pages being

xen-blkback: bug fixes

2014-01-28 Thread Roger Pau Monne
blkback bug fixes for memory leaks (patches 1 and 2) and a race (patch 3). -- To unsubscribe from this list: send the line unsubscribe linux-kernel in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at

[PATCH v2 0/2] xen-blkfront: fixes for blkfront

2013-08-12 Thread Roger Pau Monne
This series contains a couple of improvements to blkfront to make it work better if there's a shortage on available free grants. -- To unsubscribe from this list: send the line unsubscribe linux-kernel in the body of a message to majord...@vger.kernel.org More majordomo info at

[PATCH v2 2/2] xen-blkfront: revoke foreign access for grants not mapped by the backend

2013-08-12 Thread Roger Pau Monne
There's no need to keep the foreign access in a grant if it is not persistently mapped by the backend. This allows us to free grants that are not mapped by the backend, thus preventing blkfront from hoarding all grants. The main effect of this is that blkfront will only persistently map the same

[PATCH v2 1/2] xen-blkfront: improve aproximation of required grants per request

2013-08-12 Thread Roger Pau Monne
Improve the calculation of required grants to process a request by using nr_phys_segments instead of always assuming a request is going to use all posible segments. nr_phys_segments contains the number of scatter-gather DMA addr+len pairs, which is basically what we put at every granted page.

[PATCH] xen-blkback: only attach blkback if the required features are met

2014-04-04 Thread Roger Pau Monne
Blkback cannot work properly on auto-translated guests if Xen doesn't update the IOMMU when performing grant maps/unmaps, so only attach if the newly introduced XENFEAT_hvm_gntmap_supports_iommu is found. Signed-off-by: Roger Pau Monné roger@citrix.com Cc: Konrad Rzeszutek Wilk

[PATCH] xen-blkfront: fix accounting of reqs when migrating

2015-02-02 Thread Roger Pau Monne
Current migration code uses blk_put_request in order to finish a request before requeuing it. This function doesn't update the statistics of the queue, which completely screws accounting. Use blk_end_request_all instead which properly updates the statistics of the queue. Signed-off-by: Roger Pau

[PATCH] xen-blk: add myself as maintainer of xen-blk{back/front}

2015-01-23 Thread Roger Pau Monne
I've done quite a lot of work in blkfront/blkback, and I usually end up looking at the patches, so add myself as maintainer together with Konrad. Signed-off-by: Roger Pau Monné roger@citrix.com Cc: Konrad Rzeszutek Wilk konrad.w...@oracle.com Cc: Boris Ostrovsky boris.ostrov...@oracle.com Cc:

  1   2   3   >