From patchwork Thu Nov 6 12:41:56 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Daniel Thompson X-Patchwork-Id: 40279 Return-Path: X-Original-To: linaro@patches.linaro.org Delivered-To: linaro@patches.linaro.org Received: from mail-la0-f72.google.com (mail-la0-f72.google.com [209.85.215.72]) by ip-10-151-82-157.ec2.internal (Postfix) with ESMTPS id 6688720C4E for ; Thu, 6 Nov 2014 12:42:20 +0000 (UTC) Received: by mail-la0-f72.google.com with SMTP id mc6sf1700192lab.11 for ; Thu, 06 Nov 2014 04:42:19 -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=qFYBnAVX3GccqwGwiWDtWS55ymm+gwbdhOYA87DmPsU=; b=GVdlxlEo+r+5krUbdDsdD1RP694+k70xAMi1k2oCJL9WYG5RSGqOWPjLf1r2/FDRQd EhrocDvZQhjQutT3Dc/9rqym/e7ruN1XPn6JpO15jgRbNqasVHsLXk8AM2flDqOiTQ3R JWdAuwekscFAwANbwxNd4SsU1D+opGglmZe2G6URhwunUukiuQ3XhQti7oAmJDyEHPfA Xgt51x6EJY+LKTxe2jLL4kZT2VtRptyJmeHOQx5xEnDuYR48yk3DgqyEehAw8pPEoKc4 jtc2NJ34uhq9Vfhh/4P8umI5GwZzF+hOss2FEpJRCw6J7D2kcCsWN6f0GwUqBSiNkEhS nUkA== X-Gm-Message-State: ALoCoQkIGTNV42eVb+4wRATKPEzao5QJMOJe9LGywgsihKDu4kJoy+KUOdoHXsMXteKBj+29xtNr X-Received: by 10.112.217.102 with SMTP id ox6mr9285lbc.19.1415277739415; Thu, 06 Nov 2014 04:42:19 -0800 (PST) MIME-Version: 1.0 X-BeenThere: patchwork-forward@linaro.org Received: by 10.152.7.66 with SMTP id h2ls59421laa.58.gmail; Thu, 06 Nov 2014 04:42:18 -0800 (PST) X-Received: by 10.112.201.201 with SMTP id kc9mr4986618lbc.76.1415277738738; Thu, 06 Nov 2014 04:42:18 -0800 (PST) Received: from mail-lb0-f177.google.com (mail-lb0-f177.google.com. [209.85.217.177]) by mx.google.com with ESMTPS id kk6si11328293lac.69.2014.11.06.04.42.18 for (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Thu, 06 Nov 2014 04:42:18 -0800 (PST) Received-SPF: pass (google.com: domain of patch+caf_=patchwork-forward=linaro.org@linaro.org designates 209.85.217.177 as permitted sender) client-ip=209.85.217.177; Received: by mail-lb0-f177.google.com with SMTP id z12so799689lbi.8 for ; Thu, 06 Nov 2014 04:42:18 -0800 (PST) X-Received: by 10.112.14.69 with SMTP id n5mr4904052lbc.34.1415277738645; Thu, 06 Nov 2014 04:42:18 -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 ew9csp37334lbc; Thu, 6 Nov 2014 04:42:18 -0800 (PST) X-Received: by 10.180.91.137 with SMTP id ce9mr40877542wib.60.1415277738079; Thu, 06 Nov 2014 04:42:18 -0800 (PST) Received: from mail-wg0-f53.google.com (mail-wg0-f53.google.com. [74.125.82.53]) by mx.google.com with ESMTPS id o9si9148261wjf.93.2014.11.06.04.42.17 for (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Thu, 06 Nov 2014 04:42:18 -0800 (PST) Received-SPF: pass (google.com: domain of daniel.thompson@linaro.org designates 74.125.82.53 as permitted sender) client-ip=74.125.82.53; Received: by mail-wg0-f53.google.com with SMTP id b13so1087360wgh.12 for ; Thu, 06 Nov 2014 04:42:17 -0800 (PST) X-Received: by 10.194.82.74 with SMTP id g10mr5387080wjy.116.1415277737839; Thu, 06 Nov 2014 04:42:17 -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 kn5sm132907wjb.48.2014.11.06.04.42.16 for (version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Thu, 06 Nov 2014 04:42:17 -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 RESEND 3.18-rc3 v2 2/2] trace: kdb: Fix kernel livelock with empty buffers Date: Thu, 6 Nov 2014 12:41:56 +0000 Message-Id: <1415277716-19419-3-git-send-email-daniel.thompson@linaro.org> X-Mailer: git-send-email 1.9.3 In-Reply-To: <1415277716-19419-1-git-send-email-daniel.thompson@linaro.org> References: <1411554781-16751-1-git-send-email-daniel.thompson@linaro.org> <1415277716-19419-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.217.177 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 8faa7ce..b0b1c44 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; }