From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1755063Ab3L3JIH (ORCPT ); Mon, 30 Dec 2013 04:08:07 -0500 Received: from szxga03-in.huawei.com ([119.145.14.66]:31632 "EHLO szxga03-in.huawei.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751598Ab3L3JIF (ORCPT ); Mon, 30 Dec 2013 04:08:05 -0500 Message-ID: <52C1377A.5030202@huawei.com> Date: Mon, 30 Dec 2013 17:06:02 +0800 From: Weng Meiling User-Agent: Mozilla/5.0 (Windows NT 6.1; rv:24.0) Gecko/20100101 Thunderbird/24.0.1 MIME-Version: 1.0 To: Robert Richter , , CC: Li Zefan , , "zhangwei(Jovi)" , Huang Qiang Subject: Re: [PATCH] oprofile: check whether oprofile perf enabled in op_overflow_handler() References: <52B3F66D.6060707@huawei.com> In-Reply-To: <52B3F66D.6060707@huawei.com> Content-Type: text/plain; charset="ISO-8859-1" Content-Transfer-Encoding: 7bit X-Originating-IP: [10.177.24.66] X-CFilter-Loop: Reflected Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Hi Robert, What do you think about this patch? On 2013/12/20 15:49, Weng Meiling wrote: > > From: Weng Meiling > > There is a situation event is triggered before oprofile_perf_start() finish. > Because the event is still not stored in per_cpu(perf_events, cpu)[event], > op_overflow_handler() will print the warning. During the time, if unregistered > event is triggered again, the cpu will print again. This may make cpu keeping > on printing and trigger softlockup. So check whether events register finished > in op_overflow_handler(). > > The problem was once triggered on kernel 2.6.34, the main information: > <3>BUG: soft lockup - CPU#0 stuck for 60005ms! [opcontrol:8673] > > Pid: 8673, comm: opcontrol > =====================SOFTLOCKUP INFO BEGIN======================= > [CPU#0] the task [opcontrol] is not waiting for a lock,maybe a delay or deadcricle! > <6>opcontrol R running 0 8673 7603 0x00000002 > locked: > bf0e1928 mutex 0 [] oprofile_start+0x10/0x68 [oprofile] > bf0e1a24 mutex 0 [] op_arm_start+0x10/0x48 [oprofile] > c0628020 &ctx->mutex 0 [] perf_event_create_kernel_counter+0xa4/0x14c > [] (unwind_backtrace+0x0/0x164) from [] (show_stack+0x10/0x14) > [] (show_stack+0x10/0x14) from [] (show_lock_info+0x9c/0x168) > [] (show_lock_info+0x9c/0x168) from [] (softlockup_tick+0x1c4/0x234) > [] (softlockup_tick+0x1c4/0x234) from [] (update_process_times+0x2c/0x50) > [] (update_process_times+0x2c/0x50) from [] (tick_sched_timer+0x268/0x2c4) > [] (tick_sched_timer+0x268/0x2c4) from [] (__run_hrtimer+0x158/0x25c) > [] (__run_hrtimer+0x158/0x25c) from [] (hrtimer_interrupt+0x13c/0x2f8) > [] (hrtimer_interrupt+0x13c/0x2f8) from [] (timer64_timer_interrupt+0x20/0x2c) > [] (timer64_timer_interrupt+0x20/0x2c) from [] (handle_IRQ_event+0x144/0x2ec) > [] (handle_IRQ_event+0x144/0x2ec) from [] (handle_level_irq+0xc0/0x13c) > [] (handle_level_irq+0xc0/0x13c) from [] (asm_do_IRQ+0x80/0xbc) > [] (asm_do_IRQ+0x80/0xbc) from [] (__irq_svc+0x4c/0xe4) > Exception stack(0xc4099db8 to 0xc4099e00) > 9da0: c0357538 00000000 > 9dc0: 00000000 c0380cc0 c4098000 00000202 00000028 c4098000 3fca9fbc c4098000 > 9de0: c0028b08 00000000 c4098000 c4099e00 c005eb50 c005e544 20000113 ffffffff > [] (__irq_svc+0x4c/0xe4) from [] (__do_softirq+0x64/0x25c) > [] (__do_softirq+0x64/0x25c) from [] (irq_exit+0x48/0x5c) > [] (irq_exit+0x48/0x5c) from [] (asm_do_IRQ+0x84/0xbc) > [] (asm_do_IRQ+0x84/0xbc) from [] (__irq_svc+0x4c/0xe4) > Exception stack(0xc4099e58 to 0xc4099ea0) > 9e40: c0628010 20000093 > 9e60: 00000001 00000000 00000000 60000013 c00aff24 cc4f6c00 00000001 c4098000 > 9e80: 00000000 00000000 00000000 c4099ea0 c0084fa0 c0084fa4 60000013 ffffffff > [] (__irq_svc+0x4c/0xe4) from [] (smp_call_function_single+0xc0/0x1d8) > [] (smp_call_function_single+0xc0/0x1d8) from [] (perf_event_create_kernel_counter+0xb4/0x14c) > [] (perf_event_create_kernel_counter+0xb4/0x14c) from [] (op_perf_start+0x54/0xf0 [oprofile]) > [] (op_perf_start+0x54/0xf0 [oprofile]) from [] (op_arm_start+0x20/0x48 [oprofile]) > [] (op_arm_start+0x20/0x48 [oprofile]) from [] (oprofile_start+0x38/0x68 [oprofile]) > [] (oprofile_start+0x38/0x68 [oprofile]) from [] (enable_write+0x34/0x54 [oprofile]) > [] (enable_write+0x34/0x54 [oprofile]) from [] (vfs_write+0xa8/0x150) > [] (vfs_write+0xa8/0x150) from [] (sys_write+0x3c/0x100) > [] (sys_write+0x3c/0x100) from [] (ret_fast_syscall+0x0/0x30) > =====================SOFTLOCKUP INFO END========================= > <0>Kernel panic - not syncing: softlockup: hung tasks > > Cc: # 2.6.34+ > Signed-off-by: Weng Meiling > --- > drivers/oprofile/oprofile_perf.c | 3 +++ > 1 file changed, 3 insertions(+) > > diff --git a/drivers/oprofile/oprofile_perf.c b/drivers/oprofile/oprofile_perf.c > index d5b2732..a9e5761 100644 > --- a/drivers/oprofile/oprofile_perf.c > +++ b/drivers/oprofile/oprofile_perf.c > @@ -38,6 +38,9 @@ static void op_overflow_handler(struct perf_event *event, > int id; > u32 cpu = smp_processor_id(); > > + if (!oprofile_perf_enabled) > + return; > + > for (id = 0; id < num_counters; ++id) > if (per_cpu(perf_events, cpu)[id] == event) > break; >