Re: [PATCH 9/9] x86/iommu: use dma_ops_list in get_dma_ops

From: FUJITA Tomonori
Date: Sun Sep 28 2008 - 10:22:48 EST


On Mon, 22 Sep 2008 20:21:21 +0200
Joerg Roedel <joerg.roedel@xxxxxxx> wrote:

> This patch enables stackable dma_ops on x86. To do this, it also enables
> the per-device dma_ops on i386.
>
> Signed-off-by: Joerg Roedel <joerg.roedel@xxxxxxx>
> ---
> arch/x86/kernel/pci-dma.c | 26 ++++++++++++++++++++++++++
> include/asm-x86/device.h | 6 +++---
> include/asm-x86/dma-mapping.h | 14 +++++++-------
> 3 files changed, 36 insertions(+), 10 deletions(-)
>
> diff --git a/arch/x86/kernel/pci-dma.c b/arch/x86/kernel/pci-dma.c
> index b990fb6..2e517c2 100644
> --- a/arch/x86/kernel/pci-dma.c
> +++ b/arch/x86/kernel/pci-dma.c
> @@ -82,6 +82,32 @@ void x86_register_dma_ops(struct dma_mapping_ops *ops,
> write_unlock_irqrestore(&dma_ops_list_lock, flags);
> }
>
> +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?
--
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/