On Thu, Jul 1, 2021 at 5:02 AM Jan Kiszka <jan.kis...@siemens.com> wrote:

> On 01.07.21 09:19, Jan Kiszka via Xenomai wrote:
> > From: Jan Kiszka <jan.kis...@siemens.com>
> >
> > On some archs, WARN* is implemented by triggering a fault. This can
> > cause troubles if we are already in a fault and try to submit too much
> > root work. Convert to open-coded warning and stack dump.
> >
> > Signed-off-by: Jan Kiszka <jan.kis...@siemens.com>
> > ---
> >
> > Doesn't solve the overflow you've seen, Mauro, but should give a better
> > hint.
> >
> >  kernel/ipipe/core.c | 11 +++++++++--
> >  1 file changed, 9 insertions(+), 2 deletions(-)
> >
> > diff --git a/kernel/ipipe/core.c b/kernel/ipipe/core.c
> > index 99a88e4d620e..485db973b81b 100644
> > --- a/kernel/ipipe/core.c
> > +++ b/kernel/ipipe/core.c
> > @@ -2027,9 +2027,16 @@ void __ipipe_post_work_root(struct
> ipipe_work_header *work)
> >       cpu = ipipe_processor_id();
> >       tail = per_cpu(work_tail, cpu);
> >
> > -     if (WARN_ON_ONCE((unsigned char *)tail + work->size >=
> > -                      per_cpu(work_buf, cpu) + WORKBUF_SIZE))
> > +     if (unlikely((unsigned char *)tail + work->size >=
> > +                  per_cpu(work_buf, cpu) + WORKBUF_SIZE)) {
> > +             static volatile unsigned long once;
> > +             if (!test_and_set_bit(0, &once)) {
> > +                     ipipe_prepare_panic();
> > +                     pr_err("I-pipe root work queue overflow! System
> may be unstable now.\n");
> > +                     dump_stack();
> > +             }
> >               goto out;
> > +     }
> >
> >       /* Work handling is deferred, so data has to be copied. */
> >       memcpy(tail, work, work->size);
> >
>
> Possibly relevant for ARM/64 as well. Patch is in 4.19 and head noarch
> trees now.
>
> Jan
>
> --
> Siemens AG, T RDA IOT
> Corporate Competence Center Embedded Linux


Thanks, I’ll pull these in and do a new release shortly.

Greg

>
>

Reply via email to