* [PATCH RESEND 1/2] xen/blkback: safely unmap purge persistent grants
@ 2015-03-26 12:16 Bob Liu
0 siblings, 0 replies; 8+ messages in thread
From: Bob Liu @ 2015-03-26 12:16 UTC (permalink / raw)
To: xen-devel
Cc: jennifer.herbert, linux-kernel, Bob Liu, david.vrabel,
boris.ostrovsky, roger.pau
Commit c43cf3ea8385 ("xen-blkback: safely unmap grants in case they are still
in use") use gnttab_unmap_refs_async() to wait until the mapped pages are no
longer in use before unmapping them, but that commit missed the persistent case.
Purge persistent pages can't be unmapped either unless no longer in use.
Signed-off-by: Bob Liu <bob.liu@oracle.com>
---
drivers/block/xen-blkback/blkback.c | 24 ++++++++++++++++++------
1 file changed, 18 insertions(+), 6 deletions(-)
diff --git a/drivers/block/xen-blkback/blkback.c b/drivers/block/xen-blkback/blkback.c
index 2a04d34..f59d7c3 100644
--- a/drivers/block/xen-blkback/blkback.c
+++ b/drivers/block/xen-blkback/blkback.c
@@ -327,8 +327,18 @@ void xen_blkbk_unmap_purged_grants(struct work_struct *work)
struct gnttab_unmap_grant_ref unmap[BLKIF_MAX_SEGMENTS_PER_REQUEST];
struct page *pages[BLKIF_MAX_SEGMENTS_PER_REQUEST];
struct persistent_gnt *persistent_gnt;
- int ret, segs_to_unmap = 0;
+ int segs_to_unmap = 0;
struct xen_blkif *blkif = container_of(work, typeof(*blkif), persistent_purge_work);
+ struct gntab_unmap_queue_data unmap_data;
+ struct completion unmap_completion;
+
+ init_completion(&unmap_completion);
+
+ unmap_data.data = &unmap_completion;
+ unmap_data.done = &free_persistent_gnts_unmap_callback;
+ unmap_data.pages = pages;
+ unmap_data.unmap_ops = unmap;
+ unmap_data.kunmap_ops = NULL;
while(!list_empty(&blkif->persistent_purge_list)) {
persistent_gnt = list_first_entry(&blkif->persistent_purge_list,
@@ -344,17 +354,19 @@ void xen_blkbk_unmap_purged_grants(struct work_struct *work)
pages[segs_to_unmap] = persistent_gnt->page;
if (++segs_to_unmap == BLKIF_MAX_SEGMENTS_PER_REQUEST) {
- ret = gnttab_unmap_refs(unmap, NULL, pages,
- segs_to_unmap);
- BUG_ON(ret);
+ unmap_data.count = segs_to_unmap;
+ gnttab_unmap_refs_async(&unmap_data);
+ wait_for_completion(&unmap_completion);
+
put_free_pages(blkif, pages, segs_to_unmap);
segs_to_unmap = 0;
}
kfree(persistent_gnt);
}
if (segs_to_unmap > 0) {
- ret = gnttab_unmap_refs(unmap, NULL, pages, segs_to_unmap);
- BUG_ON(ret);
+ unmap_data.count = segs_to_unmap;
+ gnttab_unmap_refs_async(&unmap_data);
+ wait_for_completion(&unmap_completion);
put_free_pages(blkif, pages, segs_to_unmap);
}
}
--
1.8.3.1
^ permalink raw reply related [flat|nested] 8+ messages in thread
* [PATCH RESEND 1/2] xen/blkback: safely unmap purge persistent grants
@ 2015-03-26 12:16 Bob Liu
2015-03-26 15:23 ` Roger Pau Monné
2015-03-26 15:23 ` Roger Pau Monné
0 siblings, 2 replies; 8+ messages in thread
From: Bob Liu @ 2015-03-26 12:16 UTC (permalink / raw)
To: xen-devel
Cc: boris.ostrovsky, jennifer.herbert, david.vrabel, roger.pau,
linux-kernel, konrad.wilk, Bob Liu
Commit c43cf3ea8385 ("xen-blkback: safely unmap grants in case they are still
in use") use gnttab_unmap_refs_async() to wait until the mapped pages are no
longer in use before unmapping them, but that commit missed the persistent case.
Purge persistent pages can't be unmapped either unless no longer in use.
Signed-off-by: Bob Liu <bob.liu@oracle.com>
---
drivers/block/xen-blkback/blkback.c | 24 ++++++++++++++++++------
1 file changed, 18 insertions(+), 6 deletions(-)
diff --git a/drivers/block/xen-blkback/blkback.c b/drivers/block/xen-blkback/blkback.c
index 2a04d34..f59d7c3 100644
--- a/drivers/block/xen-blkback/blkback.c
+++ b/drivers/block/xen-blkback/blkback.c
@@ -327,8 +327,18 @@ void xen_blkbk_unmap_purged_grants(struct work_struct *work)
struct gnttab_unmap_grant_ref unmap[BLKIF_MAX_SEGMENTS_PER_REQUEST];
struct page *pages[BLKIF_MAX_SEGMENTS_PER_REQUEST];
struct persistent_gnt *persistent_gnt;
- int ret, segs_to_unmap = 0;
+ int segs_to_unmap = 0;
struct xen_blkif *blkif = container_of(work, typeof(*blkif), persistent_purge_work);
+ struct gntab_unmap_queue_data unmap_data;
+ struct completion unmap_completion;
+
+ init_completion(&unmap_completion);
+
+ unmap_data.data = &unmap_completion;
+ unmap_data.done = &free_persistent_gnts_unmap_callback;
+ unmap_data.pages = pages;
+ unmap_data.unmap_ops = unmap;
+ unmap_data.kunmap_ops = NULL;
while(!list_empty(&blkif->persistent_purge_list)) {
persistent_gnt = list_first_entry(&blkif->persistent_purge_list,
@@ -344,17 +354,19 @@ void xen_blkbk_unmap_purged_grants(struct work_struct *work)
pages[segs_to_unmap] = persistent_gnt->page;
if (++segs_to_unmap == BLKIF_MAX_SEGMENTS_PER_REQUEST) {
- ret = gnttab_unmap_refs(unmap, NULL, pages,
- segs_to_unmap);
- BUG_ON(ret);
+ unmap_data.count = segs_to_unmap;
+ gnttab_unmap_refs_async(&unmap_data);
+ wait_for_completion(&unmap_completion);
+
put_free_pages(blkif, pages, segs_to_unmap);
segs_to_unmap = 0;
}
kfree(persistent_gnt);
}
if (segs_to_unmap > 0) {
- ret = gnttab_unmap_refs(unmap, NULL, pages, segs_to_unmap);
- BUG_ON(ret);
+ unmap_data.count = segs_to_unmap;
+ gnttab_unmap_refs_async(&unmap_data);
+ wait_for_completion(&unmap_completion);
put_free_pages(blkif, pages, segs_to_unmap);
}
}
--
1.8.3.1
^ permalink raw reply related [flat|nested] 8+ messages in thread
* Re: [PATCH RESEND 1/2] xen/blkback: safely unmap purge persistent grants
2015-03-26 12:16 Bob Liu
@ 2015-03-26 15:23 ` Roger Pau Monné
2015-03-26 15:23 ` Roger Pau Monné
1 sibling, 0 replies; 8+ messages in thread
From: Roger Pau Monné @ 2015-03-26 15:23 UTC (permalink / raw)
To: Bob Liu, xen-devel
Cc: boris.ostrovsky, jennifer.herbert, david.vrabel, linux-kernel
El 26/03/15 a les 13.16, Bob Liu ha escrit:
> Commit c43cf3ea8385 ("xen-blkback: safely unmap grants in case they are still
> in use") use gnttab_unmap_refs_async() to wait until the mapped pages are no
> longer in use before unmapping them, but that commit missed the persistent case.
> Purge persistent pages can't be unmapped either unless no longer in use.
>
> Signed-off-by: Bob Liu <bob.liu@oracle.com>
AFAICT since this is basically the same patch as what I've sent:
Acked-by: Roger Pau Monné <roger.pau@citrix.com>
^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: [PATCH RESEND 1/2] xen/blkback: safely unmap purge persistent grants
2015-03-26 12:16 Bob Liu
2015-03-26 15:23 ` Roger Pau Monné
@ 2015-03-26 15:23 ` Roger Pau Monné
2015-03-26 19:01 ` Konrad Rzeszutek Wilk
2015-03-26 19:01 ` Konrad Rzeszutek Wilk
1 sibling, 2 replies; 8+ messages in thread
From: Roger Pau Monné @ 2015-03-26 15:23 UTC (permalink / raw)
To: Bob Liu, xen-devel
Cc: boris.ostrovsky, jennifer.herbert, david.vrabel, linux-kernel,
konrad.wilk
El 26/03/15 a les 13.16, Bob Liu ha escrit:
> Commit c43cf3ea8385 ("xen-blkback: safely unmap grants in case they are still
> in use") use gnttab_unmap_refs_async() to wait until the mapped pages are no
> longer in use before unmapping them, but that commit missed the persistent case.
> Purge persistent pages can't be unmapped either unless no longer in use.
>
> Signed-off-by: Bob Liu <bob.liu@oracle.com>
AFAICT since this is basically the same patch as what I've sent:
Acked-by: Roger Pau Monné <roger.pau@citrix.com>
^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: [PATCH RESEND 1/2] xen/blkback: safely unmap purge persistent grants
2015-03-26 15:23 ` Roger Pau Monné
@ 2015-03-26 19:01 ` Konrad Rzeszutek Wilk
2015-03-26 19:01 ` Konrad Rzeszutek Wilk
1 sibling, 0 replies; 8+ messages in thread
From: Konrad Rzeszutek Wilk @ 2015-03-26 19:01 UTC (permalink / raw)
To: Roger Pau Monné, axboe
Cc: jennifer.herbert, linux-kernel, david.vrabel, xen-devel, boris.ostrovsky
On Thu, Mar 26, 2015 at 04:23:27PM +0100, Roger Pau Monné wrote:
> El 26/03/15 a les 13.16, Bob Liu ha escrit:
> > Commit c43cf3ea8385 ("xen-blkback: safely unmap grants in case they are still
> > in use") use gnttab_unmap_refs_async() to wait until the mapped pages are no
> > longer in use before unmapping them, but that commit missed the persistent case.
> > Purge persistent pages can't be unmapped either unless no longer in use.
> >
> > Signed-off-by: Bob Liu <bob.liu@oracle.com>
>
> AFAICT since this is basically the same patch as what I've sent:
>
> Acked-by: Roger Pau Monné <roger.pau@citrix.com>
>
Hey Jens,
These patches are on top of patches that add this framework in the Xen tree.
Would you be OK with this patch (and the other which I will CC shortly)
to go through the Xen tree?
Thanks.
^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: [PATCH RESEND 1/2] xen/blkback: safely unmap purge persistent grants
2015-03-26 15:23 ` Roger Pau Monné
2015-03-26 19:01 ` Konrad Rzeszutek Wilk
@ 2015-03-26 19:01 ` Konrad Rzeszutek Wilk
2015-03-26 20:11 ` Jens Axboe
2015-03-26 20:11 ` Jens Axboe
1 sibling, 2 replies; 8+ messages in thread
From: Konrad Rzeszutek Wilk @ 2015-03-26 19:01 UTC (permalink / raw)
To: Roger Pau Monné, axboe
Cc: Bob Liu, xen-devel, boris.ostrovsky, jennifer.herbert,
david.vrabel, linux-kernel
On Thu, Mar 26, 2015 at 04:23:27PM +0100, Roger Pau Monné wrote:
> El 26/03/15 a les 13.16, Bob Liu ha escrit:
> > Commit c43cf3ea8385 ("xen-blkback: safely unmap grants in case they are still
> > in use") use gnttab_unmap_refs_async() to wait until the mapped pages are no
> > longer in use before unmapping them, but that commit missed the persistent case.
> > Purge persistent pages can't be unmapped either unless no longer in use.
> >
> > Signed-off-by: Bob Liu <bob.liu@oracle.com>
>
> AFAICT since this is basically the same patch as what I've sent:
>
> Acked-by: Roger Pau Monné <roger.pau@citrix.com>
>
Hey Jens,
These patches are on top of patches that add this framework in the Xen tree.
Would you be OK with this patch (and the other which I will CC shortly)
to go through the Xen tree?
Thanks.
^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: [PATCH RESEND 1/2] xen/blkback: safely unmap purge persistent grants
2015-03-26 19:01 ` Konrad Rzeszutek Wilk
@ 2015-03-26 20:11 ` Jens Axboe
2015-03-26 20:11 ` Jens Axboe
1 sibling, 0 replies; 8+ messages in thread
From: Jens Axboe @ 2015-03-26 20:11 UTC (permalink / raw)
To: Konrad Rzeszutek Wilk, Roger Pau Monné
Cc: jennifer.herbert, linux-kernel, david.vrabel, xen-devel, boris.ostrovsky
On 03/26/2015 01:01 PM, Konrad Rzeszutek Wilk wrote:
> On Thu, Mar 26, 2015 at 04:23:27PM +0100, Roger Pau Monné wrote:
>> El 26/03/15 a les 13.16, Bob Liu ha escrit:
>>> Commit c43cf3ea8385 ("xen-blkback: safely unmap grants in case they are still
>>> in use") use gnttab_unmap_refs_async() to wait until the mapped pages are no
>>> longer in use before unmapping them, but that commit missed the persistent case.
>>> Purge persistent pages can't be unmapped either unless no longer in use.
>>>
>>> Signed-off-by: Bob Liu <bob.liu@oracle.com>
>>
>> AFAICT since this is basically the same patch as what I've sent:
>>
>> Acked-by: Roger Pau Monné <roger.pau@citrix.com>
>>
>
> Hey Jens,
>
> These patches are on top of patches that add this framework in the Xen tree.
> Would you be OK with this patch (and the other which I will CC shortly)
> to go through the Xen tree?
Sure that's fine.
--
Jens Axboe
^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: [PATCH RESEND 1/2] xen/blkback: safely unmap purge persistent grants
2015-03-26 19:01 ` Konrad Rzeszutek Wilk
2015-03-26 20:11 ` Jens Axboe
@ 2015-03-26 20:11 ` Jens Axboe
1 sibling, 0 replies; 8+ messages in thread
From: Jens Axboe @ 2015-03-26 20:11 UTC (permalink / raw)
To: Konrad Rzeszutek Wilk, Roger Pau Monné
Cc: Bob Liu, xen-devel, boris.ostrovsky, jennifer.herbert,
david.vrabel, linux-kernel
On 03/26/2015 01:01 PM, Konrad Rzeszutek Wilk wrote:
> On Thu, Mar 26, 2015 at 04:23:27PM +0100, Roger Pau Monné wrote:
>> El 26/03/15 a les 13.16, Bob Liu ha escrit:
>>> Commit c43cf3ea8385 ("xen-blkback: safely unmap grants in case they are still
>>> in use") use gnttab_unmap_refs_async() to wait until the mapped pages are no
>>> longer in use before unmapping them, but that commit missed the persistent case.
>>> Purge persistent pages can't be unmapped either unless no longer in use.
>>>
>>> Signed-off-by: Bob Liu <bob.liu@oracle.com>
>>
>> AFAICT since this is basically the same patch as what I've sent:
>>
>> Acked-by: Roger Pau Monné <roger.pau@citrix.com>
>>
>
> Hey Jens,
>
> These patches are on top of patches that add this framework in the Xen tree.
> Would you be OK with this patch (and the other which I will CC shortly)
> to go through the Xen tree?
Sure that's fine.
--
Jens Axboe
^ permalink raw reply [flat|nested] 8+ messages in thread
end of thread, other threads:[~2015-03-26 20:11 UTC | newest]
Thread overview: 8+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2015-03-26 12:16 [PATCH RESEND 1/2] xen/blkback: safely unmap purge persistent grants Bob Liu
2015-03-26 12:16 Bob Liu
2015-03-26 15:23 ` Roger Pau Monné
2015-03-26 15:23 ` Roger Pau Monné
2015-03-26 19:01 ` Konrad Rzeszutek Wilk
2015-03-26 19:01 ` Konrad Rzeszutek Wilk
2015-03-26 20:11 ` Jens Axboe
2015-03-26 20:11 ` Jens Axboe
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.