Re: [PATCH/RFC v5 4/5]: core: Add dump device to call on oopses andpanics

From: Simon Kagstrom
Date: Mon Nov 30 2009 - 04:53:39 EST


On Mon, 30 Nov 2009 11:40:55 +0200
Artem Bityutskiy <dedekind1@xxxxxxxxx> wrote:

> > > + /*
> > > + * Have we ever rotated around the circular buffer? If we never did,
> > > + * we have to have zeroes at the end.
> > > + */
> > > + if (log_buf[end]) {
> > > + s1 = log_buf + end;
> > > + l1 = log_buf_len - end;
> > > + } else {
> > > + s1 = "";
> > > + l1 = 0;
> >
> > So now you are assuming that a) the buffer is initially zeroed and b)
> > noone ever writes NUL to it. Is that correct?
>
> a) seems to be true because the buffer is either a static array or a
> bootmem alloc, which seems to memzero the buffers it returns, at least
> AFAICS. But I did not test this.

True as far as I can see.

> vs b). well, the printk ring buffer should contain ASCII, so I assumed
> binary zeroes should not be possible there.

Yes, if this would be printed with printk it sounds like a bug to me.

I've tested your patch, and it seems to work fine both 1) before the
buffer is filled, 2) when the buffer has wrapped and 3) when log_end
wraps (although that part was a quick hack).

So

Tested-by: Simon Kagstrom <simon.kagstrom@xxxxxxxxxxxxxx>

// Simon
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/