Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1757630Ab2J2CeQ (ORCPT ); Sun, 28 Oct 2012 22:34:16 -0400 Received: from mga14.intel.com ([143.182.124.37]:18086 "EHLO mga14.intel.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1755360Ab2J2CeO convert rfc822-to-8bit (ORCPT ); Sun, 28 Oct 2012 22:34:14 -0400 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="4.80,668,1344236400"; d="scan'208,223";a="210525994" From: "Zhang, Jun" To: Robert Richter , Thomas Gleixner , Ingo Molnar , "H. Peter Anvin" , "x86@kernel.org" , "oprofile-list@lists.sf.net" , "linux-kernel@vger.kernel.org" CC: "Zhang, Jun" Subject: [PATCH] Sometimes, there is OOPS happened when we use oprofile. Thread-Topic: [PATCH] Sometimes, there is OOPS happened when we use oprofile. Thread-Index: Ac21fdbrMGxdLfDSTxOYLdnLhBOHyg== Date: Mon, 29 Oct 2012 02:33:54 +0000 Message-ID: <88DC34334CA3444C85D647DBFA962C270FD7E416@SHSMSX102.ccr.corp.intel.com> Accept-Language: en-US Content-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: x-originating-ip: [10.239.127.40] Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 8BIT MIME-Version: 1.0 Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 4148 Lines: 97 >From fff479313342940372444797814edee996b18fc9 Mon Sep 17 00:00:00 2001 From: jzha144 Date: Mon, 29 Oct 2012 09:07:22 +0800 Subject: [PATCH] Sometimes, there is OOPS happened when we use oprofile. next is the call stack. From call stack, we find in call_on_stack if there is a nmi interrupt between "xchgl %%ebx,%%esp" and "call *%%edi", system will OOPS. BUG: unable to handle kernel paging request at ff06383f IP: [] print_context_stack+0x4d/0x100 *pde = 00000000 Oops: 0000 [#1] PREEMPT SMP Modules linked in: wl12xx_sdio wl12xx mac80211 cfg80211 compat btwilink atomisp lm3554 mt9m114 mt9e013 videobuf2_memops videobuf2_core st_drv matrix(C) Pid: 162, comm: adbd Tainted: G WC 3.0.34-140446-g9e77874-dirty #1 Intel Corporation EIP: 0060:[] EFLAGS: 00010083 CPU: 1 EIP is at print_context_stack+0x4d/0x100 EAX: ff063ffc EBX: ff06383f ECX: f4a0bd74 EDX: ff06383f ESI: 00000000 EDI: ffffe000 EBP: f58dbe48 ESP: f58dbe24 DS: 007b ES: 007b FS: 00d8 GS: 0033 SS: 0068 Process adbd (pid: 162, ti=f58da000 task=f430a730 task.ti=f4a0a000) Stack: 0000000c ff063ffc f4a0bd74 ffffe000 ff062000 f4a0bd74 ff06383f c1b2b1c0 ff062000 f58dbe74 c120428f c1b2b1c0 f58dbe98 00000000 f58dbe60 00000000 00000000 f4a0bd74 f58dbfc4 00000005 f58dbebc c172d52f f4a0bd74 c1b2b1c0 Call Trace: [] dump_trace+0x7f/0xf0 [] x86_backtrace+0x13f/0x150 [] ? op_cpu_buffer_write_commit+0x14/0x20 [] ? log_sample+0x8e/0xb0 [] oprofile_add_sample+0x9a/0xc0 [] ppro_check_ctrs+0x8e/0x110 [] ? rb_reserve_next_event+0x3e/0x370 [] profile_exceptions_notify+0x67/0x70 [] notifier_call_chain+0x47/0x90 [] __atomic_notifier_call_chain+0x38/0x50 [] ? remote_softirq_receive+0x110/0x110 [] atomic_notifier_call_chain+0x1f/0x30 [] notify_die+0x2d/0x30 [] do_nmi+0xb0/0x300 [] ? __local_bh_enable+0x4f/0xa0 [] nmi_stack_correct+0x28/0x2d [] ? remote_softirq_receive+0x110/0x110 [] ? do_softirq+0x8f/0xe0 [] irq_exit+0x86/0xd0 [] smp_apic_timer_interrupt+0x59/0x88 [] ? trace_hardirqs_off_thunk+0xc/0x14 [] apic_timer_interrupt+0x2f/0x34 [] ? handle_vm86_fault+0x78b/0x9b0 [] ? _raw_spin_unlock_irqrestore+0x3f/0x50 [] __wake_up_sync_key+0x4c/0x60 [] sock_def_readable+0x40/0x70 [] unix_stream_sendmsg+0x22d/0x390 [] sock_aio_write+0x11b/0x140 [] ? __schedule+0x23d/0x8d0 [] ? nmi_stack_correct+0x28/0x2d [] do_sync_write+0xa9/0xe0 [] ? sub_preempt_count+0x3d/0x50 [] vfs_write+0x151/0x160 [] ? fget_light+0x58/0xd0 [] sys_write+0x3d/0x70 [] syscall_call+0x7/0xb Code: f6 89 4d f0 89 4d e4 89 45 e0 89 7d e8 74 5e 8d b4 26 00 00 00 00 39 f3 72 0c 8b 45 f0 83 c4 18 5b 5e 5f 5d c3 90 3b 5d e8 72 ef <8b> 3b 89 f8 89 7d dc e8 c7 07 06 00 85 c0 74 2b 8b 45 f0 83 c0 EIP: [] print_context_stack+0x4d/0x100 SS:ESP 0068:f58dbe24 CR2: 00000000ff06383f Signed-off-by: jzha144 --- arch/x86/oprofile/backtrace.c | 4 ++++ 1 files changed, 4 insertions(+), 0 deletions(-) diff --git a/arch/x86/oprofile/backtrace.c b/arch/x86/oprofile/backtrace.c index d6aa6e8..c1af4f0 100644 --- a/arch/x86/oprofile/backtrace.c +++ b/arch/x86/oprofile/backtrace.c @@ -113,6 +113,10 @@ x86_backtrace(struct pt_regs * const regs, unsigned int depth) if (!user_mode_vm(regs)) { unsigned long stack = kernel_stack_pointer(regs); + + if (!((unsigned long)stack & (THREAD_SIZE - 1))) + stack = 0; + if (depth) dump_trace(NULL, regs, (unsigned long *)stack, 0, &backtrace_ops, &depth); -- 1.7.6 -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/