qemu-devel
[Top][All Lists]
Advanced

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

Re: [Qemu-devel] [PATCH 09/13] iommu: Add facility to cancel in-use dma


From: Benjamin Herrenschmidt
Subject: Re: [Qemu-devel] [PATCH 09/13] iommu: Add facility to cancel in-use dma memory maps
Date: Fri, 22 Jun 2012 13:18:58 +1000

On Wed, 2012-06-20 at 16:25 -0500, Anthony Liguori wrote:

> > +static void dma_aio_cancel(BlockDriverAIOCB *acb)
> > +{
> > +    DMAAIOCB *dbs = container_of(acb, DMAAIOCB, common);
> > +
> > +    trace_dma_aio_cancel(dbs);
> > +
> > +    if (dbs->acb) {
> > +        BlockDriverAIOCB *acb = dbs->acb;
> > +        dbs->acb = NULL;
> > +        dbs->in_cancel = true;
> > +        bdrv_aio_cancel(acb);
> > +        dbs->in_cancel = false;
> > +    }
> > +    dbs->common.cb = NULL;
> > +    dma_complete(dbs, 0);
> 
> So this cancellation stuff is hopelessly broken
> 
> It's simply not possible to fully cancel pending DMA in a synchronous 
> callback.
> 
> Indeed, bdrv_aio_cancel ends up having a nasty little loop in it:

Yes, it's broken. Note that the patch didn't add the above function,
only moved it around.

In any case, I've decided to just drop that patch completely from the
series. IE. I'm not adding the dma_memory_map_with_cancel() variant,
there's no point since:

 - Nothing will call the cancel callback today and possibly for a while

 - Nothing passes a cancel callback other than the bdrv stuff and that
callback is hopelessly broken as you mentioned above.

So there's just no point. We will add an optional cancel callback again
later when we eventually decide to sort that problem out properly, it
will be an asynchronous cancel, ie, just "initiate" the cancellation,
and I'll probably add that as an argument to the normal dma_memory_map()
(adding NULL to all callers that don't care) at that point.

For now, let's not add a known to be broken and unused interface.

Cheers,
Ben.





reply via email to

[Prev in Thread] Current Thread [Next in Thread]