linux-scsi.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Douglas Gilbert <dgilbert@interlog.com>
To: Yoshihiro YUNOMAE <yoshihiro.yunomae.ez@hitachi.com>
Cc: Hannes Reinecke <hare@suse.de>,
	"Martin K. Petersen" <martin.petersen@oracle.com>,
	linux-scsi@vger.kernel.org, yrl.pp-manager.tt@hitachi.com,
	linux-kernel@vger.kernel.org,
	"James E.J. Bottomley" <JBottomley@parallels.com>,
	Masami Hiramatsu <masami.hiramatsu.pt@hitachi.com>,
	Hidehiro Kawai <hidehiro.kawai.ez@hitachi.com>,
	Christoph Hellwig <hch@lst.de>
Subject: Re: [RFC PATCH -logging 00/10] scsi/constants: Output continuous error messages on trace
Date: Fri, 22 Aug 2014 15:54:16 -0400	[thread overview]
Message-ID: <53F79FE8.7030406@interlog.com> (raw)
In-Reply-To: <53EAD7CC.8030408@hitachi.com>

On 14-08-12 11:13 PM, Yoshihiro YUNOMAE wrote:
> Hi Douglas,
>
> Thank you for your comment.
>
> (2014/08/08 22:07), Douglas Gilbert wrote:
>> On 14-08-08 01:50 PM, Yoshihiro YUNOMAE wrote:
>>> Hi All,
>>>
>>> This patch set introduces new traceevents in order to output
>>> continuous error
>>> messages. Current SCSI printk messages in upstream kernel can be
>>> divided by and
>>> mixed with other messages. Even if each error message has its device id,
>>> sometimes we can easily be lost in mixed logs because the message's
>>> device id
>>> is separated from it's body. To avoid it, I'd like to use traceevents to
>>> store error messages into the ftrace or perf buuffer, because traceevents
>>> are atomically commited to the buffer.
>>>
>>> In this patch set, all printk messages are removed based on a local
>>> discussion with Hannes, but I think printk messages should be kept
>>> because all
>>> users don't enable traceevents and rsyslog can store as files.
>>>
>>> However, if printk of logging branch is kept, the messages are
>>> duplicate and
>>> it can induce stack overflow by using local buffer(*1).
>>>
>>>   (*1) https://lkml.org/lkml/2014/5/20/742
>>>
>>> So, my suggestion is follows:
>>>
>>> 1) printk
>>> Keeps current implemntation of upstream kernel.
>>> The messages are divided and can be mixed, but all users can check the
>>> error
>>> messages without any settings.
>>>
>>> 2) traceevents
>>> To get the complete messages, we can use ftrace or perf (or something
>>> on them).
>>> Users can always understand correct messages, but they need to set up the
>>> tracers.
>>>
>>> This patch set is based on Hannes' logging branch:
>>> http://git.kernel.org/cgit/linux/kernel/git/hare/scsi-devel.git/log/?h=logging
>>>
>>>
>>> [1/10] ~  [6/10]: just cleanup for logging branch
>>> [7/10] ~ [10/10]: introduce new traceevents
>>>
>>> Any comments are welcome!
>>
>> In sg3_utils there are now string yielding equivalents
>> to the sense buffer "print" functions. They take a form
>> like this:
>>    char * get_sense_str(const unsigned char * sense_buffer,
>>                         int sb_len, int blen, char * b);
>>
>> So this just does the hard work of decoding the sense buffer
>> (or saying it is invalid) the result of which it places in
>> buffer 'b'. And 'b' is returned (so this function can be in
>> the arguments of a driver's printing function).
>>
>> Adding such string functions would give other parts of the
>> SCSI subsystem the capability of tailoring their own
>> messages that include sense data information.
>>
>>
>> Existing sense buffer "print" function could be kept and
>> implemented using the newer "_str" variants. Would that
>> be worth the trouble?
>
> I have already sent the idea using local buffer on this February,
> but it was rejected by James (*1). By using stack region for local
> buffer, stack overflow can occur. So, I implemented this feature
> to atomically output an error message with device information.
>
> (*1) https://lkml.org/lkml/2014/5/20/742

Hi,
In the "_str" variants that I referred to, the caller provides
the buffer and its length. The responsibility of the
implementation of those "_str" variants is to use that
buffer, not exceed it, and make sure that it is null terminated
on return.

Can't see any inherent threat to the stack size there, and if
there is then that is just bad design by the caller.

The advantage of the "_str" variants is that the caller can
supply context and print/log a more useful message, perhaps
including the caller's __func__ . That message could include
sense information (perhaps truncated to 128 bytes, say),
and be output as a single unit.

IMO too many log messages are multi-line and in a noisy,
misbehaving system those messages can be interleaved
with other "noise" making them difficult to decipher.

Doug Gilbert

  reply	other threads:[~2014-08-22 19:54 UTC|newest]

Thread overview: 48+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-08-08 11:50 [RFC PATCH -logging 00/10] scsi/constants: Output continuous error messages on trace Yoshihiro YUNOMAE
2014-08-08 11:50 ` [RFC PATCH 01/10] scsi/constants: Cleanup printk message in __scsi_print_sense() Yoshihiro YUNOMAE
2014-08-12 14:51   ` Elliott, Robert (Server Storage)
2014-08-13  3:14     ` Yoshihiro YUNOMAE
2014-08-27 13:56   ` Hannes Reinecke
2014-08-08 11:50 ` [RFC PATCH 02/10] scsi/constants: Cleanup printk message in scsi_decode_sense_extras() Yoshihiro YUNOMAE
2014-08-27 13:58   ` Hannes Reinecke
2014-08-08 11:50 ` [RFC PATCH 03/10] scsi/constants: Cleanup printk message in __scsi_print_command() Yoshihiro YUNOMAE
2014-08-15 15:05   ` Ewan Milne
2014-08-18  5:05     ` Yoshihiro YUNOMAE
2014-08-27 13:58   ` Hannes Reinecke
2014-08-08 11:50 ` [RFC PATCH 04/10] scsi/constants: Cleanup printk message in scsi_dump_sense_buffer() Yoshihiro YUNOMAE
2014-08-15 15:08   ` Ewan Milne
2014-08-18  5:06     ` Yoshihiro YUNOMAE
2014-08-27 13:59   ` Hannes Reinecke
2014-08-08 11:50 ` [RFC PATCH 05/10] scsi/trace: Use macros for getting driver byte, host byte, msg byte, and status byte Yoshihiro YUNOMAE
2014-08-15 15:10   ` Ewan Milne
2014-08-27 14:01   ` Hannes Reinecke
2014-08-08 11:50 ` [RFC PATCH 06/10] scsi/sd: Delete extra scsi_show_extd_sense() in sd_print_sense_hdr() Yoshihiro YUNOMAE
2014-08-15 15:14   ` Ewan Milne
2014-08-27 14:07   ` Hannes Reinecke
2014-08-08 11:50 ` [RFC PATCH 07/10] scsi/trace: Use scsi_show_result trace point instead of printk Yoshihiro YUNOMAE
2014-08-27 14:12   ` Hannes Reinecke
2014-08-28  1:37     ` Yoshihiro YUNOMAE
2014-08-29  0:50     ` Christoph Hellwig
2014-09-03  1:17       ` Yoshihiro YUNOMAE
2014-08-08 11:50 ` [RFC PATCH 08/10] scsi/trace: Use scsi_print_sense " Yoshihiro YUNOMAE
2014-08-27 14:15   ` Hannes Reinecke
2014-08-28  1:39     ` Yoshihiro YUNOMAE
2014-08-08 11:50 ` [RFC PATCH 09/10] scsi/trace: Add additional sense code and additional sense code qualifier to scsi_print_sense trace point Yoshihiro YUNOMAE
2014-08-27 14:16   ` Hannes Reinecke
2014-08-28  1:39     ` Yoshihiro YUNOMAE
2014-08-08 11:50 ` [RFC PATCH 10/10] scsi/trace: Use scsi_print_command trace point instead of printk Yoshihiro YUNOMAE
2014-08-27 14:16   ` Hannes Reinecke
2014-08-28  1:40     ` Yoshihiro YUNOMAE
2014-08-28  6:19       ` Yoshihiro YUNOMAE
2014-08-28 12:15         ` Hannes Reinecke
2014-09-01  6:38           ` Yoshihiro YUNOMAE
2014-08-08 13:07 ` [RFC PATCH -logging 00/10] scsi/constants: Output continuous error messages on trace Douglas Gilbert
2014-08-13  3:13   ` Yoshihiro YUNOMAE
2014-08-22 19:54     ` Douglas Gilbert [this message]
2014-08-26 14:23       ` Hannes Reinecke
2014-08-27 14:23   ` Hannes Reinecke
2014-08-27 14:48     ` Douglas Gilbert
2014-08-22  0:39 ` Elliott, Robert (Server Storage)
2014-08-24 20:44   ` scsi logging future directions, was " Christoph Hellwig
2014-08-25 11:30     ` Hannes Reinecke
2014-08-26  8:53   ` Hannes Reinecke

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=53F79FE8.7030406@interlog.com \
    --to=dgilbert@interlog.com \
    --cc=JBottomley@parallels.com \
    --cc=hare@suse.de \
    --cc=hch@lst.de \
    --cc=hidehiro.kawai.ez@hitachi.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-scsi@vger.kernel.org \
    --cc=martin.petersen@oracle.com \
    --cc=masami.hiramatsu.pt@hitachi.com \
    --cc=yoshihiro.yunomae.ez@hitachi.com \
    --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;
as well as URLs for NNTP newsgroup(s).