Date: Wed, 14 Jul 2004 17:32:58 +0200 From: thefly <thefly@acaro.org> To: freebsd-hackers@freebsd.org Subject: My module freezes the kernel Message-ID: <20040714153258.GA2629@tyler>
next in thread | raw e-mail | index | archive | help
--mP3DRpeJDSE+ciuQ Content-Type: text/plain; charset=us-ascii Content-Disposition: inline Content-Transfer-Encoding: quoted-printable Hello everybody. I finised developing my module (actually modifying ng_netflow), and my code can be found at http://www.acaro.org/ng_netflow-0.2.4/ i added a few hooks to my code inside ng_netflow.c in the constructor, rmnode, rcvdata etc etc, and the mmap/ioctl code. The rest of my code is found in ng_counter.c. I'm testing it, and it happens it makes my box panic.=20 I tested it using linux's packetgenerator building 95Mb/s, and the box doesn't freeze. I tested it with an nmap on ALL ports range (1-65535), and it logs it. But with high traffic, and actually general purpouse traffic (scp of a big file plus 4 nmaps + some ftp + some http etc etc) the code panics saying the kernel is trying to access a page which doesn't exist. This happens simply counting, not while doing mmap() or ioctl(). The actual code that counts is this: static int _add_traffic(struct ng_counter_data *counters, u_int16_t dest_port, u_short= packet_len, char prot) { u_int64_t * dest, old_val; if(dest_port < 0 || dest_port > 65535) return EINVAL; mtx_lock(&counters->counter_lock); switch(prot){ case UDP_P: dest =3D counters->B_array+ARRAY_SHIFT; break; case TCP_P: dest =3D counters->B_array; break; default: return EINVAL; } old_val =3D *(dest+dest_port); *(dest+dest_port) +=3D packet_len; mtx_unlock(&counters->counter_lock); return 0; } i don't know how netgraph reacts with my lockings, and what the problem might be. I tested it on a freebsd 5.2.1 both on a UP and a dual SMP box, and i've got the same problem on both of them. The two big memory chunks are given me by contigmalloc(), it can be found in ng_counter.c:ng_counter_constr(). I don't know what it can be, because under medium load it works, but with high variegate load it crashes.So it doesn't seem to be a coding error, and all the shared data is under the mutex lock. TIA --=20 Claudio "thefly" Martella thefly@acaro.org GNU/PG keyid: 0x8EA95625 --mP3DRpeJDSE+ciuQ Content-Type: application/pgp-signature; name="signature.asc" Content-Description: Digital signature Content-Disposition: inline -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.2.4 (GNU/Linux) iD8DBQFA9VIqygeBqo6pViURAqOIAKC71+10mroIhNFwuyGsdV0KFTv61ACgjUnV 2HkZl6orPi5GH+1h5PbX26Q= =SFvT -----END PGP SIGNATURE----- --mP3DRpeJDSE+ciuQ--
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?20040714153258.GA2629>