Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1756251AbdDFAi7 (ORCPT ); Wed, 5 Apr 2017 20:38:59 -0400 Received: from mx0b-00082601.pphosted.com ([67.231.153.30]:59580 "EHLO mx0b-00082601.pphosted.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752609AbdDFAiw (ORCPT ); Wed, 5 Apr 2017 20:38:52 -0400 Authentication-Results: suse.com; dkim=none (message not signed) header.d=none;suse.com; dmarc=none action=none header.from=fb.com; Date: Wed, 5 Apr 2017 17:38:19 -0700 From: Calvin Owens To: Petr Mladek CC: Sergey Senozhatsky , Steven Rostedt , Greg Kroah-Hartman , "Jiri Slaby" , Andrew Morton , Manuel =?utf-8?Q?Sch=C3=B6lling?= , Hans de Goede , Paul Burton , , , Sergey Senozhatsky Subject: Re: [RFC][PATCH 1/2] printk: Introduce per-console filtering of messages by loglevel Message-ID: <20170406003819.dgbkdixvh6tn7hk5@Haydn> References: <20170405020800.GB11669@jagdpanzerIV.localdomain> <20170405021628.GC11669@jagdpanzerIV.localdomain> <20170405152256.GS3452@pathway.suse.cz> MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Disposition: inline In-Reply-To: <20170405152256.GS3452@pathway.suse.cz> User-Agent: NeoMutt/20170306 (1.8.0) X-Originating-IP: [2620:10d:c090:200::e:2533] X-ClientProxiedBy: DM5PR2201CA0036.namprd22.prod.outlook.com (10.174.180.153) To CY4PR15MB1221.namprd15.prod.outlook.com (10.172.177.19) X-MS-Office365-Filtering-Correlation-Id: 26d21938-2a2c-4a6d-2b39-08d47c853d73 X-Microsoft-Antispam: UriScan:;BCL:0;PCL:0;RULEID:(22001)(201703131423075)(201703031133081);SRVR:CY4PR15MB1221; X-Microsoft-Exchange-Diagnostics: 1;CY4PR15MB1221;3:nXwF6c993cjaHtDQjorpEvXr+luUyW6QNZr/bU5LJwzbTUv7hC+a9UWWm9/kZk+97IUnusL4UWRTDSUTiZueLaSHaHdPv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2sr3xpLTSicxBpJ5/lQ8ZmJFwHvAGIZdcPOG8InYB2PFTTRqgsBbY7ia2KENlwwqjtxuCOqNbfbL3DKVPhuo8h7XDSFESydwIuTis6t77YwZIsJ/zIXjQVjDWvORAaVXRHGAfsbDQG0fwIRAV48CeCTHGeB0PAm1IFjpCq19HLQgH3mI1m3qkVAeQ+RIw2raiMwEzAImPkWGVXuJsT6/eCBLQPvxqAokHhVn/v8CC7RzDMgKM0DgwzArJjuBQnSAPCGrc22QM8wGcewl4Kr41IIrt1YOJefbSL9zfEYZlWOHrJLITJD2T0q5lmKFvr3oBnQThhppIY4GOU5wYa/dwukIoi9ZhxxlDTGn+HJ1dCoZS6CxtgpnNop6Eyj/I7R3+k0y3tx08YbrI0QqyTThbl88VG5le0XlldhRzBgj0R42qBIOQAA X-Microsoft-Antispam-PRVS: X-Exchange-Antispam-Report-Test: UriScan:(100405760836317); X-Exchange-Antispam-Report-CFA-Test: BCL:0;PCL:0;RULEID:(6040450)(601004)(2401047)(5005006)(8121501046)(3002001)(10201501046)(93006095)(93001095)(6041248)(20161123555025)(20161123564025)(20161123560025)(201703131423075)(201702281528075)(201703061421075)(20161123562025)(6072148);SRVR:CY4PR15MB1221;BCL:0;PCL:0;RULEID:;SRVR:CY4PR15MB1221; X-Microsoft-Exchange-Diagnostics: 1;CY4PR15MB1221;4:SgbDrHaTK7qcjFEwlFb6/kD55CbpkHR6rROFfduNVJwf676lXwPtBRt2ROIftCOIvgfL9Am3wlPAlm36MiKK5mI/DwPpO0xdJc+VnyhW8w4DkHBHYA48MAYR/feZ3f6Fkb3beCTtKRG650hdm1uiBXuBs0v+3vjM3qOziHvt5lFolXtTqA463KnPFGAIo6jgXzuwmLSuuVloQGoK8n700qW8bJ8K6u81pPxG1dNs2vdKS8VLl9PDb4alTuL1vtyLmYH1XUXzw8S6TmOrz4BRkiOtFOOqG8ngRGvqx6ClsrnjXaON9rjFb9wWUP8OKPzi5v6LzC8VshTVfxaycqObpUm5OU//Q4MmDXE/bNEJQ2J/kxvIDI2EYbaPb2hYvyRBrvfWMpJx4e/LsL2mu2rXxry1xrrQhRwpnny+A9GaLZueDo42smlzblll4zoEoXW/K2Io7cQJVxTAaGzwm8lgSsWl15/ei0bI9DJhiI+tK6LUZa/6MCjfrdCMNK+DWQQ4W8JRAbm4tSoVrFnbSfaGnC85WOtYNEhUhN9TzaGaHSdT/4Maoaplmn1GImlOcudDJLGslyN+F3Jqc3IbPp9LlUFxtRRXyXN6n7sHB8fqqxj0Zleh/+LsWkB5lFSQj4bZTxr71gX3LJNmJUHEOdWi1H0SweuBKtXI7q9LNm1D5peZ57T5FbyDYZbMupzSkaJvFc+vPEUUTl1NEZ1KD7QmDir6o9BRKro4ecU6LYt9Yp2PHpIiAHXSCnUYAhQpanLnGQ7h88l534Mb739/fMtLog== X-Forefront-PRVS: 02698DF457 X-Forefront-Antispam-Report: SFV:NSPM;SFS:(10019020)(4630300001)(6009001)(39450400003)(39850400002)(39840400002)(39400400002)(39410400002)(24454002)(76104003)(377424004)(4001350100001)(81166006)(6916009)(86362001)(1076002)(8676002)(6116002)(189998001)(42186005)(6246003)(2950100002)(6666003)(50466002)(83506001)(47776003)(53936002)(2906002)(15650500001)(229853002)(4326008)(305945005)(5660300001)(50986999)(9686003)(76176999)(55016002)(7736002)(25786009)(54906002)(7416002)(6496005)(23676002)(33716001)(110136004)(54356999)(33646002)(38730400002)(93886004)(8666007);DIR:OUT;SFP:1102;SCL:1;SRVR:CY4PR15MB1221;H:Haydn;FPR:;SPF:None;MLV:sfv;LANG:en; X-Microsoft-Exchange-Diagnostics: =?utf-8?B?MTtDWTRQUjE1TUIxMjIxOzIzOlRERTJZQzNnU3FyK1BKYmd5UXFkaFFwc1h5?= =?utf-8?B?OXBpajloMHZjOHlDaDNkRWc1SjdPc0VZWjZxWEMyakwzOEtwRkpyUERmU2Z2?= =?utf-8?B?TmJHZ2YzQ3BDZFVUSFprMmYxV0ZrTWsxWkZ4WTgxOHpwdkxhYWs1b0dZU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v4V1sFJcxsG6jV+ftHgLnCi3dYJocRO2gZUEfYmEtI3x56aLYrf8l6cp6JEqZHKQ4rynQ5O+ulPC1l7Bas0eh22LCgZEsW23qlxckRY56XiY335Uf93Kag33dhnybJLMA==;5:9tn7rCfhqrOU2bzBpba6Q6P6YqoGVXo+f5glwjZ6OMQbnGvS+3RqVFknJDyH8SQJP3wp6KNIPJpKsjIk3jGbhKWWjFQfOjtCZaPtxOtDNaP8ENYpaKzdPM3HOKkl8ew4aqycqWXSLqPl72BUklSNXg==;24:hj09leCJUylev7I5Mw1kBvmSf/ialbcS9pDfWdnKYP4i4TO1qsc9/uoIWHu4gigwawAaa/tG4NzeRzQeB2VBo5Xpu+6n1vxsfBivlSOwn2k= SpamDiagnosticOutput: 1:99 SpamDiagnosticMetadata: NSPM X-Microsoft-Exchange-Diagnostics: 1;CY4PR15MB1221;7:oihaqaAwL1rCNefplskCl4kaF0sOo6ClVIlKbIf2cqLpCs7L5iM/vU3nkOk3JIZz3sfONpXGvtKJw/ybcIhwfPiTS4ahLRGJ7g2aCP+xQIWPQYbgkIo7sNNeX1sZuXZLTpxdwu0GfEcJlljGKEcpvelUaQhaBlHarEoAzPtyJa/JqLas6UGW6IYZJny+Jx2XTzC2Yuv4PoSBqLmCNFRu3VDSUAr+GhbwUd2LTMWKEowokR82cwsI9Z8nkF2dHpmHPphWEA9E9W7ft5cK7dy96PyTdlspJEDkZuoy6mEXf4i8mgqufFq3Vlsp/aogIZ65nq94cNEHZY7F4jl9H2EjGw==;20:A2aH9JXPmHfWrSWgUU7IS7cQwfDq7Ft3jF5dkouCMM/V04obOjdmxAdjtIWKC4Fd2UdVM6WVgSRaai+AafIadZgmVPK/rk95kV1O1AJwKwww9tYA+pel4lagCZPZ+dXcRSkWkB+Y5hDqp+pwJVhWNS7d/5YzUOFlb2VziqlPbZk= X-MS-Exchange-CrossTenant-OriginalArrivalTime: 06 Apr 2017 00:38:25.4932 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-Transport-CrossTenantHeadersStamped: CY4PR15MB1221 X-OriginatorOrg: fb.com X-Proofpoint-Spam-Reason: safe X-FB-Internal: Safe X-Proofpoint-Virus-Version: vendor=fsecure engine=2.50.10432:,, definitions=2017-04-05_17:,, signatures=0 Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 3687 Lines: 104 On Wednesday 04/05 at 17:22 +0200, Petr Mladek wrote: > On Wed 2017-04-05 11:16:28, Sergey Senozhatsky wrote: > > On (04/05/17 11:08), Sergey Senozhatsky wrote: > > [..] > > > > stop_critical_timings(); /* don't trace print latency */ > > > > - call_console_drivers(ext_text, ext_len, text, len); > > > > + call_console_drivers(ext_text, ext_len, text, len, msg->level); > > > > start_critical_timings(); > > > > printk_safe_exit_irqrestore(flags); > > > > > > ok, so the idea is quite clear and reasonable. > > > > > > > > > some thoughts, > > > we have a system-wide suppress_message_printing() loglevel filtering > > > in console_unlock() loop, which sets a limit on loglevel for all of > > > the messages - we don't even msg_print_text() if the message has > > > suppressible loglevel. and this implicitly restricts per-console > > > maxlevels. > > > > > > console_unlock() > > > { > > > for (;;) { > > > ... > > > skip: > > > > > > if (suppress_message_printing(msg->level)) // console_loglevel > > > goto skip; > > > > > > call_console_drivers(msg->level) > > > { > > > if (level > con->maxlevel) // con loglevel > > > continue; > > > ... > > > } > > > } > > > } > > > > > > this can be slightly confusing. what do you think? I think it makes sense as long as we're clear about the semantics: if a message would normally be printed to the console according to the global settings, this allows you to limit the loglevel a specific console will print. Petr suggested the opposite approach, I'll address that below. > I think about a reasonable behavior. There seems to be three variables > that are related and are in use: > > console_level > minimum_console_loglevel > ignore_loglevel > > The functions seems to be the following: > > + console_level defines the current maximum level of > messages that appear on all enabled consoles; it > allows to filter out less important ones > > + minimum_console_loglevel defines the minimum > console_loglevel that might be set by userspace > via syslog interface; it prevents userspace from > hiding emergency messages > > + ignore_loglevel allows to see all messages > easily; it is used for debugging > > IMPORTANT: console_level is increased in some special > situations to see everything, e.g. in panic(), oops_begin(), > __handle_sysrq(). > > I guess that people want to see all messages even on the slow > console during panic(), oops(), with ignore_loglevel. It means > that the new per-console setting must not limit it. Also any > console must not go below minimum_console_level. I can definitely take oops_in_progress and minimum_console_level into account in the drop condition. I can also send a patch to make the sysrq handler reset all the maxlevels to LOGLEVEL_DEBUG if you like. > What about doing it the other way and define min_loglevel > for each console. It might be used to make selected consoles > always more verbose (above current console_level) but it > will not limit the more verbose modes. I think it's more intuitive to let the global sysctl behave as it always has, and allow additional filtering of higher levels downstream. I can definitely see why users might find this a bit confusing, but IMHO stacking two "filters" is more intuitive than a "filter" and a "bypass". How about a read-only "functional_loglevel" attribute for each console that displays: max(min(console_level, con->maxlevel), minimum_console_level) Would that make the semantics more obvious? I'll obviously also send patches for Documentation once there's consensus about the interface. Thanks, Calvin > Best Regards, > Petr