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

From: Konrad Rzeszutek Wilk
Date: Thu May 10 2012 - 12:19:49 EST


On Wed, May 09, 2012 at 07:42:33PM +0100, Stefano Stabellini wrote:
> 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...

Ok, will wait for that and in the meantime drop the patch so I can
send a git pull to Jens.
>
> _______________________________________________
> Xen-devel mailing list
> Xen-devel@xxxxxxxxxxxxx
> http://lists.xen.org/xen-devel
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/