public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Hidehiro Kawai <hidehiro.kawai.ez@hitachi.com>
To: Kay Sievers <kay@vrfy.org>
Cc: linux-kernel@vger.kernel.org, yrl.pp-manager.tt@hitachi.com,
	akpm@linux-foundation.org, gregkh@linuxfoundation.org,
	davem@davemloft.net, itoukzo@nttdata.co.jp
Subject: Re: Re: [RFC PATCH 0/5] Add a hash value for each line in /dev/kmsg
Date: Mon, 29 Jul 2013 20:54:51 +0900	[thread overview]
Message-ID: <51F6580B.30409@hitachi.com> (raw)
In-Reply-To: <CAPXgP11HzstSBt1PQUgJeGC59yXc=DSYQuruB40LOsm=RZQBZA@mail.gmail.com>

Hello,

(2013/07/26 21:43), Kay Sievers wrote:> On Wed, Jul 3, 2013 at 3:46 AM, Hidehiro Kawai
> <hidehiro.kawai.ez@hitachi.com> wrote:
>
>> This patch series adds hash values of printk format strings into
>> each line of /dev/kmsg outputs as follows:
>>
>>         6,154,325061,-,b7db707c@kernel/smp.c:554;Brought up 4 CPUs
>
> /dev/kmsg is to a certain degree a kernel ABI. Having source code
> locations in exported log records might cause people / userspace tools
> to rely on these strings and expect stability here. The kernel though
> cannot make any promises of its source code layout.

All we have to keep as kABI is <hash>@<filename>:<lineno> of the 5th field.
I regard the 5th field including hash as just a hint; it's not guaranteed
either the hash is unique or filename:lineno is unchanged.  Userspace
tools can use the hash to identify the message quickly, but if a hash
collision occurs, the user space need to do message matching in a
traditional way.  Please note that userspace tools can know which ones
collide from a catalog generated at build time.

As for <filename>:<lineno>, it wouldn't be needed for the most of the cases.
So I think I can introduce an option to suppress the output of
<filename>:<lineno> to reduce memory space.

> The hash is supposed to identify the content of a message, but what if
> someone fixes the string? Maybe someone just fixes a one char typo,
> the hash will change and the message will not be recognizable any
> more.

A catalog file which includes hash, location info, and message is
generated at build time.  Combining this information with diff between
two kernel versions, userspace tools will be able to track where
messages moved and which messages changed.  Then, the userspace tool
updates the message DB managed by it.  So I don't think it's a hard
problem.

> As much as "automated" hash creation sounds simple; I really think
> adding explicit "manually" created random message ids to the bunch of
> messages that are interesting is the better option long-term. It
> shouldn't be that many messages, most of the printk output is not
> really useful for automated inspection or to trigger specific actions.

Yes, as far as the use case goes, it may be true.  But it has some
drawbacks.  Please also see my reply to Joe Perches in another thread
(I resent the patches on July 25th).  Also, I heard about the discussion
at the kernel summit 2 years ago.  According to the article of LWN,
it seems that Linus objected your approach (i.e. adding random bit as
message ID).  Were there some agreements on this issue at the kernel summit?

Regards,
-- 
Hidehiro Kawai
Hitachi, Yokohama Research Laboratory
Linux Technology Center



  reply	other threads:[~2013-07-29 11:55 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-07-03  1:46 [RFC PATCH 0/5] Add a hash value for each line in /dev/kmsg Hidehiro Kawai
2013-07-03  1:46 ` [RFC PATCH 3/5] tools/include: Add jhash.h Hidehiro Kawai
2013-07-03  1:46 ` [RFC PATCH 1/5] printk: make printk a macro Hidehiro Kawai
2013-07-03  1:46 ` [RFC PATCH 2/5] printk: add message hash values in /dev/kmsg output Hidehiro Kawai
2013-07-03  1:46 ` [RFC PATCH 4/5] msghash: Add userland msghash tool Hidehiro Kawai
2013-07-03  1:46 ` [RFC PATCH 5/5] printk: Add msghash support for dev_printk Hidehiro Kawai
2013-07-26 12:43 ` [RFC PATCH 0/5] Add a hash value for each line in /dev/kmsg Kay Sievers
2013-07-29 11:54   ` Hidehiro Kawai [this message]
2013-07-29 12:46     ` Kay Sievers
2013-07-30  6:43       ` Hidehiro Kawai

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=51F6580B.30409@hitachi.com \
    --to=hidehiro.kawai.ez@hitachi.com \
    --cc=akpm@linux-foundation.org \
    --cc=davem@davemloft.net \
    --cc=gregkh@linuxfoundation.org \
    --cc=itoukzo@nttdata.co.jp \
    --cc=kay@vrfy.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=yrl.pp-manager.tt@hitachi.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox