misc/genwqe: get rid of atomic allocations
authorSebastian Ott <sebott@linux.vnet.ibm.com>
Tue, 29 Sep 2015 16:23:50 +0000 (18:23 +0200)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Sun, 4 Oct 2015 11:42:33 +0000 (12:42 +0100)
we received reports of failed allocations in genwqe code:

[  733.550955] genwqe_gzip: page allocation failure: order:1, mode:0x20
[  733.550964] CPU: 2 PID: 1846 Comm: genwqe_gzip Not tainted 4.3.0-rc3-00042-g3225031 #78
[  733.550968]        000000002782b830 000000002782b8c0 0000000000000002 0000000000000000
       000000002782b960 000000002782b8d8 000000002782b8d8 00000000001134a0
       0000000000000000 0000000000892b2a 0000000000871d0a 000000000000000b
       000000002782b920 000000002782b8c0 0000000000000000 0000000000000000
       0000000000000000 00000000001134a0 000000002782b8c0 000000002782b920
[  733.551003] Call Trace:
[  733.551013] ([<0000000000113388>] show_trace+0xf8/0x158)
[  733.551018]  [<0000000000113452>] show_stack+0x6a/0xe8
[  733.551024]  [<00000000004611d4>] dump_stack+0x7c/0xd8
[  733.551031]  [<000000000024dc22>] warn_alloc_failed+0xda/0x150
[  733.551036]  [<000000000025268e>] __alloc_pages_nodemask+0x94e/0xbc0
[  733.551041]  [<000000000012bcd8>] s390_dma_alloc+0x70/0x1a0
[  733.551054]  [<000003ff804d8e8c>] __genwqe_alloc_consistent+0x84/0xd0 [genwqe_card]
[  733.551063]  [<000003ff804d90c2>] genwqe_alloc_sync_sgl+0x13a/0x328 [genwqe_card]
[  733.551066]  [<000003ff804d41a0>] do_execute_ddcb+0x1f8/0x388 [genwqe_card]
[  733.551069]  [<000003ff804d48c8>] genwqe_ioctl+0x598/0xd50 [genwqe_card]
[  733.551072]  [<00000000002cc90c>] do_vfs_ioctl+0x3f4/0x590
[  733.551074]  [<00000000002ccb46>] SyS_ioctl+0x9e/0xb0
[  733.551078]  [<00000000006c8166>] system_call+0xd6/0x258
[  733.551080]  [<000003fffd25819a>] 0x3fffd25819a
[  733.551082] no locks held by genwqe_gzip/1846.

This specific allocation and some others in genwqe are unnecessary flagged
as atomic.

All of genwqe's atomic allocations happen in a context where it's allowed
to sleep. Change these to use GFP_KERNEL.

Signed-off-by: Sebastian Ott <sebott@linux.vnet.ibm.com>
Acked-by: Frank Haverkamp <haver@linux.vnet.ibm.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
drivers/misc/genwqe/card_ddcb.c
drivers/misc/genwqe/card_dev.c
drivers/misc/genwqe/card_utils.c

index 6d51e5f086642adba8ac41c39b1347082f875083..353ee0cc733d8b7773f70393b92c24f9c9b02e56 100644 (file)
@@ -203,7 +203,7 @@ struct genwqe_ddcb_cmd *ddcb_requ_alloc(void)
 {
        struct ddcb_requ *req;
 
-       req = kzalloc(sizeof(*req), GFP_ATOMIC);
+       req = kzalloc(sizeof(*req), GFP_KERNEL);
        if (!req)
                return NULL;
 
index 70e62d6a3231fd7ce4f42ea2cc8c2065163f083c..7f1b282d7d963c65cf8a7a8bf5d7f559f668951e 100644 (file)
@@ -449,7 +449,7 @@ static int genwqe_mmap(struct file *filp, struct vm_area_struct *vma)
        if (get_order(vsize) > MAX_ORDER)
                return -ENOMEM;
 
-       dma_map = kzalloc(sizeof(struct dma_mapping), GFP_ATOMIC);
+       dma_map = kzalloc(sizeof(struct dma_mapping), GFP_KERNEL);
        if (dma_map == NULL)
                return -ENOMEM;
 
@@ -785,7 +785,7 @@ static int genwqe_pin_mem(struct genwqe_file *cfile, struct genwqe_mem *m)
        map_addr = (m->addr & PAGE_MASK);
        map_size = round_up(m->size + (m->addr & ~PAGE_MASK), PAGE_SIZE);
 
-       dma_map = kzalloc(sizeof(struct dma_mapping), GFP_ATOMIC);
+       dma_map = kzalloc(sizeof(struct dma_mapping), GFP_KERNEL);
        if (dma_map == NULL)
                return -ENOMEM;
 
index 1ca94e6fa8fbb54452ad70b72c466c203c1aab6c..222367cc8c815ba9214e9e9c25a8482f7967a772 100644 (file)
@@ -220,7 +220,8 @@ void *__genwqe_alloc_consistent(struct genwqe_dev *cd, size_t size,
        if (get_order(size) > MAX_ORDER)
                return NULL;
 
-       return pci_alloc_consistent(cd->pci_dev, size, dma_handle);
+       return dma_alloc_coherent(&cd->pci_dev->dev, size, dma_handle,
+                                 GFP_KERNEL);
 }
 
 void __genwqe_free_consistent(struct genwqe_dev *cd, size_t size,
@@ -229,7 +230,7 @@ void __genwqe_free_consistent(struct genwqe_dev *cd, size_t size,
        if (vaddr == NULL)
                return;
 
-       pci_free_consistent(cd->pci_dev, size, vaddr, dma_handle);
+       dma_free_coherent(&cd->pci_dev->dev, size, vaddr, dma_handle);
 }
 
 static void genwqe_unmap_pages(struct genwqe_dev *cd, dma_addr_t *dma_list,