From owner-freebsd-hackers@FreeBSD.ORG Wed Jul 14 15:29:03 2004 Return-Path: Delivered-To: freebsd-hackers@freebsd.org Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id 8E86716A4E0 for ; Wed, 14 Jul 2004 15:29:03 +0000 (GMT) Received: from ms006msg.fastweb.it (ms006msg.fastweb.it [213.140.2.54]) by mx1.FreeBSD.org (Postfix) with ESMTP id EEB7B43D31 for ; Wed, 14 Jul 2004 15:28:57 +0000 (GMT) (envelope-from thefly@acaro.org) Received: from tyler (1.10.185.81) by ms006msg.fastweb.it (7.0.028) id 40D855CC002BD670 for freebsd-hackers@freebsd.org; Wed, 14 Jul 2004 17:28:56 +0200 Received: by tyler (Postfix, from userid 1000) id 8BBF0123DEA; Wed, 14 Jul 2004 17:32:58 +0200 (CEST) Date: Wed, 14 Jul 2004 17:32:58 +0200 From: thefly To: freebsd-hackers@freebsd.org Message-ID: <20040714153258.GA2629@tyler> Mime-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha1; protocol="application/pgp-signature"; boundary="mP3DRpeJDSE+ciuQ" Content-Disposition: inline X-Editor: VIM - Vi IMproved 6.2 (2003 Jun 1, compiled May 20 2004 09:35:32) X-OS: Debian GNU/Linux 2.6.6 i686 User-Agent: Mutt/1.5.6+20040523i Subject: My module freezes the kernel X-BeenThere: freebsd-hackers@freebsd.org X-Mailman-Version: 2.1.1 Precedence: list List-Id: Technical Discussions relating to FreeBSD List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 14 Jul 2004 15:29:03 -0000 --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--