From patchwork Wed Sep 24 10:38:17 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Daniel Thompson X-Patchwork-Id: 37801 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 B7B46202DB for ; Wed, 24 Sep 2014 10:38:51 +0000 (UTC) Received: by mail-lb0-f198.google.com with SMTP id 10sf4953690lbg.5 for ; Wed, 24 Sep 2014 03:38:50 -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=mOzU/ahauD17g/EnAXh+AuO0JX4BtUC9EqA+H40io/o=; b=b+Sg1Xn1pJczCWewcvBXiBH+VktRWQKctI1pmF2WCORtXgmAOanpEvtVmORyTFT+iM u62qDBlchbMoohZNAgBoKJaJSHc3hOKg+FngSYXomyHSgQI8MLf5D+SVlHyCGYAgeGUX ncJ4NVXu1QwUtJxzgxmiFSH6KQG76yYxO5SwclOlLqtT7I8tCAzg+JEMEZVIFeHrGYAK ++oK7qB3h9Mdsy7UehqLqf/w9n6cWOnuEP+/hFRqiHbL6xa4A/G1o4u902SEQhPzh2Wa QkPxY/R6E1WlfZCiqTx79x2qdE2uuJW1xQJNePeFn8rLvcr/NglHam8/7madFOReKi4Y FWVA== X-Gm-Message-State: ALoCoQkHCUKY3fBL2Sw4gVKQLTGG/evpy7iF0led6ZjmfKKigeOpgv658P8HXhELtWxfqkjMmGVS X-Received: by 10.180.87.228 with SMTP id bb4mr2219461wib.3.1411555130495; Wed, 24 Sep 2014 03:38:50 -0700 (PDT) MIME-Version: 1.0 X-BeenThere: patchwork-forward@linaro.org Received: by 10.152.6.39 with SMTP id x7ls152535lax.31.gmail; Wed, 24 Sep 2014 03:38:50 -0700 (PDT) X-Received: by 10.112.13.232 with SMTP id k8mr5046569lbc.81.1411555130232; Wed, 24 Sep 2014 03:38:50 -0700 (PDT) Received: from mail-la0-f51.google.com (mail-la0-f51.google.com [209.85.215.51]) by mx.google.com with ESMTPS id y2si22308700lae.49.2014.09.24.03.38.50 for (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Wed, 24 Sep 2014 03:38:50 -0700 (PDT) Received-SPF: pass (google.com: domain of patch+caf_=patchwork-forward=linaro.org@linaro.org designates 209.85.215.51 as permitted sender) client-ip=209.85.215.51; Received: by mail-la0-f51.google.com with SMTP id pv20so798869lab.24 for ; Wed, 24 Sep 2014 03:38:50 -0700 (PDT) X-Received: by 10.152.179.226 with SMTP id dj2mr5679688lac.40.1411555130174; Wed, 24 Sep 2014 03:38:50 -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 of9csp559238lbb; Wed, 24 Sep 2014 03:38:49 -0700 (PDT) X-Received: by 10.195.11.234 with SMTP id el10mr6846436wjd.95.1411555129578; Wed, 24 Sep 2014 03:38:49 -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 lf2si18934970wjb.24.2014.09.24.03.38.49 for (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Wed, 24 Sep 2014 03:38:49 -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 fb4so6620280wid.13 for ; Wed, 24 Sep 2014 03:38:49 -0700 (PDT) X-Received: by 10.180.35.133 with SMTP id h5mr29915738wij.74.1411555129346; Wed, 24 Sep 2014 03:38:49 -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 ju1sm18993298wjc.1.2014.09.24.03.38.47 for (version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Wed, 24 Sep 2014 03:38:48 -0700 (PDT) From: Daniel Thompson To: Jason Wessel Cc: Daniel Thompson , linux-kernel@vger.kernel.org, kgdb-bugreport@lists.sourceforge.net, patches@linaro.org, linaro-kernel@lists.linaro.org, Mike Travis , Ingo Molnar , Andrew Morton Subject: [PATCH 3.17rc4] kdb: Avoid printing KERN_ levels to consoles Date: Wed, 24 Sep 2014 11:38:17 +0100 Message-Id: <1411555097-16924-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.215.51 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 when kdb traps printk messages then the log level prefix does not get stripped off before the message is issued to the various I/O handlers supported by kdb. This results in annoying visual noise and problems with grepping for ^. This patch addresses the problem by stripping log levels from messages before they are issued to the I/O handlers. printk(), which is used as an I/O handler for logging purposes, is handled as a special case; if the caller provided a log level then this will be preserved. Signed-off-by: Daniel Thompson Cc: Jason Wessel Cc: Mike Travis Cc: Ingo Molnar Cc: Andrew Morton --- kernel/debug/kdb/kdb_io.c | 20 +++++++++++++------- 1 file changed, 13 insertions(+), 7 deletions(-) -- 1.9.3 diff --git a/kernel/debug/kdb/kdb_io.c b/kernel/debug/kdb/kdb_io.c index 7c70812..381f297 100644 --- a/kernel/debug/kdb/kdb_io.c +++ b/kernel/debug/kdb/kdb_io.c @@ -691,19 +691,22 @@ kdb_printit: * Write to all consoles. */ retlen = strlen(kdb_buffer); + cp = kdb_buffer; + if (cp[0] == KERN_SOH_ASCII && cp[1] != '\0') + cp += 2; if (!dbg_kdb_mode && kgdb_connected) { - gdbstub_msg_write(kdb_buffer, retlen); + gdbstub_msg_write(cp, retlen - (cp - kdb_buffer)); } else { if (dbg_io_ops && !dbg_io_ops->is_console) { - len = retlen; - cp = kdb_buffer; + len = retlen - (cp - kdb_buffer); + cp2 = cp; while (len--) { - dbg_io_ops->write_char(*cp); - cp++; + dbg_io_ops->write_char(*cp2); + cp2++; } } while (c) { - c->write(c, kdb_buffer, retlen); + c->write(c, cp, retlen - (cp - kdb_buffer)); touch_nmi_watchdog(); c = c->next; } @@ -711,7 +714,10 @@ kdb_printit: if (logging) { saved_loglevel = console_loglevel; console_loglevel = CONSOLE_LOGLEVEL_SILENT; - printk(KERN_INFO "%s", kdb_buffer); + if (cp == kdb_buffer) + printk(KERN_INFO "%s", kdb_buffer); + else + printk("%s", kdb_buffer); } if (KDB_STATE(PAGER)) {