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

[Xen-devel] [PATCH] make sure dma_map_single doesn't sleep


  • To: xen-devel@xxxxxxxxxxxxxxxxxxx
  • From: Chris Wright <chrisw@xxxxxxxx>
  • Date: Wed, 10 Aug 2005 00:02:35 -0700
  • Delivery-date: Wed, 10 Aug 2005 07:00:54 +0000
  • List-id: Xen developer discussion <xen-devel.lists.xensource.com>

dma_map_single can't sleep since it may be called with locks held, or
interrupts off, etc.   Thus it shouldn't make sleeping allocations.

Signed-off-by: Chris Wright <chrisw@xxxxxxxx>

diff -r 38c7c25b3cb9 linux-2.6-xen-sparse/arch/xen/i386/kernel/pci-dma.c
--- a/linux-2.6-xen-sparse/arch/xen/i386/kernel/pci-dma.c       Tue Aug  9 
13:53:15 2005
+++ b/linux-2.6-xen-sparse/arch/xen/i386/kernel/pci-dma.c       Wed Aug 10 
01:35:28 2005
@@ -182,8 +182,8 @@
        if ((((unsigned int)ptr & ~PAGE_MASK) + size) <= PAGE_SIZE) {
                dma = virt_to_bus(ptr);
        } else {
-               BUG_ON((bnc = dma_alloc_coherent(dev, size, &dma, 0)) == NULL);
-               BUG_ON((ent = kmalloc(sizeof(*ent), GFP_KERNEL)) == NULL);
+               BUG_ON((bnc = dma_alloc_coherent(dev, size, &dma, GFP_ATOMIC)) 
== NULL);
+               BUG_ON((ent = kmalloc(sizeof(*ent), GFP_ATOMIC)) == NULL);
                if (direction != DMA_FROM_DEVICE)
                        memcpy(bnc, ptr, size);
                ent->dma    = dma;
diff -r 38c7c25b3cb9 linux-2.6-xen-sparse/arch/xen/x86_64/kernel/pci-dma.c
--- a/linux-2.6-xen-sparse/arch/xen/x86_64/kernel/pci-dma.c     Tue Aug  9 
13:53:15 2005
+++ b/linux-2.6-xen-sparse/arch/xen/x86_64/kernel/pci-dma.c     Wed Aug 10 
01:35:28 2005
@@ -234,8 +234,8 @@
        if (((((unsigned long)ptr) & ~PAGE_MASK) + size) <= PAGE_SIZE) {
                dma = virt_to_bus(ptr);
        } else {
-               BUG_ON((bnc = dma_alloc_coherent(dev, size, &dma, 0)) == NULL);
-               BUG_ON((ent = kmalloc(sizeof(*ent), GFP_KERNEL)) == NULL);
+               BUG_ON((bnc = dma_alloc_coherent(dev, size, &dma, GFP_ATOMIC)) 
== NULL);
+               BUG_ON((ent = kmalloc(sizeof(*ent), GFP_ATOMIC)) == NULL);
                if (direction != DMA_FROM_DEVICE)
                        memcpy(bnc, ptr, size);
                ent->dma    = dma;

_______________________________________________
Xen-devel mailing list
Xen-devel@xxxxxxxxxxxxxxxxxxx
http://lists.xensource.com/xen-devel


 


Rackspace

Lists.xenproject.org is hosted with RackSpace, monitoring our
servers 24x7x365 and backed by RackSpace's Fanatical Support®.