Hi Wendy,
Almost correct. Any global data that may be accessed and modified at
the same time
should be protected. If the data is only used in driver functions and
not in interrupt handlers,
it may still need to be protected. It is possible for different threads
to be in the driver
at the same time. It may also be possible for the interrupt handling
code to
run concurrently, (though not likely for the same instance of a
device). You need to
look at all global data very carefully. If the data can be accessed and
modified at the
same time, normally it should be protected.
I'm not sure I understand your last question (i.e., "Do you list all the
possible shared data
between threads?"). Are you asking if there is a way to find such
data? There was a tool,
I'm not sure it is still available, called locklint (I think in the
kernel it was called "warlock").
I have seen references to warlock in the kernel source, but have not
looked at it carefully.
This might automate the process of finding data that needs protection.
Someone else reading this may have more information?
Hope this helps.
max
wendy wrote:
Thanks Max,
So, for a GLD network driver, any shared soft-state data between Interrupts ( receive interrupt or timer interrupt etc) and other driver functions(gld_start, gld_stop, gld_reset and others etc) need to be protected using mutex, other data that is not shared, i.e. only used in interrupts or in driver functions do not need mutex? isn't it? do you list all the possible shared data between threads?
Wendy
This message posted from opensolaris.org
_______________________________________________
networking-discuss mailing list
[email protected]
_______________________________________________
networking-discuss mailing list
[email protected]