From patchwork Tue Jul 1 14:16:14 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Daniel Thompson X-Patchwork-Id: 32890 Return-Path: X-Original-To: linaro@patches.linaro.org Delivered-To: linaro@patches.linaro.org Received: from mail-pd0-f199.google.com (mail-pd0-f199.google.com [209.85.192.199]) by ip-10-151-82-157.ec2.internal (Postfix) with ESMTPS id 4D70320672 for ; Tue, 1 Jul 2014 14:16:39 +0000 (UTC) Received: by mail-pd0-f199.google.com with SMTP id r10sf46535829pdi.2 for ; Tue, 01 Jul 2014 07:16:38 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:mime-version:delivered-to:from:to:cc:subject :date:message-id:x-original-sender:x-original-authentication-results :precedence:mailing-list:list-id:list-post:list-help:list-archive :list-unsubscribe; bh=gkBM3kHzPUWIFVksRI+H3u16EQy8vVPlTIiDGDgRfkU=; b=CLg+t+jEZh9tpigBLHbjtwTW06r0Jm23U0iueHiFwZUVkyGu9cjsAiqBCYQx2I1qlQ 3/wPlYOXPcR5XlLTU56NS6C6meL82OQ2DoRAMXmek6kTGSpVMdQwAPsv32M73xHe6zyN 7H2ahYnHl2h6+4qIQ22a+DdZCimVUftAhzV9u5/EHSgHkpRSznv5rvtRWfW15AnSx/sf 3s2ktjt6EA2Z/2V5ConjniXPyo8SsTg9mBzHZq67u/QIr/NbCmp3DITBvHjQlmo1ZPED jqEbxqmsx8OzxQbL+ppAq0Kr7oGK1qlTQvZi/KUNfAT901ndpajK2r6jtshOKxIYxeU6 7s6Q== X-Gm-Message-State: ALoCoQnBB0xCewEYR8H7j/PEQ76g0aHnNlzWC4EeC4hZjrVUdJpui77mEtFZm+aRAWyoMaYgoQaS X-Received: by 10.66.173.75 with SMTP id bi11mr26927663pac.4.1404224198619; Tue, 01 Jul 2014 07:16:38 -0700 (PDT) MIME-Version: 1.0 X-BeenThere: patchwork-forward@linaro.org Received: by 10.140.102.178 with SMTP id w47ls1952851qge.55.gmail; Tue, 01 Jul 2014 07:16:38 -0700 (PDT) X-Received: by 10.220.95.2 with SMTP id b2mr869554vcn.61.1404224198503; Tue, 01 Jul 2014 07:16:38 -0700 (PDT) Received: from mail-ve0-f180.google.com (mail-ve0-f180.google.com [209.85.128.180]) by mx.google.com with ESMTPS id tk8si11459706vcb.62.2014.07.01.07.16.38 for (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Tue, 01 Jul 2014 07:16:38 -0700 (PDT) Received-SPF: pass (google.com: domain of patch+caf_=patchwork-forward=linaro.org@linaro.org designates 209.85.128.180 as permitted sender) client-ip=209.85.128.180; Received: by mail-ve0-f180.google.com with SMTP id jw12so9680307veb.39 for ; Tue, 01 Jul 2014 07:16:38 -0700 (PDT) X-Received: by 10.58.182.234 with SMTP id eh10mr876431vec.41.1404224198411; Tue, 01 Jul 2014 07:16:38 -0700 (PDT) X-Forwarded-To: patchwork-forward@linaro.org X-Forwarded-For: patch@linaro.org patchwork-forward@linaro.org Delivered-To: patches@linaro.org Received: by 10.221.37.5 with SMTP id tc5csp218147vcb; Tue, 1 Jul 2014 07:16:37 -0700 (PDT) X-Received: by 10.180.76.68 with SMTP id i4mr36981413wiw.83.1404224197518; Tue, 01 Jul 2014 07:16:37 -0700 (PDT) Received: from mail-we0-f181.google.com (mail-we0-f181.google.com [74.125.82.181]) by mx.google.com with ESMTPS id y17si13202050wie.85.2014.07.01.07.16.35 for (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Tue, 01 Jul 2014 07:16:35 -0700 (PDT) Received-SPF: pass (google.com: domain of daniel.thompson@linaro.org designates 74.125.82.181 as permitted sender) client-ip=74.125.82.181; Received: by mail-we0-f181.google.com with SMTP id q59so9963894wes.12 for ; Tue, 01 Jul 2014 07:16:35 -0700 (PDT) X-Received: by 10.194.2.45 with SMTP id 13mr3226544wjr.127.1404224194700; Tue, 01 Jul 2014 07:16:34 -0700 (PDT) Received: from sundance.lan (cpc4-aztw19-0-0-cust157.18-1.cable.virginm.net. [82.33.25.158]) by mx.google.com with ESMTPSA id wi9sm48453725wjc.23.2014.07.01.07.16.32 for (version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Tue, 01 Jul 2014 07:16:33 -0700 (PDT) From: Daniel Thompson To: Jason Wessel Cc: Daniel Thompson , linux-kernel@vger.kernel.org, patches@linaro.org, linaro-kernel@lists.linaro.org, Mike Travis , Randy Dunlap , Dimitri Sivanich , Andrew Morton , Borislav Petkov , kgdb-bugreport@lists.sourceforge.net Subject: [RFC PATCH] kgdb: Timeout if secondary CPUs ignore the roundup Date: Tue, 1 Jul 2014 15:16:14 +0100 Message-Id: <1404224174-25024-1-git-send-email-daniel.thompson@linaro.org> X-Mailer: git-send-email 1.9.3 X-Removed-Original-Auth: Dkim didn't pass. X-Original-Sender: daniel.thompson@linaro.org X-Original-Authentication-Results: mx.google.com; spf=pass (google.com: domain of patch+caf_=patchwork-forward=linaro.org@linaro.org designates 209.85.128.180 as permitted sender) smtp.mail=patch+caf_=patchwork-forward=linaro.org@linaro.org Precedence: list Mailing-list: list patchwork-forward@linaro.org; contact patchwork-forward+owners@linaro.org List-ID: X-Google-Group-Id: 836684582541 List-Post: , List-Help: , List-Archive: List-Unsubscribe: , Currently if an active CPU fails to respond to a roundup request the CPU that requested the roundup will become stuck. This needlessly reduces the robustness of the debugger. This patch introduces a timeout allowing the system state to be examined even when the system contains unresponsive processors. It also modifies kdb's cpu command to make it censor attempts to switch to unresponsive processors and to report their state as (D)ead. Signed-off-by: Daniel Thompson Cc: Jason Wessel Cc: Mike Travis Cc: Randy Dunlap Cc: Dimitri Sivanich Cc: Andrew Morton Cc: Borislav Petkov Cc: kgdb-bugreport@lists.sourceforge.net --- kernel/debug/debug_core.c | 9 +++++++-- kernel/debug/kdb/kdb_main.c | 4 +++- 2 files changed, 10 insertions(+), 3 deletions(-) diff --git a/kernel/debug/debug_core.c b/kernel/debug/debug_core.c index 1adf62b..acd7497 100644 --- a/kernel/debug/debug_core.c +++ b/kernel/debug/debug_core.c @@ -471,6 +471,7 @@ static int kgdb_cpu_enter(struct kgdb_state *ks, struct pt_regs *regs, int cpu; int trace_on = 0; int online_cpus = num_online_cpus(); + u64 time_left; kgdb_info[ks->cpu].enter_kgdb++; kgdb_info[ks->cpu].exception_state |= exception_state; @@ -595,9 +596,13 @@ return_normal: /* * Wait for the other CPUs to be notified and be waiting for us: */ - while (kgdb_do_roundup && (atomic_read(&masters_in_kgdb) + - atomic_read(&slaves_in_kgdb)) != online_cpus) + time_left = loops_per_jiffy * HZ; + while (kgdb_do_roundup && --time_left && + (atomic_read(&masters_in_kgdb) + atomic_read(&slaves_in_kgdb)) != + online_cpus) cpu_relax(); + if (!time_left) + pr_crit("KGDB: Timed out waiting for secondary CPUs.\n"); /* * At this point the primary processor is completely diff --git a/kernel/debug/kdb/kdb_main.c b/kernel/debug/kdb/kdb_main.c index 2f7c760..49f2425 100644 --- a/kernel/debug/kdb/kdb_main.c +++ b/kernel/debug/kdb/kdb_main.c @@ -2157,6 +2157,8 @@ static void kdb_cpu_status(void) for (start_cpu = -1, i = 0; i < NR_CPUS; i++) { if (!cpu_online(i)) { state = 'F'; /* cpu is offline */ + } else if (!kgdb_info[i].enter_kgdb) { + state = 'D'; /* cpu is online but unresponsive */ } else { state = ' '; /* cpu is responding to kdb */ if (kdb_task_state_char(KDB_TSK(i)) == 'I') @@ -2210,7 +2212,7 @@ static int kdb_cpu(int argc, const char **argv) /* * Validate cpunum */ - if ((cpunum > NR_CPUS) || !cpu_online(cpunum)) + if ((cpunum > NR_CPUS) || !kgdb_info[cpunum].enter_kgdb) return KDB_BADCPUNUM; dbg_switch_cpu = cpunum;