Re: [RFC] Outline of USB process integration in the kernel taskqueue system

Previous message: [thread] [date] [author]
Next message: [thread] [date] [author]
From: Hans Petter Selasky
Date: Saturday, November 6, 2010 - 7:22 am

Hi,

On Saturday 06 November 2010 14:57:50 Matthew Fleming wrote:

I agree that the order of checks is not important. That is not the problem.

Cut & paste from suggested taskqueue patch from Fleming:

 > +int

What happens in this case if ta_pending > 0. Are you saying this is not 
possible? If ta_pending > 0, shouldn't we also do a STAILQ_REMOVE() ?



Agreed, but that is not what I'm pointing at. I'm pointing at what happens if 
you re-queue a task and then cancel while it is actually running. Will the 
task still be queued for execution after taskqueue_cancel()?


This is not the problem.


And if you re-queue and cancel in this window, shouldn't this also be handled 
like in the other cases?

Cut & paste from kern/subr_taskqueue.c:

                task->ta_pending = 0;
                tb.tb_running = task;
                TQ_UNLOCK(queue);

If a concurrent thread at exactly this point in time calls taskqueue_enqueue() 
on this task, then we re-add the task to the "queue->tq_queue". So far we 
agree. Imagine now that for some reason a following call to taskqueue_cancel() 
on this task at same point in time. Now, shouldn't taskqueue_cancel() also 
remove the task from the "queue->tq_queue" in this case aswell? Because in 
your implementation you only remove the task if we are not running, and that 
is not true when we are at exactly this point in time.

                task->ta_func(task->ta_context, pending);

                TQ_LOCK(queue);
                tb.tb_running = NULL;
                wakeup(task);


Another issue I noticed is that the ta_pending counter should have a wrap 
protector.

--HPS
_______________________________________________
freebsd-current@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-current
To unsubscribe, send any mail to "freebsd-current-unsubscribe@freebsd.org"
Previous message: [thread] [date] [author]
Next message: [thread] [date] [author]

Messages in current thread:
[RFC] Outline of USB process integration in the kernel tas ..., Hans Petter Selasky, (Mon Nov 1, 12:54 pm)
Re: [RFC] Outline of USB process integration in the kernel ..., Hans Petter Selasky, (Mon Nov 1, 1:15 pm)
Re: [RFC] Outline of USB process integration in the kernel ..., Hans Petter Selasky, (Tue Nov 2, 12:39 am)
Re: [RFC] Outline of USB process integration in the kernel ..., Hans Petter Selasky, (Thu Nov 4, 1:38 am)
Re: [RFC] Outline of USB process integration in the kernel ..., Hans Petter Selasky, (Thu Nov 4, 8:10 am)
Re: [RFC] Outline of USB process integration in the kernel ..., Hans Petter Selasky, (Thu Nov 4, 11:41 am)
Re: [RFC] Outline of USB process integration in the kernel ..., Hans Petter Selasky, (Thu Nov 4, 12:08 pm)
Re: [RFC] Outline of USB process integration in the kernel ..., Hans Petter Selasky, (Thu Nov 4, 12:11 pm)
Re: [RFC] Outline of USB process integration in the kernel ..., Hans Petter Selasky, (Thu Nov 4, 1:15 pm)
Re: [RFC] Outline of USB process integration in the kernel ..., Hans Petter Selasky, (Fri Nov 5, 10:36 am)
Re: [RFC] Outline of USB process integration in the kernel ..., Hans Petter Selasky, (Fri Nov 5, 11:30 am)
Re: [RFC] Outline of USB process integration in the kernel ..., Hans Petter Selasky, (Fri Nov 5, 11:35 am)
Re: [RFC] Outline of USB process integration in the kernel ..., Hans Petter Selasky, (Fri Nov 5, 11:45 am)
Re: [RFC] Outline of USB process integration in the kernel ..., Hans Petter Selasky, (Fri Nov 5, 12:00 pm)
Re: [RFC] Outline of USB process integration in the kernel ..., Hans Petter Selasky, (Sat Nov 6, 1:37 am)
Re: [RFC] Outline of USB process integration in the kernel ..., Hans Petter Selasky, (Sat Nov 6, 7:22 am)