lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Date:	Fri, 16 Sep 2011 17:06:34 +0800
From:	Barry Song <21cnbao@...il.com>
To:	"Koul, Vinod" <vinod.koul@...el.com>
Cc:	"Baohua.Song@....com" <Baohua.Song@....com>,
	"arnd@...db.de" <arnd@...db.de>,
	"linux-kernel@...r.kernel.org" <linux-kernel@...r.kernel.org>,
	"workgroup.linux@....com" <workgroup.linux@....com>,
	"rongjun.ying@....com" <rongjun.ying@....com>,
	"Williams, Dan J" <dan.j.williams@...el.com>,
	"linux-arm-kernel@...ts.infradead.org" 
	<linux-arm-kernel@...ts.infradead.org>
Subject: Re: [PATCH] dmaengine: add CSR SiRFprimaII DMAC driver

>>> +/* Interrupt handler */
>>> +static irqreturn_t sirfsoc_dma_irq(int irq, void *data)
>>> +{
>>> +     struct sirfsoc_dma *sdma = data;
>>> +     struct sirfsoc_dma_chan *schan;
>>> +     u32 is;
>>> +     int ch;
>>> +
>>> +     is = readl_relaxed(sdma->regs + SIRFSOC_DMA_CH_INT);
>>> +     while ((ch = fls(is) - 1) >= 0) {
>>> +             is &= ~(1 << ch);
>>> +             writel_relaxed(1 << ch, sdma->regs + SIRFSOC_DMA_CH_INT);
>>> +             schan = &sdma->channels[ch];
>>> +
>>> +             spin_lock(&schan->lock);
>>> +
>>> +             /* Execute queued descriptors */
>>> +             list_splice_tail_init(&schan->active, &schan->completed);
>>> +             if (!list_empty(&schan->queued))
>>> +                     sirfsoc_dma_execute(schan);
>>> +
>>> +             spin_unlock(&schan->lock);
>>> +     }
>> Here you know which channel has triggered interrupt and you may pass
>> this info to your tasklet and avoid scanning again there
>
> ok. let me see.

we really know what channels have been trigger in irq. but we lose a
good way to transfer that to tasklet actually. if we place a flag in
schan data.
1. there can be more 1 channels triggers, then tasklet still need a for(...)
2. we actually need a lock between irq and tasklet. otherwise, new irq
coming in tasklet might change the flag.

so i think current way should be better.

>
>>
>>> +
>>> +     /* Schedule tasklet */
>>> +     tasklet_schedule(&sdma->tasklet);
>>> +
>>> +     return IRQ_HANDLED;
>>> +}
>>> +
>>> +/* process completed descriptors */
>>> +static void sirfsoc_dma_process_completed(struct sirfsoc_dma *sdma)
>>> +{
>>> +     dma_cookie_t last_cookie = 0;
>>> +     struct sirfsoc_dma_chan *schan;
>>> +     struct sirfsoc_dma_desc *mdesc;
>>> +     struct dma_async_tx_descriptor *desc;
>>> +     unsigned long flags;
>>> +     LIST_HEAD(list);
>>> +     int i;
>>> +
>>> +     for (i = 0; i < sdma->dma.chancnt; i++) {
>>> +             schan = &sdma->channels[i];
>>> +
>>> +             /* Get all completed descriptors */
>>> +             spin_lock_irqsave(&schan->lock, flags);
>> this will block interrupts, i dont see a reason why this should be used
>> here??
>
> ok. no irq is accessing completed list.

sorry. after reading more carefully, we actually need this lock since
irq will move finished active node to completed list. we need to keep
the completed safe.

i have fixed other issues and used jassi's v1 patch (generic xfer) and
will send v2.

Thanks
barry
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ