From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Date: Sat, 26 Jan 2013 15:53:57 +0800 From: Wang YanQing To: akpm@linux-foundation.org Cc: peterz@infradead.org, tglx@linutronix.de, mina86@mina86.org, srivatsa.bhat@linux.vnet.ibm.com, linux-kernel@vger.kernel.org, torvalds@linux-foundation.org, stable@vger.kernel.org Subject: [PATCH]smp: Fix send func call IPI to empty cpu mask Message-ID: <20130126075357.GA3205@udknight> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline Sender: linux-kernel-owner@vger.kernel.org List-ID: I get below warning every day with 3.7, one or two times per day. [ 2235.186027] WARNING: at /mnt/sda7/kernel/linux/arch/x86/kernel/apic/ipi.c:109 default_send_IPI_mask_logical+0x2f/0xb8() [ 2235.186030] Hardware name: Aspire 4741 [ 2235.186032] empty IPI mask [ 2235.186034] Modules linked in: vboxpci(O) vboxnetadp(O) vboxnetflt(O) vboxdrv(O) nvidia(PO) wl(O) [ 2235.186046] Pid: 5542, comm: pool Tainted: P O 3.7.2+ #41 [ 2235.186049] Call Trace: [ 2235.186059] [] warn_slowpath_common+0x65/0x7a [ 2235.186064] [] ? default_send_IPI_mask_logical+0x2f/0xb8 [ 2235.186069] [] warn_slowpath_fmt+0x26/0x2a [ 2235.186074] [] default_send_IPI_mask_logical+0x2f/0xb8 [ 2235.186079] [] native_send_call_func_ipi+0x4f/0x57 [ 2235.186087] [] smp_call_function_many+0x191/0x1a9 [ 2235.186092] [] ? do_flush_tlb_all+0x3f/0x3f [ 2235.186097] [] native_flush_tlb_others+0x21/0x24 [ 2235.186101] [] flush_tlb_page+0x63/0x89 [ 2235.186105] [] ptep_set_access_flags+0x20/0x26 [ 2235.186111] [] do_wp_page+0x234/0x502 [ 2235.186117] [] ? T.2009+0x31/0x35 [ 2235.186121] [] handle_pte_fault+0x50d/0x54c [ 2235.186128] [] ? irq_exit+0x5f/0x61 [ 2235.186133] [] ? smp_call_function_interrupt+0x2c/0x2e [ 2235.186143] [] ? call_function_interrupt+0x2d/0x34 [ 2235.186148] [] handle_mm_fault+0xd0/0xe2 [ 2235.186153] [] __do_page_fault+0x411/0x42d [ 2235.186158] [] ? sys_futex+0xa9/0xee [ 2235.186162] [] ? __do_page_fault+0x42d/0x42d [ 2235.186166] [] do_page_fault+0x8/0xa [ 2235.186170] [] error_code+0x5a/0x60 [ 2235.186174] [] ? __do_page_fault+0x42d/0x42d [ 2235.186177] ---[ end trace 089b20858c3cb340 ]--- This patch fix it. This patch also fix some system hang problem: If the data->cpumask been cleared after pass if (WARN_ONCE(!mask, "empty IPI mask")) return; then the problem 83d349f3 fix will happen again. Signed-off-by: Wang YanQing --- kernel/smp.c | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/kernel/smp.c b/kernel/smp.c index 29dd40a..7c56aba 100644 --- a/kernel/smp.c +++ b/kernel/smp.c @@ -33,6 +33,7 @@ struct call_function_data { struct call_single_data csd; atomic_t refs; cpumask_var_t cpumask; + cpumask_var_t cpumask_ipi; }; static DEFINE_PER_CPU_SHARED_ALIGNED(struct call_function_data, cfd_data); @@ -526,6 +527,13 @@ void smp_call_function_many(const struct cpumask *mask, return; } + /* + * After we put entry into list, data->cpumask + * may be cleared when others cpu respone other + * IPI for call function, then data->cpumask will + * be zero. + */ + cpumask_copy(data->cpumask_ipi, data->cpumask); raw_spin_lock_irqsave(&call_function.lock, flags); /* * Place entry at the _HEAD_ of the list, so that any cpu still @@ -549,7 +557,7 @@ void smp_call_function_many(const struct cpumask *mask, smp_mb(); /* Send a message to all CPUs in the map */ - arch_send_call_function_ipi_mask(data->cpumask); + arch_send_call_function_ipi_mask(data->cpumask_ipi); /* Optionally wait for the CPUs to complete */ if (wait) -- 1.7.11.1.116.g8228a23