cvs commit: src/sys/kern kern_poll.c

Luigi Rizzo rizzo at
Mon Sep 5 09:43:43 PDT 2005

gleb, could you document how you are using the PRF_RUNNING
and PRF_LEAVING flags that you added ?

also i am unclear on whether there is a race condition involving
unregistering poll (second part of netisr_poll())
while running the section of ether_poll() where it drops
the mutex before calling the handler.

ether_poll signals its activity with PRF_RUNNING, but
netisr_poll() does not check it, so it might happen that

	1. on one CPU, ether_poll() drops the lock before calling
		pr[i].handler(), perhaps even getting descheduled

	2. on another CPU, netisr_poll() gets the lock and goes
	   all the way to the end, setting pr[i].handler = NULL

	3. on the first CPU, without further checks, the code
	   tries to dereference the field.

Also, what is the overall design - do you want to support multiple polling
loops running concurrently (netisr_poll, one poll_idle per CPU,
and possibly the poll_in_trap) ?


More information about the cvs-src mailing list