Re: [PATCH 08/18] DMAENGINE: ste_dma40: lock fix

From: Dan Williams
Date: Tue Jun 15 2010 - 00:53:22 EST


On Mon, Jun 14, 2010 at 9:41 AM, Linus WALLEIJ
<linus.walleij@xxxxxxxxxxxxxx> wrote:
> On 06/12/2010 12:38 AM, Dan Williams wrote:
>
>> On Tue, Jun 1, 2010 at 5:21 AM, Linus Walleij
>> <linus.walleij@xxxxxxxxxxxxxx> wrote:
>>> From: Jonas Aaberg <jonas.aberg@xxxxxxxxxxxxxx>
>>>
>>> Fix up some locking issues found by enabling lock debugging.
>>>
>>> Signed-off-by: Jonas Aaberg <jonas.aberg@xxxxxxxxxxxxxx>
>>> Signed-off-by: Linus Walleij <linus.walleij@xxxxxxxxxxxxxx>
>>> ---
>>>  drivers/dma/ste_dma40.c |   14 +++++++-------
>>>  1 files changed, 7 insertions(+), 7 deletions(-)
>>>
>>> diff --git a/drivers/dma/ste_dma40.c b/drivers/dma/ste_dma40.c index
>>> aba86bb..c4b0d37 100644
>>> --- a/drivers/dma/ste_dma40.c
>>> +++ b/drivers/dma/ste_dma40.c
>> [..]
>>>  static int d40_channel_execute_command(struct d40_chan *d40c, @@
>>> -1990,8 +1992,6 @@ static struct dma_async_tx_descriptor *d40_prep_slave_sg(struct dma_chan *chan,
>>>        if (d40d == NULL)
>>>                return NULL;
>>>
>>> -       memset(d40d, 0, sizeof(struct d40_desc));
>>> -
>>
>> This one isn't a locking bug fix.
>
> Well, actually it was overwriting a spinlock, so I would considering
> a locking bug area atleast.

Ah, I missed that you call dma_async_tx_descriptor_init() every prep.
It may be worthwhile to select ASYNC_TX_DISABLE_CHANNEL_SWITCH to get
rid of the unused fields for async_tx channel switching *.

> But if you prefer we split this one-liner into a separate patch.

You never take the embedded lock so there was not a problem, but you
can leave it in as an innocuous cleanup.

Thanks,
Dan

* I'm now thinking that channel switching should be an opt-in request
rather than opt-out, because I can foresee a driver relying on the
size reductions it affords. With the logic flipped we can disable the
driver that has this dependence.
--
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/