Re: [PATCH v2 5/7][next] printk: ringbuffer: add finalization/extension support

From: Sergey Senozhatsky
Date: Wed Aug 26 2020 - 06:01:24 EST


On (20/08/26 10:45), John Ogness wrote:
> On 2020-08-24, John Ogness <john.ogness@xxxxxxxxxxxxx> wrote:
> > @@ -1157,6 +1431,14 @@ bool prb_reserve(struct prb_reserved_entry *e, struct printk_ringbuffer *rb,
> > goto fail;
> > }
> >
> > + /*
> > + * New data is about to be reserved. Once that happens, previous
> > + * descriptors are no longer able to be extended. Finalize the
> > + * previous descriptor now so that it can be made available to
> > + * readers (when committed).
> > + */
> > + desc_finalize(desc_ring, DESC_ID(id - 1));
> > +
> > d = to_desc(desc_ring, id);
> >
> > /*
>
> Apparently this is not enough to guarantee that past descriptors are
> finalized. I am able to reproduce a scenario where the finalization of a
> certain descriptor never happens. That leaves the descriptor permanently
> in the reserved queried state, which prevents any new records from being
> created. I am investigating.

Good to know. I also run into problems:
- broken dmesg (and broken journalctl -f /dev/kmsg poll) and broken
syslog read

$ strace dmesg

...
openat(AT_FDCWD, "/dev/kmsg", O_RDONLY|O_NONBLOCK) = 3
lseek(3, 0, SEEK_DATA) = 0
read(3, 0x55dda8c240a8, 8191) = -1 EAGAIN (Resource temporarily unavailable)
close(3) = 0
syslog(10 /* SYSLOG_ACTION_SIZE_BUFFER */) = 524288
mmap(NULL, 528384, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_ANONYMOUS, -1, 0) = 0x7f43ea847000
syslog(3 /* SYSLOG_ACTION_READ_ALL */, "", 524296) = 0
munmap(0x7f43ea847000, 528384) = 0
...

-ss