From 7cd10a60c3d0db95bc94073587725adc6c813cc3 Mon Sep 17 00:00:00 2001 From: Jianguo Wu Date: Thu, 6 Sep 2012 15:18:04 +0800 Subject: [IA64] Fix a node distance bug In arch ia64, has following definition: extern u8 numa_slit[MAX_NUMNODES * MAX_NUMNODES]; #define node_distance(from,to) (numa_slit[(from) * num_online_nodes() + (to)]) num_online_nodes() is a variable value, it can be changed after hot-remove/add a node. In my practice, I found node distance is wrong after offline a node in IA64 platform. For example system has 4 nodes: node distances: node 0 1 2 3 0: 10 21 21 32 1: 21 10 32 21 2: 21 32 10 21 3: 32 21 21 10 linux-drf:/sys/devices/system/node/node0 # cat distance 10 21 21 32 linux-drf:/sys/devices/system/node/node1 # cat distance 21 10 32 21 After offline node2: linux-drf:/sys/devices/system/node/node0 # cat distance 10 21 32 linux-drf:/sys/devices/system/node/node1 # cat distance 32 21 32 --------->expected value is: 21 10 21 Signed-off-by: Jianguo Wu Signed-off-by: Jiang Liu Acked-by: David Rientjes Signed-off-by: Tony Luck --- arch/ia64/include/asm/numa.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'arch/ia64') diff --git a/arch/ia64/include/asm/numa.h b/arch/ia64/include/asm/numa.h index 6a8a27cfae3e..2e27ef175652 100644 --- a/arch/ia64/include/asm/numa.h +++ b/arch/ia64/include/asm/numa.h @@ -59,7 +59,7 @@ extern struct node_cpuid_s node_cpuid[NR_CPUS]; */ extern u8 numa_slit[MAX_NUMNODES * MAX_NUMNODES]; -#define node_distance(from,to) (numa_slit[(from) * num_online_nodes() + (to)]) +#define node_distance(from,to) (numa_slit[(from) * MAX_NUMNODES + (to)]) extern int paddr_to_nid(unsigned long paddr); -- cgit v1.2.3 From 36a45e741783629e2c9039da51b95f637d56f875 Mon Sep 17 00:00:00 2001 From: Wei Yongjun Date: Mon, 10 Sep 2012 12:49:57 +0800 Subject: [IA64] kexec: Move the dereference below the NULL test The dereference should be moved below the NULL test. spatch with a semantic match is used to found this. (http://coccinelle.lip6.fr/) Signed-off-by: Wei Yongjun Signed-off-by: Tony Luck --- arch/ia64/kernel/machine_kexec.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to 'arch/ia64') diff --git a/arch/ia64/kernel/machine_kexec.c b/arch/ia64/kernel/machine_kexec.c index 070e8effa175..5151a649c96b 100644 --- a/arch/ia64/kernel/machine_kexec.c +++ b/arch/ia64/kernel/machine_kexec.c @@ -85,12 +85,13 @@ static void ia64_machine_kexec(struct unw_frame_info *info, void *arg) struct kimage *image = arg; relocate_new_kernel_t rnk; void *pal_addr = efi_get_pal_addr(); - unsigned long code_addr = (unsigned long)page_address(image->control_code_page); + unsigned long code_addr; int ii; u64 fp, gp; ia64_fptr_t *init_handler = (ia64_fptr_t *)ia64_os_init_on_kdump; BUG_ON(!image); + code_addr = (unsigned long)page_address(image->control_code_page); if (image->type == KEXEC_TYPE_CRASH) { crash_save_this_cpu(); current->thread.ksp = (__u64)info->sw - 16; -- cgit v1.2.3 From 0967237ca6521c63822340138e4d62ecf8a3d173 Mon Sep 17 00:00:00 2001 From: Tony Luck Date: Thu, 20 Sep 2012 11:47:13 -0700 Subject: [IA64] Must enable interrupts in do_notify_resume_user before calling tracehook_notify_resume() If we call with interrupts disabled, we'll be hit with: WARNING: at kernel/softirq.c:160 local_bh_enable_ip+0x150/0x180() and a stack trace like this: Call Trace: [] show_stack+0x80/0xa0 [] dump_stack+0x30/0x50 [] warn_slowpath_common+0xc0/0x100 [] warn_slowpath_null+0x40/0x60 [] local_bh_enable_ip+0x150/0x180 [] _raw_write_unlock_bh+0x40/0x60 [] unix_release_sock+0x120/0x5a0 [] unix_release+0x40/0x60 [] sock_release+0x60/0x1a0 [] sock_close+0x30/0xa0 [] __fput+0x190/0x500 [] ____fput+0x20/0x40 [] task_work_run+0x1b0/0x260 [] do_notify_resume_user+0x110/0x2a0 [] notify_resume_user+0x40/0x60 [] skip_rbs_switch+0xe0/0xf0 [] ia64_ivt+0xffffffff00040720/0x400 Fix-suggested-by: Al Viro Signed-off-by: Tony Luck --- arch/ia64/kernel/process.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'arch/ia64') diff --git a/arch/ia64/kernel/process.c b/arch/ia64/kernel/process.c index dd6fc1449741..cf84a2f37c13 100644 --- a/arch/ia64/kernel/process.c +++ b/arch/ia64/kernel/process.c @@ -196,8 +196,8 @@ do_notify_resume_user(sigset_t *unused, struct sigscratch *scr, long in_syscall) ia64_do_signal(scr, in_syscall); } - if (test_thread_flag(TIF_NOTIFY_RESUME)) { - clear_thread_flag(TIF_NOTIFY_RESUME); + if (test_and_clear_thread_flag(TIF_NOTIFY_RESUME)) { + local_irq_enable(); /* force interrupt enable */ tracehook_notify_resume(&scr->pt); } -- cgit v1.2.3 From 39c9a4ab2b91bff26801c86e423ef07fb705b3c0 Mon Sep 17 00:00:00 2001 From: Wei Yongjun Date: Thu, 27 Sep 2012 12:30:18 -0700 Subject: [IA64] xen: Fix return value check in xencomm_vtop() In case of error, the function follow_page() returns ERR_PTR() or NULL pointer. The NULL test in the error handling should be replaced with IS_ERR_OR_NULL(). dpatch engine is used to auto generated this patch. (https://github.com/weiyj/dpatch) Signed-off-by: Wei Yongjun Signed-off-by: Tony Luck --- arch/ia64/xen/xencomm.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to 'arch/ia64') diff --git a/arch/ia64/xen/xencomm.c b/arch/ia64/xen/xencomm.c index 1f5d7ac82e97..73d903ca2d64 100644 --- a/arch/ia64/xen/xencomm.c +++ b/arch/ia64/xen/xencomm.c @@ -17,6 +17,7 @@ */ #include +#include static unsigned long kernel_virtual_offset; static int is_xencomm_initialized; @@ -98,7 +99,7 @@ xencomm_vtop(unsigned long vaddr) /* We assume the page is modified. */ page = follow_page(vma, vaddr, FOLL_WRITE | FOLL_TOUCH); - if (!page) + if (IS_ERR_OR_NULL(page)) return ~0UL; return (page_to_pfn(page) << PAGE_SHIFT) | (vaddr & ~PAGE_MASK); -- cgit v1.2.3