misc/genwqe: get rid of atomic allocations

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>
This commit is contained in:
Sebastian Ott 2015-09-29 18:23:50 +02:00 коммит произвёл Greg Kroah-Hartman
Родитель 6b1eb14502
Коммит 19f7767e29
3 изменённых файлов: 6 добавлений и 5 удалений

Просмотреть файл

@ -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;

Просмотреть файл

@ -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;

Просмотреть файл

@ -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,