From 9345b8f94bfd0df479fafdbe3f1c30a3b43aeee3 Mon Sep 17 00:00:00 2001 From: Shiraz Hashim Date: Sat, 16 Apr 2016 11:43:02 +0530 Subject: mm/memblock: disable local irqs while late memblock changes There is a possibility of deadlock while doing late memblock configuration as only preemption is disabled and irq can be serviced while seqlock is held and in turn memblock_is_memory can be called from irq context thus trying to claim seqlock again. Following call stack was observed, [] memblock_search+0x1c [] memblock_is_memory+0x10 [] free_kmem_pages+0x44 [] free_task+0x28 [] rcu_process_callbacks+0x488 [] __do_softirq+0x150 [] irq_exit+0x84 [] handle_IPI+0x12c [] gic_handle_irq+0x70 [] __irq_svc+0x40 [] memblock_region_resize_late_end+0xc [] removed_alloc+0x110 [] pil_boot+0x2b0 [] __subsystem_get+0xe0 [] subsys_device_open+0x74 [] chrdev_open+0x12c [] do_dentry_open+0x280 [] do_last+0x9a4 [] path_openat+0x23c [] do_filp_open+0x2c Fix it by disabling irqs during late memblock configuration. It is a one time operation which changes memblock related data structures and doesn't carry performance impact. CRs-Fixed: 1003890 Change-Id: I3ff1894f0c80580920b1971cda357915665b5054 Signed-off-by: Shiraz Hashim --- include/linux/memblock.h | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'include/linux') diff --git a/include/linux/memblock.h b/include/linux/memblock.h index 42b40345119f..3d28c3a18b95 100644 --- a/include/linux/memblock.h +++ b/include/linux/memblock.h @@ -83,8 +83,8 @@ int memblock_mark_hotplug(phys_addr_t base, phys_addr_t size); int memblock_clear_hotplug(phys_addr_t base, phys_addr_t size); int memblock_mark_mirror(phys_addr_t base, phys_addr_t size); ulong choose_memblock_flags(void); -void memblock_region_resize_late_begin(void); -void memblock_region_resize_late_end(void); +unsigned long memblock_region_resize_late_begin(void); +void memblock_region_resize_late_end(unsigned long); /* Low level functions */ int memblock_add_range(struct memblock_type *type, -- cgit v1.2.3