D&C GLug - Home Page

[ Date Index ] [ Thread Index ] [ <= Previous by date / thread ] [ Next by date / thread => ]

Re: [LUG] Tasklets

 

Robin Cornelius wrote:
On Monday 18 April 2005 17:34, Robin Cornelius wrote:

On Sunday 17 April 2005 22:59, John Daragon wrote:

Robin Cornelius wrote:

BIG Snip...

BIGGER SNIP..



So tasklet_schedule() *is* being called. And I presume there's no other invocation of tasklet_disable() anywhere so that the disable count is zero at this stage...

Actually, what I'm trying to say is : "Is

(0 == adapter->rx_tasklet.count)

at this juncture ?"

tasklet_schedule just puts it on the head of the per-cpu tasklet list, so if it's called (which it seems to be from your direct call mod...) then this *must* work,



I've got it!

IMHO its a kernel bug, look at these line from softirq.c in the function tasklet action :-

        if (tasklet_trylock(t)) {
                        if (!atomic_read(&t->count)) {
                                if (!test_and_clear_bit(TASKLET_STATE_SCHED, 
&t->state))
                                        BUG();
                                t->func(t->data);
                                tasklet_unlock(t);
                                continue;
                        }
                        tasklet_unlock(t);
                }

right in the middle there is if (!atomic_read(&t->count))

so if the count is non zero then the tasklets DO NOT RUN! and ksoftirqd deadlocks. If i call tasklet_enable() it DECREMENTS the count by 1 and tasklet_disable() INCREMENTS the count by one, therefor if you do a tasklet_enable() your count ends up at -1 which is no good.

Yup. That's how it's supposed to work. You only disable the tasklet if you want to make sure that it won't be handled by tasklet_action() on this or subsequent reschedules. There are macros in interrupt.h to declare and initialise tasklet structures in either an enabled (0 == count) or disabled (1 == count) state, and the tasklet is designed only to be processed when a) it's on the queue and b) the count is 0.


Of course, I can't think where this behaviour is really useful, but it *is* the way it's supposed to work...

jd

--
John Daragon                                          john@xxxxxxxxxx
argv[0] limited
Lambs Lawn Cottage,  Staple Fitzpaine,  Taunton,  TA3 5SL,  UK
v +44 (0) 1460 234068   f +44 (0) 1460 234069   m +44 (0) 7836 576127



--
The Mailing List for the Devon & Cornwall LUG
Mail majordomo@xxxxxxxxxxxxx with "unsubscribe list" in the
message body to unsubscribe. FAQ: www.dcglug.org.uk/linux_adm/list-faq.html