From patchwork Fri Nov 14 23:24:05 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Steven Rostedt X-Patchwork-Id: 40870 Return-Path: X-Original-To: linaro@patches.linaro.org Delivered-To: linaro@patches.linaro.org Received: from mail-ee0-f72.google.com (mail-ee0-f72.google.com [74.125.83.72]) by ip-10-151-82-157.ec2.internal (Postfix) with ESMTPS id A5E12244FC for ; Fri, 14 Nov 2014 23:25:21 +0000 (UTC) Received: by mail-ee0-f72.google.com with SMTP id d17sf11272818eek.11 for ; Fri, 14 Nov 2014 15:25:20 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:delivered-to:message-id:user-agent:date:from:to :cc:subject:references:mime-version:sender:precedence:list-id :x-original-sender:x-original-authentication-results:mailing-list :list-post:list-help:list-archive:list-unsubscribe:content-type :content-disposition; bh=nw/CXVuUDyI3mgomxI1dsueufl2v2tCW8mP0qI/893g=; b=NszZC78KLuzofPDT34UQKkyoLF6LubE35f6OMy7GrvhIxn0lzk/a3I9loaiixRY5iN yrEpfvCwCbWZfjAGR2NA6QivOgzvJiqf1ZTM4JVXeJ1jlUflcRfpB4k8oHothAXoRi4j smT/oHLtM5KMVa6elmYv11skXNz+EIubXClpYZhZXo7TQyp/M0TYurBPZcOTR7UvMi+d j2oI1jhp8KX5cOdUh3Q6OAIko3Ye2Cz1Lw6uP1l2dla9wewXu0ZcSUc/3sHAWCbo/5zE /+OKz803/eOvCu+txSrZWif5kQ2FcfiC1uB6S+6ATG927n234o8tG3ahYaF3WqeKrtoI NKdw== X-Gm-Message-State: ALoCoQmMGJ3QrEHv413ic/kCcqHzMTmlKHyNk3CGDYlXrEkGIwxXuHPGJI4LqjFIGX3hADBZ4TtL X-Received: by 10.152.27.38 with SMTP id q6mr5094640lag.5.1416007520471; Fri, 14 Nov 2014 15:25:20 -0800 (PST) X-BeenThere: patchwork-forward@linaro.org Received: by 10.152.121.72 with SMTP id li8ls1064203lab.101.gmail; Fri, 14 Nov 2014 15:25:20 -0800 (PST) X-Received: by 10.152.28.72 with SMTP id z8mr11088665lag.52.1416007520128; Fri, 14 Nov 2014 15:25:20 -0800 (PST) Received: from mail-lb0-f181.google.com (mail-lb0-f181.google.com. [209.85.217.181]) by mx.google.com with ESMTPS id s10si43250430lal.38.2014.11.14.15.25.19 for (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Fri, 14 Nov 2014 15:25:19 -0800 (PST) Received-SPF: pass (google.com: domain of patch+caf_=patchwork-forward=linaro.org@linaro.org designates 209.85.217.181 as permitted sender) client-ip=209.85.217.181; Received: by mail-lb0-f181.google.com with SMTP id l4so13500309lbv.26 for ; Fri, 14 Nov 2014 15:25:19 -0800 (PST) X-Received: by 10.152.22.135 with SMTP id d7mr10817601laf.46.1416007519883; Fri, 14 Nov 2014 15:25:19 -0800 (PST) X-Forwarded-To: patchwork-forward@linaro.org X-Forwarded-For: patch@linaro.org patchwork-forward@linaro.org Delivered-To: patch@linaro.org Received: by 10.112.184.201 with SMTP id ew9csp859500lbc; Fri, 14 Nov 2014 15:25:18 -0800 (PST) X-Received: by 10.68.135.100 with SMTP id pr4mr13176548pbb.123.1416007517565; Fri, 14 Nov 2014 15:25:17 -0800 (PST) Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id x3si29545578pda.177.2014.11.14.15.25.16 for ; Fri, 14 Nov 2014 15:25:17 -0800 (PST) Received-SPF: none (google.com: linux-kernel-owner@vger.kernel.org does not designate permitted sender hosts) client-ip=209.132.180.67; Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1422932AbaKNXZM (ORCPT + 26 others); Fri, 14 Nov 2014 18:25:12 -0500 Received: from cdptpa-outbound-snat.email.rr.com ([107.14.166.226]:59789 "EHLO cdptpa-oedge-vip.email.rr.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S935436AbaKNXZB (ORCPT ); Fri, 14 Nov 2014 18:25:01 -0500 Received: from [67.246.153.56] ([67.246.153.56:53828] helo=gandalf.local.home) by cdptpa-oedge02 (envelope-from ) (ecelerity 3.5.0.35861 r(Momo-dev:tip)) with ESMTP id 92/60-16424-A4F86645; Fri, 14 Nov 2014 23:24:59 +0000 Received: from rostedt by gandalf.local.home with local (Exim 4.84) (envelope-from ) id 1XpQEW-0003VZ-Jm; Fri, 14 Nov 2014 18:24:52 -0500 Message-Id: <20141114232452.539100956@goodmis.org> User-Agent: quilt/0.61-1 Date: Fri, 14 Nov 2014 18:24:05 -0500 From: Steven Rostedt To: linux-kernel@vger.kernel.org Cc: Ingo Molnar , Andrew Morton , Ingo Molnar , John Stultz , Sumit Semwal , Jason Wessel , Daniel Thompson Subject: [for-next][PATCH 4/9] tracing: kdb: Fix kernel livelock with empty buffers References: <20141114232401.493543108@goodmis.org> MIME-Version: 1.0 X-RR-Connecting-IP: 107.14.168.130:25 X-Cloudmark-Score: 0 Sender: linux-kernel-owner@vger.kernel.org Precedence: list List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-Removed-Original-Auth: Dkim didn't pass. X-Original-Sender: rostedt@goodmis.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.181 as permitted sender) smtp.mail=patch+caf_=patchwork-forward=linaro.org@linaro.org Mailing-list: list patchwork-forward@linaro.org; contact patchwork-forward+owners@linaro.org X-Google-Group-Id: 836684582541 List-Post: , List-Help: , List-Archive: List-Unsubscribe: , Content-Disposition: inline; filename=0004-tracing-kdb-Fix-kernel-livelock-with-empty-buffers.patch From: Daniel Thompson 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(). Link: http://lkml.kernel.org/r/1415277716-19419-3-git-send-email-daniel.thompson@linaro.org Cc: Ingo Molnar Cc: Andrew Morton Cc: John Stultz Cc: Sumit Semwal Cc: Jason Wessel Signed-off-by: Daniel Thompson Signed-off-by: Steven Rostedt --- 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; }