Received: by 2002:ac0:aed5:0:0:0:0:0 with SMTP id t21csp6027523imb; Fri, 8 Mar 2019 07:45:32 -0800 (PST) X-Google-Smtp-Source: APXvYqw6emwFzcTbRIAREZGjLDCSx2a0/pw7gvKGp6Nq2gOR61p9uapkddT9qVv+7ET5zzq82W0S X-Received: by 2002:a17:902:9003:: with SMTP id a3mr19191492plp.2.1552059932284; Fri, 08 Mar 2019 07:45:32 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1552059932; cv=none; d=google.com; s=arc-20160816; b=rYETo4YDSwAAxLhK+QgndEXOdo6fGIMxLibL32x8U4hu9tYKx7lvB1zEanG1jT6Ofb m1oiFIfcKe2k2uEpa34RGjD+34QjTHk6arn8I9bc2Z9KpSg2lW5s/Q2yXyz3yJ6K9Ud/ OWZJLQWLnOv0ZRUWjloN5yjNCMI+fANqQickUm+aZlFHmV1mPQKMqcEw+5P9IGDR4F2Q 7KGSHHg7c3AU8bt8yTq/loz6Jcu0XNiQz4fmKQmw31Iqk816B/wyoTucthGjOm6jnLfN r27uxX1WCWG2ofHHghfWXkmF7l5RyDs/iI7j4dJ0KZ8AMoN1I9oajeSvQ3Ngxa4Ywb28 tJmA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:user-agent:in-reply-to :content-disposition:mime-version:references:message-id:subject:cc :to:from:date; bh=fy8Z60Gocdsi1upWUKVBcnjVZxYAgL/x03TqKUxKY30=; b=exkloB7/NqIsZi8+tEocY0xxjmyEKAcJRDc/u3I+rTQEjDK8XfaQJvHZmtkVVqF429 MWS90cX7kbk6VHQQr4ZZpOZI0vHS6r8/isqgAvCwKe7SuraZ+PX+yE6wA4o/gmcBrFe+ Bnmr3CzjcUnMRjGI9qrlhTivY9ZB9P4o22WbQPmRWCoil7PnB+EI7Fu5d4QYGKzndQtn Z1MhnK5fZMSMBTUcCu9B5CbmzCyjFznkiMA+kaj74MeIqmfQ3P+P1XltrDjuFhlWwT6t Pqy6YocMl1mZAsm3FT4k2XOTmf2hRTNtaWDQkN474MGLmlZ1UgHZhfLDdqnzn9pKITa7 znYQ== 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 c5si7283036pls.287.2019.03.08.07.45.13; Fri, 08 Mar 2019 07:45:32 -0800 (PST) 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 S1726395AbfCHPof (ORCPT + 99 others); Fri, 8 Mar 2019 10:44:35 -0500 Received: from mx2.suse.de ([195.135.220.15]:57842 "EHLO mx1.suse.de" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1726171AbfCHPoe (ORCPT ); Fri, 8 Mar 2019 10:44:34 -0500 X-Virus-Scanned: by amavisd-new at test-mx.suse.de Received: from relay2.suse.de (unknown [195.135.220.254]) by mx1.suse.de (Postfix) with ESMTP id 72583AFCE; Fri, 8 Mar 2019 15:44:32 +0000 (UTC) Date: Fri, 8 Mar 2019 16:44:31 +0100 From: Petr Mladek To: Calvin Owens Cc: Sergey Senozhatsky , Steven Rostedt , Greg Kroah-Hartman , Jonathan Corbet , linux-kernel@vger.kernel.org, linux-serial@vger.kernel.org Subject: Re: [PATCH 2/4] printk: Add ability to set loglevel via "console=" cmdline Message-ID: <20190308154431.vutfqckuv3t57znd@pathway.suse.cz> References: MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: User-Agent: NeoMutt/20170421 (1.8.2) Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Fri 2019-03-01 16:48:18, Calvin Owens wrote: > This extends the "console=" interface to allow setting the per-console > loglevel by adding "/N" to the string, where N is the desired loglevel > expressed as a base 10 integer. Invalid values are silently ignored. > > Signed-off-by: Calvin Owens > --- > .../admin-guide/kernel-parameters.txt | 6 ++-- > kernel/printk/console_cmdline.h | 1 + > kernel/printk/printk.c | 30 +++++++++++++++---- > 3 files changed, 28 insertions(+), 9 deletions(-) > > diff --git a/Documentation/admin-guide/kernel-parameters.txt b/Documentation/admin-guide/kernel-parameters.txt > index 858b6c0b9a15..afada61dcbce 100644 > --- a/Documentation/admin-guide/kernel-parameters.txt > +++ b/Documentation/admin-guide/kernel-parameters.txt > @@ -612,10 +612,10 @@ > ttyS[,options] > ttyUSB0[,options] > Use the specified serial port. The options are of > - the form "bbbbpnf", where "bbbb" is the baud rate, > + the form "bbbbpnf/l", where "bbbb" is the baud rate, > "p" is parity ("n", "o", or "e"), "n" is number of > - bits, and "f" is flow control ("r" for RTS or > - omit it). Default is "9600n8". > + bits, "f" is flow control ("r" for RTS or omit it), > + and "l" is the loglevel on [0,7]. Default is "9600n8". We should a more detailed explanation about the loglevel semantic. It is either minimal loglevel. Or that it overrides the global console_loglevel if you accept my proposal. > > See Documentation/admin-guide/serial-console.rst for more > information. See > diff --git a/kernel/printk/console_cmdline.h b/kernel/printk/console_cmdline.h > index 11f19c466af5..fbf9b539366e 100644 > --- a/kernel/printk/console_cmdline.h > +++ b/kernel/printk/console_cmdline.h > @@ -6,6 +6,7 @@ struct console_cmdline > { > char name[16]; /* Name of the driver */ > int index; /* Minor dev. to use */ > + int loglevel; /* Loglevel to use */ The comment will be true only with the new proposal. > char *options; /* Options for the driver */ > #ifdef CONFIG_A11Y_BRAILLE_CONSOLE > char *brl_options; /* Options for braille driver */ > diff --git a/kernel/printk/printk.c b/kernel/printk/printk.c > index 6ead14f8c2bc..2e0eb89f046c 100644 > --- a/kernel/printk/printk.c > +++ b/kernel/printk/printk.c > @@ -2104,8 +2105,8 @@ __setup("console_msg_format=", console_msg_format_setup); > static int __init console_setup(char *str) > { > char buf[sizeof(console_cmdline[0].name) + 4]; /* 4 for "ttyS" */ > - char *s, *options, *brl_options = NULL; > - int idx; > + char *s, *options, *llevel, *brl_options = NULL; > + int idx, loglevel = LOGLEVEL_EMERG; > > if (_braille_console_setup(&str, &brl_options)) > return 1; > @@ -2123,6 +2124,14 @@ static int __init console_setup(char *str) > options = strchr(str, ','); > if (options) > *(options++) = 0; > + > + llevel = strchr(str, '/'); This should be: if (options) llevel = strchr(options, '/'); > + if (llevel) { > + *(llevel++) = 0; > + if (kstrtoint(llevel, 10, &loglevel)) > + loglevel = LOGLEVEL_EMERG; > + } > + > #ifdef __sparc__ > if (!strcmp(str, "ttya")) > strcpy(buf, "ttyS0"); Best Regards, Petr