Date: Thu, 13 Nov 2014 12:43:26 +0900 From: Ryota Ozaki <ozak...@netbsd.org>
Here is a new patch: http://www.netbsd.org/~ozaki-r/psz-ifnet.diff I think the patch reflects rmind's suggestions: - Use pserialize for IFNET_FOREACH - but use a lock for blockable/sleepable critical sections - cpu_intr_p workaround for HW interrupt Any comments? Hmm...some quick notes from a non-expert in sys/net: - You call malloc(M_WAITOK) while the ifnet lock is held, in if_alloc_sadl_locked, which is not allowed. - You call copyout in a pserialize read section, in ifconf, which is not allowed because copyout may block. - I don't know what cpu_intr_p is working around but it's probably not a good idea! Generally, all that you are allowed to do in a pserialize read section is read a small piece of information, or grab a reference to a data structure which you are then going to use outside the read section. I don't think it's going to be easy to scalably parallelize this code without restructuring it, unless as a stop-gap you use a heaver-weight reader-writer lock like the prwlock at <https://www.NetBSD.org/~riastradh/tmp/20140517/rwlock/prwlock.c>. (No idea how much overhead this might add.)