From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753609AbdGNPpi (ORCPT ); Fri, 14 Jul 2017 11:45:38 -0400 Received: from smtprelay0199.hostedemail.com ([216.40.44.199]:49804 "EHLO smtprelay.hostedemail.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1753386AbdGNPph (ORCPT ); Fri, 14 Jul 2017 11:45:37 -0400 X-Session-Marker: 6A6F6540706572636865732E636F6D X-Spam-Summary: 50,0,0,,d41d8cd98f00b204,joe@perches.com,:::::::::,RULES_HIT:41:355:379:541:599:967:973:988:989:1260:1277:1311:1313:1314:1345:1359:1373:1437:1515:1516:1518:1534:1542:1593:1594:1605:1711:1730:1747:1777:1792:1963:2376:2393:2525:2560:2563:2682:2685:2691:2828:2859:2933:2937:2939:2942:2945:2947:2951:2954:3022:3138:3139:3140:3141:3142:3622:3865:3866:3867:3868:3870:3871:3872:3873:3874:3934:3936:3938:3941:3944:3947:3950:3953:3956:3959:4321:5007:8985:9025:10004:10400:10450:10455:10848:11026:11232:11658:11914:12043:12438:12663:12740:12760:12895:13141:13149:13161:13229:13230:13439:14096:14097:14180:14181:14659:14721:19904:19999:21080:21222:21324:21433:21434:21627:30012:30034:30054:30091,0,RBL:none,CacheIP:none,Bayesian:0.5,0.5,0.5,Netcheck:none,DomainCache:0,MSF:not bulk,SPF:,MSBL:0,DNSBL:none,Custom_rules:0:0:0,LFtime:2,LUA_SUMMARY:none X-HE-Tag: power34_13bab93100644 X-Filterd-Recvd-Size: 3925 Message-ID: <1500047134.4457.74.camel@perches.com> Subject: Re: [PATCH] printk: Move printk_delay to separate file From: Joe Perches To: Petr Mladek Cc: Sergey Senozhatsky , Steven Rostedt , Andrew Morton , linux-kernel@vger.kernel.org Date: Fri, 14 Jul 2017 08:45:34 -0700 In-Reply-To: <20170714151738.GC32632@pathway.suse.cz> References: <20170708052420.GC488@tigerII.localdomain> <1499492659.20988.14.camel@perches.com> <20170714151738.GC32632@pathway.suse.cz> Content-Type: text/plain; charset="ISO-8859-1" X-Mailer: Evolution 3.22.6-1ubuntu1 Mime-Version: 1.0 Content-Transfer-Encoding: 7bit Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Fri, 2017-07-14 at 17:17 +0200, Petr Mladek wrote: > On Fri 2017-07-07 22:44:19, Joe Perches wrote: > > On Sat, 2017-07-08 at 14:24 +0900, Sergey Senozhatsky wrote: > > > On (07/07/17 11:08), Joe Perches wrote: > > > > printk.c is a huge file with too many local functions for a > > > > human to read and easily parse. > > > > > > > > Start to separate out bits into smaller files. > > > > > > > > Miscellanea: > > > > > > > > o Rename suppress_message_printing to printk_suppress_message > > > > o Add function definitions to printk.h > > > > > > I don't mind, in general, but I'm a bit hesitant. we want to have > > > automatic printk throttling (printk delay basically) and we need > > > some of those printk-internal *_seq numbers to see how far consoles > > > are behind the logbuf. so either we need to 'un-static' those *_seq > > > and extern them in delay.c or simply keep printk-delay machinery in > > > printk.c and add the new function. > > I agree with Sergey here. Some split would make sense but I would > prefer to keep the delay stuff as is for now. It is not a big win. > And there is some demand to extent the throttling capabilities. > It would fit together with the delay stuff. But we did not think > much about it yet. > > > > // p.s. I'll take a look at the patch a bit later. I'm on a sick leave now. > > > > Hey Sergey. > > > > Basically, this is a simple trial patch. > > > > printk is getting nothing but more complex. > > > > I believe printk is in real need of logical separation > > into multiple parts to isolate the various logic bits. > > > > o console > > I think that this might be the biggest win. IMHO, one confusing > thing is that big parts of printk.c are compiled only when > CONFIG_PRINTK is defined. There there are some small parts > that are always compiled. These are mostly console related. > I am sometimes not sure what is in what section and it is > "hard" to find. Start somewhere without regard to whatever new stuff you have future dreams to add. The concept of logical separation is a big win. Moving delay into a separate file is trivial and making the symbols required to support whatever symbols are required for additional throttling is also trivial. > > o kmsg/devkmsg > > Sounds good. Well, I wonder how much code is shared with > syslog. It might make sense to join this stuff. But let's > see how it would look. > > In each case, there are some functions (msg_print_text, ...) > that are shared between console, kmsg, and syslog. We would > need to put this somewhere and share. It's relatively simple to prefix the various bits that have to become shared with printk_ and make them global symbols in separate files in the kernel/printk/ directory. It's also unfortunately tedious. I did all of that several years ago. https://lkml.org/lkml/2012/10/17/41