[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20200429191224.GA75562@google.com>
Date: Wed, 29 Apr 2020 15:12:24 -0400
From: Joel Fernandes <joel@...lfernandes.org>
To: Steven Rostedt <rostedt@...dmis.org>
Cc: Xiao Yang <yangx.jy@...fujitsu.com>, linux-kernel@...r.kernel.org,
Ingo Molnar <mingo@...hat.com>
Subject: Re: [PATCH] kernel/trace: Stop and wait for kthread on preempt irq
module unload
On Wed, Apr 29, 2020 at 12:31:41PM -0400, Steven Rostedt wrote:
> On Wed, 29 Apr 2020 19:54:16 +0800
> Xiao Yang <yangx.jy@...fujitsu.com> wrote:
>
> > On 2020/4/28 22:45, Steven Rostedt wrote:
> > > diff --git a/kernel/trace/preemptirq_delay_test.c b/kernel/trace/preemptirq_delay_test.c
> > >> index 1c28ca20e30b..6d9131ae7e8c 100644
> > >> --- a/kernel/trace/preemptirq_delay_test.c
> > >> +++ b/kernel/trace/preemptirq_delay_test.c
> > >> @@ -113,15 +113,27 @@ static int preemptirq_delay_run(void *data)
> > >>
> > >> for (i = 0; i< s; i++)
> > >> (testfuncs[i])(i);
> > >> +
> > >> + while (!kthread_should_stop()) {
> > >> + schedule();
> > >> + set_current_state(TASK_INTERRUPTIBLE);
> > >> + }
> > >> +
> > >> + __set_current_state(TASK_RUNNING);
> > >> +
> > >> return 0;
> > >> }
> > >>
> > Hi Steven,
> >
> > Thanks for your patch.
> >
> > I also used the following steps to do test and didn't get any
> > warning/panic after applying your patch.
> > ---------------------------------
> > for i in $(seq 1 100); do modprobe preemptirq_delay_test test_mode=irq
> > delay=500000; rmmod preemptirq_delay_test; done
> > for i in $(seq 1 100); do modprobe preemptirq_delay_test
> > test_mode=preempt delay=500000; rmmod preemptirq_delay_test; done
> > ---------------------------------
> >
> > But I am not sure which fix(from you and Joel) is better.
>
> Mine ;-)
>
> The "kthread_should_stop()" is the normal way to end kernel threads. Using
> get/put is not the orthodox way.
Agreed :-) thanks.
- Joel
Powered by blists - more mailing lists