From patchwork Fri Nov 14 11:21:23 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Daniel Thompson X-Patchwork-Id: 40810 Return-Path: X-Original-To: linaro@patches.linaro.org Delivered-To: linaro@patches.linaro.org Received: from mail-lb0-f198.google.com (mail-lb0-f198.google.com [209.85.217.198]) by ip-10-151-82-157.ec2.internal (Postfix) with ESMTPS id 1D493240ED for ; Fri, 14 Nov 2014 11:21:58 +0000 (UTC) Received: by mail-lb0-f198.google.com with SMTP id 10sf9045194lbg.9 for ; Fri, 14 Nov 2014 03:21:57 -0800 (PST) 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:in-reply-to:references:x-original-sender :x-original-authentication-results:precedence:mailing-list:list-id :list-post:list-help:list-archive:list-unsubscribe; bh=8C/E8uFCG1a1g4NtmbHh56EldtXOE8eCRyL6jXpMm9o=; b=OIcmw3tczfnuoUcbPUf4NNv263pVe7ICPj5Q4Foy4mEksRPDNXl/z7bz0rAr9XXqq6 avyTTyoH5rG3LTmxSk3HcCME+JiJuJHcn9AZi8aQMvL9RoQgTAE9AgSW8f9TmtH1qt1V 591zWqAG2EYGaw6UxVz/SCYs/rHDSRIAzFoL5aRhF+0HTY3CrUeiLq09Twfc6km7aoZn ZqULe6bDVKx2Jsg2snkOTBJsar+HT+iBOUBk1YDbR4WzeEDqrjAUs3Hg+ff5vJ7c79Lv IEisbDmNOPH6j7yo61FP42oh3YpCQeGKBRL8838n3RyBq/OC37kiEmcLTEAOX5yTFyfB 91gA== X-Gm-Message-State: ALoCoQkevxporNnQsj9StfsXosR09kDlbH03g/Pm4qX/HFqSI9qyvhFO/MOMOKaWbIh1r9mKiYv4 X-Received: by 10.112.138.202 with SMTP id qs10mr10428521lbb.5.1415964117097; Fri, 14 Nov 2014 03:21:57 -0800 (PST) MIME-Version: 1.0 X-BeenThere: patchwork-forward@linaro.org Received: by 10.152.234.170 with SMTP id uf10ls112371lac.3.gmail; Fri, 14 Nov 2014 03:21:56 -0800 (PST) X-Received: by 10.152.22.194 with SMTP id g2mr7682925laf.33.1415964116960; Fri, 14 Nov 2014 03:21:56 -0800 (PST) Received: from mail-la0-f42.google.com (mail-la0-f42.google.com. [209.85.215.42]) by mx.google.com with ESMTPS id ww1si41189255lbb.128.2014.11.14.03.21.56 for (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Fri, 14 Nov 2014 03:21:56 -0800 (PST) Received-SPF: pass (google.com: domain of patch+caf_=patchwork-forward=linaro.org@linaro.org designates 209.85.215.42 as permitted sender) client-ip=209.85.215.42; Received: by mail-la0-f42.google.com with SMTP id s18so980506lam.29 for ; Fri, 14 Nov 2014 03:21:56 -0800 (PST) X-Received: by 10.112.235.196 with SMTP id uo4mr7630523lbc.66.1415964116885; Fri, 14 Nov 2014 03:21:56 -0800 (PST) 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.112.184.201 with SMTP id ew9csp747451lbc; Fri, 14 Nov 2014 03:21:56 -0800 (PST) X-Received: by 10.180.91.70 with SMTP id cc6mr6890954wib.5.1415964116024; Fri, 14 Nov 2014 03:21:56 -0800 (PST) Received: from mail-wg0-f49.google.com (mail-wg0-f49.google.com. [74.125.82.49]) by mx.google.com with ESMTPS id bn5si3171603wib.88.2014.11.14.03.21.55 for (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Fri, 14 Nov 2014 03:21:56 -0800 (PST) Received-SPF: pass (google.com: domain of daniel.thompson@linaro.org designates 74.125.82.49 as permitted sender) client-ip=74.125.82.49; Received: by mail-wg0-f49.google.com with SMTP id x13so19102809wgg.36 for ; Fri, 14 Nov 2014 03:21:55 -0800 (PST) X-Received: by 10.194.238.133 with SMTP id vk5mr193627wjc.18.1415964115726; Fri, 14 Nov 2014 03:21:55 -0800 (PST) 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 p3sm39228147wjf.49.2014.11.14.03.21.54 for (version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Fri, 14 Nov 2014 03:21:54 -0800 (PST) From: Daniel Thompson To: Steven Rostedt , Ingo Molnar Cc: Daniel Thompson , kgdb-bugreport@lists.sourceforge.net, linux-kernel@vger.kernel.org, Andrew Morton , patches@linaro.org, linaro-kernel@lists.linaro.org, John Stultz , Sumit Semwal , Jason Wessel Subject: [PATCH 3.18-rc3 v3 2/2] trace: kdb: Fix kernel livelock with empty buffers Date: Fri, 14 Nov 2014 11:21:23 +0000 Message-Id: <1415964083-10354-3-git-send-email-daniel.thompson@linaro.org> X-Mailer: git-send-email 1.9.3 In-Reply-To: <1415964083-10354-1-git-send-email-daniel.thompson@linaro.org> References: <1415277716-19419-1-git-send-email-daniel.thompson@linaro.org> <1415964083-10354-1-git-send-email-daniel.thompson@linaro.org> 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.215.42 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 kdb's ftdump command will livelock by constantly printk'ing the empty string at KERN_EMERG level if it run when the ftrace system is not in use. This occurs because trace_empty() never returns false when the ring buffers are left at the start of a non-consuming read [launched by ring_buffer_read_start()]. This patch changes the loop exit condition to use the result of trace_find_next_entry_inc(). Effectively this switches the non-consuming kdb dumper to follow the approach of the non-consuming userspace interface [s_next()] rather than the consuming ftrace_dump(). Signed-off-by: Daniel Thompson Cc: Jason Wessel Cc: Steven Rostedt Cc: Ingo Molnar --- kernel/trace/trace_kdb.c | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/kernel/trace/trace_kdb.c b/kernel/trace/trace_kdb.c index 8faa7ce58814..b0b1c44e923a 100644 --- a/kernel/trace/trace_kdb.c +++ b/kernel/trace/trace_kdb.c @@ -59,19 +59,19 @@ static void ftrace_dump_buf(int skip_lines, long cpu_file) ring_buffer_read_start(iter.buffer_iter[cpu_file]); tracing_iter_reset(&iter, cpu_file); } - if (!trace_empty(&iter)) - trace_find_next_entry_inc(&iter); - while (!trace_empty(&iter)) { + + while (trace_find_next_entry_inc(&iter)) { if (!cnt) kdb_printf("---------------------------------\n"); cnt++; - if (trace_find_next_entry_inc(&iter) != NULL && !skip_lines) + if (!skip_lines) { print_trace_line(&iter); - if (!skip_lines) trace_printk_seq(&iter.seq); - else + } else { skip_lines--; + } + if (KDB_FLAG(CMD_INTERRUPT)) goto out; }