Received: by 2002:ac0:a5a6:0:0:0:0:0 with SMTP id m35-v6csp1827600imm; Mon, 3 Sep 2018 10:27:57 -0700 (PDT) X-Google-Smtp-Source: ANB0VdYFzkp7e8jPwgXyKLpjIv+0o7LBQO8SudU2DtEcoFZ7dYoMrqh0Bvw4cO5TpXDn2/4YhbCq X-Received: by 2002:a63:1b4e:: with SMTP id b14-v6mr27145474pgm.303.1535995677230; Mon, 03 Sep 2018 10:27:57 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1535995677; cv=none; d=google.com; s=arc-20160816; b=COa0qW1DC7ajIqLopbdODI6IoCIulnQ2kWcJ5UACZm6fkEChysXeVdVPF5L9Mg8ZIR dOkfn7hJ30+1coyIz1z8RIUiQJrb6nvIunT6wHXT+a2VDZ4X8DoARjHgQ4BXnDzSpCro gEDGIy52uyxVOFSZGEJho4rh8Xy4qID4hwehHM93j6xJ2pn0wxSFfPAHZKf95yzGdkKt rdj2iU3hC0CqZjm97RYuqn5ySIUFOmPaBRJZzI9CV/enh1QKLud9MRQKV2+gMjNhGcc7 CQvAhx0i0xXVmZ3TcF7Mw65dksq0zC5nFLxe9RHYFcZMz4bx0/4W4R35ZabpQEpnJvVe TJOA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:mime-version:user-agent:references :in-reply-to:message-id:date:subject:cc:to:from :arc-authentication-results; bh=1ibykPANGM2Y2lKUSXd2WPmTx4QNaA+b5B3fW9B3z2E=; b=z+h0OzLzDqcDJeVPEBHfwa2y1SswlcMW+z8sEhOgS3Do8k1AagetxNzAFrlFJxc57S qpL6ymCv7Yaqi3ZyJO0tgfVByMh9lynj+VDX51/+4R0oB5tPgg8zayLS6Cm196QbJWCK tmp/tdwbRn9SXCbxbn7XqVQAAu97zhnH3N13ApiOvZMOk4g8iS4ivd56KiImGo7OnIUh OF+ajsx56DvQQF/1fcozmFRC7Th8PB7rbJhMdq+JEuQfy9yYeJ3V3DSSPAB90DTJ5Clj L0ZAMblbFG6Nsm09jrmrkr53STIIf+RDdwjpGgw+dy+pmTskzgu8NZvcafUFpCyVbYlc nQag== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id r7-v6si19446100pli.248.2018.09.03.10.27.42; Mon, 03 Sep 2018 10:27:57 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1730855AbeICVrr (ORCPT + 99 others); Mon, 3 Sep 2018 17:47:47 -0400 Received: from mail.linuxfoundation.org ([140.211.169.12]:45924 "EHLO mail.linuxfoundation.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1728628AbeICVrq (ORCPT ); Mon, 3 Sep 2018 17:47:46 -0400 Received: from localhost (ip-213-127-74-90.ip.prioritytelecom.net [213.127.74.90]) by mail.linuxfoundation.org (Postfix) with ESMTPSA id 4503ED30; Mon, 3 Sep 2018 17:26:39 +0000 (UTC) From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org, Steven Rostedt Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Peter Zijlstra , Tetsuo Handa , Sergey Senozhatsky , Sergey Senozhatsky , Petr Mladek Subject: [PATCH 4.14 094/165] printk: Split the code for storing a message into the log buffer Date: Mon, 3 Sep 2018 18:56:20 +0200 Message-Id: <20180903165700.240935200@linuxfoundation.org> X-Mailer: git-send-email 2.18.0 In-Reply-To: <20180903165655.003605184@linuxfoundation.org> References: <20180903165655.003605184@linuxfoundation.org> User-Agent: quilt/0.65 X-stable: review MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 4.14-stable review patch. If anyone has any objections, please let me know. ------------------ From: Petr Mladek commit ba552399954dde1b388f7749fecad5c349216981 upstream. It is just a preparation step. The patch does not change the existing behavior. Link: http://lkml.kernel.org/r/20180627140817.27764-2-pmladek@suse.com To: Steven Rostedt Cc: Peter Zijlstra Cc: Tetsuo Handa Cc: Sergey Senozhatsky Cc: linux-kernel@vger.kernel.org Cc: stable@vger.kernel.org Acked-by: Sergey Senozhatsky Signed-off-by: Petr Mladek Signed-off-by: Greg Kroah-Hartman --- kernel/printk/printk.c | 43 ++++++++++++++++++++++++++----------------- 1 file changed, 26 insertions(+), 17 deletions(-) --- a/kernel/printk/printk.c +++ b/kernel/printk/printk.c @@ -1680,28 +1680,16 @@ static size_t log_output(int facility, i return log_store(facility, level, lflags, 0, dict, dictlen, text, text_len); } -asmlinkage int vprintk_emit(int facility, int level, - const char *dict, size_t dictlen, - const char *fmt, va_list args) +/* Must be called under logbuf_lock. */ +int vprintk_store(int facility, int level, + const char *dict, size_t dictlen, + const char *fmt, va_list args) { static char textbuf[LOG_LINE_MAX]; char *text = textbuf; size_t text_len; enum log_flags lflags = 0; - unsigned long flags; - int printed_len; - bool in_sched = false; - - if (level == LOGLEVEL_SCHED) { - level = LOGLEVEL_DEFAULT; - in_sched = true; - } - - boot_delay_msec(level); - printk_delay(); - /* This stops the holder of console_sem just where we want him */ - logbuf_lock_irqsave(flags); /* * The printf needs to come first; we need the syslog * prefix which might be passed-in as a parameter. @@ -1742,8 +1730,29 @@ asmlinkage int vprintk_emit(int facility if (dict) lflags |= LOG_PREFIX|LOG_NEWLINE; - printed_len = log_output(facility, level, lflags, dict, dictlen, text, text_len); + return log_output(facility, level, lflags, + dict, dictlen, text, text_len); +} +asmlinkage int vprintk_emit(int facility, int level, + const char *dict, size_t dictlen, + const char *fmt, va_list args) +{ + int printed_len; + bool in_sched = false; + unsigned long flags; + + if (level == LOGLEVEL_SCHED) { + level = LOGLEVEL_DEFAULT; + in_sched = true; + } + + boot_delay_msec(level); + printk_delay(); + + /* This stops the holder of console_sem just where we want him */ + logbuf_lock_irqsave(flags); + printed_len = vprintk_store(facility, level, dict, dictlen, fmt, args); logbuf_unlock_irqrestore(flags); /* If called from the scheduler, we can not call up(). */