From patchwork Mon Oct 2 02:06:18 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Nicolas Pitre X-Patchwork-Id: 9980071 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id F354E602A0 for ; Mon, 2 Oct 2017 02:07:06 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id E1DFF28A16 for ; Mon, 2 Oct 2017 02:07:06 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id D703428A72; Mon, 2 Oct 2017 02:07:06 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-4.2 required=2.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,RCVD_IN_DNSWL_MED autolearn=ham version=3.3.1 Received: from bombadil.infradead.org (bombadil.infradead.org [65.50.211.133]) (using TLSv1.2 with cipher AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id 602F628A16 for ; Mon, 2 Oct 2017 02:07:06 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20170209; h=Sender: Content-Transfer-Encoding:Content-Type:MIME-Version:List-Subscribe:List-Help: List-Post:List-Archive:List-Unsubscribe:List-Id:References:In-Reply-To: Message-Id:Date:Subject:To:From:Reply-To:Cc:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=1G1QPU0XJkFM+3YonlwRjYU11kmPYyHVzExOE2gn7y0=; b=VNSDqGmiwtsUuE Nsb6SsYu0J96D/u+orkReGf0LPXuvA0sPgpHSJAbrYng1dcwWVtTVsq/4/dbxkFImpUFEkhhx3voa MZaZlwzYgYF05Fyo9yQ1xvjoD2k8PXQQ6M/HIBWJiKEtDpXkapEzHg+ZwuXvDglpOmqOsgG2/fGa2 hlrvAbQVO4iXl4d/Ap8QOZdltYinU7Hv4Ny45mC4oKR5RVZRav9KBzt543Jm99LJM3gipfu4tgD2J GxjdzYA7nRD2NDFYvLWLveJkSnF1Hs92AWdcoOHhlKXCEIkrZlBMBwbUCUw3kTP+laohMzH43vNKb amihg0PSkHgAu4IpmmUg==; Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.87 #1 (Red Hat Linux)) id 1dyq8J-0005st-FM; Mon, 02 Oct 2017 02:06:59 +0000 Received: from pb-smtp1.pobox.com ([64.147.108.70] helo=sasl.smtp.pobox.com) by bombadil.infradead.org with esmtps (Exim 4.87 #1 (Red Hat Linux)) id 1dyq8D-0005mY-J6 for linux-arm-kernel@lists.infradead.org; Mon, 02 Oct 2017 02:06:57 +0000 Received: from sasl.smtp.pobox.com (unknown [127.0.0.1]) by pb-smtp1.pobox.com (Postfix) with ESMTP id 6B83892287 for ; Sun, 1 Oct 2017 22:06:30 -0400 (EDT) DKIM-Signature: v=1; a=rsa-sha1; c=relaxed; d=pobox.com; h=from:to :subject:date:message-id:in-reply-to:references; s=sasl; bh=40WL D3w6aer+9hvfqdwSOXuCdBI=; b=rpxzxxWcf8mzU7NOD0Uo34NfKLLpBovV09R9 hbg3yC/KO8ZDHRjBbXvlMYbbH+hDL+WuiC0ANNDrNgL3ItdvKgulefKXZVMQzmjx k5McZyyiUM01eX2WAhG3AOsqiqjfH1YEoE0YSupCkNT8ouiB8oFmedPF7h3jaKC9 p2NnVwo= Received: from pb-smtp1.nyi.icgroup.com (unknown [127.0.0.1]) by pb-smtp1.pobox.com (Postfix) with ESMTP id 6352692285 for ; Sun, 1 Oct 2017 22:06:30 -0400 (EDT) Received: from yoda.home (unknown [137.175.234.45]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by pb-smtp1.pobox.com (Postfix) with ESMTPSA id EE7A792282 for ; Sun, 1 Oct 2017 22:06:29 -0400 (EDT) Received: from xanadu.home (xanadu.home [192.168.2.2]) by yoda.home (Postfix) with ESMTP id 540C32DA0695 for ; Sun, 1 Oct 2017 22:06:29 -0400 (EDT) From: Nicolas Pitre To: linux-arm-kernel@lists.infradead.org Subject: [PATCH 3/3] ARM: early_printk: use printascii() rather than printch() Date: Sun, 1 Oct 2017 22:06:18 -0400 Message-Id: <20171002020618.23924-4-nicolas.pitre@linaro.org> X-Mailer: git-send-email 2.9.5 In-Reply-To: <20171002020618.23924-1-nicolas.pitre@linaro.org> References: <20171002020618.23924-1-nicolas.pitre@linaro.org> X-Pobox-Relay-ID: 4E1F9830-A716-11E7-8605-8EF31968708C-78420484!pb-smtp1.pobox.com X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20171001_190653_779615_03FA5283 X-CRM114-Status: GOOD ( 14.26 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+patchwork-linux-arm=patchwork.kernel.org@lists.infradead.org X-Virus-Scanned: ClamAV using ClamSMTP With printch() the console messages are sent out one character at a time which is agonizingly slow especially with semihosting as the whole trap intercept, remote byte access, and system resume danse is performed for every single character across a relatively slow remote debug connection. Let's use printascii() to send a whole string at once. This is also going to be more efficient, albeit to a quite lesser extent, with serial ports as well. Signed-off-by: Nicolas Pitre --- arch/arm/kernel/early_printk.c | 16 ++++++++++------ 1 file changed, 10 insertions(+), 6 deletions(-) diff --git a/arch/arm/kernel/early_printk.c b/arch/arm/kernel/early_printk.c index 4307653696..9257736ec9 100644 --- a/arch/arm/kernel/early_printk.c +++ b/arch/arm/kernel/early_printk.c @@ -11,16 +11,20 @@ #include #include #include +#include -extern void printch(int); +extern void printascii(const char *); static void early_write(const char *s, unsigned n) { - while (n-- > 0) { - if (*s == '\n') - printch('\r'); - printch(*s); - s++; + char buf[128]; + while (n) { + unsigned l = min(n, sizeof(buf)-1); + memcpy(buf, s, l); + buf[l] = 0; + s += l; + n -= l; + printascii(buf); } }