[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20080928184424.GA26563@8bytes.org>
Date: Sun, 28 Sep 2008 20:44:24 +0200
From: Joerg Roedel <joro@...tes.org>
To: FUJITA Tomonori <fujita.tomonori@....ntt.co.jp>
Cc: joerg.roedel@....com, linux-kernel@...r.kernel.org,
kvm@...r.kernel.org, iommu@...ts.linux-foundation.org,
dwmw2@...radead.org, muli@...ibm.com, amit.shah@...ranet.com,
mingo@...hat.com
Subject: Re: [PATCH 9/9] x86/iommu: use dma_ops_list in get_dma_ops
On Sun, Sep 28, 2008 at 11:21:23PM +0900, FUJITA Tomonori wrote:
> > +struct dma_mapping_ops *find_dma_ops_for_device(struct device *dev)
> > +{
> > + int i;
> > + unsigned long flags;
> > + struct dma_mapping_ops *entry, *ops = NULL;
> > +
> > + read_lock_irqsave(&dma_ops_list_lock, flags);
> > +
> > + for (i = 0; i < DMA_OPS_TYPE_MAX; ++i)
> > + list_for_each_entry(entry, &dma_ops_list[i], list) {
> > + if (!entry->device_supported)
> > + continue;
> > + if (entry->device_supported(dev)) {
> > + ops = entry;
> > + goto out;
> > + }
> > + }
> > +out:
> > + read_unlock_irqrestore(&dma_ops_list_lock, flags);
>
> Hmm, every time we call dma_sg/map_single, we call
> read_lock_irqsave(&dma_ops_list_lock, flags). It's likely that we see
> notable performance drop?
Hmm, we should only call find_dma_ops_for_device() the first time a
dma api call is done (look into get_dma_ops). But I also thought about
how this lock can be avoided. In the real world it should not be
necessary because the dma_ops list is initialized before dma api calls
are done. But since there is now a register function which can be called
its safer this way. What do you think, are we still safe enough without
this lock?
Joerg
--
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