Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1755455AbdDFWxa (ORCPT ); Thu, 6 Apr 2017 18:53:30 -0400 Received: from mx0b-00082601.pphosted.com ([67.231.153.30]:35713 "EHLO mx0b-00082601.pphosted.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752587AbdDFWxV (ORCPT ); Thu, 6 Apr 2017 18:53:21 -0400 Authentication-Results: suse.com; dkim=none (message not signed) header.d=none;suse.com; dmarc=none action=none header.from=fb.com; Date: Thu, 6 Apr 2017 15:52:50 -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: <20170406225250.tz7ltv7s4d4xjrxy@Haydn> References: <20170405020800.GB11669@jagdpanzerIV.localdomain> <20170405021628.GC11669@jagdpanzerIV.localdomain> <20170405152256.GS3452@pathway.suse.cz> <20170406003819.dgbkdixvh6tn7hk5@Haydn> <20170406140251.GC27578@pathway.suse.cz> MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Disposition: inline In-Reply-To: <20170406140251.GC27578@pathway.suse.cz> User-Agent: NeoMutt/20170306 (1.8.0) X-Originating-IP: [2620:10d:c090:200::e:2533] X-ClientProxiedBy: MWHPR18CA0012.namprd18.prod.outlook.com (10.173.238.150) To CY4PR15MB1224.namprd15.prod.outlook.com (10.172.178.135) X-MS-Office365-Filtering-Correlation-Id: 9232c71a-9c6d-47ba-5316-08d47d3fac65 X-Microsoft-Antispam: UriScan:;BCL:0;PCL:0;RULEID:(22001)(201703131423075)(201703031133081);SRVR:CY4PR15MB1224; X-Microsoft-Exchange-Diagnostics: 1;CY4PR15MB1224;3:wIbPtWGKdxhbixt1zc2W1RC9MB5meK6dPOj26TWY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loDig==;20:HVQZd8PIFVp29n2DeNCXFa3kUNH1YjedzlJKa+3fiJTRjqbK2UVNRnjhleXBhbgWEOnDfMPwML7fV5gAG7qdQ+2DWfIJFCq8x8wtoiCzvt+iEBD055mvEWTaZOsp2MAmftAzZp2zpLu/6u+j6t3JYusEsi5mtiKZie3X7tptpr3bdgckkUtbC0yqq92uJr59kuwxMNRuP+B7ykdQdWH853ao7O15LorOnUZAbPlfijvUy46eOeGFdQjH86Osqn7/2SJZ7t6zWaemPLrHVbEswDdf/oR9NBmcxFeHC4IQe0/46PQaKfBeUqC2qWTxmxRGtB1LERWrthbAbKOC3kGewQOMutXoKi/DIZHSgQ+QoWV9XQSbwzO/DnBzV322P9SizVE5yFhXtblxwb0OT6wipIBVaSzoWHQ1YccKgq0of87FJYrKdqJx4Sl6rH4zrQ+9POuZLPTzzPDLUqc4/hUTMxtyquCeStgh2f+qOj2WGrWwqg3RZEBb0eRd2MGQZLLH X-Microsoft-Antispam-PRVS: X-Exchange-Antispam-Report-Test: UriScan:(9452136761055)(100405760836317); X-Exchange-Antispam-Report-CFA-Test: BCL:0;PCL:0;RULEID:(6040450)(601004)(2401047)(8121501046)(5005006)(10201501046)(3002001)(93006095)(93001095)(6041248)(201703131423075)(201702281528075)(201703061421075)(20161123562025)(20161123560025)(20161123564025)(20161123555025)(6072148);SRVR:CY4PR15MB1224;BCL:0;PCL:0;RULEID:;SRVR:CY4PR15MB1224; X-Microsoft-Exchange-Diagnostics: 1;CY4PR15MB1224;4:J4jE9dL1D+5xCm4ypYR1Bazd/jAtq34XakdvJA+zUtBEJK0TRkwBqFgAv/08BQEb+z6AF0bpH9vPZ3HasCGuxoqiESRR6acwk184BgtItnJ/DBTM00TKGSS10vjqbVzJ7VZBZkKx6FqznL63DLP4kjpWmEz+tLIWwuMqTm7GCO5NAs+vhVxVsHfufr7pt5+LrE+cll1u9NSRTcSFB4N8GDBMD7fouPedi5YJmA05Y6ATQwgJFA9dX6XiG7j0YtqHmvzp7Bi3qiUjXbkoyl5+T6ZasZiAAZCGAgJgBoFh/rsLM7Km3GmgipZlQEhJrg/SeTYR5vcxfPm6SpotVsAml+OjtZykDLMKIbyXo1WAMy7du60qkEPnANNE29S2Dgw9cJY9v4xL4WyAZMnUUd9JtlOrbUaJEgrVxoniG8UwISL5MkMcdAIPfBoZhf4bbKEtBsi/AYL0B0OGFmWDwHC6NTz5KJSSxhyDXSimolgGaNPMYmAkkQHxrgwxnLSQM7VaTlr2x1DBFZQW0q4Mtnpau2tjJfbmmMnp0YRiUdfyxFSIsWPPzLPRhiqldInADHfz716dJrDlIlGl6x1n+MwwzWXjKlO+q8GsohyUVUFjjT/9TsW7j8NSRi7sq+2+IvOBVRvrLWXEfG/y6LNw7GShv+L4C8L7vd30Ag8f2Hol5rWv0pJBkeJ7ZgG9KBxANCitSNGy9NrdD5M/GQtqKuNEKBld8FVW5WWkE8XsmFV1nIEmJcLwcVERP5FuzPm86uMtePTSzFsq67jjBQ1XLAbFfuajjQLQXh3fyt3+7dWrGM0= X-Forefront-PRVS: 02698DF457 X-Forefront-Antispam-Report: SFV:NSPM;SFS:(10019020)(4630300001)(6009001)(39840400002)(39850400002)(39410400002)(39450400003)(39400400002)(377424004)(24454002)(2950100002)(6916009)(54356999)(76176999)(6666003)(50986999)(7736002)(7416002)(33716001)(42186005)(23676002)(5660300001)(33646002)(93886004)(50466002)(15650500001)(305945005)(81166006)(8676002)(54906002)(189998001)(55016002)(6246003)(6496005)(8666007)(53936002)(86362001)(25786009)(83506001)(1076002)(9686003)(110136004)(6116002)(229853002)(47776003)(38730400002)(2906002)(4326008);DIR:OUT;SFP:1102;SCL:1;SRVR:CY4PR15MB1224;H:Haydn;FPR:;SPF:None;MLV:sfv;LANG:en; X-Microsoft-Exchange-Diagnostics: =?utf-8?B?MTtDWTRQUjE1TUIxMjI0OzIzOngvZ25rOHZvRXQ5RmpQM1ZqOTJMdHhNcXA4?= =?utf-8?B?VWVLUVpPOVZWREVaNC9GYmw0TTUvN0pLREh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jAVqx1erNI4UAkb00iu50uh+jAJ8pQygWkWrobh1BDuAjQmnR0avm9FD4//pfNQg85/1RgxQx4QqVfhw1AzmNFNRQv18EZQqmYao0GjpeE4bxDgPEnG26fsctC5NzuU2VOeB1nk2hujPNLMg3firlqd9veBDKL4KLrtIz462xxw==;5:b4UBdx1+pV82gJqg1EA4P5BL+sLqq+uQHiKKnWU9xxDg54gKI5eN09rJcnpo90Cf9LKv/rWrAC20563TmO3ykxSMN9cHGt5G1gbUxr3R8Q8g1idSeqA1oxhBpVipO0D+jS5wekZRlKh5QvUTMWNfWg==;24:LojuFDJFeXxl4iX52hKpLVJbZudo2ckoTLvhaFGWNmnJ8mJn5kMfJCYnAuSHJZrR2Q3YXf2/YpC+xaj0Q/ahgXDfOzUHJ0XfbHQABKFQdfk= SpamDiagnosticOutput: 1:99 SpamDiagnosticMetadata: NSPM X-Microsoft-Exchange-Diagnostics: 1;CY4PR15MB1224;7:2+8219KIALbFrsQeqDvuwHeU1GMNOaW29/0JF49nfwuvuq5VceY+cfqxKODKINy0W2SwYKcMK7WN2MyWAcJ5NwRdfo5lUc9paCLnG2gX+huYLLpA4IWQDvZsPViVRQjNC5M9e7ypn57Z03A+pP5izoUOTWXR/Dc+Ziih4FwdRg/1KDinXX+hsA2/EVGWqHLcuZQYFp63zVf9eXAQXoJU+vdRsuwwstwpoHw6hMRgQ4Bj8DO19vBrsSXcpR/42lMDMMM+p/vNUumomTfh522RDsKsWt3V9YqqguKWPwSiUKZVerPqFDtFXguFM9NtJWTCcOqhJKrsNSsObrzzLeFvbA==;20:/3G85ZqBt26EoVMAuw0S5P4gu05Nf2mPhpXH+QPTMfnAaOfLc1JqBhLWBKWxy4ZDzGe5s4q/kkSH8k9vV35d3Yg8VN/RSccvrL3l8NVD+KlKoUNGm0W3LKLJRU6LCMnDoUEHHqHzb06JJ4x9jZ6g2P6kk6QgfKDHDe39QttFfjE= X-MS-Exchange-CrossTenant-OriginalArrivalTime: 06 Apr 2017 22:52:58.6608 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-Transport-CrossTenantHeadersStamped: CY4PR15MB1224 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-06_14:,, signatures=0 Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 4447 Lines: 119 On Thursday 04/06 at 16:02 +0200, Petr Mladek wrote: > On Wed 2017-04-05 17:38:19, Calvin Owens wrote: > > On Wednesday 04/05 at 17:22 +0200, Petr Mladek wrote: > > > 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. > > Please note that you must not call console_lock() in the sysrq > handler. The function might sleep and it is irq context. > By other words, you could not manipulate the console structures > there. Sure, I'd punt it to process context somehow. > > > 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". > > I do not have strong opinion here. I like the idea of this patch. > Sadly, the console setting already is pretty confusing. > > I know that many people, including me, have troubles to understand > the meaning of the 4 numbers in /proc/sys/kernel/printk. They set > > console_loglevel > default_message_loglevel > minimum_console_loglevel > default_console_loglevel > > And we are going to add another complexity :-( > > > > How about a read-only "functional_loglevel" attribute for each console > > that displays: > > > > max(min(console_level, con->maxlevel), minimum_console_level) > > I like this idea and it inspired me. What about creating the following > structure under /sys > > /sys/consoles//loglevel > /minimum_loglevel > //loglevel > /minimum_loglevel > /loglevel > /minimum_loglevel > > The semantic would be: > > + global loglevel will show the current default console_loglevel, > it must be above the global minimum_console_loglevel > > + the per-console loglevel will show the loglevel specific > for the given console; it must be above the per-console > minimum_loglevel while > > + the per-console minimum_loglevel must be above the global > minimum_console_loglevel > > The setting of the global values would affect the per-console > values but it must respect the above rules. > > It is still the "filter" and "bypass" logic. But we will just > repeat the existing terms and logic. Also note that > "ignore_loglevel" and the special modes in sysrq, panic, oops > use the "bypass" logic as well. Okay, I see where you're coming from. Let me play with this a bit, I'll send something concrete in the next day or two. > > Would that make the semantics more obvious? I'll obviously also send > > patches for Documentation once there's consensus about the interface. > > Please add also linux-api@vger.kernel.org, especially for the > patch adding the new toplevel directory under /sys. Will do. Thanks, Calvin > Best Regards, > Petr