[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Xen-devel] [PATCH v3] xen-blkfront: set pages are FOREIGN_FRAME when sharing them



On Tue, 8 May 2012, Stefano Stabellini wrote:
> I have been unable to reproduce this problem (I haven't given up yet)
> but I bet that the following patch fixes it:
> 
> 
> diff --git a/drivers/block/xen-blkfront.c b/drivers/block/xen-blkfront.c
> index e3a9945..88e9304 100644
> --- a/drivers/block/xen-blkfront.c
> +++ b/drivers/block/xen-blkfront.c
> @@ -333,7 +333,7 @@ static int blkif_queue_request(struct request *req)
>                                       buffer_mfn,
>                                       rq_data_dir(req));
>  
> -                     info->shadow[id].frame[i] = mfn_to_pfn(buffer_mfn);
> +                     info->shadow[id].frame[i] = buffer_pfn;
>                       ring_req->u.rw.seg[i] =
>                                       (struct blkif_request_segment) {
>                                               .gref       = ref,
> 
> 
> The idea is that the request contains a page for which
> 
> pfn->mfn->pfn == 0xffffffffffffffff
> 
> I am not sure exactly how it could be possible to get into this state in
> blkfront, I hope that some more tracing and code reading will be able to
> shed some lights on the issue.

The one line patch fixes the issue: when using LVM in the guest the same
page can be used in two different requests (in blkif_queue_request)
before being unmapped.
The second time mfn_to_pfn is going to return ~0 because buffer_mfn has
the FOREIGN_FRAME_BIT set.
But actually we don't need to call mfn_to_pfn at all because we already
know the pfn value, that is stored in buffer_pfn.

However the real problem remains at the time of blkif_completion: we
will remove the FOREIGN_FRAME_BIT before the other requests have been
completed.

If sharing the same page twice (or more) is a normal condition then I
might have to revisit this patch completely and choose another
strategy...

_______________________________________________
Xen-devel mailing list
Xen-devel@xxxxxxxxxxxxx
http://lists.xen.org/xen-devel


 


Rackspace

Lists.xenproject.org is hosted with RackSpace, monitoring our
servers 24x7x365 and backed by RackSpace's Fanatical Support®.