From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1755285AbcEQJYv (ORCPT ); Tue, 17 May 2016 05:24:51 -0400 Received: from mx2.suse.de ([195.135.220.15]:46188 "EHLO mx2.suse.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752045AbcEQJYu (ORCPT ); Tue, 17 May 2016 05:24:50 -0400 Date: Tue, 17 May 2016 11:24:46 +0200 From: Petr Mladek To: Calvin Owens Cc: "Paul E. McKenney" , Andrew Morton , David Howells , Pranith Kumar , David Woodhouse , Johannes Weiner , Ard Biesheuvel , Tejun Heo , Sergey Senozhatsky , Vasily Averin , Thierry Reding , Geliang Tang , Ivan Delalande , linux-kernel@vger.kernel.org, kernel-team@fb.com Subject: Re: [RFC][PATCH] printk: Add option to append kernel version to the dict Message-ID: <20160517092446.GI2895@pathway.suse.cz> References: <51047c0f6e86abcb9ee13f60653b6946f8fcfc99.1463172791.git.calvinowens@fb.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <51047c0f6e86abcb9ee13f60653b6946f8fcfc99.1463172791.git.calvinowens@fb.com> User-Agent: Mutt/1.5.21 (2010-09-15) Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Fri 2016-05-13 13:58:04, Calvin Owens wrote: > We use netconsole to collect kernel logs from all the servers at > Facebook. We use this patch internally so each logline has a record of > which kernel version emitted it. > > At first glance, this might seem lazy: as you would expect, we have a > database which records which kernel version a host is currently running. > But there are a lot of situations where that database cannot be current: > early-ish boot crashes are probably the best example, but even beyond > that there are lots of varieties of kernel brokenness that can prevent > the database from being updated. Doing it explicitly this way ensures > that we always know exactly what version emitted a given message. > > Doing it in printk() itself rather than extended netconsole ends up > being much simpler, and has the advantage that future extended console > implementations will be able to benefit from this as well. I do not have strong opinion about it. I am just not sure that repeating the very same string in each message is efficient and practical in general. If you store the entire log somewhere, you should be able to find the kernel version from the early boot messages, e.g. from pr_notice("%s", linux_banner). Of course, this does not help if the boot fails earlier but it is rather a corner case. The risk is that someone else might need another information. If we do it more generic, we might end up with quite complex code. If we really need such a feature. It might make sense to print the identifier at the beginning of each message. It will be the same on each line and it might be easier to parse. Best Regards, Petr