Re: [RFC PATCH v5 1/3] printk-rb: new printk ringbuffer implementation (writer)

2020-01-04 Thread Andrea Parri
On Fri, Jan 03, 2020 at 11:24:20AM +0100, Petr Mladek wrote: > On Mon 2019-12-23 17:01:00, John Ogness wrote: > > Hi Andrea, > > > > On 2019-12-21, Andrea Parri wrote: > > >> +*desc_out = READ_ONCE(*desc); > > >> + > > >> +/* Load data before re-checking state. */ > > >> +

Re: [RFC PATCH v5 1/3] printk-rb: new printk ringbuffer implementation (writer)

2020-01-03 Thread Petr Mladek
On Mon 2019-12-23 17:01:00, John Ogness wrote: > Hi Andrea, > > On 2019-12-21, Andrea Parri wrote: > >> + *desc_out = READ_ONCE(*desc); > >> + > >> + /* Load data before re-checking state. */ > >> + smp_rmb(); /* matches LMM_REF(desc_reserve:A) */ > > > > I looked for a matching WRITE_ONCE()

Re: [RFC PATCH v5 1/3] printk-rb: new printk ringbuffer implementation (writer)

2019-12-23 Thread John Ogness
Hi Andrea, On 2019-12-21, Andrea Parri wrote: >> +*desc_out = READ_ONCE(*desc); >> + >> +/* Load data before re-checking state. */ >> +smp_rmb(); /* matches LMM_REF(desc_reserve:A) */ > > I looked for a matching WRITE_ONCE() or some other type of marked write, > but I could not find

Re: [RFC PATCH v5 1/3] printk-rb: new printk ringbuffer implementation (writer)

2019-12-21 Thread Andrea Parri
Hi John, Sorry for the delay. I don't have an overall understanding of the patch(-set) yet, so I limit to a couple of general questions about the memory barriers introduced by the path. Please see inline comments. > + *desc_out = READ_ONCE(*desc); > + > + /* Load data before

Re: [RFC PATCH v5 1/3] printk-rb: new printk ringbuffer implementation (writer)

2019-12-09 Thread John Ogness
On 2019-12-09, Sergey Senozhatsky wrote: >> + * Sample reader code:: >> + * >> + * struct printk_info info; >> + * char text_buf[32]; >> + * char dict_buf[32]; >> + * u64 next_seq = 0; >> + * struct printk_record r = { >> + * .info = , >> + * .text_buf =

Re: [RFC PATCH v5 1/3] printk-rb: new printk ringbuffer implementation (writer)

2019-12-09 Thread Sergey Senozhatsky
On (19/11/28 02:58), John Ogness wrote: > + * Sample reader code:: > + * > + * struct printk_info info; > + * char text_buf[32]; > + * char dict_buf[32]; > + * u64 next_seq = 0; > + * struct printk_record r = { > + * .info = , > + * .text_buf =

Re: [RFC PATCH v5 1/3] printk-rb: new printk ringbuffer implementation (writer)

2019-12-09 Thread Sergey Senozhatsky
On (19/12/02 16:48), Petr Mladek wrote: > Hi, > > I have seen few prelimitary versions before this public one. > I am either happy with it or blind to see new problems[*]. I guess I'm happy with it. -ss ___ kexec mailing list

Re: [RFC PATCH v5 1/3] printk-rb: new printk ringbuffer implementation (writer)

2019-12-09 Thread John Ogness
On 2019-12-09, Sergey Senozhatsky wrote: >> +#define _DATA_SIZE(sz_bits) (1UL << (sz_bits)) >> +#define _DESCS_COUNT(ct_bits) (1U << (ct_bits)) >> +#define DESC_SV_BITS(sizeof(int) * 8) >> +#define DESC_COMMITTED_MASK (1U << (DESC_SV_BITS -

Re: [RFC PATCH v5 1/3] printk-rb: new printk ringbuffer implementation (writer)

2019-12-08 Thread Sergey Senozhatsky
On (19/11/28 02:58), John Ogness wrote: [..] > + > +#define _DATA_SIZE(sz_bits) (1UL << (sz_bits)) > +#define _DESCS_COUNT(ct_bits)(1U << (ct_bits)) > +#define DESC_SV_BITS (sizeof(int) * 8) > +#define DESC_COMMITTED_MASK (1U << (DESC_SV_BITS - 1))

Re: [RFC PATCH v5 1/3] printk-rb: new printk ringbuffer implementation (writer)

2019-12-05 Thread John Ogness
On 2019-12-03, Steven Rostedt wrote: > +/* Reserve a new descriptor, invalidating the oldest if necessary. */ > +static bool desc_reserve(struct printk_ringbuffer *rb, u32 *id_out) > +{ > + struct prb_desc_ring *desc_ring = >desc_ring; > + struct prb_desc *desc; > + u32

Re: [RFC PATCH v5 1/3] printk-rb: new printk ringbuffer implementation (writer)

2019-12-03 Thread Petr Mladek
On Tue 2019-12-03 15:13:36, John Ogness wrote: > On 2019-12-02, Petr Mladek wrote: > >> +/* > >> + * Sanity checker for reserve size. The ringbuffer code assumes that a > >> data > >> + * block does not exceed the maximum possible size that could fit within > >> the > >> + * ringbuffer. This

Re: [RFC PATCH v5 1/3] printk-rb: new printk ringbuffer implementation (writer)

2019-12-03 Thread Steven Rostedt
On Tue, 3 Dec 2019 10:17:21 +0900 Sergey Senozhatsky wrote: > > > BTW: If I am counting correctly. The ABA problem would happen when > > > exactly 2^30 (1G) messages is written in the mean time. > > > > All the ringbuffer code assumes that the use of index numbers handles > > the ABA problem

Re: [RFC PATCH v5 1/3] printk-rb: new printk ringbuffer implementation (writer)

2019-12-03 Thread John Ogness
On 2019-12-02, Petr Mladek wrote: >> +/* >> + * Sanity checker for reserve size. The ringbuffer code assumes that a data >> + * block does not exceed the maximum possible size that could fit within the >> + * ringbuffer. This function provides that basic size check so that the >> + * assumption

Re: [RFC PATCH v5 1/3] printk-rb: new printk ringbuffer implementation (writer)

2019-12-03 Thread Petr Mladek
On Mon 2019-12-02 17:37:26, John Ogness wrote: > On 2019-12-02, Petr Mladek wrote: > >> > +/* Reserve a new descriptor, invalidating the oldest if necessary. */ > >> > +static bool desc_reserve(struct printk_ringbuffer *rb, u32 *id_out) > >> > +{ > >> > +struct prb_desc_ring *desc_ring =

Re: [RFC PATCH v5 1/3] printk-rb: new printk ringbuffer implementation (writer)

2019-12-02 Thread Sergey Senozhatsky
On (19/12/02 17:37), John Ogness wrote: > On 2019-12-02, Petr Mladek wrote: > >> > +/* Reserve a new descriptor, invalidating the oldest if necessary. */ > >> > +static bool desc_reserve(struct printk_ringbuffer *rb, u32 *id_out) > >> > +{ > >> > +struct prb_desc_ring *desc_ring =

Re: [RFC PATCH v5 1/3] printk-rb: new printk ringbuffer implementation (writer)

2019-12-02 Thread John Ogness
On 2019-12-02, Petr Mladek wrote: >> > +/* Reserve a new descriptor, invalidating the oldest if necessary. */ >> > +static bool desc_reserve(struct printk_ringbuffer *rb, u32 *id_out) >> > +{ >> > + struct prb_desc_ring *desc_ring = >desc_ring; >> > + struct prb_desc *desc; >> > + u32

Re: [RFC PATCH v5 1/3] printk-rb: new printk ringbuffer implementation (writer)

2019-12-02 Thread Petr Mladek
On Mon 2019-12-02 16:48:41, Petr Mladek wrote: > > +/* Reserve a new descriptor, invalidating the oldest if necessary. */ > > +static bool desc_reserve(struct printk_ringbuffer *rb, u32 *id_out) > > +{ > > + struct prb_desc_ring *desc_ring = >desc_ring; > > + struct prb_desc *desc; > > + u32

Re: [RFC PATCH v5 1/3] printk-rb: new printk ringbuffer implementation (writer)

2019-12-02 Thread Petr Mladek
Hi, I have seen few prelimitary versions before this public one. I am either happy with it or blind to see new problems[*]. It would be great if anyone else could look at it. Especially I am intreseted: + Whether the algorithm can be understood by people who see it for the "first" time.