* question on pktgen shutdown logic.
@ 2013-05-22 23:15 Ben Greear
2013-05-22 23:22 ` Eric Dumazet
0 siblings, 1 reply; 5+ messages in thread
From: Ben Greear @ 2013-05-22 23:15 UTC (permalink / raw)
To: netdev
While looking at pktgen.c in 3.9.3, I cannot explain how
it does not race on shutdown.
The thread worker checks for pktgen_exiting, and will bail out
of it's main loop and initiate cleanup if this is true.
The pg_net_exit sets the pktgen_exiting to true, and then
proceedes to call
kthread_stop(t->tsk);
kfree(t);
What I don't understand is what keeps the kfree(t) from happening
before the thread has noticed pktgen_exiting is set and properly
bailed out of it's loop and finished cleanup?
Thanks,
Ben
--
Ben Greear <greearb@candelatech.com>
Candela Technologies Inc http://www.candelatech.com
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: question on pktgen shutdown logic.
2013-05-22 23:15 question on pktgen shutdown logic Ben Greear
@ 2013-05-22 23:22 ` Eric Dumazet
2013-05-22 23:28 ` Ben Greear
0 siblings, 1 reply; 5+ messages in thread
From: Eric Dumazet @ 2013-05-22 23:22 UTC (permalink / raw)
To: Ben Greear; +Cc: netdev
On Wed, 2013-05-22 at 16:15 -0700, Ben Greear wrote:
> While looking at pktgen.c in 3.9.3, I cannot explain how
> it does not race on shutdown.
>
> The thread worker checks for pktgen_exiting, and will bail out
> of it's main loop and initiate cleanup if this is true.
>
> The pg_net_exit sets the pktgen_exiting to true, and then
> proceedes to call
>
> kthread_stop(t->tsk);
> kfree(t);
>
> What I don't understand is what keeps the kfree(t) from happening
> before the thread has noticed pktgen_exiting is set and properly
> bailed out of it's loop and finished cleanup?
kthread_stop() is synchronous.
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: question on pktgen shutdown logic.
2013-05-22 23:22 ` Eric Dumazet
@ 2013-05-22 23:28 ` Ben Greear
2013-05-22 23:35 ` Eric Dumazet
0 siblings, 1 reply; 5+ messages in thread
From: Ben Greear @ 2013-05-22 23:28 UTC (permalink / raw)
To: Eric Dumazet; +Cc: netdev
On 05/22/2013 04:22 PM, Eric Dumazet wrote:
> On Wed, 2013-05-22 at 16:15 -0700, Ben Greear wrote:
>> While looking at pktgen.c in 3.9.3, I cannot explain how
>> it does not race on shutdown.
>>
>> The thread worker checks for pktgen_exiting, and will bail out
>> of it's main loop and initiate cleanup if this is true.
>>
>> The pg_net_exit sets the pktgen_exiting to true, and then
>> proceedes to call
>>
>> kthread_stop(t->tsk);
>> kfree(t);
>>
>> What I don't understand is what keeps the kfree(t) from happening
>> before the thread has noticed pktgen_exiting is set and properly
>> bailed out of it's loop and finished cleanup?
>
> kthread_stop() is synchronous.
Ahh, so it waits for the pktgen_thread_worker method to return?
Why do we bother with the pktgen_exiting flag at all...it
would seem that just checking kthread_should_stop() would
do the trick?
Thanks,
Ben
--
Ben Greear <greearb@candelatech.com>
Candela Technologies Inc http://www.candelatech.com
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: question on pktgen shutdown logic.
2013-05-22 23:28 ` Ben Greear
@ 2013-05-22 23:35 ` Eric Dumazet
2013-05-22 23:52 ` Ben Greear
0 siblings, 1 reply; 5+ messages in thread
From: Eric Dumazet @ 2013-05-22 23:35 UTC (permalink / raw)
To: Ben Greear; +Cc: netdev
On Wed, 2013-05-22 at 16:28 -0700, Ben Greear wrote:
> Ahh, so it waits for the pktgen_thread_worker method to return?
>
> Why do we bother with the pktgen_exiting flag at all...it
> would seem that just checking kthread_should_stop() would
> do the trick?
If you have 4096 cpus, setting pktgen_exiting permits all pktgen exiting
faster.
Otherwise you wait about 400 seconds (4096 * HZ/10)
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: question on pktgen shutdown logic.
2013-05-22 23:35 ` Eric Dumazet
@ 2013-05-22 23:52 ` Ben Greear
0 siblings, 0 replies; 5+ messages in thread
From: Ben Greear @ 2013-05-22 23:52 UTC (permalink / raw)
To: Eric Dumazet; +Cc: netdev
On 05/22/2013 04:35 PM, Eric Dumazet wrote:
> On Wed, 2013-05-22 at 16:28 -0700, Ben Greear wrote:
>
>> Ahh, so it waits for the pktgen_thread_worker method to return?
>>
>> Why do we bother with the pktgen_exiting flag at all...it
>> would seem that just checking kthread_should_stop() would
>> do the trick?
>
> If you have 4096 cpus, setting pktgen_exiting permits all pktgen exiting
> faster.
>
> Otherwise you wait about 400 seconds (4096 * HZ/10)
Ok, I think I understand now.
Thanks,
Ben
>
>
--
Ben Greear <greearb@candelatech.com>
Candela Technologies Inc http://www.candelatech.com
^ permalink raw reply [flat|nested] 5+ messages in thread
end of thread, other threads:[~2013-05-22 23:52 UTC | newest]
Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2013-05-22 23:15 question on pktgen shutdown logic Ben Greear
2013-05-22 23:22 ` Eric Dumazet
2013-05-22 23:28 ` Ben Greear
2013-05-22 23:35 ` Eric Dumazet
2013-05-22 23:52 ` Ben Greear
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).