From patchwork Wed Sep 24 10:33:01 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Daniel Thompson X-Patchwork-Id: 37800 Return-Path: X-Original-To: linaro@patches.linaro.org Delivered-To: linaro@patches.linaro.org Received: from mail-wi0-f197.google.com (mail-wi0-f197.google.com [209.85.212.197]) by ip-10-151-82-157.ec2.internal (Postfix) with ESMTPS id 54CEA202DB for ; Wed, 24 Sep 2014 10:33:24 +0000 (UTC) Received: by mail-wi0-f197.google.com with SMTP id ho1sf3412014wib.4 for ; Wed, 24 Sep 2014 03:33:23 -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: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=QuHoIGbbrDutbCce5uzrnuFSCAnkhatk71AQSg/Jbuht9rbde/gexoKJgLSP4zTHvE h+ISoSVNNuEpI8iUF0WWM/IM7QhvJaciJ5sWFxvVe774RCkQ4gErcot/qUtlLI+TrCvp gQznY5+X3S7BJyQYWnVk95mPl6o5nsZI2Wdda7BJU8PppYXo+QtrwRMxJvjGjRk/87lX cobthJFMrA/hWVcwGjAubPEkk6eXFvaFsoLjPEen8yc3fOASBSXzGfPpktVrZ7vqZn7o C9nwwfpnccDpcemjD1Th3IatTc/rER00h7cwaESlCQxTwdJLbSxmTLj8jkmTQ9HiYvxr qgsg== X-Gm-Message-State: ALoCoQliYUW3gA99n9Lf+gOqbGd5BuesjkfySkSb9ccxwlW56eHQS9wHElyqQT0tcERuNvG3cD7U X-Received: by 10.180.24.225 with SMTP id x1mr1349506wif.2.1411554803570; Wed, 24 Sep 2014 03:33:23 -0700 (PDT) MIME-Version: 1.0 X-BeenThere: patchwork-forward@linaro.org Received: by 10.152.27.225 with SMTP id w1ls160204lag.2.gmail; Wed, 24 Sep 2014 03:33:23 -0700 (PDT) X-Received: by 10.112.253.165 with SMTP id ab5mr5280852lbd.1.1411554803420; Wed, 24 Sep 2014 03:33:23 -0700 (PDT) Received: from mail-la0-f47.google.com (mail-la0-f47.google.com [209.85.215.47]) by mx.google.com with ESMTPS id i9si22238553lbv.104.2014.09.24.03.33.23 for (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Wed, 24 Sep 2014 03:33:23 -0700 (PDT) Received-SPF: pass (google.com: domain of patch+caf_=patchwork-forward=linaro.org@linaro.org designates 209.85.215.47 as permitted sender) client-ip=209.85.215.47; Received: by mail-la0-f47.google.com with SMTP id mc6so10237015lab.20 for ; Wed, 24 Sep 2014 03:33:23 -0700 (PDT) X-Received: by 10.112.76.6 with SMTP id g6mr5374001lbw.22.1411554803324; Wed, 24 Sep 2014 03:33:23 -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.112.130.169 with SMTP id of9csp558687lbb; Wed, 24 Sep 2014 03:33:22 -0700 (PDT) X-Received: by 10.180.72.211 with SMTP id f19mr10604291wiv.39.1411554802730; Wed, 24 Sep 2014 03:33:22 -0700 (PDT) Received: from mail-wi0-f174.google.com (mail-wi0-f174.google.com [209.85.212.174]) by mx.google.com with ESMTPS id m3si6341806wiy.46.2014.09.24.03.33.22 for (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Wed, 24 Sep 2014 03:33:22 -0700 (PDT) Received-SPF: pass (google.com: domain of daniel.thompson@linaro.org designates 209.85.212.174 as permitted sender) client-ip=209.85.212.174; Received: by mail-wi0-f174.google.com with SMTP id fb4so6605325wid.1 for ; Wed, 24 Sep 2014 03:33:22 -0700 (PDT) X-Received: by 10.180.212.78 with SMTP id ni14mr10719242wic.44.1411554802544; Wed, 24 Sep 2014 03:33:22 -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 ju1sm18977110wjc.1.2014.09.24.03.33.20 for (version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Wed, 24 Sep 2014 03:33:21 -0700 (PDT) From: Daniel Thompson To: Steven Rostedt , Ingo Molnar Cc: Daniel Thompson , linux-kernel@vger.kernel.org, patches@linaro.org, linaro-kernel@lists.linaro.org, John Stultz , Sumit Semwal , kgdb-bugreport@lists.sourceforge.net, Jason Wessel Subject: [PATCH 3.17-rc4 v2 2/2] trace: kdb: Fix kernel livelock with empty buffers Date: Wed, 24 Sep 2014 11:33:01 +0100 Message-Id: <1411554781-16751-3-git-send-email-daniel.thompson@linaro.org> X-Mailer: git-send-email 1.9.3 In-Reply-To: <1411554781-16751-1-git-send-email-daniel.thompson@linaro.org> References: <1410360247-13791-1-git-send-email-daniel.thompson@linaro.org> <1411554781-16751-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.47 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; }