[PATCH v5 2/4] printk: add lockless ringbuffer
Sergey Senozhatsky
sergey.senozhatsky at gmail.com
Fri Jul 10 04:47:44 EDT 2020
On (20/07/10 17:43), Sergey Senozhatsky wrote:
> [..]
>
> > +void prb_init(struct printk_ringbuffer *rb,
> > + char *text_buf, unsigned int textbits,
> > + char *dict_buf, unsigned int dictbits,
> > + struct prb_desc *descs, unsigned int descbits)
> > +{
> > + memset(descs, 0, _DESCS_COUNT(descbits) * sizeof(descs[0]));
> > +
> > + rb->desc_ring.count_bits = descbits;
> > + rb->desc_ring.descs = descs;
> > + atomic_long_set(&rb->desc_ring.head_id, DESC0_ID(descbits));
> > + atomic_long_set(&rb->desc_ring.tail_id, DESC0_ID(descbits));
> > +
> > + rb->text_data_ring.size_bits = textbits;
> > + rb->text_data_ring.data = text_buf;
> > + atomic_long_set(&rb->text_data_ring.head_lpos, BLK0_LPOS(textbits));
> > + atomic_long_set(&rb->text_data_ring.tail_lpos, BLK0_LPOS(textbits));
> > +
> > + rb->dict_data_ring.size_bits = dictbits;
> > + rb->dict_data_ring.data = dict_buf;
> > + atomic_long_set(&rb->dict_data_ring.head_lpos, BLK0_LPOS(dictbits));
> > + atomic_long_set(&rb->dict_data_ring.tail_lpos, BLK0_LPOS(dictbits));
> > +
>
> Just a side note: some people want !CONFIG_PRINTK builds. I wonder
> how many people will want !CONFIG_PRINTK_DICT. The core logbuf/dict
> logbuf split is really cool.
We also may be can add a dedicated logbuf for the user-space logs,
as opposed to current "user space can write to the kernel logbuf".
Some folks really dislike that systemd, for instance, can trash
the core kernel logbuf doing a lot of /dev/kmsg writes.
-ss
More information about the kexec
mailing list