From patchwork Mon Jun 19 06:01:38 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Oliver O'Halloran X-Patchwork-Id: 777583 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from lists.ozlabs.org (lists.ozlabs.org [103.22.144.68]) (using TLSv1.2 with cipher ADH-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 3wrgQK3NV6z9s76 for ; Mon, 19 Jun 2017 16:03:37 +1000 (AEST) Authentication-Results: ozlabs.org; dkim=fail reason="signature verification failed" (2048-bit key; unprotected) header.d=gmail.com header.i=@gmail.com header.b="Gk7mBqm+"; dkim-atps=neutral Received: from lists.ozlabs.org (lists.ozlabs.org [IPv6:2401:3900:2:1::3]) by lists.ozlabs.org (Postfix) with ESMTP id 3wrgQK2J28zDqhF for ; Mon, 19 Jun 2017 16:03:37 +1000 (AEST) Authentication-Results: lists.ozlabs.org; dkim=fail reason="signature verification failed" (2048-bit key; unprotected) header.d=gmail.com header.i=@gmail.com header.b="Gk7mBqm+"; dkim-atps=neutral X-Original-To: skiboot@lists.ozlabs.org Delivered-To: skiboot@lists.ozlabs.org Received: from mail-pg0-x243.google.com (mail-pg0-x243.google.com [IPv6:2607:f8b0:400e:c05::243]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by lists.ozlabs.org (Postfix) with ESMTPS id 3wrgPP21L0zDqb5 for ; Mon, 19 Jun 2017 16:02:48 +1000 (AEST) Authentication-Results: lists.ozlabs.org; dkim=pass (2048-bit key; unprotected) header.d=gmail.com header.i=@gmail.com header.b="Gk7mBqm+"; dkim-atps=neutral Received: by mail-pg0-x243.google.com with SMTP id u62so8578257pgb.0 for ; Sun, 18 Jun 2017 23:02:48 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=MG1uxebalZkyrTuybjWrDeeh59zH7NF0w7hY3dlBews=; b=Gk7mBqm+q6Rf5w8B1GJbc+Cpg27G9Qdy1fKnmM7ELnzKvP/Av3GX5Q9TWV3trL+ypm Re4Ga6n46H27OKoC9LsjRaa65CbDTRzB2WzsgBlD190pn0VZshfOnOucCKRRf8/XCQ+c xWghUjxDxyag/pEGA1IZ6ppt05nnGsaHZWsV4cQJYObCcnvf/O5phM7l8aZcasjWuwUC cGkDhu4Y896jKGyvEW3vJSt2hTt0RZS2lW2fb5lBG3b1kkxl0qVRUmYfkIjcRR4MNqTa L5hQA664blv/hW2jeLJ9s+qzvUTS5qtwkL53Goki8h3lAAiZEkMIQCjMfprPe4KMzxRh 6UzA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=MG1uxebalZkyrTuybjWrDeeh59zH7NF0w7hY3dlBews=; b=joy3SbQhg18EH8gSsskUbBYmOsqYPUaUiElELfhn0/SDvmLCaHz1lMwznkTiW+pcLe 5s7GgW2Adc3HAOPIxbDBmK46+3vKOhOPz1HocNVNf4UW0cnUfpV+HJK9E4E9pefsL7Me oYsmWgK0lBnrj3y4u/+pbStGT2sbig65MWXOhx5kzdtmEPbe0oQYUJD1D/DVw6r0AyFC 2zjw6LnLVZJzrzQz68/CQQhFh/SaOPDdSjTiCxiezoQCgMi/gzmDrDhbNOItGuvjKlnF ZgaEsErd7dwPaED9l/yfcdoWGUOFTBFHM5tL6MFBwCelS92V+uEEoKrCDlqxR2WyotNV +7PA== X-Gm-Message-State: AKS2vOxTZ9FfL+hcxYe4LYfJQgenK1UtCMeVFEfoVdvEuF9KSR30C99W 1PPAnsRLNB6qN3AX X-Received: by 10.84.176.3 with SMTP id u3mr27618007plb.119.1497852167003; Sun, 18 Jun 2017 23:02:47 -0700 (PDT) Received: from flat-canetoad.ozlabs.ibm.com ([122.99.82.10]) by smtp.gmail.com with ESMTPSA id x64sm19638626pff.123.2017.06.18.23.02.45 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Sun, 18 Jun 2017 23:02:46 -0700 (PDT) From: Oliver O'Halloran To: skiboot@lists.ozlabs.org Date: Mon, 19 Jun 2017 16:01:38 +1000 Message-Id: <20170619060138.5314-6-oohall@gmail.com> X-Mailer: git-send-email 2.9.3 In-Reply-To: <20170619060138.5314-1-oohall@gmail.com> References: <20170619060138.5314-1-oohall@gmail.com> Subject: [Skiboot] [PATCH 6/6] console: excise flush_to_drivers X-BeenThere: skiboot@lists.ozlabs.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: Mailing list for skiboot development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Errors-To: skiboot-bounces+incoming=patchwork.ozlabs.org@lists.ozlabs.org Sender: "Skiboot" This is no longer used and can be removed. Signed-off-by: Oliver O'Halloran --- core/console-log.c | 6 +----- core/console.c | 20 +++++--------------- core/test/run-console-flush.c | 2 +- core/test/run-console-log-buf-overrun.c | 5 +---- core/test/run-console-log-pr_fmt.c | 16 ++++------------ core/test/run-console-log.c | 13 +------------ include/console.h | 2 +- 7 files changed, 14 insertions(+), 50 deletions(-) diff --git a/core/console-log.c b/core/console-log.c index 0b8cef53fc64..bf000a92b4e9 100644 --- a/core/console-log.c +++ b/core/console-log.c @@ -32,7 +32,6 @@ static int vprlog(int log_level, const char *fmt, va_list ap) { int count; char buffer[320]; - bool flush_to_drivers = true; unsigned long tb = mftb(); /* It's safe to return 0 when we "did" something here @@ -50,10 +49,7 @@ static int vprlog(int log_level, const char *fmt, va_list ap) tb_to_secs(tb), tb_remaining_nsecs(tb), log_level); count+= vsnprintf(buffer+count, sizeof(buffer)-count, fmt, ap); - if (log_level > (debug_descriptor.console_log_levels & 0x0f)) - flush_to_drivers = false; - - console_write(flush_to_drivers, buffer, count); + console_write(buffer, count); return count; } diff --git a/core/console.c b/core/console.c index fbab5a38e21e..b5679d77695c 100644 --- a/core/console.c +++ b/core/console.c @@ -143,7 +143,7 @@ static int parse_loghdr(int start, int *log_level) * if there is more to go, but that only happens when the * underlying driver failed so don't call it again. */ -static bool __flush_console(bool flush_to_drivers __unused) +static bool __flush_console(void) { int flush_lvl = debug_descriptor.console_log_levels & 0xf; struct cpu_thread *cpu = this_cpu(); @@ -179,16 +179,6 @@ static bool __flush_console(bool flush_to_drivers __unused) in_flush = true; - /* - * NB: this must appear after the in_flush check since it modifies - * con_out. - */ - if (!flush_to_drivers) { - con_out = con_in; - in_flush = false; - return false; - } - do { int start, req, len, log_lvl; @@ -234,7 +224,7 @@ bool flush_console(void) bool ret; lock(&con_lock); - ret = __flush_console(true); + ret = __flush_console(); unlock(&con_lock); return ret; @@ -293,7 +283,7 @@ static void write_char(char c) inmem_write(c); } -ssize_t console_write(bool flush_to_drivers, const void *buf, size_t count) +ssize_t console_write(const void *buf, size_t count) { /* We use recursive locking here as we can get called * from fairly deep debug path @@ -308,7 +298,7 @@ ssize_t console_write(bool flush_to_drivers, const void *buf, size_t count) write_char(c); } - __flush_console(flush_to_drivers); + __flush_console(); if (need_unlock) unlock(&con_lock); @@ -318,7 +308,7 @@ ssize_t console_write(bool flush_to_drivers, const void *buf, size_t count) ssize_t write(int fd __unused, const void *buf, size_t count) { - return console_write(true, buf, count); + return console_write(buf, count); } ssize_t read(int fd __unused, void *buf, size_t req_count) diff --git a/core/test/run-console-flush.c b/core/test/run-console-flush.c index 33db0460da8f..3c74b0eaab6d 100644 --- a/core/test/run-console-flush.c +++ b/core/test/run-console-flush.c @@ -108,7 +108,7 @@ int main(void) memcons.obuf_size = sizeof(console_buffer); populate_console(PR_INSANE, PR_NOTICE); - __flush_console(true); + __flush_console(); /* * Refill the console buffer dropping everything above PR_NOTICE diff --git a/core/test/run-console-log-buf-overrun.c b/core/test/run-console-log-buf-overrun.c index 01fca9b8f6fb..a2b253e62ce5 100644 --- a/core/test/run-console-log-buf-overrun.c +++ b/core/test/run-console-log-buf-overrun.c @@ -53,11 +53,8 @@ static inline unsigned long mftb(void) char console_buffer[4096]; struct debug_descriptor debug_descriptor; -bool flushed_to_drivers; - -ssize_t console_write(bool flush_to_drivers, const void *buf, size_t count) +ssize_t console_write(const void *buf, size_t count) { - flushed_to_drivers = flush_to_drivers; memcpy(console_buffer, buf, count); return count; } diff --git a/core/test/run-console-log-pr_fmt.c b/core/test/run-console-log-pr_fmt.c index ae9d206cb626..b8204b90ce2b 100644 --- a/core/test/run-console-log-pr_fmt.c +++ b/core/test/run-console-log-pr_fmt.c @@ -36,13 +36,10 @@ static inline unsigned long mftb(void) #include "../../libc/stdio/vsnprintf.c" struct debug_descriptor debug_descriptor; - -bool flushed_to_drivers; char console_buffer[4096]; -ssize_t console_write(bool flush_to_drivers, const void *buf, size_t count) +ssize_t console_write(const void *buf, size_t count) { - flushed_to_drivers = flush_to_drivers; memcpy(console_buffer, buf, count); return count; } @@ -51,24 +48,19 @@ int main(void) { debug_descriptor.console_log_levels = 0x75; + /* check basic functionality */ prlog(PR_EMERG, "Hello World"); assert(strcmp(console_buffer, "[ 0.000000042,0] PREFIX: Hello World") == 0); - assert(flushed_to_drivers==true); memset(console_buffer, 0, sizeof(console_buffer)); - // Below log level + /* Below log level is filtered */ prlog(PR_TRACE, "Hello World"); assert(console_buffer[0] == 0); - // Should not be flushed to console - prlog(PR_DEBUG, "Hello World"); - assert(strcmp(console_buffer, "[ 0.000000042,7] PREFIX: Hello World") == 0); - assert(flushed_to_drivers==false); - + /* check printf */ printf("Hello World"); assert(strcmp(console_buffer, "[ 0.000000042,5] PREFIX: Hello World") == 0); - assert(flushed_to_drivers==true); return 0; } diff --git a/core/test/run-console-log.c b/core/test/run-console-log.c index 01376eee7334..1e2dd5039986 100644 --- a/core/test/run-console-log.c +++ b/core/test/run-console-log.c @@ -36,13 +36,10 @@ int _printf(const char* fmt, ...); #include "../console-log.c" struct debug_descriptor debug_descriptor; - -bool flushed_to_drivers; char console_buffer[4096]; -ssize_t console_write(bool flush_to_drivers, const void *buf, size_t count) +ssize_t console_write(const void *buf, size_t count) { - flushed_to_drivers = flush_to_drivers; memcpy(console_buffer, buf, count); return count; } @@ -53,22 +50,14 @@ int main(void) prlog(PR_EMERG, "Hello World"); assert(strcmp(console_buffer, "[ 0.000000042,0] Hello World") == 0); - assert(flushed_to_drivers==true); - memset(console_buffer, 0, sizeof(console_buffer)); // Below log level prlog(PR_TRACE, "Hello World"); assert(console_buffer[0] == 0); - // Should not be flushed to console - prlog(PR_DEBUG, "Hello World"); - assert(strcmp(console_buffer, "[ 0.000000042,7] Hello World") == 0); - assert(flushed_to_drivers==false); - printf("Hello World"); assert(strcmp(console_buffer, "[ 0.000000042,5] Hello World") == 0); - assert(flushed_to_drivers==true); return 0; } diff --git a/include/console.h b/include/console.h index 708b696bf03e..9783e4dee2e3 100644 --- a/include/console.h +++ b/include/console.h @@ -86,7 +86,7 @@ extern void console_complete_flush(void); extern size_t mambo_console_write(const char *buf, size_t count); extern void enable_mambo_console(void); -ssize_t console_write(bool flush_to_drivers, const void *buf, size_t count); +ssize_t console_write(const void *buf, size_t count); extern void clear_console(void); extern void memcons_add_properties(void);