From owner-freebsd-hackers@FreeBSD.ORG Sun Jun 26 04:44:44 2005 Return-Path: X-Original-To: freebsd-hackers@freebsd.org 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 D4B4516A41F for ; Sun, 26 Jun 2005 04:44:44 +0000 (GMT) (envelope-from domze.sa@gmail.com) Received: from wproxy.gmail.com (wproxy.gmail.com [64.233.184.201]) by mx1.FreeBSD.org (Postfix) with ESMTP id 8BE6743D49 for ; Sun, 26 Jun 2005 04:44:44 +0000 (GMT) (envelope-from domze.sa@gmail.com) Received: by wproxy.gmail.com with SMTP id 50so166353wri for ; Sat, 25 Jun 2005 21:44:44 -0700 (PDT) DomainKey-Signature: a=rsa-sha1; q=dns; c=nofws; s=beta; d=gmail.com; h=received:message-id:from:to:subject:date:mime-version:content-type:x-priority:x-msmail-priority:x-mailer:x-mimeole; b=G5kmHfnzpBrXzpR5MzUg940gZdNlAK1mqA8IXJg+1IDMazSH6eQ536k1REiC7UNZkxxUUKmUCJRdQH8xaSR0fuj94pt9kuMVxQO9/c7E77P5JmJysc1QC8LBTVYU80O59TZJMVk1XmAZ/9VWStuqC79eeknPDuQC/nWpGNYnVM8= Received: by 10.54.107.9 with SMTP id f9mr2754550wrc; Sat, 25 Jun 2005 21:44:44 -0700 (PDT) Received: from DOMZ ([70.52.7.9]) by mx.gmail.com with ESMTP id 65sm3549598wra.2005.06.25.21.44.43; Sat, 25 Jun 2005 21:44:43 -0700 (PDT) Message-ID: <003701c57a09$c0631360$02000a0a@DOMZ> From: "Dominique SA" To: Date: Sun, 26 Jun 2005 00:44:32 -0400 MIME-Version: 1.0 X-Priority: 3 X-MSMail-Priority: Normal X-Mailer: Microsoft Outlook Express 6.00.2741.2600 X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2742.200 Content-Type: text/plain; charset="Windows-1252" Content-Transfer-Encoding: quoted-printable X-Content-Filtered-By: Mailman/MimeDel 2.1.5 Subject: KMEM Problem With OIDENTD X-BeenThere: freebsd-hackers@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: Technical Discussions relating to FreeBSD List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 26 Jun 2005 04:44:45 -0000 Hey guys, I'm using FreeBSD 5.4, with oidentd 2.0.7 and PF. I can run = oidentd fine but when i try to run it with the -m flag (masquerade flag) = it tells me: Fatal: Can't open kmem device: No such file or directory Though: mem.ko module is loaded and: crw-r----- 1 root kmem 244, 1 Jun 24 16:06 /dev/kmem note: when i run oidentd, i run it with the following flags: -d -f -m -l 20 -u root -g kmem -i (interactive mode so i can see if i = get error messages, etc) note 2: this was posted in freebsd-questions, but it looks like this = list is for more technical questions any ideas on how to fix this?=20 Thanks=20 From owner-freebsd-hackers@FreeBSD.ORG Sun Jun 26 08:27:16 2005 Return-Path: X-Original-To: hackers@freebsd.org 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 97DF716A41C for ; Sun, 26 Jun 2005 08:27:16 +0000 (GMT) (envelope-from vd@datamax.bg) Received: from jengal.datamax.bg (jengal.datamax.bg [82.103.104.21]) by mx1.FreeBSD.org (Postfix) with ESMTP id 0BD3443D4C for ; Sun, 26 Jun 2005 08:27:05 +0000 (GMT) (envelope-from vd@datamax.bg) Received: from sinanica.bg.datamax (sinanica.bg.datamax [192.168.10.1]) by jengal.datamax.bg (Postfix) with QMQP id 4976687CA for ; Sun, 26 Jun 2005 11:27:02 +0300 (EEST) Received: (nullmailer pid 77045 invoked by uid 1004); Sun, 26 Jun 2005 08:27:02 -0000 Date: Sun, 26 Jun 2005 11:27:02 +0300 From: Vasil Dimov To: hackers@freebsd.org Message-ID: <20050626082702.GA76984@sinanica.bg.datamax> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii; x-action=pgp-signed Content-Disposition: inline X-OS: FreeBSD 5.4-STABLE User-Agent: Mutt/1.5.9i Cc: Subject: /bin/sh -e function parsing strangeness X-BeenThere: freebsd-hackers@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list Reply-To: vd@datamax.bg List-Id: Technical Discussions relating to FreeBSD List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 26 Jun 2005 08:27:16 -0000 -----BEGIN PGP SIGNED MESSAGE----- Hash: SHA1 Can anyone explain this: % sh -ec 'f() { return 5 ; } ; if f ; then echo tt ; else echo ff ; fi' ff % sh -ec 'f() { return 5 ; : ; } ; if f ; then echo tt ; else echo ff ; fi' % echo $? 5 If any commands appear after the return statement in a function, then -e flag triggers untested command failure although function call is tested with `if' statement. -----BEGIN PGP SIGNATURE----- iD8DBQFCvmbWFw6SP/bBpCARAo2GAJ9DT0FeeUEbweidCklxj8V8uEeXHQCgmNd7 pT2zbB8UF9TClhRUWpyZyf4= =Alpo -----END PGP SIGNATURE----- From owner-freebsd-hackers@FreeBSD.ORG Sun Jun 26 09:00:27 2005 Return-Path: X-Original-To: hackers@freebsd.org 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 1D8FF16A41C for ; Sun, 26 Jun 2005 09:00:27 +0000 (GMT) (envelope-from vd@datamax.bg) Received: from jengal.datamax.bg (jengal.datamax.bg [82.103.104.21]) by mx1.FreeBSD.org (Postfix) with ESMTP id CA51E43D49 for ; Sun, 26 Jun 2005 09:00:26 +0000 (GMT) (envelope-from vd@datamax.bg) Received: from sinanica.bg.datamax (sinanica.bg.datamax [192.168.10.1]) by jengal.datamax.bg (Postfix) with QMQP id CA33687CA for ; Sun, 26 Jun 2005 12:00:25 +0300 (EEST) Received: (nullmailer pid 77923 invoked by uid 1004); Sun, 26 Jun 2005 09:00:25 -0000 Date: Sun, 26 Jun 2005 12:00:25 +0300 From: Vasil Dimov To: hackers@freebsd.org Message-ID: <20050626090025.GA77882@sinanica.bg.datamax> References: <20050626082702.GA76984@sinanica.bg.datamax> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii; x-action=pgp-signed Content-Disposition: inline In-Reply-To: <20050626082702.GA76984@sinanica.bg.datamax> X-OS: FreeBSD 5.4-STABLE User-Agent: Mutt/1.5.9i Cc: Subject: Re: /bin/sh -e function parsing strangeness X-BeenThere: freebsd-hackers@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list Reply-To: vd@datamax.bg List-Id: Technical Discussions relating to FreeBSD List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 26 Jun 2005 09:00:27 -0000 -----BEGIN PGP SIGNED MESSAGE----- Hash: SHA1 On Sun, Jun 26, 2005 at 11:27:02AM +0300, Vasil Dimov wrote: > > Can anyone explain this: > > % sh -ec 'f() { return 5 ; } ; if f ; then echo tt ; else echo ff ; fi' > ff > % sh -ec 'f() { return 5 ; : ; } ; if f ; then echo tt ; else echo ff ; fi' > % echo $? > 5 > > If any commands appear after the return statement in a function, > then -e flag triggers untested command failure although function call is > tested with `if' statement. > I see, -e counts for each command inside function body, no matter that the whole function return status is tested with `if'. % sh -ec 'f() { ls /nonexistent ; ls / ; } ; if f ; then echo tt ; else echo ff ; fi' ls: /nonexistent: No such file or directory % Probably this should be considered as a sh "feature". -----BEGIN PGP SIGNATURE----- iD8DBQFCvm6pFw6SP/bBpCARAu6FAKCCoGXwounURHk6o4m8huqEDtmX9wCfXqxf M0BT7Ej0fG9Iulgr/A18MMk= =/5jF -----END PGP SIGNATURE----- From owner-freebsd-hackers@FreeBSD.ORG Sun Jun 26 13:03:18 2005 Return-Path: X-Original-To: freebsd-hackers@freebsd.org 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 0FE7B16A41C for ; Sun, 26 Jun 2005 13:03:18 +0000 (GMT) (envelope-from dmitry.mityugov@gmail.com) Received: from wproxy.gmail.com (wproxy.gmail.com [64.233.184.200]) by mx1.FreeBSD.org (Postfix) with ESMTP id 872E943D49 for ; Sun, 26 Jun 2005 13:03:17 +0000 (GMT) (envelope-from dmitry.mityugov@gmail.com) Received: by wproxy.gmail.com with SMTP id 55so196391wri for ; Sun, 26 Jun 2005 06:03:17 -0700 (PDT) DomainKey-Signature: a=rsa-sha1; q=dns; c=nofws; s=beta; d=gmail.com; h=received:message-id:date:from:reply-to:to:subject:cc:in-reply-to:mime-version:content-type:content-transfer-encoding:content-disposition:references; b=T3CArQhJvXazJGhrnz+Ga6BR5kuuIk70Fk0iOnzqFOMXS/CU87rnbkmANLjk6U/JbY+dZVJSsb24Y8d8mXGygBAZDt9fCOuUmiRgfm0cPe6W+V5um28vq32Lvbirrpr02hbG4vp81xgXHeWDKuxPoWg6rGxcuH/+SxiWscoPbC4= Received: by 10.54.49.67 with SMTP id w67mr1917729wrw; Sun, 26 Jun 2005 06:03:17 -0700 (PDT) Received: by 10.54.56.33 with HTTP; Sun, 26 Jun 2005 06:03:16 -0700 (PDT) Message-ID: Date: Sun, 26 Jun 2005 17:03:16 +0400 From: Dmitry Mityugov To: Dominique SA In-Reply-To: <003701c57a09$c0631360$02000a0a@DOMZ> Mime-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: quoted-printable Content-Disposition: inline References: <003701c57a09$c0631360$02000a0a@DOMZ> Cc: freebsd-hackers@freebsd.org Subject: Re: KMEM Problem With OIDENTD X-BeenThere: freebsd-hackers@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list Reply-To: Dmitry Mityugov List-Id: Technical Discussions relating to FreeBSD List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 26 Jun 2005 13:03:18 -0000 On 6/26/05, Dominique SA wrote: > Hey guys, I'm using FreeBSD 5.4, with oidentd 2.0.7 and PF. I can run oid= entd fine but when i try to run it with the -m flag (masquerade flag) it te= lls me: > Fatal: Can't open kmem device: No such file or directory > Though: > mem.ko module is loaded and: > crw-r----- 1 root kmem 244, 1 Jun 24 16:06 /dev/kmem >=20 > note: when i run oidentd, i run it with the following flags: > -d -f -m -l 20 -u root -g kmem -i (interactive mode so i can see if i get= error messages, etc) > note 2: this was posted in freebsd-questions, but it looks like this list= is for more technical questions >=20 > any ideas on how to fix this? The only idea I have is a raised securelevel. What does sysctl kern.securelevel produce? --=20 Dmitry "We live less by imagination than despite it" - Rockwell Kent, "N by E" From owner-freebsd-hackers@FreeBSD.ORG Sun Jun 26 23:09:31 2005 Return-Path: X-Original-To: freebsd-hackers@freebsd.org 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 84B0A16A41C for ; Sun, 26 Jun 2005 23:09:31 +0000 (GMT) (envelope-from maslanbsd@gmail.com) Received: from wproxy.gmail.com (wproxy.gmail.com [64.233.184.207]) by mx1.FreeBSD.org (Postfix) with ESMTP id 4472943D4C for ; Sun, 26 Jun 2005 23:09:31 +0000 (GMT) (envelope-from maslanbsd@gmail.com) Received: by wproxy.gmail.com with SMTP id i24so278886wra for ; Sun, 26 Jun 2005 16:09:30 -0700 (PDT) DomainKey-Signature: a=rsa-sha1; q=dns; c=nofws; s=beta; d=gmail.com; h=received:message-id:date:from:reply-to:to:subject:mime-version:content-type:content-transfer-encoding:content-disposition; b=TG9wMw6RZCFFqY5tzrMP9BMOHLPaF8AlnQayVyuktoSDvXNRLnOjVHGgyNwuFJPicz4MOLpReB6dRj5vLZrD9vQ0S2b+J6/RcSuZugks5baVt2I8SCOwKH2pxAuzNrfQ+ETrMEudgJrkEWKaSjYYHS2hG7hPHGo6YdrQPMs5uJA= Received: by 10.54.5.47 with SMTP id 47mr3075621wre; Sun, 26 Jun 2005 16:09:30 -0700 (PDT) Received: by 10.54.99.11 with HTTP; Sun, 26 Jun 2005 16:09:30 -0700 (PDT) Message-ID: <319cceca050626160959aa3f78@mail.gmail.com> Date: Mon, 27 Jun 2005 02:09:30 +0300 From: Maslan To: FreeBSD Hackers Mime-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: quoted-printable Content-Disposition: inline Subject: GmailFS X-BeenThere: freebsd-hackers@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list Reply-To: Maslan List-Id: Technical Discussions relating to FreeBSD List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 26 Jun 2005 23:09:31 -0000 hello guys can not the FUSE http://fuse.sourceforge.net ported to freebsd ? it would be nice to test the gmail fs on freebsd=20 http://richard.jones.name/google-hacks/gmail-filesystem/gmail-filesystem.ht= ml --=20 I'm Searching For Perfection, So Even If U Need Portability U've To Use Assembly ;-) http://www.maslanlab.org From owner-freebsd-hackers@FreeBSD.ORG Sun Jun 26 23:17:53 2005 Return-Path: X-Original-To: freebsd-hackers@freebsd.org 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 4939416A41C for ; Sun, 26 Jun 2005 23:17:53 +0000 (GMT) (envelope-from tataz@tataz.chchile.org) Received: from postfix3-2.free.fr (postfix3-2.free.fr [213.228.0.169]) by mx1.FreeBSD.org (Postfix) with ESMTP id 0CDF443D48 for ; Sun, 26 Jun 2005 23:17:53 +0000 (GMT) (envelope-from tataz@tataz.chchile.org) Received: from tatooine.tataz.chchile.org (vol75-8-82-233-239-98.fbx.proxad.net [82.233.239.98]) by postfix3-2.free.fr (Postfix) with ESMTP id E398EC038; Mon, 27 Jun 2005 01:17:51 +0200 (CEST) Received: by tatooine.tataz.chchile.org (Postfix, from userid 1000) id 91A5A405B; Mon, 27 Jun 2005 01:18:05 +0200 (CEST) Date: Mon, 27 Jun 2005 01:18:05 +0200 From: Jeremie Le Hen To: Maslan Message-ID: <20050626231805.GK1283@obiwan.tataz.chchile.org> References: <319cceca050626160959aa3f78@mail.gmail.com> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <319cceca050626160959aa3f78@mail.gmail.com> User-Agent: Mutt/1.5.9i Cc: FreeBSD Hackers Subject: Re: GmailFS X-BeenThere: freebsd-hackers@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: Technical Discussions relating to FreeBSD List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 26 Jun 2005 23:17:53 -0000 Hi Maslan, > hello guys > can not the FUSE http://fuse.sourceforge.net ported to freebsd ? > it would be nice to test the gmail fs on freebsd > http://richard.jones.name/google-hacks/gmail-filesystem/gmail-filesystem.html AFAIK, this is not available with FreeBSD. There is no user level filesystem support. However, NetBSD announced [1] that one of their project for Google Summer of Code is to implement userspace file system hooks. This may be ported on FreeBSD one day. Regards, [1] http://mail-index.NetBSD.org/netbsd-announce/2005/06/26/0000.html -- Jeremie Le Hen < jeremie at le-hen dot org >< ttz at chchile dot org > From owner-freebsd-hackers@FreeBSD.ORG Mon Jun 27 03:04:44 2005 Return-Path: X-Original-To: freebsd-hackers@freebsd.org 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 846B916A41F for ; Mon, 27 Jun 2005 03:04:44 +0000 (GMT) (envelope-from fbsd.hackers@gmail.com) Received: from rproxy.gmail.com (rproxy.gmail.com [64.233.170.199]) by mx1.FreeBSD.org (Postfix) with ESMTP id 03CAF43D5C for ; Mon, 27 Jun 2005 03:04:42 +0000 (GMT) (envelope-from fbsd.hackers@gmail.com) Received: by rproxy.gmail.com with SMTP id i8so793772rne for ; Sun, 26 Jun 2005 20:04:41 -0700 (PDT) DomainKey-Signature: a=rsa-sha1; q=dns; c=nofws; s=beta; d=gmail.com; h=received:message-id:date:from:reply-to:to:subject:mime-version:content-type:content-transfer-encoding:content-disposition; b=s1SuBGh+4jce2PkloIWVca1t1K/Q/wqq+itxFX70JC3hZoaoJgNv85+4+aP8xSVPqo19rH4JXZfKml+fnl1wCjY4Hn6AmsYDExP13rVkXBapwADSmfLTvyK2+5eEGLLCzywofMLo2fcR5rPPx0GMwnPo0quGyKe3wUzDQibVo8k= Received: by 10.38.79.39 with SMTP id c39mr1780720rnb; Sun, 26 Jun 2005 20:04:41 -0700 (PDT) Received: by 10.38.11.46 with HTTP; Sun, 26 Jun 2005 20:04:41 -0700 (PDT) Message-ID: Date: Sun, 26 Jun 2005 23:04:41 -0400 From: Pablo Mora To: freebsd-hackers@freebsd.org Mime-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: quoted-printable Content-Disposition: inline Subject: problem handling POSIX thread on FreeBSD X-BeenThere: freebsd-hackers@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list Reply-To: Pablo Mora List-Id: Technical Discussions relating to FreeBSD List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 27 Jun 2005 03:04:44 -0000 /* file: taller.c */ int main() { .... if(pthread_attr_setscope(&attr, PTHREAD_SCOPE_SYSTEM) !=3D 0) /* handler */ .... } $ gcc taller.c -pthread $ ./a.out pthread_attr_setscope: Unknown error: 0 $ PTHREAD_SCOPE_SYSTEM fail on freebsd ? help me please...=20 very thanks... --=20 Concepci=F3n, Chile. From owner-freebsd-hackers@FreeBSD.ORG Mon Jun 27 03:04:59 2005 Return-Path: X-Original-To: freebsd-hackers@freebsd.org 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 752BD16A41C for ; Mon, 27 Jun 2005 03:04:59 +0000 (GMT) (envelope-from domze.sa@gmail.com) Received: from wproxy.gmail.com (wproxy.gmail.com [64.233.184.205]) by mx1.FreeBSD.org (Postfix) with ESMTP id 21E7843D55 for ; Mon, 27 Jun 2005 03:04:59 +0000 (GMT) (envelope-from domze.sa@gmail.com) Received: by wproxy.gmail.com with SMTP id 55so286741wri for ; Sun, 26 Jun 2005 20:04:58 -0700 (PDT) DomainKey-Signature: a=rsa-sha1; q=dns; c=nofws; s=beta; d=gmail.com; h=received:message-id:from:to:cc:references:subject:date:mime-version:content-type:x-priority:x-msmail-priority:x-mailer:x-mimeole; b=cXE20Zp9sU4yy5duhZyCOdeOz73lXV7hr2+N+ZG3NWBVKOWss4HsvSI2bW7zBSZJ73f+L3YUS6hwz4RctxTBdduXrAM2sSyZgieF+REeVj6FGub1+FiAzhywvUf0olDFVcRhbYnGpguaTMJpDiFeLJ+sQ75s3I8+R1zQwm8WGwo= Received: by 10.54.28.70 with SMTP id b70mr3078258wrb; Sun, 26 Jun 2005 20:04:58 -0700 (PDT) Received: from DOMZ ([70.52.7.9]) by mx.gmail.com with ESMTP id g3sm7297674wra.2005.06.26.20.04.57; Sun, 26 Jun 2005 20:04:58 -0700 (PDT) Message-ID: <001501c57ac4$f94bcbc0$02000a0a@DOMZ> From: "Dominique SA" To: "Dmitry Mityugov" References: <003701c57a09$c0631360$02000a0a@DOMZ> Date: Sun, 26 Jun 2005 23:04:43 -0400 MIME-Version: 1.0 X-Priority: 3 X-MSMail-Priority: Normal X-Mailer: Microsoft Outlook Express 6.00.2741.2600 X-MIMEOLE: Produced By Microsoft MimeOLE V6.00.2742.200 Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: quoted-printable X-Content-Filtered-By: Mailman/MimeDel 2.1.5 Cc: freebsd-hackers@freebsd.org Subject: Re: KMEM Problem With OIDENTD X-BeenThere: freebsd-hackers@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: Technical Discussions relating to FreeBSD List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 27 Jun 2005 03:04:59 -0000 sysctl kern.securelevel produces -1 i didnt enable securelevel yet as i am still updating/installing stuff ----- Original Message -----=20 From: Dmitry Mityugov=20 To: Dominique SA=20 Cc: freebsd-hackers@freebsd.org=20 Sent: Sunday, June 26, 2005 9:03 AM Subject: Re: KMEM Problem With OIDENTD On 6/26/05, Dominique SA wrote: > Hey guys, I'm using FreeBSD 5.4, with oidentd 2.0.7 and PF. I can = run oidentd fine but when i try to run it with the -m flag (masquerade = flag) it tells me: > Fatal: Can't open kmem device: No such file or directory > Though: > mem.ko module is loaded and: > crw-r----- 1 root kmem 244, 1 Jun 24 16:06 /dev/kmem >=20 > note: when i run oidentd, i run it with the following flags: > -d -f -m -l 20 -u root -g kmem -i (interactive mode so i can see if = i get error messages, etc) > note 2: this was posted in freebsd-questions, but it looks like this = list is for more technical questions >=20 > any ideas on how to fix this? The only idea I have is a raised securelevel. What does sysctl kern.securelevel produce? --=20 Dmitry "We live less by imagination than despite it" - Rockwell Kent, "N by = E" From owner-freebsd-hackers@FreeBSD.ORG Mon Jun 27 04:19:59 2005 Return-Path: X-Original-To: freebsd-hackers@freebsd.org 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 6523116A41C for ; Mon, 27 Jun 2005 04:19:59 +0000 (GMT) (envelope-from dan@dan.emsphone.com) Received: from dan.emsphone.com (dan.emsphone.com [199.67.51.101]) by mx1.FreeBSD.org (Postfix) with ESMTP id 2FA8443D48 for ; Mon, 27 Jun 2005 04:19:58 +0000 (GMT) (envelope-from dan@dan.emsphone.com) Received: (from dan@localhost) by dan.emsphone.com (8.13.1/8.13.3) id j5R4JwKe091123; Sun, 26 Jun 2005 23:19:58 -0500 (CDT) (envelope-from dan) Date: Sun, 26 Jun 2005 23:19:58 -0500 From: Dan Nelson To: Pablo Mora Message-ID: <20050627041958.GB51206@dan.emsphone.com> References: Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: X-OS: FreeBSD 5.4-STABLE X-message-flag: Outlook Error User-Agent: Mutt/1.5.9i Cc: freebsd-hackers@freebsd.org Subject: Re: problem handling POSIX thread on FreeBSD X-BeenThere: freebsd-hackers@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: Technical Discussions relating to FreeBSD List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 27 Jun 2005 04:19:59 -0000 In the last episode (Jun 26), Pablo Mora said: > int main() { > .... > if(pthread_attr_setscope(&attr, PTHREAD_SCOPE_SYSTEM) != 0) > /* handler */ > .... > } > > $ gcc taller.c -pthread > $ ./a.out > pthread_attr_setscope: Unknown error: 0 > $ > > PTHREAD_SCOPE_SYSTEM fail on freebsd ? The libc_r and libthr threads libraries do not support PTHREAD_SCOPE_SYSTEM. The standard does not require support for both PTHREAD_SCOPE_PROCESS and PTHREAD_SCOPE_SYSTEM, so it's better if you don't treat failure of pthread_attr_setscope() as fatal to the program. If you're running FreeBSD 4.0, your only choice of threads library is libc_r. Also note that the pthread_attr_*() functions are special in that they do not set the errno variable. They return their error code, so you need to do something like: rv = pthread_attr_setscope(&attr, PTHREAD_SCOPE_SYSTEM); if (rv && rv != ENOTSUP) handle_error(); -- Dan Nelson dnelson@allantgroup.com From owner-freebsd-hackers@FreeBSD.ORG Mon Jun 27 05:10:13 2005 Return-Path: X-Original-To: freebsd-hackers@freebsd.org 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 888B516A41C for ; Mon, 27 Jun 2005 05:10:13 +0000 (GMT) (envelope-from fbsd.hackers@gmail.com) Received: from rproxy.gmail.com (rproxy.gmail.com [64.233.170.200]) by mx1.FreeBSD.org (Postfix) with ESMTP id 473A243D48 for ; Mon, 27 Jun 2005 05:10:13 +0000 (GMT) (envelope-from fbsd.hackers@gmail.com) Received: by rproxy.gmail.com with SMTP id i8so806558rne for ; Sun, 26 Jun 2005 22:10:12 -0700 (PDT) DomainKey-Signature: a=rsa-sha1; q=dns; c=nofws; s=beta; d=gmail.com; h=received:message-id:date:from:reply-to:to:subject:cc:in-reply-to:mime-version:content-type:content-transfer-encoding:content-disposition:references; b=HbMBdJn1RZyIhJeFTyKUocNj0OvvUDk/osOcEZ+iy6jgZ0XvBkirPSrDCdmMWqjDUKOmmJlLYoUv8mdcQvCnB6jpEAtiqmtgcn3IDcG3fOF1ZxhT1cVII5XoHEHV/UUWEqK2I6GBQyUKSvomWNEztOs59xgSUZQjDM9jcU7SPyw= Received: by 10.38.78.56 with SMTP id a56mr2401491rnb; Sun, 26 Jun 2005 22:10:12 -0700 (PDT) Received: by 10.38.11.46 with HTTP; Sun, 26 Jun 2005 22:10:12 -0700 (PDT) Message-ID: Date: Mon, 27 Jun 2005 01:10:12 -0400 From: Pablo Mora To: Dan Nelson In-Reply-To: <20050627041958.GB51206@dan.emsphone.com> Mime-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: quoted-printable Content-Disposition: inline References: <20050627041958.GB51206@dan.emsphone.com> Cc: freebsd-hackers@freebsd.org Subject: Re: problem handling POSIX thread on FreeBSD X-BeenThere: freebsd-hackers@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list Reply-To: Pablo Mora List-Id: Technical Discussions relating to FreeBSD List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 27 Jun 2005 05:10:13 -0000 Hi, very thanks you... i running fbsd v4.11 stable. --=20 Concepci=F3n, Chile. From owner-freebsd-hackers@FreeBSD.ORG Mon Jun 27 05:32:48 2005 Return-Path: X-Original-To: freebsd-hackers@freebsd.org 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 5AEF616A41C for ; Mon, 27 Jun 2005 05:32:48 +0000 (GMT) (envelope-from fbsd.hackers@gmail.com) Received: from rproxy.gmail.com (rproxy.gmail.com [64.233.170.201]) by mx1.FreeBSD.org (Postfix) with ESMTP id 13CE843D1F for ; Mon, 27 Jun 2005 05:32:47 +0000 (GMT) (envelope-from fbsd.hackers@gmail.com) Received: by rproxy.gmail.com with SMTP id i8so808593rne for ; Sun, 26 Jun 2005 22:32:46 -0700 (PDT) DomainKey-Signature: a=rsa-sha1; q=dns; c=nofws; s=beta; d=gmail.com; h=received:message-id:date:from:reply-to:to:subject:in-reply-to:mime-version:content-type:content-transfer-encoding:content-disposition:references; b=B9gJtnZZRhvg8iMC2rAJVLJXBB5+qj/lKlqkcFy59yUov1nFryoIUT9AldTq3zqW8rSApMKXlZFVtk7BNm3uz1rOrslEZ2YlpPMBxEZj86j//q107Cej/tzg3nqPtZMhIGYjY0E59pni+9Dh2GBRvkPFXmr7kvTtcDgCMgnxn70= Received: by 10.38.78.9 with SMTP id a9mr759778rnb; Sun, 26 Jun 2005 22:32:46 -0700 (PDT) Received: by 10.38.11.46 with HTTP; Sun, 26 Jun 2005 22:32:46 -0700 (PDT) Message-ID: Date: Mon, 27 Jun 2005 01:32:46 -0400 From: Pablo Mora To: freebsd-hackers@freebsd.org In-Reply-To: Mime-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: quoted-printable Content-Disposition: inline References: <20050627041958.GB51206@dan.emsphone.com> Subject: Re: problem handling POSIX thread on FreeBSD X-BeenThere: freebsd-hackers@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list Reply-To: Pablo Mora List-Id: Technical Discussions relating to FreeBSD List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 27 Jun 2005 05:32:48 -0000 /* file: test.c */ #include #include #include #include #include char buffer[512]; pthread_mutex_t mutex, mutex2;=20 pthread_t hilo1, hilo2; void f1(void* ptr) { =09int i,n=3D10; =09int valor=3D0; =09char*p=3D(char*)ptr; =09 =09for(i=3D0;i X-Original-To: freebsd-hackers@freebsd.org 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 1780016A41C for ; Mon, 27 Jun 2005 06:24:19 +0000 (GMT) (envelope-from julian@elischer.org) Received: from delight.idiom.com (delight.idiom.com [216.240.32.16]) by mx1.FreeBSD.org (Postfix) with ESMTP id 00B9643D49 for ; Mon, 27 Jun 2005 06:24:18 +0000 (GMT) (envelope-from julian@elischer.org) Received: from idiom.com (idiom.com [216.240.32.1]) by delight.idiom.com (Postfix) with ESMTP id 532FF1F9D76; Sun, 26 Jun 2005 23:24:18 -0700 (PDT) Received: from [192.168.2.5] (home.elischer.org [216.240.48.38]) by idiom.com (8.12.11/8.12.11) with ESMTP id j5R6OGBV068989; Sun, 26 Jun 2005 23:24:17 -0700 (PDT) (envelope-from julian@elischer.org) Message-ID: <42BF9B8F.70105@elischer.org> Date: Sun, 26 Jun 2005 23:24:15 -0700 From: Julian Elischer User-Agent: Mozilla/5.0 (X11; U; FreeBSD i386; en-US; rv:1.7.7) Gecko/20050424 X-Accept-Language: en, hu MIME-Version: 1.0 To: Jeremie Le Hen References: <319cceca050626160959aa3f78@mail.gmail.com> <20050626231805.GK1283@obiwan.tataz.chchile.org> In-Reply-To: <20050626231805.GK1283@obiwan.tataz.chchile.org> Content-Type: text/plain; charset=us-ascii; format=flowed Content-Transfer-Encoding: 7bit Cc: Maslan , FreeBSD Hackers Subject: Re: GmailFS X-BeenThere: freebsd-hackers@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: Technical Discussions relating to FreeBSD List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 27 Jun 2005 06:24:19 -0000 Jeremie Le Hen wrote: > Hi Maslan, > > >>hello guys >>can not the FUSE http://fuse.sourceforge.net ported to freebsd ? >>it would be nice to test the gmail fs on freebsd >>http://richard.jones.name/google-hacks/gmail-filesystem/gmail-filesystem.html > > > AFAIK, this is not available with FreeBSD. There is no user level > filesystem support. However, NetBSD announced [1] that one of their > project for Google Summer of Code is to implement userspace file system > hooks. This may be ported on FreeBSD one day. > > Regards, > > [1] http://mail-index.NetBSD.org/netbsd-announce/2005/06/26/0000.html is not the portalfs an implementation of a user space filesystem? From owner-freebsd-hackers@FreeBSD.ORG Mon Jun 27 08:14:42 2005 Return-Path: X-Original-To: freebsd-hackers@freebsd.org 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 0EE2116A41C for ; Mon, 27 Jun 2005 08:14:42 +0000 (GMT) (envelope-from tataz@tataz.chchile.org) Received: from postfix3-2.free.fr (postfix3-2.free.fr [213.228.0.169]) by mx1.FreeBSD.org (Postfix) with ESMTP id C66EB43D1F for ; Mon, 27 Jun 2005 08:14:41 +0000 (GMT) (envelope-from tataz@tataz.chchile.org) Received: from tatooine.tataz.chchile.org (vol75-8-82-233-239-98.fbx.proxad.net [82.233.239.98]) by postfix3-2.free.fr (Postfix) with ESMTP id BED8BC08B; Mon, 27 Jun 2005 10:14:40 +0200 (CEST) Received: by tatooine.tataz.chchile.org (Postfix, from userid 1000) id DCDA1405B; Mon, 27 Jun 2005 10:14:54 +0200 (CEST) Date: Mon, 27 Jun 2005 10:14:54 +0200 From: Jeremie Le Hen To: Julian Elischer Message-ID: <20050627081454.GM1283@obiwan.tataz.chchile.org> References: <319cceca050626160959aa3f78@mail.gmail.com> <20050626231805.GK1283@obiwan.tataz.chchile.org> <42BF9B8F.70105@elischer.org> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <42BF9B8F.70105@elischer.org> User-Agent: Mutt/1.5.9i Cc: Maslan , Jeremie Le Hen , FreeBSD Hackers Subject: Re: GmailFS X-BeenThere: freebsd-hackers@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: Technical Discussions relating to FreeBSD List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 27 Jun 2005 08:14:42 -0000 Hi Julian, Hi Maslan, > is not the portalfs an implementation of a user space filesystem? yes indeed, I never used it and this is not a very familiar subject on these mailing lists. Sorry for giving bad information. Regards, -- Jeremie Le Hen < jeremie at le-hen dot org >< ttz at chchile dot org > From owner-freebsd-hackers@FreeBSD.ORG Mon Jun 27 09:41:50 2005 Return-Path: X-Original-To: freebsd-hackers@freebsd.org 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 34FFB16A41C for ; Mon, 27 Jun 2005 09:41:50 +0000 (GMT) (envelope-from rwatson@FreeBSD.org) Received: from cyrus.watson.org (cyrus.watson.org [204.156.12.53]) by mx1.FreeBSD.org (Postfix) with ESMTP id 0C96B43D49 for ; Mon, 27 Jun 2005 09:41:50 +0000 (GMT) (envelope-from rwatson@FreeBSD.org) Received: from fledge.watson.org (fledge.watson.org [204.156.12.50]) by cyrus.watson.org (Postfix) with ESMTP id 3B1E946B03; Mon, 27 Jun 2005 05:41:49 -0400 (EDT) Date: Mon, 27 Jun 2005 10:45:35 +0100 (BST) From: Robert Watson X-X-Sender: robert@fledge.watson.org To: Jeremie Le Hen In-Reply-To: <20050626231805.GK1283@obiwan.tataz.chchile.org> Message-ID: <20050627104433.W23520@fledge.watson.org> References: <319cceca050626160959aa3f78@mail.gmail.com> <20050626231805.GK1283@obiwan.tataz.chchile.org> MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII; format=flowed Cc: Maslan , FreeBSD Hackers Subject: Re: GmailFS X-BeenThere: freebsd-hackers@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: Technical Discussions relating to FreeBSD List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 27 Jun 2005 09:41:50 -0000 On Mon, 27 Jun 2005, Jeremie Le Hen wrote: >> hello guys >> can not the FUSE http://fuse.sourceforge.net ported to freebsd ? >> it would be nice to test the gmail fs on freebsd >> http://richard.jones.name/google-hacks/gmail-filesystem/gmail-filesystem.html > > AFAIK, this is not available with FreeBSD. There is no user level > filesystem support. However, NetBSD announced [1] that one of their > project for Google Summer of Code is to implement userspace file system > hooks. This may be ported on FreeBSD one day. Arla's XFS code actually does quite a good job of providing a userlevel file system framework on FreeBSD, and the Coda kernel module also lets you implement userlevel file systems. I have a slight preference for the Arla XFS implementation as it's more general-purpose. I've previously used Arla's framework to write part of a user level tertiary file system implementation. Robert N M Watson From owner-freebsd-hackers@FreeBSD.ORG Mon Jun 27 10:02:04 2005 Return-Path: X-Original-To: freebsd-hackers@freebsd.org 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 25F9116A41C for ; Mon, 27 Jun 2005 10:02:04 +0000 (GMT) (envelope-from cnugoud@gmail.com) Received: from wproxy.gmail.com (wproxy.gmail.com [64.233.184.201]) by mx1.FreeBSD.org (Postfix) with ESMTP id DD35543D1F for ; Mon, 27 Jun 2005 10:02:03 +0000 (GMT) (envelope-from cnugoud@gmail.com) Received: by wproxy.gmail.com with SMTP id i21so369716wra for ; Mon, 27 Jun 2005 03:02:03 -0700 (PDT) DomainKey-Signature: a=rsa-sha1; q=dns; c=nofws; s=beta; d=gmail.com; h=received:message-id:date:from:reply-to:to:subject:mime-version:content-type:content-transfer-encoding:content-disposition; b=rEWBkRNGK94OtKxWL4DAM4QoCWBvt6kxoQF4rEnjtg8RfTi6MnNOkWXmnuKHeiAsdGIUjeFWrgLj5oxxVF2ujEfwPNLcpCTkZuByJkokNUIJTCU+8huBJ7xLO8VKGv7DBlNTP9KrBkpRhBq5EznSIEs2bb28BF3abYsQOFJL8fg= Received: by 10.54.101.16 with SMTP id y16mr984574wrb; Mon, 27 Jun 2005 03:02:03 -0700 (PDT) Received: by 10.54.101.15 with HTTP; Mon, 27 Jun 2005 03:02:02 -0700 (PDT) Message-ID: Date: Mon, 27 Jun 2005 15:32:02 +0530 From: Srinivas Goud To: freebsd-hackers@freebsd.org Mime-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: quoted-printable Content-Disposition: inline Subject: IPv6 Extension Headers X-BeenThere: freebsd-hackers@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list Reply-To: Srinivas Goud List-Id: Technical Discussions relating to FreeBSD List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 27 Jun 2005 10:02:04 -0000 Hello All, I am working on IPv6 Extension Headers Implementation. =20 I am confused with freeBSD implementation and RFC2460 specification for Destination Options. My interpretation from RFC2460 is that, If a packet consists of hop-by-hop and destination extension headers, destination header should be inserted inside AH. i.e., hop + AH + dst.=20 But freeBSD implementation is the other way,=20 i.e., hop + dst + AH. which is correct way of implementation according to RFC2460? Please let me know, if my interpretation is wrong. Any help will be appreciated greatly. Thanks, Srinivas. --=20 Srinivas Goud "Everything is Nicer when shared with a Friend" From owner-freebsd-hackers@FreeBSD.ORG Mon Jun 27 14:06:54 2005 Return-Path: X-Original-To: freebsd-hackers@freebsd.org 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 A4BD016A41C for ; Mon, 27 Jun 2005 14:06:54 +0000 (GMT) (envelope-from cole@opteqint.net) Received: from kalypso.opteqint.net (kalypso.opteqint.net [160.124.112.28]) by mx1.FreeBSD.org (Postfix) with ESMTP id DF30943D53 for ; Mon, 27 Jun 2005 14:06:53 +0000 (GMT) (envelope-from cole@opteqint.net) Received: from localhost.opteqint.net ([127.0.0.1] helo=opteqint.net) by kalypso.opteqint.net with esmtp (Exim 4.43 (FreeBSD)) id 1DmuFv-0008QN-JD for freebsd-hackers@freebsd.org; Mon, 27 Jun 2005 16:06:46 +0200 Received: from tbnb-165-211-233.telkomadsl.co.za (tbnb-165-211-233.telkomadsl.co.za [165.165.211.233]) by mail.opteqint.net (Horde) with HTTP for ; Mon, 27 Jun 2005 16:06:35 +0200 Message-ID: <20050627160635.9kkhi57rk88w848k@mail.opteqint.net> Date: Mon, 27 Jun 2005 16:06:35 +0200 From: cole@opteqint.net To: freebsd-hackers@freebsd.org MIME-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-1 Content-Disposition: inline Content-Transfer-Encoding: 7bit User-Agent: Internet Messaging Program (IMP) H3 (4.0.1) / FreeBSD-5.2.1 X-Spam-Score: -99.8 (---------------------------------------------------) X-Spam-Report: Spam detection software, running on the system "kalypso.opteqint.net", has identified this incoming email as possible spam. The original message has been attached to this so you can view it (if it isn't spam) or label similar future email. If you have any questions, see the administrator of that system for details. Content preview: Hi I wanted to know if there are any libraries similar to pcap to intercept packets/mangle packets. What im trying to do specifically is like link compression, and I would then need to check if the packet is then compressed and decompress, and so forth and so on. [...] Content analysis details: (-99.8 points, 4.2 required) pts rule name description ---- ---------------------- -------------------------------------------------- -100 USER_IN_WHITELIST From: address is in the user's white-list 0.2 NO_REAL_NAME From: does not include a real name Subject: Packet interception / Mangling X-BeenThere: freebsd-hackers@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: Technical Discussions relating to FreeBSD List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 27 Jun 2005 14:06:54 -0000 Hi I wanted to know if there are any libraries similar to pcap to intercept packets/mangle packets. What im trying to do specifically is like link compression, and I would then need to check if the packet is then compressed and decompress, and so forth and so on. I would like to avoid having to use a ipfw divert to a port, and specifically check all traffic to the box using a library function or some kind of hook into the kernel. The FreeBSD version I will be using is 4.9 or 4.11, and would like to know if there are any such routines available, and whether it could be a userland daemon, or if i am going to need to write a kernel loadable module? If anyone has any ideas or suggestions, or knows anything about this, it would be a great help. Regards /Cole From owner-freebsd-hackers@FreeBSD.ORG Mon Jun 27 17:42:06 2005 Return-Path: X-Original-To: freebsd-hackers@freebsd.org 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 21CAB16A41C for ; Mon, 27 Jun 2005 17:42:06 +0000 (GMT) (envelope-from alexander_kurilovich@hotmail.com) Received: from hotmail.com (bay13-dav3.bay13.hotmail.com [64.4.31.177]) by mx1.FreeBSD.org (Postfix) with ESMTP id D41FC43D1F for ; Mon, 27 Jun 2005 17:42:05 +0000 (GMT) (envelope-from alexander_kurilovich@hotmail.com) Received: from mail pickup service by hotmail.com with Microsoft SMTPSVC; Mon, 27 Jun 2005 10:42:05 -0700 Message-ID: Received: from 66.174.76.201 by BAY13-DAV3.phx.gbl with DAV; Mon, 27 Jun 2005 17:42:05 +0000 X-Originating-IP: [66.174.76.201] X-Originating-Email: [alexander_kurilovich@hotmail.com] X-Sender: alexander_kurilovich@hotmail.com From: "Alexander Kurilovich" To: Date: Mon, 27 Jun 2005 13:40:40 -0400 MIME-Version: 1.0 X-Mailer: Microsoft Office Outlook, Build 11.0.6353 X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2900.2527 Thread-Index: AcV486knGyLVIKQhQfGrgRQByAo9VwBosyPQ In-Reply-To: X-OriginalArrivalTime: 27 Jun 2005 17:42:05.0764 (UTC) FILETIME=[88C42840:01C57B3F] Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit X-Content-Filtered-By: Mailman/MimeDel 2.1.5 Subject: RE: Wireless CDMA cards for Verizon X-BeenThere: freebsd-hackers@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: Technical Discussions relating to FreeBSD List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 27 Jun 2005 17:42:06 -0000 Hi Don't know why attachment couldn't go through. So I put it in body: Append to FILE: src/sys/dev/usb/usbdevs vendor AIRPRIME 0x0f3d AirPrime, Incorporated vendor NOVATEL 0x1410 Novatel /* AirPrime products */ product AIRPRIME PC5220 0x0112 CDMA Wireless PC Card /* Novatel products */ product NOVATEL PC620 0x1110 CDMA Wireless PC Card Append to FILE: /etc/usbd.conf device "Verizon wireless Airprime" devname "ucom0" vendor 0x0f3d product 0x0112 #attach "/usr/sbin/pppctl /var/run/ppp/3g-ppp quit all;/usr/sbin/ppp -auto 3g" attach "/usr/sbin/ppp -auto 3g" detach "/usr/sbin/pppctl /var/run/ppp/3g-ppp quit all" device "Verizon wireless Novatel" devname "ucom0" vendor 0x1410 product 0x1110 #attach "/usr/sbin/pppctl /var/run/ppp/3g-ppp quit all;/usr/sbin/ppp -auto 3g" attach "/usr/sbin/ppp -auto 3g" detach "/usr/sbin/pppctl /var/run/ppp/3g-ppp quit all" Append to FILE: /etc/ppp/pppd.conf 3g: set device /dev/ucom0 set speed 460800 # SPEED IS GOOD! set phone \#777 # 1 refers to CID # The chat script is a little bit different set dial "ABORT BUSY ABORT NO\sCARRIER TIMEOUT 5 \ \"\" AT OK-AT-OK \ AT OK-AT-OK \\dATD\\T TIMEOUT 40 CONNECT" enable dns set authname wap set authkey wap accept PAP set login add default HISADDR set ifaddr 10.0.0.1/0 10.0.0.2/0 0.0.0.0 0.0.0.0 disable ipv6cp disable mppe set reconnect 3 15 new FILE: src/sys/dev/usb/uveriz.c,v #include __FBSDID("$FreeBSD: src/sys/dev/usb/uveriz.c,v 1.1 2005/06/08 12:44:09 akurilov Exp $"); #include "opt_uvscom.h" #include #include #include #include #include #include #include #include #include #if defined(__FreeBSD__) #include #include #if __FreeBSD_version >= 500014 #include #else #include #endif #else #include #include #endif #include #include #include #include #include #include #include #include #include "usbdevs.h" #include #include /* */ #define uveriz_DEBUG 1 #ifdef uveriz_DEBUG #define DPRINTF(x) if (uverizdebug) printf x #define DPRINTFN(n,x) if (uverizdebug>(n)) printf x int uverizdebug = 0; #else #define DPRINTF(x) #define DPRINTFN(n,x) #endif struct uveriz_softc { struct ucom_softc sc_ucom; u_int16_t sc_flags; }; #define UVERIZ_CONFIG_INDEX 0 #define UVERIZ_IFACE_INDEX 0 #define UVERIZ_MODVER 1 #define UVERIZ_BUFSIZE 1024 static const struct usb_devno uveriz_devs[] = { { USB_VENDOR_AIRPRIME, USB_PRODUCT_AIRPRIME_PC5220 }, { USB_VENDOR_NOVATEL, USB_PRODUCT_NOVATEL_PC620 }, }; #define uveriz_lookup(v, p) usb_lookup(uveriz_devs, v, p) Static void uveriz_close(void *, int); struct ucom_callback uveriz_callback = { NULL, NULL, NULL, NULL, NULL, uveriz_close, NULL, NULL, }; /*USB_DECLARE_DRIVER(uveriz);*/ Static device_probe_t uveriz_match; Static device_attach_t uveriz_attach; Static device_detach_t uveriz_detach; Static device_method_t uveriz_methods[] = { /* Device interface */ DEVMETHOD(device_probe, uveriz_match), DEVMETHOD(device_attach, uveriz_attach), DEVMETHOD(device_detach, uveriz_detach), { 0, 0 } }; Static driver_t uveriz_driver = { "ucom", uveriz_methods, sizeof (struct uveriz_softc) }; DRIVER_MODULE(uveriz, uhub, uveriz_driver, ucom_devclass, usbd_driver_load, 0); MODULE_DEPEND(uveriz, usb, 1, 1, 1); MODULE_DEPEND(uveriz, ucom, UCOM_MINVER, UCOM_PREFVER, UCOM_MAXVER); MODULE_VERSION(uveriz, UVERIZ_MODVER); USB_MATCH(uveriz) { USB_MATCH_START(uveriz, uaa); if (uaa->iface != NULL) return (UMATCH_NONE); DPRINTFN(20,("uveriz: vendor=0x%x, product=0x%x\n", uaa->vendor, uaa->product)); return (uveriz_lookup(uaa->vendor, uaa->product) != NULL ? UMATCH_VENDOR_PRODUCT : UMATCH_NONE); } USB_ATTACH(uveriz) { USB_ATTACH_START(uveriz, sc, uaa); usbd_device_handle dev = uaa->device; usbd_interface_handle iface; usb_interface_descriptor_t *id; usb_endpoint_descriptor_t *ed; char *devinfo; const char *devname; int i; usbd_status err; struct ucom_softc *ucom; devinfo = malloc(1024, M_USBDEV, M_WAITOK); ucom = &sc->sc_ucom; bzero(sc, sizeof (struct uveriz_softc)); usbd_devinfo(dev, 0, devinfo); /*USB_ATTACH_SETUP;*/ ucom->sc_dev = self; device_set_desc_copy(self, devinfo); ucom->sc_udev = dev; ucom->sc_iface = uaa->iface; devname = USBDEVNAME(ucom->sc_dev); printf("%s: %s\n", devname, devinfo); DPRINTFN(10,("\nuveriz_attach: sc=%p\n", sc)); /* Move the device into the configured state. */ err = usbd_set_config_index(dev, UVERIZ_CONFIG_INDEX, 1); if (err) { printf("\n%s: failed to set configuration, err=%s\n", devname, usbd_errstr(err)); goto bad; } err = usbd_device2interface_handle(dev, UVERIZ_IFACE_INDEX, &iface); if (err) { printf("\n%s: failed to get interface, err=%s\n", devname, usbd_errstr(err)); goto bad; } printf("%s: %s\n", devname, devinfo); /*sc->sc_flags = uveriz_lookup(uaa->vendor, uaa->product)->uv_flags;*/ id = usbd_get_interface_descriptor(iface); ucom->sc_udev = dev; ucom->sc_iface = iface; ucom->sc_bulkin_no = ucom->sc_bulkout_no = -1; for (i = 0; i < id->bNumEndpoints; i++) { int addr, dir, attr; ed = usbd_interface2endpoint_descriptor(iface, i); if (ed == NULL) { printf("%s: could not read endpoint descriptor" ": %s\n", devname, usbd_errstr(err)); goto bad; } addr = ed->bEndpointAddress; dir = UE_GET_DIR(ed->bEndpointAddress); attr = ed->bmAttributes & UE_XFERTYPE; if (dir == UE_DIR_IN && attr == UE_BULK) ucom->sc_bulkin_no = addr; else if (dir == UE_DIR_OUT && attr == UE_BULK) ucom->sc_bulkout_no = addr; else if (attr == UE_INTERRUPT) { printf("interrupt\n"); } else { printf("%s: unexpected endpoint(%d %d)\n", devname, dir, attr); goto bad; } } if (ucom->sc_bulkin_no == -1) { printf("%s: Could not find data bulk in\n", USBDEVNAME(ucom->sc_dev)); goto bad; } if (ucom->sc_bulkout_no == -1) { printf("%s: Could not find data bulk out\n", USBDEVNAME(ucom->sc_dev)); goto bad; } ucom->sc_parent = sc; ucom->sc_portno = UCOM_UNK_PORTNO; /* bulkin, bulkout set above */ ucom->sc_ibufsize = UVERIZ_BUFSIZE; ucom->sc_obufsize = UVERIZ_BUFSIZE; ucom->sc_ibufsizepad = UVERIZ_BUFSIZE; ucom->sc_opkthdrlen = 0; ucom->sc_callback = &uveriz_callback; if (err) { printf("%s: init failed, %s\n", USBDEVNAME(ucom->sc_dev), usbd_errstr(err)); goto bad; } usbd_add_drv_event(USB_EVENT_DRIVER_ATTACH, ucom->sc_udev, USBDEV(ucom->sc_dev)); DPRINTF(("uveriz: in=0x%x out=0x%x\n", ucom->sc_bulkin_no, ucom->sc_bulkout_no)); ucom_attach(&sc->sc_ucom); USB_ATTACH_SUCCESS_RETURN; bad: DPRINTF(("uveriz_attach: ATTACH ERROR\n")); ucom->sc_dying = 1; USB_ATTACH_ERROR_RETURN; } /* int uveriz_activate(device_ptr_t self, enum devact act) { struct uveriz_softc *sc = (struct uveriz_softc *)self; int rv = 0; switch (act) { case DVACT_ACTIVATE: return (EOPNOTSUPP); break; case DVACT_DEACTIVATE: sc->sc_dying = 1; if (sc->sc_subdev) rv = config_deactivate(sc->sc_subdev); break; } return (rv); }*/ USB_DETACH(uveriz) { USB_DETACH_START(uveriz, sc); int rv = 0; DPRINTF(("uveriz_detach: sc=%p\n", sc)); sc->sc_ucom.sc_dying = 1; rv = ucom_detach(&sc->sc_ucom); usbd_add_drv_event(USB_EVENT_DRIVER_DETACH, sc->sc_ucom.sc_udev, USBDEV(sc->sc_ucom.sc_dev)); return (rv); } void uveriz_close(void *addr, int portno) { /*struct uvisor_softc *sc = addr; usb_device_request_t req; struct uveriz_connection_info coninfo; int actlen; if (sc->sc_ucom.sc_dying) return; req.bmRequestType = UT_READ_VENDOR_ENDPOINT; req.bRequest = UVISOR_CLOSE_NOTIFICATION; USETW(req.wValue, 0); USETW(req.wIndex, 0); USETW(req.wLength, UVISOR_CONNECTION_INFO_SIZE); (void)usbd_do_request_flags(sc->sc_ucom.sc_udev, &req, &coninfo, USBD_SHORT_XFER_OK, &actlen, USBD_DEFAULT_TIMEOUT);*/ } Best regards. Alexander Kurilovich _____ From: Alexander Kurilovich [mailto:alexander_kurilovich@hotmail.com] Sent: Friday, June 24, 2005 3:34 PM To: 'freebsd-hackers@freebsd.org' Subject: Wireless CDMA cards for Verizon Hi I've implemented 2 PCMCI wireless CDMA-3G cards from Verizon. I use them via 'ppp' using 'ucom'. It might be helpful for somebody. Code, ppp.conf and usbd.conf in attached file. Alexander Kurilovich From owner-freebsd-hackers@FreeBSD.ORG Mon Jun 27 18:22:57 2005 Return-Path: X-Original-To: hackers@freebsd.org 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 7D5EA16A41C for ; Mon, 27 Jun 2005 18:22:57 +0000 (GMT) (envelope-from dmp@bitfreak.org) Received: from mail.bitfreak.org (mail.bitfreak.org [65.75.198.146]) by mx1.FreeBSD.org (Postfix) with ESMTP id 566A743D1D for ; Mon, 27 Jun 2005 18:22:57 +0000 (GMT) (envelope-from dmp@bitfreak.org) Received: from SMILEY (mail.bitfreak.org [65.75.198.146]) by mail.bitfreak.org (Postfix) with ESMTP id 04DB119F3B for ; Mon, 27 Jun 2005 11:24:44 -0700 (PDT) From: "Darren Pilgrim" To: Date: Mon, 27 Jun 2005 11:22:55 -0700 Message-ID: <002501c57b45$3d72c9e0$0b2a15ac@SMILEY> MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: quoted-printable X-Priority: 3 (Normal) X-MSMail-Priority: Normal X-Mailer: Microsoft Outlook, Build 10.0.6626 X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2900.2527 Importance: Normal Cc: Subject: How to disable at-boot configuration of a network interface but permit manual use of rc.d? X-BeenThere: freebsd-hackers@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: Technical Discussions relating to FreeBSD List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 27 Jun 2005 18:22:57 -0000 There are some conditions to the task given by the subject: 1: The interface must be present at boot. 2: Use of /etc/rc.d scripts to start and stop the interface is desirable. The first condition poses no problem, just don't include the relevant ifconfig_ifn line in /etc/rc.conf and the interface won't be configured. But rc.d/dhclient and rc.d/netif won't work without an ifconfig line for the interface. Adding the ifconfig line and then listing every interface but the one I want configured in network_interfaces does prevent it from being configured at boot while having an ifconfig line in rc.conf, but if I try to use rc.d/netif to start the interface, rc.d/netif does nothing because it tests the interface against the contents of network_interfaces and cloned_interfaces, so the interface I left out will be excluded. Have I overlooked an option somewhere? From owner-freebsd-hackers@FreeBSD.ORG Mon Jun 27 18:26:14 2005 Return-Path: X-Original-To: freebsd-hackers@freebsd.org 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 CFFF016A41C for ; Mon, 27 Jun 2005 18:26:14 +0000 (GMT) (envelope-from jhb@FreeBSD.org) Received: from mv.twc.weather.com (mv.twc.weather.com [65.212.71.225]) by mx1.FreeBSD.org (Postfix) with ESMTP id 6E6F843D1F for ; Mon, 27 Jun 2005 18:26:14 +0000 (GMT) (envelope-from jhb@FreeBSD.org) Received: from [10.50.41.231] (Not Verified[65.202.103.25]) by mv.twc.weather.com with NetIQ MailMarshal (v6, 0, 3, 8) id ; Mon, 27 Jun 2005 14:39:53 -0400 From: John Baldwin To: freebsd-hackers@freebsd.org, Pablo Mora Date: Mon, 27 Jun 2005 13:18:35 -0400 User-Agent: KMail/1.8 References: In-Reply-To: MIME-Version: 1.0 Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: 7bit Content-Disposition: inline Message-Id: <200506271318.36748.jhb@FreeBSD.org> Cc: Subject: Re: problem handling POSIX thread on FreeBSD X-BeenThere: freebsd-hackers@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: Technical Discussions relating to FreeBSD List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 27 Jun 2005 18:26:14 -0000 On Monday 27 June 2005 01:32 am, Pablo Mora wrote: > /* file: test.c */ > #include > #include > #include > #include > #include > > char buffer[512]; > pthread_mutex_t mutex, mutex2; > pthread_t hilo1, hilo2; > > void f1(void* ptr) > { > int i,n=10; > int valor=0; > char*p=(char*)ptr; > > for(i=0;i { > pthread_mutex_lock(&mutex); > sscanf(p,"%d",&valor); > printf("\thilo1: puntero contiene %d\n", valor); > valor=i*3; > sprintf(p, "%d",valor); > > pthread_mutex_unlock(&mutex2); > } > valor=(int)pthread_self(); > printf("finaliza hilo1 con id %d\n", valor); > pthread_exit(&valor); > } > void f2(void* ptr) > { > int i,n=10; > int valor=0; > char*p=(char*)ptr; > for(i=0;i { > pthread_mutex_lock(&mutex2); > sscanf(p,"%d",&valor); > printf("hilo2: puntero contiene %d\n", valor); > valor=i*2; > > sprintf(p, "%d",valor); > pthread_mutex_unlock(&mutex); > } > valor=(int)pthread_self(); > printf("finaliza hilo2 con id %d\n", valor); > pthread_exit(&valor); > } This code is nuts. You can't unlock a mutex that you don't own. You probably want to be using semaphores I think. However, even then that doesn't really make sense. Replace 'mutex2' with 'mutex' in the f1() and f2() functions and get rid of mutex2 and try it again. However, with that change, f1() is free to run to completion before f2() will start. If you want to enforce ping ponging, you need to use a condition variable to synchronize. Something like: pthread_cond_t condvar; f1() { ... pthread_mutex_lock(&mutex); for (i = 0; i < n; i++) { sscanf(...) printf(...) valor = i * 3; sprintf(...) pthread_cond_wait(&condvar, &mutex); } pthread_mutex_unlock(&mutex); valor = (int)pthread_self(); ... } and f2() is similar except s/3/2/. This will cause the threads to ping pong where one thread waits for the other to run after each cycle. You might also want to read up on how synchronization with multiple threads works. "Programming with POSIX Threads" is a decent book, and Tannebaum's "Modern Operating Systems" has a decent section on various synchronization primitives such as mutexes, semaphores, etc. Also, if you have thread specific questions, there is a freebsd-threads@ mailing list that is probably a better place to ask them on. > int main() > { > pthread_attr_t atributos; > //pthread_mutexattr_t mutexattr; - solaris > > memset(buffer, '\0', sizeof(buffer)); > /* > > if(pthread_mutexattr_setpshared(&mutexattr,PTHREAD_PROCESS_PRIVATE)!=0) > //solaris > { > perror("pthread_mutexattr_setpshared"); > exit(-12); > } > */ > > pthread_mutex_init(&mutex, NULL); //linux > pthread_mutex_init(&mutex2, NULL); //linux > > pthread_mutex_lock(&mutex2); / > > /*if(pthread_mutex_init(&mutex, &mutexattr)!=0) //solaris > { > perror("pthread_mutex_init"); > exit(-2); > }*/ > > if(pthread_attr_init(&atributos) < 0) > { > perror("pthread_attr_init"); > exit(-1); > } > if(pthread_attr_setscope(&atributos,PTHREAD_SCOPE_PROCESS) < 0) > { > perror("pthread_attr_setscope"); > exit(-2); > } > if(pthread_create (&hilo1, &atributos, (void*)&f1, (void*)buffer)<0) > { > perror("pthread_create hilo1"); > exit(-2); > } > if(pthread_create(&hilo2, &atributos, (void*)&f2, (void*)buffer)<0) > { > perror("pthread_create hilo2"); > exit(-2); > } > > > if(pthread_join(hilo2, NULL)<0) > { > perror("pthread_join hilo1 "); > exit(-3); > } > puts("fin hilo 2"); > /*if(pthread_join(hilo1, NULL)<0) > { > perror("pthread_join hilo2 "); > exit(-3); > }*/ > > > pthread_mutex_destroy(&mutex); > exit(0); > } > > output in solaris and linux: (gcc test.c -lpthread) > > hilo1: puntero contiene 0 > hilo2: puntero contiene 0 > hilo1: puntero contiene 0 > hilo2: puntero contiene 3 > hilo1: puntero contiene 2 > hilo2: puntero contiene 6 > hilo1: puntero contiene 4 > hilo2: puntero contiene 9 > hilo1: puntero contiene 6 > hilo2: puntero contiene 12 > hilo1: puntero contiene 8 > hilo2: puntero contiene 15 > hilo1: puntero contiene 10 > hilo2: puntero contiene 18 > hilo1: puntero contiene 12 > hilo2: puntero contiene 21 > hilo1: puntero contiene 14 > hilo2: puntero contiene 24 > hilo1: puntero contiene 16 > finaliza hilo1 con id 1082231728 > hilo2: puntero contiene 27 > finaliza hilo2 con id 1090624432 > fin hilo 2 > > output on FreeBSD v4.11 STABLE (gcc test.c -pthread): > > hilo1: puntero contiene 0 > hilo1: puntero contiene 0 > hilo1: puntero contiene 3 > hilo1: puntero contiene 6 > hilo1: puntero contiene 9 > hilo1: puntero contiene 12 > hilo1: puntero contiene 15 > hilo1: puntero contiene 18 > hilo1: puntero contiene 21 > hilo1: puntero contiene 24 > finaliza hilo1 con id 134534144 > > why ?? > > help me please :-). -- John Baldwin <>< http://www.FreeBSD.org/~jhb/ "Power Users Use the Power to Serve" = http://www.FreeBSD.org From owner-freebsd-hackers@FreeBSD.ORG Mon Jun 27 19:21:43 2005 Return-Path: X-Original-To: hackers@freebsd.org 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 4445416A41C for ; Mon, 27 Jun 2005 19:21:43 +0000 (GMT) (envelope-from nike_d@cytexbg.com) Received: from mail.interbgc.com (mx01.interbgc.com [217.9.224.225]) by mx1.FreeBSD.org (Postfix) with SMTP id 86E9143D4C for ; Mon, 27 Jun 2005 19:21:42 +0000 (GMT) (envelope-from nike_d@cytexbg.com) Received: (qmail 95514 invoked from network); 27 Jun 2005 19:21:39 -0000 Received: from nike_d@cytexbg.com by keeper.interbgc.com by uid 1002 with qmail-scanner-1.14 (uvscan: v4.2.40/v4374. spamassassin: 2.63. Clear:SA:0(-2.6/8.0):. Processed in 3.363679 secs); 27 Jun 2005 19:21:39 -0000 X-Spam-Status: No, hits=-2.6 required=8.0 Received: from 213-240-205-251.1697748.ddns.cablebg.net (HELO tormentor.totalterror.net) (213.240.205.251) by mx01.interbgc.com with SMTP; 27 Jun 2005 19:21:36 -0000 Received: (qmail 53165 invoked from network); 27 Jun 2005 19:21:34 -0000 Received: from qmail by qscan (mail filter); 27 Jun 2005 19:21:34 +0000 Received: from unknown (HELO ?10.0.0.3?) (10.0.0.3) by tormentor.totalterror.net with SMTP; 27 Jun 2005 19:21:34 -0000 Message-ID: <42C051D3.2080709@cytexbg.com> Date: Mon, 27 Jun 2005 22:21:55 +0300 From: Niki Denev User-Agent: Mozilla Thunderbird 1.0.2 (Windows/20050317) X-Accept-Language: en-us, en MIME-Version: 1.0 To: Darren Pilgrim References: <002501c57b45$3d72c9e0$0b2a15ac@SMILEY> In-Reply-To: <002501c57b45$3d72c9e0$0b2a15ac@SMILEY> Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit Cc: hackers@freebsd.org Subject: Re: How to disable at-boot configuration of a network interface but permit manual use of rc.d? X-BeenThere: freebsd-hackers@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: Technical Discussions relating to FreeBSD List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 27 Jun 2005 19:21:43 -0000 Darren Pilgrim wrote: > There are some conditions to the task given by the subject: > > 1: The interface must be present at boot. > 2: Use of /etc/rc.d scripts to start and stop the interface is > desirable. > > The first condition poses no problem, just don't include the relevant > ifconfig_ifn line in /etc/rc.conf and the interface won't be configured. > But rc.d/dhclient and rc.d/netif won't work without an ifconfig line for > the interface. > > Adding the ifconfig line and then listing every interface but the one I > want configured in network_interfaces does prevent it from being > configured at boot while having an ifconfig line in rc.conf, but if I > try to use rc.d/netif to start the interface, rc.d/netif does nothing > because it tests the interface against the contents of > network_interfaces and cloned_interfaces, so the interface I left out > will be excluded. > > Have I overlooked an option somewhere? > Hi, What happens if you configure the interface in 'down' state, like : ifconfig_fxp0="inet 192.168.0.10 netmask 0xffffff00 down" P.S.: Just an idea, never tried it :) --niki From owner-freebsd-hackers@FreeBSD.ORG Mon Jun 27 19:27:08 2005 Return-Path: X-Original-To: hackers@freebsd.org 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 50F0716A41C for ; Mon, 27 Jun 2005 19:27:08 +0000 (GMT) (envelope-from dmp@bitfreak.org) Received: from mail.bitfreak.org (mail.bitfreak.org [65.75.198.146]) by mx1.FreeBSD.org (Postfix) with ESMTP id 26ECD43D48 for ; Mon, 27 Jun 2005 19:27:08 +0000 (GMT) (envelope-from dmp@bitfreak.org) Received: from SMILEY (mail.bitfreak.org [65.75.198.146]) by mail.bitfreak.org (Postfix) with ESMTP id 00E8C19F3B; Mon, 27 Jun 2005 12:28:55 -0700 (PDT) From: "Darren Pilgrim" To: "'Niki Denev'" Date: Mon, 27 Jun 2005 12:27:06 -0700 Message-ID: <004f01c57b4e$34a289a0$0b2a15ac@SMILEY> MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit X-Priority: 3 (Normal) X-MSMail-Priority: Normal X-Mailer: Microsoft Outlook, Build 10.0.6626 X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2900.2527 In-Reply-To: <42C051D3.2080709@cytexbg.com> Importance: Normal Cc: hackers@freebsd.org Subject: RE: How to disable at-boot configuration of a network interface but permit manual use of rc.d? X-BeenThere: freebsd-hackers@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: Technical Discussions relating to FreeBSD List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 27 Jun 2005 19:27:08 -0000 From: Niki Denev [mailto:nike_d@cytexbg.com] > Darren Pilgrim wrote: > > There are some conditions to the task given by the subject: > > > > 1: The interface must be present at boot. > > 2: Use of /etc/rc.d scripts to start and stop the interface > > is desirable. > > > > The first condition poses no problem, just don't include the > > relevant ifconfig_ifn line in /etc/rc.conf and the interface won't > > be configured. But rc.d/dhclient and rc.d/netif won't work without > > an ifconfig line for the interface. > > > > Adding the ifconfig line and then listing every interface but the > > one I want configured in network_interfaces does prevent it from > > being configured at boot while having an ifconfig line in rc.conf, > > but if I try to use rc.d/netif to start the interface, rc.d/netif > > does nothing because it tests the interface against the contents > > of network_interfaces and cloned_interfaces, so the interface I > > left out will be excluded. > > > > Have I overlooked an option somewhere? > > What happens if you configure the interface in 'down' state, like : > > ifconfig_fxp0="inet 192.168.0.10 netmask 0xffffff00 down" Then rc.d/dhclient won't work. The "DHCP" keyword must be present in the ifconfig line in order for dhcpif to test true. A similar logic is in place for wpaif based on the "WPA" keyword. From owner-freebsd-hackers@FreeBSD.ORG Mon Jun 27 21:05:15 2005 Return-Path: X-Original-To: hackers@freebsd.org 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 1224216A41C for ; Mon, 27 Jun 2005 21:05:15 +0000 (GMT) (envelope-from sean-freebsd@farley.org) Received: from mail.farley.org (farley.org [67.64.95.201]) by mx1.FreeBSD.org (Postfix) with ESMTP id BE42843D49 for ; Mon, 27 Jun 2005 21:05:14 +0000 (GMT) (envelope-from sean-freebsd@farley.org) Received: from thor.farley.org (thor.farley.org [192.168.1.5]) by mail.farley.org (8.13.1/8.13.1) with ESMTP id j5RL5AEH054855; Mon, 27 Jun 2005 16:05:10 -0500 (CDT) (envelope-from sean-freebsd@farley.org) Date: Mon, 27 Jun 2005 16:05:20 -0500 (CDT) From: =?ISO-8859-1?Q?Se=E1n_C=2E_Farley?= To: Darren Pilgrim In-Reply-To: <004f01c57b4e$34a289a0$0b2a15ac@SMILEY> Message-ID: <20050627160130.X87609@thor.farley.org> References: <004f01c57b4e$34a289a0$0b2a15ac@SMILEY> MIME-Version: 1.0 Content-Type: MULTIPART/MIXED; BOUNDARY="0-1040642303-1119906320=:87609" Cc: hackers@freebsd.org Subject: RE: How to disable at-boot configuration of a network interface but permit manual use of rc.d? X-BeenThere: freebsd-hackers@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: Technical Discussions relating to FreeBSD List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 27 Jun 2005 21:05:15 -0000 This message is in MIME format. The first part should be readable text, while the remaining parts are likely unreadable without MIME-aware tools. --0-1040642303-1119906320=:87609 Content-Type: TEXT/PLAIN; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: QUOTED-PRINTABLE On Mon, 27 Jun 2005, Darren Pilgrim wrote: > From: Niki Denev [mailto:nike_d@cytexbg.com] >> Darren Pilgrim wrote: >>> There are some conditions to the task given by the subject: >>> >>> 1: The interface must be present at boot. >>> 2: Use of /etc/rc.d scripts to start and stop the interface is >>> desirable. >>> >>> The first condition poses no problem, just don't include the >>> relevant ifconfig_ifn line in /etc/rc.conf and the interface won't >>> be configured. But rc.d/dhclient and rc.d/netif won't work without >>> an ifconfig line for the interface. >>> >>> Adding the ifconfig line and then listing every interface but the >>> one I want configured in network_interfaces does prevent it from >>> being configured at boot while having an ifconfig line in rc.conf, >>> but if I try to use rc.d/netif to start the interface, rc.d/netif >>> does nothing because it tests the interface against the contents of >>> network_interfaces and cloned_interfaces, so the interface I left >>> out will be excluded. >>> >>> Have I overlooked an option somewhere? >> >> What happens if you configure the interface in 'down' state, like : >> >> ifconfig_fxp0=3D"inet 192.168.0.10 netmask 0xffffff00 down" > > Then rc.d/dhclient won't work. The "DHCP" keyword must be present in > the ifconfig line in order for dhcpif to test true. A similar logic > is in place for wpaif based on the "WPA" keyword. I am not sure it will help, but have you tried playing with /etc/start_if.DEVICE scripts? I do not know where they are documented, but you can configure a network device this way. I used it in the past to change the MAC address on a NIC at boot before the card was configured in rc.conf. Se=E1n --=20 sean-freebsd@farley.org --0-1040642303-1119906320=:87609-- From owner-freebsd-hackers@FreeBSD.ORG Mon Jun 27 21:17:37 2005 Return-Path: X-Original-To: freebsd-hackers@freebsd.org 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 01B6D16A41C for ; Mon, 27 Jun 2005 21:17:37 +0000 (GMT) (envelope-from samuel.pierson@gmail.com) Received: from wproxy.gmail.com (wproxy.gmail.com [64.233.184.197]) by mx1.FreeBSD.org (Postfix) with ESMTP id 957FD43D49 for ; Mon, 27 Jun 2005 21:17:36 +0000 (GMT) (envelope-from samuel.pierson@gmail.com) Received: by wproxy.gmail.com with SMTP id 57so484154wri for ; Mon, 27 Jun 2005 14:17:36 -0700 (PDT) DomainKey-Signature: a=rsa-sha1; q=dns; c=nofws; s=beta; d=gmail.com; h=received:message-id:date:from:reply-to:to:subject:mime-version:content-type:content-transfer-encoding:content-disposition; b=Jf29B6Fi9Y7tuG6TwKCGwPvxU8YtAfCW48AAobYmNsOiS5bTQ91HLnLDTQnXH6eXwgtm01uxaOQBvQ0rEnQ4OVi1HV0v/H5lTbDtGSmM2a71Myj0tacq7mD5k4yp1GgEJzKhYAjXIgF23+bIpKD/Shf2eaNs4PCmz7gnO52ZkPw= Received: by 10.54.67.3 with SMTP id p3mr3743148wra; Mon, 27 Jun 2005 14:17:35 -0700 (PDT) Received: by 10.54.144.1 with HTTP; Mon, 27 Jun 2005 14:17:34 -0700 (PDT) Message-ID: Date: Mon, 27 Jun 2005 16:17:34 -0500 From: Sam Pierson To: FreeBSD Hackers Mime-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: quoted-printable Content-Disposition: inline Subject: Accurate/Fine-grained timing of latency in atheros drivers X-BeenThere: freebsd-hackers@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list Reply-To: Sam Pierson List-Id: Technical Discussions relating to FreeBSD List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 27 Jun 2005 21:17:37 -0000 Hey guys, In a current project, I need to find out exactly how long it takes to send a 802.11 packet and how much time is spent in the following stages: send time - time spent constructing message, including context switches and other delays and the time it takes to transfer the message to the network card. access time - delay which we experience waiting to access the transmitting channel. Normally this would include the RTS and CTS queuing signals, but for this application, I have to disable them. Is it possible that no t= ime is spent waiting here, if I have disabled the whole CSMA scheme on the hardware level? propagation time - how long it takes to get to the receiver, once it has le= ft our card receive time - how long it takes for the receiving network card to get the= =20 message and notify the host that it has something to read. Am I going to have to put in hardware interrupts to time these events or=20 are such tools already available? =20 -Sam From owner-freebsd-hackers@FreeBSD.ORG Mon Jun 27 21:28:21 2005 Return-Path: X-Original-To: hackers@freebsd.org 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 9570C16A41C for ; Mon, 27 Jun 2005 21:28:21 +0000 (GMT) (envelope-from saturnero@freesbie.org) Received: from jail1-fbsd4.consiagnet.it (jail1-fbsd4.consiagnet.it [83.149.128.151]) by mx1.FreeBSD.org (Postfix) with ESMTP id 44C9E43D48 for ; Mon, 27 Jun 2005 21:28:20 +0000 (GMT) (envelope-from saturnero@freesbie.org) Received: by jail1-fbsd4.consiagnet.it (Postfix, from userid 1000) id 4A15357B5; Mon, 27 Jun 2005 23:37:26 +0200 (CEST) Date: Mon, 27 Jun 2005 23:37:26 +0200 From: Dario Freni To: hackers@freebsd.org Message-ID: <20050627213726.GE19764@cvs.freesbie.org> References: <002501c57b45$3d72c9e0$0b2a15ac@SMILEY> Mime-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha1; protocol="application/pgp-signature"; boundary="WfZ7S8PLGjBY9Voh" Content-Disposition: inline In-Reply-To: <002501c57b45$3d72c9e0$0b2a15ac@SMILEY> X-Operating-System: FreeBSD 4.10-STABLE (What else? ;) X-Sent-From: cvs.freesbie.org X-GPG-Key: http://www.saturnero.net/saturnero.asc X-GPG-Fingerprint: 9C23 3CED 32A4 1E6E 7F83 042F CA68 BBD8 8892 872B User-Agent: Mutt/1.5.9i Cc: Subject: Re: How to disable at-boot configuration of a network interface but permit manual use of rc.d? X-BeenThere: freebsd-hackers@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: Technical Discussions relating to FreeBSD List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 27 Jun 2005 21:28:21 -0000 --WfZ7S8PLGjBY9Voh Content-Type: text/plain; charset=us-ascii Content-Disposition: inline Content-Transfer-Encoding: quoted-printable nduja# grep ifconfig_ed1 /etc/rc.conf #ifconfig_ed1=3D"DHCP" nduja# sh /etc/rc.d/dhclient start nduja# setenv ifconfig_ed1 DHCP nduja# sh /etc/rc.d/dhclient start Starting dhclient. ed1: flags=3D108843 mtu 1500 inet6 fe80::250:baff:fe7a:a9bd%ed1 prefixlen 64 scopeid 0x3 inet 37.0.203.130 netmask 0xffffff00 broadcast 37.0.203.255 ether 00:50:ba:7a:a9:bd media: Ethernet 10baseT/UTP status: active nduja# Regards, Dario --=20 Dario Freni (saturnero@freesbie.org) FreeSBIE developer (http://www.freesbie.org) GPG Public key at http://www.saturnero.net/saturnero.asc --WfZ7S8PLGjBY9Voh Content-Type: application/pgp-signature Content-Disposition: inline -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.4.0 (FreeBSD) iD8DBQFCwHGVymi72IiShysRAmHRAKCx88zcan/g5NEB+0GPT2YXsDz2NwCfQ4mw R+xVdfy2ee6WuUrWQOHp8UE= =yU6Y -----END PGP SIGNATURE----- --WfZ7S8PLGjBY9Voh-- From owner-freebsd-hackers@FreeBSD.ORG Tue Jun 28 01:18:09 2005 Return-Path: X-Original-To: freebsd-hackers@freebsd.org 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 2747A16A41C for ; Tue, 28 Jun 2005 01:18:09 +0000 (GMT) (envelope-from julian@elischer.org) Received: from postoffice.vicor-nb.com (www.vicor.com [12.155.182.151]) by mx1.FreeBSD.org (Postfix) with ESMTP id 14F8F44173 for ; Tue, 28 Jun 2005 00:38:34 +0000 (GMT) (envelope-from julian@elischer.org) Received: from localhost (localhost [127.0.0.1]) by postoffice.vicor-nb.com (Postfix) with ESMTP id A1CE14CE94E; Mon, 27 Jun 2005 17:38:28 -0700 (PDT) Received: from postoffice.vicor-nb.com ([127.0.0.1]) by localhost (postoffice.vicor-nb.com [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id 26791-09; Mon, 27 Jun 2005 17:38:28 -0700 (PDT) Received: from bigwoop.vicor-nb.com (bigwoop.vicor-nb.com [208.206.78.2]) by postoffice.vicor-nb.com (Postfix) with ESMTP id 224754CE931; Mon, 27 Jun 2005 17:38:28 -0700 (PDT) Received: from [208.206.78.97] (julian.vicor-nb.com [208.206.78.97]) by bigwoop.vicor-nb.com (Postfix) with ESMTP id D614B7A403; Mon, 27 Jun 2005 17:38:27 -0700 (PDT) Message-ID: <42C09C33.2050403@elischer.org> Date: Mon, 27 Jun 2005 17:39:15 -0700 From: Julian Elischer User-Agent: Mozilla/5.0 (X11; U; FreeBSD i386; en-US; rv:1.7.7) Gecko/20050423 X-Accept-Language: en, hu MIME-Version: 1.0 To: cole@opteqint.net References: <20050627160635.9kkhi57rk88w848k@mail.opteqint.net> In-Reply-To: <20050627160635.9kkhi57rk88w848k@mail.opteqint.net> Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit X-Virus-Scanned: by amavisd-new at postoffice.vicor.com Cc: freebsd-hackers@freebsd.org Subject: Re: Packet interception / Mangling X-BeenThere: freebsd-hackers@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: Technical Discussions relating to FreeBSD List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 28 Jun 2005 01:18:09 -0000 cole@opteqint.net wrote: >Hi > >I wanted to know if there are any libraries similar to pcap to intercept >packets/mangle packets. > > how about pcap? :-) There are also two other mechinisms.. "divert sockets" (man divert) which is used in conjuction with teh ipfw packet fileter and netgraph (man 4 netgraph, man ngctl, man ng_socket, man ng_ether) which can do a lot of interesting thins. >What im trying to do specifically is like link compression, and I would then >need to check if the packet is then compressed and decompress, and so forth and >so on. > >I would like to avoid having to use a ipfw divert to a port, and specifically >check all traffic to the box using a library function or some kind of hook into >the kernel. > >The FreeBSD version I will be using is 4.9 or 4.11, and would like to know if >there are any such routines available, and whether it could be a userland >daemon, or if i am going to need to write a kernel loadable module? > >If anyone has any ideas or suggestions, or knows anything about this, it would >be a great help. > >Regards >/Cole > > >_______________________________________________ >freebsd-hackers@freebsd.org mailing list >http://lists.freebsd.org/mailman/listinfo/freebsd-hackers >To unsubscribe, send any mail to "freebsd-hackers-unsubscribe@freebsd.org" > > From owner-freebsd-hackers@FreeBSD.ORG Tue Jun 28 09:22:33 2005 Return-Path: X-Original-To: freebsd-hackers@freebsd.org 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 B183516A41C for ; Tue, 28 Jun 2005 09:22:33 +0000 (GMT) (envelope-from cole@opteqint.net) Received: from kalypso.opteqint.net (kalypso.opteqint.net [160.124.112.28]) by mx1.FreeBSD.org (Postfix) with ESMTP id D6B1C43D1D for ; Tue, 28 Jun 2005 09:22:32 +0000 (GMT) (envelope-from cole@opteqint.net) Received: from 196-47-3-224.access.uunet.co.za ([196.47.3.224] helo=deadmind) by kalypso.opteqint.net with esmtpsa (TLSv1:RC4-MD5:128) (Exim 4.43 (FreeBSD)) id 1DnCIQ-000JJ9-0y; Tue, 28 Jun 2005 11:22:30 +0200 Message-ID: <001301c57bc3$5608bea0$4206000a@deadmind> From: "Cole" To: "Julian Elischer" References: <20050627160635.9kkhi57rk88w848k@mail.opteqint.net> <42C09C33.2050403@elischer.org> Date: Tue, 28 Jun 2005 11:25:27 +0200 MIME-Version: 1.0 Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: 7bit X-Priority: 3 X-MSMail-Priority: Normal X-Mailer: Microsoft Outlook Express 5.50.4922.1500 X-MIMEOLE: Produced By Microsoft MimeOLE V5.50.4939.300 X-Spam-Score: -100.0 (---------------------------------------------------) X-Spam-Report: Spam detection software, running on the system "kalypso.opteqint.net", has identified this incoming email as possible spam. The original message has been attached to this so you can view it (if it isn't spam) or label similar future email. If you have any questions, see the administrator of that system for details. Content preview: Hi Isnt pcap meant to be non-intrusive, as in it only gets sent a copy of the packet from the kernel space to userspace? And doesnt actually intercept anything? Thanks for the other suggestions, but im trying to stay away from divert sockets, a friend also suggested libdnet, so I'll look into that today, but if you have any further ideas, please let me know, thanks [...] Content analysis details: (-100.0 points, 4.2 required) pts rule name description ---- ---------------------- -------------------------------------------------- -100 USER_IN_WHITELIST From: address is in the user's white-list Cc: freebsd-hackers@freebsd.org Subject: Re: Packet interception / Mangling X-BeenThere: freebsd-hackers@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list Reply-To: Cole List-Id: Technical Discussions relating to FreeBSD List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 28 Jun 2005 09:22:34 -0000 Hi Isnt pcap meant to be non-intrusive, as in it only gets sent a copy of the packet from the kernel space to userspace? And doesnt actually intercept anything? Thanks for the other suggestions, but im trying to stay away from divert sockets, a friend also suggested libdnet, so I'll look into that today, but if you have any further ideas, please let me know, thanks Regards /Cole ----- Original Message ----- From: "Julian Elischer" To: Cc: Sent: Tuesday, June 28, 2005 2:39 AM Subject: Re: Packet interception / Mangling > > > cole@opteqint.net wrote: > > >Hi > > > >I wanted to know if there are any libraries similar to pcap to intercept > >packets/mangle packets. > > > > > > how about pcap? :-) > > There are also two other mechinisms.. > "divert sockets" (man divert) which is used in conjuction with teh ipfw > packet fileter > and netgraph (man 4 netgraph, man ngctl, man ng_socket, man ng_ether) > which can do a lot of interesting thins. > > >What im trying to do specifically is like link compression, and I would then > >need to check if the packet is then compressed and decompress, and so forth and > >so on. > > > >I would like to avoid having to use a ipfw divert to a port, and specifically > >check all traffic to the box using a library function or some kind of hook into > >the kernel. > > > >The FreeBSD version I will be using is 4.9 or 4.11, and would like to know if > >there are any such routines available, and whether it could be a userland > >daemon, or if i am going to need to write a kernel loadable module? > > > >If anyone has any ideas or suggestions, or knows anything about this, it would > >be a great help. > > > >Regards > >/Cole > > > > > >_______________________________________________ > >freebsd-hackers@freebsd.org mailing list > >http://lists.freebsd.org/mailman/listinfo/freebsd-hackers > >To unsubscribe, send any mail to "freebsd-hackers-unsubscribe@freebsd.org" > > > > From owner-freebsd-hackers@FreeBSD.ORG Mon Jun 27 22:12:10 2005 Return-Path: X-Original-To: freebsd-hackers@freebsd.org 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 D509716A41C for ; Mon, 27 Jun 2005 22:12:10 +0000 (GMT) (envelope-from asimex@gmx.net) Received: from mail.gmx.net (pop.gmx.de [213.165.64.20]) by mx1.FreeBSD.org (Postfix) with SMTP id 72E4243D48 for ; Mon, 27 Jun 2005 22:12:10 +0000 (GMT) (envelope-from asimex@gmx.net) Received: (qmail 19500 invoked by uid 0); 27 Jun 2005 22:12:09 -0000 Received: from 217.70.211.11 by www79.gmx.net with HTTP; Tue, 28 Jun 2005 00:12:09 +0200 (MEST) Date: Tue, 28 Jun 2005 00:12:09 +0200 (MEST) From: "Andreas Feid" To: freebsd-hackers@freebsd.org MIME-Version: 1.0 X-Priority: 3 (Normal) X-Authenticated: #138425 Message-ID: <23948.1119910329@www79.gmx.net> X-Mailer: WWW-Mail 1.6 (Global Message Exchange) X-Flags: 0001 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit X-Mailman-Approved-At: Tue, 28 Jun 2005 13:08:03 +0000 Cc: asimex@gmx.net Subject: ISCSI Beta X-BeenThere: freebsd-hackers@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: Technical Discussions relating to FreeBSD List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 27 Jun 2005 22:12:11 -0000 All, there was a posting from Danny Braniss in February with title iSCSI initiator driver beta version, testers wanted can someone please point me to the source. I would be very interessted in running some tests. -Andreas -- Weitersagen: GMX DSL-Flatrates mit Tempo-Garantie! Ab 4,99 Euro/Monat: http://www.gmx.net/de/go/dsl From owner-freebsd-hackers@FreeBSD.ORG Mon Jun 27 22:48:47 2005 Return-Path: X-Original-To: hackers@freebsd.org 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 4CD0C16A42B for ; Mon, 27 Jun 2005 22:48:47 +0000 (GMT) (envelope-from mwm-dated-1120776563.40f9da@mired.org) Received: from delight.idiom.com (delight.idiom.com [216.240.32.16]) by mx1.FreeBSD.org (Postfix) with ESMTP id 8F4B643D70 for ; Mon, 27 Jun 2005 22:48:45 +0000 (GMT) (envelope-from mwm-dated-1120776563.40f9da@mired.org) Received: from idiom.com (idiom.com [216.240.32.1]) by delight.idiom.com (Postfix) with ESMTP id 99C201F8E84 for ; Mon, 27 Jun 2005 15:48:44 -0700 (PDT) Received: from mired.org (mwm@idiom [216.240.32.1]) by idiom.com (8.12.11/8.12.11) with SMTP id j5RMmgwA030139 for ; Mon, 27 Jun 2005 15:48:44 -0700 (PDT) (envelope-from mwm-dated-1120776563.40f9da@mired.org) Received: (qmail 85448 invoked by uid 1001); 27 Jun 2005 22:49:23 -0000 Received: by bhuda.mired.org (tmda-sendmail, from uid 1001); Mon, 27 Jun 2005 18:49:23 -0400 (EDT) MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit Message-ID: <17088.33395.356858.72172@bhuda.mired.org> Date: Mon, 27 Jun 2005 18:49:23 -0400 To: hackers@freebsd.org X-Mailer: VM 7.17 under 21.4 (patch 17) "Jumbo Shrimp" XEmacs Lucid X-Primary-Address: mwm@mired.org X-face: "5Mnwy%?j>IIV\)A=):rjWL~NB2aH[}Yq8Z=u~vJ`"(,&SiLvbbz2W`; h9L,Yg`+vb1>RG% *h+%X^n0EZd>TM8_IB;a8F?(Fb"lw'IgCoyM.[Lg#r\ From: Mike Meyer X-Delivery-Agent: TMDA/1.0.3 (Seattle Slew) X-Mailman-Approved-At: Tue, 28 Jun 2005 13:08:03 +0000 Cc: Subject: /boot/loader bug? X-BeenThere: freebsd-hackers@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: Technical Discussions relating to FreeBSD List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 27 Jun 2005 22:48:47 -0000 As reported here (I hope - the moderator got the message) and in -questions, I have a motherboard that installs just fine, but gets a "Can't work out which disk we are booting fromm" message when the installed os boots. Hacking boot/i386/loader/main.c to wire the proper values into new_currdev fixed the problem. At this point, I'm considering filing a bug report - but I'm not sure where the bug is. Is this a /boot/loader bug, and it should have known what was going on? Is this a BIOS bug, in that it reported the wrong thing to /boot/loader? Is it a bug in one of the earlier boot stages? Anyone got any opinions on this? Any suggestions for things to look at to determine what component is actually buggy? Thanks, http://www.mired.org/consulting.html Independent Network/Unix/Perforce consultant, email for more information. From owner-freebsd-hackers@FreeBSD.ORG Tue Jun 28 13:11:34 2005 Return-Path: X-Original-To: freebsd-hackers@freebsd.org 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 32ED716A41C for ; Tue, 28 Jun 2005 13:11:34 +0000 (GMT) (envelope-from NKoch@demig.de) Received: from server.absolute-media.de (server.absolute-media.de [213.239.231.9]) by mx1.FreeBSD.org (Postfix) with ESMTP id B7E9343D1D for ; Tue, 28 Jun 2005 13:11:33 +0000 (GMT) (envelope-from NKoch@demig.de) Received: from localhost (unknown [127.0.0.1]) by server.absolute-media.de (Postfix) with ESMTP id 77F8787BEC for ; Tue, 28 Jun 2005 15:11:30 +0200 (CEST) Received: from server.absolute-media.de ([127.0.0.1]) by localhost (server [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id 18014-02 for ; Tue, 28 Jun 2005 15:11:25 +0200 (CEST) Received: from firewall.demig (p5083BE71.dip0.t-ipconnect.de [80.131.190.113]) by server.absolute-media.de (Postfix) with ESMTP id A57B287BE0 for ; Tue, 28 Jun 2005 15:11:25 +0200 (CEST) Received: from ws-ew-3 (ws-ew-3.w2kdemig [192.168.1.72]) by firewall.demig (8.13.4/8.13.1) with SMTP id j5SD8CIY075219 for ; Tue, 28 Jun 2005 15:08:12 +0200 (CEST) (envelope-from NKoch@demig.de) From: "Norbert Koch" To: "Freebsd-Hackers@Freebsd. Org" Date: Tue, 28 Jun 2005 15:08:09 +0200 Message-ID: <000901c57be2$6e97e1c0$4801a8c0@ws-ew-3.W2KDEMIG> MIME-Version: 1.0 Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: 7bit X-Priority: 3 (Normal) X-MSMail-Priority: Normal X-Mailer: Microsoft Outlook 8.5, Build 4.71.2173.0 Importance: Normal X-MimeOLE: Produced By Microsoft MimeOLE V4.72.2120.0 X-Virus-Scanned: by amavisd-new X-Virus-Scanned: by amavisd-new at absolute-media.de Subject: pxe boot failure X-BeenThere: freebsd-hackers@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: Technical Discussions relating to FreeBSD List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 28 Jun 2005 13:11:34 -0000 Hello, I'm trying to get pxeboot running without any success so far. I get 'BTX halted' after a register dump showing an int 6. I read almost anything, I could find about that problem. I tried with/without LOADER_TFTP_SUPPORT, I uncommented those delay() lines in pxe.c and enlarged the delays. I even doubled some of the internal buffers. The crash is always at different locations. The last message usually is "pxe_open: gateway ip: 10.47.11.1". Tcpdump shows no problems. So am I just having a buggy boot prom? My board has an intel 82559er chip and I was told by the board's manufacturer, that linux pxeboot does work fine, which not really helps. They have no newer bios update and know nothing about pxe problems. My environment is FreeBSD 4.11 with latest ISC dhcpd. Here are my settings: /usr/local/dhcpd.conf: default-lease-time 600; max-lease-time 7200; ddns-update-style ad-hoc; log-facility local7; subnet 10.47.11.0 netmask 255.255.255.0 { range dynamic-bootp 10.47.11.10 10.47.11.99; option routers 10.47.11.1; filename "pxeboot"; next-server 10.47.11.1; option root-path "10.47.11.1:/usr/local/diskless_root"; } /etc/inetd.conf (for LOADER_TFTP_SUPPORT=yes): tftp dgram udp wait root /usr/libexec/tftpd tftpd -l -s /usr/local/diskless_root /etc/exports: /usr -ro -maproot=0 -alldirs -network 10.47.11.00 -mask 255.255.255.0 BTW, booting via etherboot disk works. I just have to replace "pxeboot" with "kernel" in dhcpd.conf. Any hints? Thank you, Norbert From owner-freebsd-hackers@FreeBSD.ORG Tue Jun 28 13:25:28 2005 Return-Path: X-Original-To: freebsd-hackers@freebsd.org 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 7C54616A41F for ; Tue, 28 Jun 2005 13:25:28 +0000 (GMT) (envelope-from asimex@gmx.net) Received: from mail.gmx.net (mail.gmx.net [213.165.64.20]) by mx1.FreeBSD.org (Postfix) with SMTP id 1A68943D1F for ; Tue, 28 Jun 2005 13:25:27 +0000 (GMT) (envelope-from asimex@gmx.net) Received: (qmail 12735 invoked by uid 0); 28 Jun 2005 13:25:26 -0000 Received: from 217.70.211.11 by www18.gmx.net with HTTP; Tue, 28 Jun 2005 15:25:26 +0200 (MEST) Date: Tue, 28 Jun 2005 15:25:26 +0200 (MEST) From: "Andreas Feid" To: freebsd-hackers@freebsd.org MIME-Version: 1.0 X-Priority: 3 (Normal) X-Authenticated: #138425 Message-ID: <27984.1119965126@www18.gmx.net> X-Mailer: WWW-Mail 1.6 (Global Message Exchange) X-Flags: 0001 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit X-Mailman-Approved-At: Tue, 28 Jun 2005 13:35:15 +0000 Cc: asimex@gmx.net Subject: ISCSI Beta X-BeenThere: freebsd-hackers@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: Technical Discussions relating to FreeBSD List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 28 Jun 2005 13:25:28 -0000 All, there was a posting from Danny Braniss in February with title iSCSI initiator driver beta version, testers wanted can someone please point me to the source. I would be very interessted in running some tests. -Andreas -- 5 GB Mailbox, 50 FreeSMS http://www.gmx.net/de/go/promail +++ GMX - die erste Adresse für Mail, Message, More +++ From owner-freebsd-hackers@FreeBSD.ORG Tue Jun 28 18:14:47 2005 Return-Path: X-Original-To: freebsd-hackers@freebsd.org 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 885F116A424 for ; Tue, 28 Jun 2005 18:14:47 +0000 (GMT) (envelope-from jhb@FreeBSD.org) Received: from mv.twc.weather.com (mv.twc.weather.com [65.212.71.225]) by mx1.FreeBSD.org (Postfix) with ESMTP id 2DAF143D58 for ; Tue, 28 Jun 2005 18:14:46 +0000 (GMT) (envelope-from jhb@FreeBSD.org) Received: from [10.50.41.231] (Not Verified[65.202.103.25]) by mv.twc.weather.com with NetIQ MailMarshal (v6, 0, 3, 8) id ; Tue, 28 Jun 2005 14:28:30 -0400 From: John Baldwin To: freebsd-hackers@freebsd.org Date: Tue, 28 Jun 2005 13:15:52 -0400 User-Agent: KMail/1.8 References: <17088.33395.356858.72172@bhuda.mired.org> In-Reply-To: <17088.33395.356858.72172@bhuda.mired.org> MIME-Version: 1.0 Content-Disposition: inline Message-Id: <200506281315.53321.jhb@FreeBSD.org> Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: 7bit Cc: Mike Meyer Subject: Re: /boot/loader bug? X-BeenThere: freebsd-hackers@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: Technical Discussions relating to FreeBSD List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 28 Jun 2005 18:14:47 -0000 On Monday 27 June 2005 06:49 pm, Mike Meyer wrote: > As reported here (I hope - the moderator got the message) and in > -questions, I have a motherboard that installs just fine, but gets a > "Can't work out which disk we are booting fromm" message when the > installed os boots. > > Hacking boot/i386/loader/main.c to wire the proper values into > new_currdev fixed the problem. At this point, I'm considering filing a > bug report - but I'm not sure where the bug is. > > Is this a /boot/loader bug, and it should have known what was going > on? Is this a BIOS bug, in that it reported the wrong thing to > /boot/loader? Is it a bug in one of the earlier boot stages? > > Anyone got any opinions on this? Any suggestions for things to look at > to determine what component is actually buggy? Your BIOS most likely. The output of 'lsdev' from your loader prompt might be helpful though. Also, what did you have to wire new_currdev to? -- John Baldwin <>< http://www.FreeBSD.org/~jhb/ "Power Users Use the Power to Serve" = http://www.FreeBSD.org From owner-freebsd-hackers@FreeBSD.ORG Tue Jun 28 19:35:32 2005 Return-Path: X-Original-To: freebsd-hackers@freebsd.org 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 8BD8E16A41C for ; Tue, 28 Jun 2005 19:35:32 +0000 (GMT) (envelope-from julian@elischer.org) Received: from postoffice.vicor-nb.com (www.vicor.com [12.155.182.151]) by mx1.FreeBSD.org (Postfix) with ESMTP id 547FA43D1D for ; Tue, 28 Jun 2005 19:35:32 +0000 (GMT) (envelope-from julian@elischer.org) Received: from localhost (localhost [127.0.0.1]) by postoffice.vicor-nb.com (Postfix) with ESMTP id 61F844CE969; Tue, 28 Jun 2005 12:35:32 -0700 (PDT) Received: from postoffice.vicor-nb.com ([127.0.0.1]) by localhost (postoffice.vicor-nb.com [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id 61759-02; Tue, 28 Jun 2005 12:35:31 -0700 (PDT) Received: from bigwoop.vicor-nb.com (bigwoop.vicor-nb.com [208.206.78.2]) by postoffice.vicor-nb.com (Postfix) with ESMTP id BC2004CE959; Tue, 28 Jun 2005 12:35:31 -0700 (PDT) Received: from [208.206.78.97] (julian.vicor-nb.com [208.206.78.97]) by bigwoop.vicor-nb.com (Postfix) with ESMTP id 75FE37A403; Tue, 28 Jun 2005 12:35:31 -0700 (PDT) Message-ID: <42C1A6B2.8070607@elischer.org> Date: Tue, 28 Jun 2005 12:36:18 -0700 From: Julian Elischer User-Agent: Mozilla/5.0 (X11; U; FreeBSD i386; en-US; rv:1.7.7) Gecko/20050423 X-Accept-Language: en, hu MIME-Version: 1.0 To: Cole References: <20050627160635.9kkhi57rk88w848k@mail.opteqint.net> <42C09C33.2050403@elischer.org> <001301c57bc3$5608bea0$4206000a@deadmind> In-Reply-To: <001301c57bc3$5608bea0$4206000a@deadmind> Content-Type: text/plain; charset=us-ascii; format=flowed Content-Transfer-Encoding: 7bit X-Virus-Scanned: by amavisd-new at postoffice.vicor.com Cc: freebsd-hackers@freebsd.org Subject: Re: Packet interception / Mangling X-BeenThere: freebsd-hackers@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: Technical Discussions relating to FreeBSD List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 28 Jun 2005 19:35:32 -0000 Cole wrote: >Hi > >Isnt pcap meant to be non-intrusive, as in it only gets sent a copy of the packet from the kernel space to userspace? And doesnt >actually intercept anything? > >Thanks for the other suggestions, but im trying to stay away from divert sockets, > Why? that's what they are for! It's like saying "I know I asked for a tool to remove this nut from the bolt but I'm trying to stay away from using wrenches". netgraph also allows you to do this in an efficient manner. > a friend also suggested libdnet, so I'll look into >that today, but if you have any further ideas, please let me know, thanks > >Regards >/Cole > >----- Original Message ----- >From: "Julian Elischer" >To: >Cc: >Sent: Tuesday, June 28, 2005 2:39 AM >Subject: Re: Packet interception / Mangling > > > > >>cole@opteqint.net wrote: >> >> >> >>>Hi >>> >>>I wanted to know if there are any libraries similar to pcap to intercept >>>packets/mangle packets. >>> >>> >>> >>> >>how about pcap? :-) >> >>There are also two other mechinisms.. >>"divert sockets" (man divert) which is used in conjuction with teh ipfw >>packet fileter >>and netgraph (man 4 netgraph, man ngctl, man ng_socket, man ng_ether) >>which can do a lot of interesting thins. >> >> >> >>>What im trying to do specifically is like link compression, and I would then >>>need to check if the packet is then compressed and decompress, and so forth and >>>so on. >>> >>>I would like to avoid having to use a ipfw divert to a port, and specifically >>>check all traffic to the box using a library function or some kind of hook into >>>the kernel. >>> >>>The FreeBSD version I will be using is 4.9 or 4.11, and would like to know if >>>there are any such routines available, and whether it could be a userland >>>daemon, or if i am going to need to write a kernel loadable module? >>> >>>If anyone has any ideas or suggestions, or knows anything about this, it would >>>be a great help. >>> >>>Regards >>>/Cole >>> >>> >>>_______________________________________________ >>>freebsd-hackers@freebsd.org mailing list >>>http://lists.freebsd.org/mailman/listinfo/freebsd-hackers >>>To unsubscribe, send any mail to "freebsd-hackers-unsubscribe@freebsd.org" >>> >>> >>> >>> From owner-freebsd-hackers@FreeBSD.ORG Tue Jun 28 19:50:13 2005 Return-Path: X-Original-To: hackers@FreeBSD.org 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 A1BEA16A421 for ; Tue, 28 Jun 2005 19:50:13 +0000 (GMT) (envelope-from jhb@FreeBSD.org) Received: from mv.twc.weather.com (mv.twc.weather.com [65.212.71.225]) by mx1.FreeBSD.org (Postfix) with ESMTP id 42E2043D53 for ; Tue, 28 Jun 2005 19:50:13 +0000 (GMT) (envelope-from jhb@FreeBSD.org) Received: from [10.50.41.231] (Not Verified[65.202.103.25]) by mv.twc.weather.com with NetIQ MailMarshal (v6, 0, 3, 8) id ; Tue, 28 Jun 2005 16:03:57 -0400 From: John Baldwin To: hackers@FreeBSD.org User-Agent: KMail/1.8 MIME-Version: 1.0 Content-Disposition: inline Date: Tue, 28 Jun 2005 15:50:11 -0400 Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: 7bit Message-Id: <200506281550.11578.jhb@FreeBSD.org> Cc: Subject: Attention Mike Meyer X-BeenThere: freebsd-hackers@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: Technical Discussions relating to FreeBSD List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 28 Jun 2005 19:50:14 -0000 Mike, Your e-mail flapper (flagger?) doesn't work, so you aren't getting my replies regarding your /boot/loader problem. If you fix your e-mail so that it functions, perhaps I will be able to help you, but until then... -- John Baldwin <>< http://www.FreeBSD.org/~jhb/ "Power Users Use the Power to Serve" = http://www.FreeBSD.org From owner-freebsd-hackers@FreeBSD.ORG Tue Jun 28 23:58:32 2005 Return-Path: X-Original-To: freebsd-hackers@freebsd.org 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 A3F7116A41F for ; Tue, 28 Jun 2005 23:58:32 +0000 (GMT) (envelope-from fbsd.hackers@gmail.com) Received: from rproxy.gmail.com (rproxy.gmail.com [64.233.170.197]) by mx1.FreeBSD.org (Postfix) with ESMTP id 4CEED43D48 for ; Tue, 28 Jun 2005 23:58:32 +0000 (GMT) (envelope-from fbsd.hackers@gmail.com) Received: by rproxy.gmail.com with SMTP id i8so1178739rne for ; Tue, 28 Jun 2005 16:58:31 -0700 (PDT) DomainKey-Signature: a=rsa-sha1; q=dns; c=nofws; s=beta; d=gmail.com; h=received:message-id:date:from:reply-to:to:subject:cc:in-reply-to:mime-version:content-type:content-transfer-encoding:content-disposition:references; b=JboRe0sip/+sH608fOUYdG0OZDVugoKKcen/BP0uo1TN9X6ZgnoMTyRWE3nif8YEJlqShpWD6T0mtsDvstslvQx52WtHvaLnhgNiMmTAOC0ob6q/CuWnzja9u8lV4KBchgj+Ev7lHLhYJptFJu7sMPxfe0G74zIhouq7QAsw1q4= Received: by 10.38.78.53 with SMTP id a53mr3523314rnb; Tue, 28 Jun 2005 16:58:31 -0700 (PDT) Received: by 10.38.11.46 with HTTP; Tue, 28 Jun 2005 16:58:31 -0700 (PDT) Message-ID: Date: Tue, 28 Jun 2005 19:58:31 -0400 From: Pablo Mora To: John Baldwin In-Reply-To: <200506271318.36748.jhb@FreeBSD.org> Mime-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: quoted-printable Content-Disposition: inline References: <200506271318.36748.jhb@FreeBSD.org> Cc: freebsd-hackers@freebsd.org Subject: Re: problem handling POSIX thread on FreeBSD X-BeenThere: freebsd-hackers@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list Reply-To: Pablo Mora List-Id: Technical Discussions relating to FreeBSD List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 28 Jun 2005 23:58:32 -0000 Ok, I understand, but by being threads POSIX should be executed of the same one in any type of S.OR? thanks to all --=20 Concepci=F3n, Chile. From owner-freebsd-hackers@FreeBSD.ORG Tue Jun 28 23:59:32 2005 Return-Path: X-Original-To: freebsd-hackers@freebsd.org 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 13ED516A41C for ; Tue, 28 Jun 2005 23:59:32 +0000 (GMT) (envelope-from fbsd.hackers@gmail.com) Received: from rproxy.gmail.com (rproxy.gmail.com [64.233.170.197]) by mx1.FreeBSD.org (Postfix) with ESMTP id B92EC43D48 for ; Tue, 28 Jun 2005 23:59:31 +0000 (GMT) (envelope-from fbsd.hackers@gmail.com) Received: by rproxy.gmail.com with SMTP id i8so1178834rne for ; Tue, 28 Jun 2005 16:59:31 -0700 (PDT) DomainKey-Signature: a=rsa-sha1; q=dns; c=nofws; s=beta; d=gmail.com; h=received:message-id:date:from:reply-to:to:subject:cc:in-reply-to:mime-version:content-type:content-transfer-encoding:content-disposition:references; b=fGAvL9/T1hfB+6eIRTFRAZVyD/KuKg0slWINJhCH89oViBvZjZpm/f8a08jBpa/7DUZdKaTQr9mzdu04CJz7xXnZQYZUNRTlknHbcCNvKsyanI+w+Q61OzQYuDoSPQJce9AsZEgUXRP8iPtrr5goPGUexZfvs+jGIoFkSPe/QLA= Received: by 10.38.78.56 with SMTP id a56mr3527405rnb; Tue, 28 Jun 2005 16:59:31 -0700 (PDT) Received: by 10.38.11.46 with HTTP; Tue, 28 Jun 2005 16:59:31 -0700 (PDT) Message-ID: Date: Tue, 28 Jun 2005 19:59:31 -0400 From: Pablo Mora To: John Baldwin In-Reply-To: Mime-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: quoted-printable Content-Disposition: inline References: <200506271318.36748.jhb@FreeBSD.org> Cc: freebsd-hackers@freebsd.org Subject: Re: problem handling POSIX thread on FreeBSD X-BeenThere: freebsd-hackers@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list Reply-To: Pablo Mora List-Id: Technical Discussions relating to FreeBSD List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 28 Jun 2005 23:59:32 -0000 S.O , sorry --=20 Concepci=F3n, Chile. From owner-freebsd-hackers@FreeBSD.ORG Wed Jun 29 08:01:36 2005 Return-Path: X-Original-To: freebsd-hackers@freebsd.org 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 D8B3D16A41C for ; Wed, 29 Jun 2005 08:01:36 +0000 (GMT) (envelope-from NKoch@demig.de) Received: from server.absolute-media.de (server.absolute-media.de [213.239.231.9]) by mx1.FreeBSD.org (Postfix) with ESMTP id 6357543D55 for ; Wed, 29 Jun 2005 08:01:35 +0000 (GMT) (envelope-from NKoch@demig.de) Received: from localhost (unknown [127.0.0.1]) by server.absolute-media.de (Postfix) with ESMTP id 6552A66061 for ; Wed, 29 Jun 2005 10:01:34 +0200 (CEST) Received: from server.absolute-media.de ([127.0.0.1]) by localhost (server [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id 01788-01 for ; Wed, 29 Jun 2005 10:01:29 +0200 (CEST) Received: from firewall.demig (p5083937F.dip0.t-ipconnect.de [80.131.147.127]) by server.absolute-media.de (Postfix) with ESMTP id 8325280396 for ; Wed, 29 Jun 2005 10:01:29 +0200 (CEST) Received: from ws-ew-3 (ws-ew-3.w2kdemig [192.168.1.72]) by firewall.demig (8.13.4/8.13.1) with SMTP id j5T7vF4e026012 for ; Wed, 29 Jun 2005 09:57:15 +0200 (CEST) (envelope-from NKoch@demig.de) From: "Norbert Koch" To: "Freebsd-Hackers@Freebsd. Org" Date: Wed, 29 Jun 2005 09:57:11 +0200 Message-ID: <000001c57c80$27dbc6e0$4801a8c0@ws-ew-3.W2KDEMIG> MIME-Version: 1.0 Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: 7bit X-Priority: 3 (Normal) X-MSMail-Priority: Normal X-Mailer: Microsoft Outlook 8.5, Build 4.71.2173.0 Importance: Normal X-MimeOLE: Produced By Microsoft MimeOLE V4.72.2120.0 X-Virus-Scanned: by amavisd-new X-Virus-Scanned: by amavisd-new at absolute-media.de Subject: Posix threads: CLOCK_REALTIME/CLOCK_MONOTONIC X-BeenThere: freebsd-hackers@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: Technical Discussions relating to FreeBSD List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 29 Jun 2005 08:01:37 -0000 Hello. I am working on a multi-threaded application which may call settimeofday() and therefore may have serious problems with timing calculations. In my applications I calclulate time differences using clock_gettime(CLOCK_MONOTONIC) under FreeBSD-5. Under FreeBSD-4 it is a trivial kernel patch in kern_time.c to have CLOCK_MONOTONIC, as there already is a kernel function nanouptime(). int clock_gettime(p, uap) struct proc *p; struct clock_gettime_args *uap; { struct timespec ats; switch (SCARG(uap, clock_id)) { case CLOCK_REALTIME: nanotime(&ats); break; case CLOCK_MONOTONIC: nanouptime(&ats); break; default: return (EINVAL); }; return (copyout(&ats, SCARG(uap, tp), sizeof(ats))); } Looking through the sources of the various threading libraries I found that either gettimeofday() or clock_gettime(CLOCK_REALTIME) is used for all calculations. I am not sure, what posix currently says about this but found a chapter 'Condition variable wait clock' in [Butenhof] (p.359). As I understand it, Posix.1j expects an implementation to - at least for pthread_cond_timedwait() - use CLOCK_MONOTONIC by default. They introduce a new function pair pthread_condattr_(get|set)clock() to change pthread_cond_timedwait() to use either CLOCK_MONOTONIC or CLOCK_REALTIME. >From my understanding of the threading libraries' internals, it should be trivial to modify them to using CLOCK_MONOTONIC only, but not quite as trivial to implement pthread_condattr_(get|set)clock(). For FreeBSD-4 I already have a modified libc_r, where I call clock_gettime(CLOCK_MONOTONIC) once in _thread_init() and set a global variable _sched_clkid to either CLOCK_MONOTONIC or CLOCK_REALTIME for further calls to clock_gettime(). Any comments/ideas/opinions? Norbert From owner-freebsd-hackers@FreeBSD.ORG Wed Jun 29 08:51:17 2005 Return-Path: X-Original-To: freebsd-hackers@freebsd.org 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 A35B516A41C; Wed, 29 Jun 2005 08:51:17 +0000 (GMT) (envelope-from sebastien.b@swissinfo.org) Received: from md1.swissinfo.org (md1.swissinfo.org [146.159.4.92]) by mx1.FreeBSD.org (Postfix) with ESMTP id 8597943D1F; Wed, 29 Jun 2005 08:51:14 +0000 (GMT) (envelope-from sebastien.b@swissinfo.org) Received: from mail.swissinfo.org ([194.6.181.33]) by md1.swissinfo.org (phad1.swissinfo.org [146.159.6.9]) (MDaemon.PRO.v7.2.1.R) with ESMTP id 63-md50000546795.msg; Wed, 29 Jun 2005 10:50:54 +0200 Received: from oasis (82.216.69.248) by mail.swissinfo.org (7.0.020) (authenticated as sebastien.b) id 41539420044423F0; Wed, 29 Jun 2005 10:50:55 +0200 From: Seb To: "M. Warner Losh" Date: Wed, 29 Jun 2005 10:51:00 +0200 User-Agent: KMail/1.8 References: <200506251203.13569.sebastien.b@swissinfo.org> <42F160E7-9B19-4A8A-8656-A86E0076EBB3@FreeBSD.org> <20050625.115747.127180168.imp@bsdimp.com> In-Reply-To: <20050625.115747.127180168.imp@bsdimp.com> MIME-Version: 1.0 Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: 7bit Content-Disposition: inline Message-Id: <200506291051.01760.sebastien.b@swissinfo.org> X-Spam-Processed: phad1.swissinfo.org, Wed, 29 Jun 2005 10:50:54 +0200 (not processed: message from valid local sender) X-MDRemoteIP: 194.6.181.33 X-Return-Path: sebastien.b@swissinfo.org X-MDAV-Processed: phad1.swissinfo.org, Wed, 29 Jun 2005 10:51:05 +0200 Cc: freebsd-hackers@freebsd.org, ssouhlal@freebsd.org Subject: Re: Accessing filesystem from a KLD X-BeenThere: freebsd-hackers@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: Technical Discussions relating to FreeBSD List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 29 Jun 2005 08:51:17 -0000 > There's also a desire to provide an easier to use interface for > drivers to load, for example, firmware. Is there an existing development ? I think I'll separate retreiving firmware from the filesystem in another KLD, so maybe I should contact the developers... From owner-freebsd-hackers@FreeBSD.ORG Wed Jun 29 09:14:00 2005 Return-Path: X-Original-To: freebsd-hackers@FreeBSD.org 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 4E03C16A41C for ; Wed, 29 Jun 2005 09:14:00 +0000 (GMT) (envelope-from jhb@FreeBSD.org) Received: from mail24.sea5.speakeasy.net (mail24.sea5.speakeasy.net [69.17.117.26]) by mx1.FreeBSD.org (Postfix) with ESMTP id 2318343D53 for ; Wed, 29 Jun 2005 09:14:00 +0000 (GMT) (envelope-from jhb@FreeBSD.org) Received: (qmail 1176 invoked from network); 29 Jun 2005 09:13:59 -0000 Received: from server.baldwin.cx ([216.27.160.63]) (envelope-sender ) by mail24.sea5.speakeasy.net (qmail-ldap-1.03) with AES256-SHA encrypted SMTP for ; 29 Jun 2005 09:13:59 -0000 Received: from zion.baldwin.cx (zion.baldwin.cx [192.168.0.7]) (authenticated bits=0) by server.baldwin.cx (8.13.1/8.13.1) with ESMTP id j5T9DpHx007252; Wed, 29 Jun 2005 05:13:51 -0400 (EDT) (envelope-from jhb@FreeBSD.org) From: John Baldwin To: freebsd-hackers@FreeBSD.org Date: Wed, 29 Jun 2005 04:52:41 -0400 User-Agent: KMail/1.8 References: <000001c57c80$27dbc6e0$4801a8c0@ws-ew-3.W2KDEMIG> In-Reply-To: <000001c57c80$27dbc6e0$4801a8c0@ws-ew-3.W2KDEMIG> MIME-Version: 1.0 Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: quoted-printable Content-Disposition: inline Message-Id: <200506290452.42480.jhb@FreeBSD.org> X-Spam-Status: No, score=-2.8 required=4.2 tests=ALL_TRUSTED autolearn=failed version=3.0.2 X-Spam-Checker-Version: SpamAssassin 3.0.2 (2004-11-16) on server.baldwin.cx Cc: Norbert Koch Subject: Re: Posix threads: CLOCK_REALTIME/CLOCK_MONOTONIC X-BeenThere: freebsd-hackers@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: Technical Discussions relating to FreeBSD List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 29 Jun 2005 09:14:00 -0000 On Wednesday 29 June 2005 03:57 am, Norbert Koch wrote: > Hello. > > I am working on a multi-threaded application which > may call settimeofday() and therefore may have > serious problems with timing calculations. > > In my applications I calclulate time differences > using clock_gettime(CLOCK_MONOTONIC) under FreeBSD-5. > Under FreeBSD-4 it is a trivial kernel patch in kern_time.c > to have CLOCK_MONOTONIC, as there already is a kernel function > nanouptime(). > > int > clock_gettime(p, uap) > struct proc *p; > struct clock_gettime_args *uap; > { > struct timespec ats; > > switch (SCARG(uap, clock_id)) { > case CLOCK_REALTIME: > nanotime(&ats); > break; > > case CLOCK_MONOTONIC: > nanouptime(&ats); > break; > > default: > return (EINVAL); > }; > return (copyout(&ats, SCARG(uap, tp), sizeof(ats))); > } > > > > > Looking through the sources of the various threading libraries > I found that either gettimeofday() or clock_gettime(CLOCK_REALTIME) > is used for all calculations. > > I am not sure, what posix currently says about this > but found a chapter 'Condition variable wait clock' in [Butenhof] (p.359). > As I understand it, Posix.1j expects an implementation to > - at least for pthread_cond_timedwait() - use CLOCK_MONOTONIC by default. > They introduce a new function pair pthread_condattr_(get|set)clock() > to change pthread_cond_timedwait() to use either CLOCK_MONOTONIC or > CLOCK_REALTIME. > > >From my understanding of the threading libraries' internals, it > > should be trivial to modify them to using CLOCK_MONOTONIC only, but not > quite as trivial to implement pthread_condattr_(get|set)clock(). > > For FreeBSD-4 I already have a modified libc_r, where I call > clock_gettime(CLOCK_MONOTONIC) once in _thread_init() and set > a global variable _sched_clkid to either CLOCK_MONOTONIC or CLOCK_REALTIME > for further calls to clock_gettime(). > > Any comments/ideas/opinions? You probably want to bring this up on threads@FreeBSD.org as that is where = all=20 the guys who implement the thread libraries hang out. :) =2D-=20 John Baldwin =A0<>< =A0http://www.FreeBSD.org/~jhb/ "Power Users Use the Power to Serve" =A0=3D =A0http://www.FreeBSD.org From owner-freebsd-hackers@FreeBSD.ORG Wed Jun 29 09:14:04 2005 Return-Path: X-Original-To: freebsd-hackers@FreeBSD.org 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 2000716A41C for ; Wed, 29 Jun 2005 09:14:04 +0000 (GMT) (envelope-from jhb@FreeBSD.org) Received: from mail22.sea5.speakeasy.net (mail22.sea5.speakeasy.net [69.17.117.24]) by mx1.FreeBSD.org (Postfix) with ESMTP id EAA5943D4C for ; Wed, 29 Jun 2005 09:14:03 +0000 (GMT) (envelope-from jhb@FreeBSD.org) Received: (qmail 20266 invoked from network); 29 Jun 2005 09:14:03 -0000 Received: from server.baldwin.cx ([216.27.160.63]) (envelope-sender ) by mail22.sea5.speakeasy.net (qmail-ldap-1.03) with AES256-SHA encrypted SMTP for ; 29 Jun 2005 09:14:03 -0000 Received: from zion.baldwin.cx (zion.baldwin.cx [192.168.0.7]) (authenticated bits=0) by server.baldwin.cx (8.13.1/8.13.1) with ESMTP id j5T9DpI0007252; Wed, 29 Jun 2005 05:13:58 -0400 (EDT) (envelope-from jhb@FreeBSD.org) From: John Baldwin To: Pablo Mora Date: Wed, 29 Jun 2005 05:01:30 -0400 User-Agent: KMail/1.8 References: <200506271318.36748.jhb@FreeBSD.org> In-Reply-To: MIME-Version: 1.0 Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: quoted-printable Content-Disposition: inline Message-Id: <200506290501.31301.jhb@FreeBSD.org> X-Spam-Status: No, score=-2.8 required=4.2 tests=ALL_TRUSTED autolearn=failed version=3.0.2 X-Spam-Checker-Version: SpamAssassin 3.0.2 (2004-11-16) on server.baldwin.cx Cc: freebsd-hackers@FreeBSD.org Subject: Re: problem handling POSIX thread on FreeBSD X-BeenThere: freebsd-hackers@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: Technical Discussions relating to FreeBSD List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 29 Jun 2005 09:14:04 -0000 On Tuesday 28 June 2005 07:58 pm, Pablo Mora wrote: > Ok, I understand, but by being threads POSIX should be executed of the > same one in any type of S.OR? Not sure I understand the question. What do you mean by S.O? Are you sayi= ng=20 that since the threads are POSIX, that you would expect the program to act= =20 the same on all Operating Systems? That's not an entirely safe assumption = to=20 make in that POSIX only guarantees that things like mutexes work (and it=20 specifically states that you have to unlock a mutex in the same thread you= =20 locked it, what you were doing would result in undefined behavior). POSIX= =20 doesn't make any guarantees about how threads are scheduled with respect to= =20 one another. =2D-=20 John Baldwin =A0<>< =A0http://www.FreeBSD.org/~jhb/ "Power Users Use the Power to Serve" =A0=3D =A0http://www.FreeBSD.org From owner-freebsd-hackers@FreeBSD.ORG Wed Jun 29 09:55:48 2005 Return-Path: X-Original-To: freebsd-hackers@freebsd.org 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 E9A3C16A41C for ; Wed, 29 Jun 2005 09:55:48 +0000 (GMT) (envelope-from sebastien.b@swissinfo.org) Received: from md1.swissinfo.org (md1.swissinfo.org [146.159.4.92]) by mx1.FreeBSD.org (Postfix) with ESMTP id E68DA43D4C for ; Wed, 29 Jun 2005 09:55:47 +0000 (GMT) (envelope-from sebastien.b@swissinfo.org) Received: from mail.swissinfo.org ([194.6.181.33]) by md1.swissinfo.org (phad1.swissinfo.org [146.159.6.9]) (MDaemon.PRO.v7.2.1.R) with ESMTP id 08-md50000546895.msg for ; Wed, 29 Jun 2005 11:55:39 +0200 Received: from oasis (82.216.69.248) by mail.swissinfo.org (7.0.020) (authenticated as sebastien.b) id 4153942004444D79 for freebsd-hackers@freebsd.org; Wed, 29 Jun 2005 11:55:38 +0200 From: Seb To: freebsd-hackers@freebsd.org Date: Wed, 29 Jun 2005 11:55:50 +0200 User-Agent: KMail/1.8 References: <200506251203.13569.sebastien.b@swissinfo.org> <200506291051.01760.sebastien.b@swissinfo.org> <20050629091211.GA438@pm514-9.comsys.ntu-kpi.kiev.ua> In-Reply-To: <20050629091211.GA438@pm514-9.comsys.ntu-kpi.kiev.ua> MIME-Version: 1.0 Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: 7bit Content-Disposition: inline Message-Id: <200506291155.50929.sebastien.b@swissinfo.org> X-Spam-Processed: phad1.swissinfo.org, Wed, 29 Jun 2005 11:55:39 +0200 (not processed: message from valid local sender) X-MDRemoteIP: 194.6.181.33 X-Return-Path: sebastien.b@swissinfo.org X-MDaemon-Deliver-To: freebsd-hackers@freebsd.org X-MDAV-Processed: phad1.swissinfo.org, Wed, 29 Jun 2005 11:55:40 +0200 Subject: Re: Accessing filesystem from a KLD X-BeenThere: freebsd-hackers@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: Technical Discussions relating to FreeBSD List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 29 Jun 2005 09:55:49 -0000 > Why not to use VOP_READ? See how it is called in dev/md.c:mdstart_vnode, > check kern/vfs_vnops.c:vn_open_cred for information how to lookup a file > name and open it. That's what I do, however I use the wrapper functions vn_open(), vn_rdwr() and so. But I have a problem, when I call this code : void *request_firmware(const char *name, size_t *size) { int flags; char filename[40]; struct nameidata nd; struct thread *td = curthread; [...] NDINIT(&nd, LOOKUP, FOLLOW, UIO_SYSSPACE, &filename[0], td); flags = FREAD; vn_open(&nd, &flags, 0, -1); [...] } from the KLD handler function (for testing) it works. But when I call it from a thread created by kthread_create() in another KLD, I have a page fault. A few printfs show that the call to vn_open() is responsible for the fault. I have not forgotten to lock Giant in my kernel thread. Any ideas ? Thanks, Sebastien From owner-freebsd-hackers@FreeBSD.ORG Wed Jun 29 13:42:31 2005 Return-Path: X-Original-To: freebsd-hackers@freebsd.org 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 493AE16A41C for ; Wed, 29 Jun 2005 13:42:31 +0000 (GMT) (envelope-from simon@comsys.ntu-kpi.kiev.ua) Received: from comsys.ntu-kpi.kiev.ua (comsys.ntu-kpi.kiev.ua [195.245.194.142]) by mx1.FreeBSD.org (Postfix) with ESMTP id B368F43D4C for ; Wed, 29 Jun 2005 13:42:22 +0000 (GMT) (envelope-from simon@comsys.ntu-kpi.kiev.ua) Received: from pm514-9.comsys.ntu-kpi.kiev.ua (pm514-9.comsys.ntu-kpi.kiev.ua [10.18.54.109]) (authenticated bits=0) by comsys.ntu-kpi.kiev.ua (8.12.10/8.12.10) with ESMTP id j5TDmFFl010126 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=NO); Wed, 29 Jun 2005 16:48:15 +0300 (EEST) Received: by pm514-9.comsys.ntu-kpi.kiev.ua (Postfix, from userid 1000) id 71AB814F; Wed, 29 Jun 2005 16:40:29 +0300 (EEST) Date: Wed, 29 Jun 2005 16:40:29 +0300 From: Andrey Simonenko To: Seb Message-ID: <20050629134029.GA220@pm514-9.comsys.ntu-kpi.kiev.ua> References: <200506251203.13569.sebastien.b@swissinfo.org> <200506291051.01760.sebastien.b@swissinfo.org> <20050629091211.GA438@pm514-9.comsys.ntu-kpi.kiev.ua> <200506291155.50929.sebastien.b@swissinfo.org> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <200506291155.50929.sebastien.b@swissinfo.org> User-Agent: Mutt/1.4.2.1i X-Spam-Status: No, score=-4.5 required=5.0 tests=ALL_TRUSTED,AWL,BAYES_00 autolearn=ham version=3.0.1 X-Spam-Checker-Version: SpamAssassin 3.0.1 (2004-10-22) on comsys.ntu-kpi.kiev.ua X-Virus-Scanned: ClamAV 0.82/950/Wed Jun 22 03:48:34 2005 on comsys.ntu-kpi.kiev.ua X-Virus-Status: Clean Cc: freebsd-hackers@freebsd.org Subject: Re: Accessing filesystem from a KLD X-BeenThere: freebsd-hackers@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: Technical Discussions relating to FreeBSD List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 29 Jun 2005 13:42:31 -0000 On Wed, Jun 29, 2005 at 11:55:50AM +0200, Seb wrote: > > Why not to use VOP_READ? See how it is called in dev/md.c:mdstart_vnode, > > check kern/vfs_vnops.c:vn_open_cred for information how to lookup a file > > name and open it. > > That's what I do, however I use the wrapper functions vn_open(), vn_rdwr() and > so. > > But I have a problem, when I call this code : > > void *request_firmware(const char *name, size_t *size) > { > int flags; > char filename[40]; > struct nameidata nd; > struct thread *td = curthread; > [...] > NDINIT(&nd, LOOKUP, FOLLOW, UIO_SYSSPACE, &filename[0], td); > flags = FREAD; > vn_open(&nd, &flags, 0, -1); > [...] > } > > from the KLD handler function (for testing) it works. But when I call it from > a thread created by kthread_create() in another KLD, I have a page fault. > A few printfs show that the call to vn_open() is responsible for the fault. > I have not forgotten to lock Giant in my kernel thread. > Any ideas ? You got page fault from namei(), which is called from vn_open() to lookup a path name. namei() tries to obtain a reference on current directory for the current thread. This current directory (fd_cdir field) is NULL in your kthread. At this point a page fault in kernel address space is generated. More detail: Check in kthread_create() how new kthread is created, check flag RFFDG in fork1(). Since new kthread is created from thread0 and RFFDG is on, then new kthread will copy descriptor table from proc0. proc0 has descriptor table created by fdinit() in proc0_init(). fdinit() sets fd_cdir (current directory) to 0 (the same as NULL in /sys). Can you change fd_cdir in kthread to rootvnode I don't know, haven't checked this yet. But you can open a file in syscall and then use obtained vp in your kthread for VOP_READ call. It would be better to see backtrace of above mentioned page fault. But I guess that everything happened as I described. Hope this can help. From owner-freebsd-hackers@FreeBSD.ORG Wed Jun 29 18:01:03 2005 Return-Path: X-Original-To: freebsd-hackers@freebsd.org 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 12AD416A41F for ; Wed, 29 Jun 2005 18:01:03 +0000 (GMT) (envelope-from jhopper@bsdhosting.net) Received: from bsdhosting.net (bsdhosting.net [65.39.221.113]) by mx1.FreeBSD.org (Postfix) with SMTP id 9F2FB43D4C for ; Wed, 29 Jun 2005 18:01:02 +0000 (GMT) (envelope-from jhopper@bsdhosting.net) Received: (qmail 15446 invoked from network); 29 Jun 2005 17:58:54 -0000 Received: from unknown (HELO ?192.168.1.2?) (jhopper@bsdhosting.net@65.39.221.113) by bsdhosting.net with SMTP; 29 Jun 2005 17:58:54 -0000 From: Justin Hopper To: freebsd-hackers@freebsd.org Content-Type: multipart/mixed; boundary="=-rNyQwFdkBajS5cBgdvBd" Date: Wed, 29 Jun 2005 11:00:59 -0700 Message-Id: <1120068059.27704.144.camel@localhost.localdomain> Mime-Version: 1.0 X-Mailer: Evolution 2.0.4 (2.0.4-4) Subject: No SMP on Compaq ML350 with FBSD 5.3-RE X-BeenThere: freebsd-hackers@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: Technical Discussions relating to FreeBSD List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 29 Jun 2005 18:01:03 -0000 --=-rNyQwFdkBajS5cBgdvBd Content-Type: text/plain Content-Transfer-Encoding: 7bit Hello, I'm sure this problem would have been found before, but so far, I can't see any trace of it in searches. I just picked up a Compaq ML350 for free from a liquidator, runs fine it seems, and has dual P-II 600MHz CPUs. The BIOS post shows the two CPUs, as does the BIOS "System Info" function. However, a fresh install of FreeBSD 5.3-RE shows only a single CPU, and utilities like "top" reflect this as well. Attached is the dmesg output. Since this is such old hardware, I'm really surprised that it doesn't just simply "work". Thoughts? -- Justin Hopper UNIX Systems Engineer BSDHosting.net Hosting Division of Digital Oasys Inc. http://www.bsdhosting.net --=-rNyQwFdkBajS5cBgdvBd Content-Disposition: attachment; filename=server-dmesg.txt Content-Type: text/plain; name=server-dmesg.txt; charset=UTF-8 Content-Transfer-Encoding: 7bit Copyright (c) 1992-2004 The FreeBSD Project. Copyright (c) 1979, 1980, 1983, 1986, 1988, 1989, 1991, 1992, 1993, 1994 The Regents of the University of California. All rights reserved. FreeBSD 5.3-RELEASE #0: Tue Jun 28 23:38:16 PDT 2005 root@box665.com:/usr/obj/usr/src/sys/SERVER Timecounter "i8254" frequency 1193182 Hz quality 0 CPU: Intel Pentium III (596.00-MHz 686-class CPU) Origin = "GenuineIntel" Id = 0x681 Stepping = 1 Features=0x383fbff real memory = 1073741824 (1024 MB) avail memory = 1045381120 (996 MB) ACPI APIC Table: ioapic0: Changing APIC ID to 8 ioapic1: Changing APIC ID to 3 ioapic1 irqs 16-31 on motherboard ioapic0 irqs 0-15 on motherboard npx0: [FAST] npx0: on motherboard npx0: INT 16 interface acpi0: on motherboard acpi0: Power Button (fixed) unknown: I/O range not supported unknown: I/O range not supported unknown: I/O range not supported unknown: I/O range not supported unknown: I/O range not supported unknown: I/O range not supported unknown: I/O range not supported unknown: I/O range not supported unknown: I/O range not supported unknown: I/O range not supported unknown: I/O range not supported unknown: I/O range not supported unknown: I/O range not supported unknown: I/O range not supported unknown: I/O range not supported unknown: I/O range not supported unknown: I/O range not supported unknown: I/O range not supported unknown: I/O range not supported unknown: I/O range not supported unknown: I/O range not supported unknown: I/O range not supported unknown: I/O range not supported Timecounter "ACPI-safe" frequency 3579545 Hz quality 1000 acpi_timer0: <32-bit timer at 3.579545MHz> port 0xf808-0xf80b on acpi0 cpu0: on acpi0 pcib0: port 0xcf8-0xcff on acpi0 pci0: on pcib0 pcib1: at device 1.0 on pci0 pci1: on pcib1 --=-rNyQwFdkBajS5cBgdvBd-- From owner-freebsd-hackers@FreeBSD.ORG Wed Jun 29 18:08:32 2005 Return-Path: X-Original-To: freebsd-hackers@freebsd.org 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 4AED116A41F for ; Wed, 29 Jun 2005 18:08:32 +0000 (GMT) (envelope-from lidl@pix.net) Received: from meketrex.pix.net (meketrex.pix.net [192.111.45.13]) by mx1.FreeBSD.org (Postfix) with ESMTP id 7AD2C43D1F for ; Wed, 29 Jun 2005 18:08:30 +0000 (GMT) (envelope-from lidl@pix.net) Received: from [192.111.45.213] (torb.pix.net [192.111.45.213]) by meketrex.pix.net (8.11.6/8.11.6) with ESMTP id j5TI8Qx05838; Wed, 29 Jun 2005 14:08:26 -0400 (EDT) Message-ID: <42C2E399.4090609@pix.net> Date: Wed, 29 Jun 2005 14:08:25 -0400 From: Kurt Lidl User-Agent: Mozilla Thunderbird 1.0.2 (Macintosh/20050317) X-Accept-Language: en-us, en MIME-Version: 1.0 To: Justin Hopper References: <1120068059.27704.144.camel@localhost.localdomain> In-Reply-To: <1120068059.27704.144.camel@localhost.localdomain> Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit Cc: freebsd-hackers@freebsd.org Subject: Re: No SMP on Compaq ML350 with FBSD 5.3-RE X-BeenThere: freebsd-hackers@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: Technical Discussions relating to FreeBSD List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 29 Jun 2005 18:08:32 -0000 Justin Hopper wrote: > I just picked up a Compaq ML350 for free from a liquidator, runs fine it > seems, and has dual P-II 600MHz CPUs. The BIOS post shows the two CPUs, > as does the BIOS "System Info" function. However, a fresh install of > FreeBSD 5.3-RE shows only a single CPU, and utilities like "top" reflect > this as well. Attached is the dmesg output. Since this is such old > hardware, I'm really surprised that it doesn't just simply "work". > Thoughts? I would certainly start by installing the latest and greatest BIOS that is available for the machine. You don't mention exactly which version of the ML350 you have -- there apparently were several. If the machine is old, chances are good that a newer BIOS exists, and probably fixes all sorts of problems. I found the following site, which might be helpful: http://h18023.www1.hp.com/support/files/server/us/romtabl.html Good luck. Oh, and I'd try 5.4 instead of 5.3 -- can't hurt ;-) -Kurt From owner-freebsd-hackers@FreeBSD.ORG Wed Jun 29 18:52:33 2005 Return-Path: X-Original-To: freebsd-hackers@freebsd.org 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 CC88916A41C for ; Wed, 29 Jun 2005 18:52:33 +0000 (GMT) (envelope-from jhb@FreeBSD.org) Received: from mv.twc.weather.com (mv.twc.weather.com [65.212.71.225]) by mx1.FreeBSD.org (Postfix) with ESMTP id 89D7143D48 for ; Wed, 29 Jun 2005 18:52:33 +0000 (GMT) (envelope-from jhb@FreeBSD.org) Received: from [10.50.41.231] (Not Verified[65.202.103.25]) by mv.twc.weather.com with NetIQ MailMarshal (v6, 0, 3, 8) id ; Wed, 29 Jun 2005 15:06:18 -0400 From: John Baldwin To: freebsd-hackers@freebsd.org Date: Wed, 29 Jun 2005 14:52:27 -0400 User-Agent: KMail/1.8 References: <1120068059.27704.144.camel@localhost.localdomain> In-Reply-To: <1120068059.27704.144.camel@localhost.localdomain> MIME-Version: 1.0 Content-Type: text/plain; charset="iso-8859-6" Content-Transfer-Encoding: 7bit Content-Disposition: inline Message-Id: <200506291452.28244.jhb@FreeBSD.org> Cc: Justin Hopper Subject: Re: No SMP on Compaq ML350 with FBSD 5.3-RE X-BeenThere: freebsd-hackers@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: Technical Discussions relating to FreeBSD List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 29 Jun 2005 18:52:33 -0000 On Wednesday 29 June 2005 02:00 pm, Justin Hopper wrote: > Hello, > > I'm sure this problem would have been found before, but so far, I can't > see any trace of it in searches. > > I just picked up a Compaq ML350 for free from a liquidator, runs fine it > seems, and has dual P-II 600MHz CPUs. The BIOS post shows the two CPUs, > as does the BIOS "System Info" function. However, a fresh install of > FreeBSD 5.3-RE shows only a single CPU, and utilities like "top" reflect > this as well. Attached is the dmesg output. Since this is such old > hardware, I'm really surprised that it doesn't just simply "work". > Thoughts? Did you add 'options SMP' to your kernel config? I think that GENERIC in 5.x has 'options SMP' disabled by default. -- John Baldwin <>< http://www.FreeBSD.org/~jhb/ "Power Users Use the Power to Serve" = http://www.FreeBSD.org From owner-freebsd-hackers@FreeBSD.ORG Wed Jun 29 22:13:09 2005 Return-Path: X-Original-To: hackers@freebsd.org 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 983A016A41C for ; Wed, 29 Jun 2005 22:13:09 +0000 (GMT) (envelope-from andrit@ukr.net) Received: from storage.ukr.net (storage.ukr.net [212.42.65.69]) by mx1.FreeBSD.org (Postfix) with ESMTP id 27B6143D48 for ; Wed, 29 Jun 2005 22:13:08 +0000 (GMT) (envelope-from andrit@ukr.net) Received: from dialup-147.41.sitel.com.ua ([217.27.147.41] helo=ertpc) by storage.ukr.net with smtp ID 1Dnknq-000CN5-0n for hackers@freebsd.org; Thu, 30 Jun 2005 01:13:07 +0300 Message-ID: <000d01c57cf7$b9b6f9f0$29931bd9@ertpc> From: "ant" To: Date: Thu, 30 Jun 2005 01:08:55 +0300 MIME-Version: 1.0 Content-Type: text/plain; charset="koi8-r" Content-Transfer-Encoding: 7bit X-Priority: 3 X-MSMail-Priority: Normal X-Mailer: Microsoft Outlook Express 6.00.2600.0000 X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2600.0000 Cc: Subject: hot path optimizations in uma_zalloc() & uma_zfree() X-BeenThere: freebsd-hackers@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: Technical Discussions relating to FreeBSD List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 29 Jun 2005 22:13:09 -0000 Hi folks. I just tryed to make buckets management in perCPU cache like in Solaris (see paper of Jeff Bonwick - Magazines and Vmem) and got perfomance gain around 10% in my test program. Then i made another minor code optimization and got another 10%. The program just creates and destroys sockets in loop. I suppose the reason of first gain lies in increasing of cpu cache hits. In current fbsd code allocations and freeings deal with separate buckets. Buckets are changed when one of them became full or empty first. In Solaris this work is pure LIFO: i.e. alloc() and free() work with one bucket - the current bucket (it is called magazine there), that's why cache hit rate is bigger. Another optimization is very trivial, for example: - bucket->ub_cnt--; - item = bucket->ub_bucket[bucket->ub_cnt]; + item = bucket->ub_bucket[--bucket->ub_cnt]; (see the patch) The test program: #include #include main(int argc, char *argv[]) { int *fd, n, i,j, iters=100000; n = atoi(argv[1]); fd = (int*) malloc(sizeof(*fd) * n); iters /= n; for (i=0; i time ./sockloop 1 # first arg is the number of sockets that created in one iteration 0.093u 2.650s 0:02.75 99.6% 5+180k 0+0io 0pf+0w > time ./sockloop 1 0.108u 2.298s 0:02.41 99.1% 5+181k 0+0io 0pf+0w > time ./sockloop 1 0.127u 2.278s 0:02.41 99.1% 5+177k 0+0io 0pf+0w > time ./sockloop 10 # number of iterations is changed according to arg (see code) 0.054u 2.239s 0:02.30 99.1% 5+181k 0+0io 0pf+0w > time ./sockloop 10 0.069u 2.199s 0:02.27 99.1% 6+184k 0+0io 0pf+0w > time ./sockloop 10 0.086u 2.185s 0:02.28 99.1% 5+178k 0+0io 0pf+0w > time ./sockloop 100 0.101u 2.393s 0:02.51 99.2% 5+179k 0+0io 0pf+0w > time ./sockloop 100 0.085u 2.505s 0:02.60 99.2% 5+180k 0+0io 0pf+0w > time ./sockloop 100 0.054u 2.441s 0:02.50 99.6% 5+178k 0+0io 0pf+0w > time ./sockloop 1000 0.093u 2.739s 0:02.84 99.2% 5+181k 0+0io 0pf+0w > time ./sockloop 1000 0.085u 2.797s 0:02.89 99.3% 5+180k 0+0io 0pf+0w > time ./sockloop 1000 0.117u 2.689s 0:02.82 98.9% 5+179k 0+0io 0pf+0w The results of first optimization (only buckets management) > time ./sockloop 1 0.125u 1.938s 0:02.06 99.5% 5+180k 0+0io 0pf+0w > time ./sockloop 1 0.070u 1.993s 0:02.06 100.0% 5+180k 0+0io 0pf+0w > time ./sockloop 1 0.110u 1.953s 0:02.06 100.0% 5+177k 0+0io 0pf+0w > time ./sockloop 10 0.093u 1.776s 0:01.87 99.4% 5+180k 0+0io 0pf+0w > time ./sockloop 10 0.116u 1.754s 0:01.87 99.4% 5+181k 0+0io 0pf+0w > time ./sockloop 10 0.093u 1.777s 0:01.87 99.4% 5+181k 0+0io 0pf+0w > time ./sockloop 100 0.100u 2.182s 0:02.29 99.5% 5+180k 0+0io 0pf+0w > time ./sockloop 100 0.093u 2.174s 0:02.27 99.5% 5+180k 0+0io 0pf+0w > time ./sockloop 100 0.078u 2.158s 0:02.24 99.1% 5+180k 0+0io 0pf+0w > time ./sockloop 1000 0.101u 2.403s 0:02.51 99.6% 5+180k 0+0io 0pf+0w > time ./sockloop 1000 0.124u 2.381s 0:02.52 99.2% 5+180k 0+0io 0pf+0w > time ./sockloop 1000 0.125u 2.373s 0:02.51 99.2% 5+178k 0+0io 0pf+0w The results of both optimizations > time ./sockloop 1 0.062u 1.785s 0:01.85 99.4% 5+180k 0+0io 0pf+0w > time ./sockloop 1 0.124u 1.722s 0:01.85 99.4% 5+180k 0+0io 0pf+0w > time ./sockloop 1 0.087u 1.759s 0:01.85 98.9% 5+177k 0+0io 0pf+0w > time ./sockloop 10 0.069u 1.684s 0:01.75 99.4% 5+181k 0+0io 0pf+0w > time ./sockloop 10 0.070u 1.673s 0:01.74 100.0% 5+180k 0+0io 0pf+0w > time ./sockloop 10 0.070u 1.672s 0:01.74 100.0% 5+177k 0+0io 0pf+0w > time ./sockloop 100 0.077u 2.102s 0:02.18 99.5% 5+180k 0+0io 0pf+0w > time ./sockloop 100 0.116u 2.062s 0:02.18 99.5% 5+180k 0+0io 0pf+0w > time ./sockloop 100 0.055u 2.126s 0:02.19 99.0% 5+178k 0+0io 0pf+0w > time ./sockloop 1000 0.077u 2.298s 0:02.39 98.7% 5+181k 0+0io 0pf+0w > time ./sockloop 1000 0.070u 2.340s 0:02.42 99.5% 5+178k 0+0io 0pf+0w > time ./sockloop 1000 0.054u 2.320s 0:02.39 99.1% 5+179k 0+0io 0pf+0w the patch is for uma_core.c from RELENG_5, but i checked uma_core.c in CURRENT - it's the same regarding to thiese improvements. I don't have any commit rights, so the patch is just for reviewing. Here it is: --- sys/vm/uma_core.c.orig Wed Jun 29 21:46:52 2005 +++ sys/vm/uma_core.c Wed Jun 29 23:09:32 2005 @@ -1830,8 +1830,7 @@ if (bucket) { if (bucket->ub_cnt > 0) { - bucket->ub_cnt--; - item = bucket->ub_bucket[bucket->ub_cnt]; + item = bucket->ub_bucket[--bucket->ub_cnt]; #ifdef INVARIANTS bucket->ub_bucket[bucket->ub_cnt] = NULL; #endif @@ -2252,7 +2251,7 @@ cache = &zone->uz_cpu[cpu]; zfree_start: - bucket = cache->uc_freebucket; + bucket = cache->uc_allocbucket; if (bucket) { /* @@ -2263,8 +2262,7 @@ if (bucket->ub_cnt < bucket->ub_entries) { KASSERT(bucket->ub_bucket[bucket->ub_cnt] == NULL, ("uma_zfree: Freeing to non free bucket index.")); - bucket->ub_bucket[bucket->ub_cnt] = item; - bucket->ub_cnt++; + bucket->ub_bucket[bucket->ub_cnt++] = item; #ifdef INVARIANTS ZONE_LOCK(zone); if (keg->uk_flags & UMA_ZONE_MALLOC) @@ -2275,7 +2273,7 @@ #endif CPU_UNLOCK(cpu); return; - } else if (cache->uc_allocbucket) { + } else if (cache->uc_freebucket) { #ifdef UMA_DEBUG_ALLOC printf("uma_zfree: Swapping buckets.\n"); #endif @@ -2283,8 +2281,7 @@ * We have run out of space in our freebucket. * See if we can switch with our alloc bucket. */ - if (cache->uc_allocbucket->ub_cnt < - cache->uc_freebucket->ub_cnt) { + if (cache->uc_freebucket->ub_cnt == 0) { bucket = cache->uc_freebucket; cache->uc_freebucket = cache->uc_allocbucket; cache->uc_allocbucket = bucket; if one will decide to commit first optimization (about buckets), then there must some adjustments be made also regarding correct statistics gathering. Regards, Andriy Tkachuk. From owner-freebsd-hackers@FreeBSD.ORG Wed Jun 29 22:41:49 2005 Return-Path: X-Original-To: hackers@freebsd.org 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 5566D16A41C; Wed, 29 Jun 2005 22:41:49 +0000 (GMT) (envelope-from rwatson@FreeBSD.org) Received: from cyrus.watson.org (cyrus.watson.org [204.156.12.53]) by mx1.FreeBSD.org (Postfix) with ESMTP id D424B43D4C; Wed, 29 Jun 2005 22:41:48 +0000 (GMT) (envelope-from rwatson@FreeBSD.org) Received: from fledge.watson.org (fledge.watson.org [204.156.12.50]) by cyrus.watson.org (Postfix) with ESMTP id 8BC9146B0C; Wed, 29 Jun 2005 18:41:48 -0400 (EDT) Date: Wed, 29 Jun 2005 23:45:57 +0100 (BST) From: Robert Watson X-X-Sender: robert@fledge.watson.org To: ant In-Reply-To: <000d01c57cf7$b9b6f9f0$29931bd9@ertpc> Message-ID: <20050629234429.A87930@fledge.watson.org> References: <000d01c57cf7$b9b6f9f0$29931bd9@ertpc> MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII; format=flowed Cc: jeff@FreeBSD.org, hackers@freebsd.org, bmilekic@FreeBSD.org Subject: Re: hot path optimizations in uma_zalloc() & uma_zfree() X-BeenThere: freebsd-hackers@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: Technical Discussions relating to FreeBSD List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 29 Jun 2005 22:41:49 -0000 On Thu, 30 Jun 2005, ant wrote: > I just tryed to make buckets management in perCPU cache like in Solaris > (see paper of Jeff Bonwick - Magazines and Vmem) and got perfomance gain > around 10% in my test program. Then i made another minor code > optimization and got another 10%. The program just creates and destroys > sockets in loop. This sounds great -- I'm off to bed now (.uk time and all), but will run some benchmarks locally tomorrow. I've recently started investigating using the PMC support in 6.x to look at cache behavior in the network-related fast paths, but haven't gotten too far as yet. Thanks, Robert N M Watson > > I suppose the reason of first gain lies in increasing of cpu cache hits. > In current fbsd code allocations and freeings deal with > separate buckets. Buckets are changed when one of them > became full or empty first. In Solaris this work is pure LIFO: > i.e. alloc() and free() work with one bucket - the current bucket > (it is called magazine there), that's why cache hit rate is bigger. > > Another optimization is very trivial, for example: > - bucket->ub_cnt--; > - item = bucket->ub_bucket[bucket->ub_cnt]; > + item = bucket->ub_bucket[--bucket->ub_cnt]; > (see the patch) > > > The test program: > > #include > #include > > main(int argc, char *argv[]) > { > int *fd, n, i,j, iters=100000; > > n = atoi(argv[1]); > fd = (int*) malloc(sizeof(*fd) * n); > > iters /= n; > for (i=0; i for (j=0; j fd[j] = socket(AF_UNIX, SOCK_STREAM, 0); > for (j=0; j close(fd[j]); > } > } > > > > The results with current uma_core.c > >> time ./sockloop 1 # first arg is the > number of sockets that created in one iteration > 0.093u 2.650s 0:02.75 99.6% 5+180k 0+0io 0pf+0w >> time ./sockloop 1 > 0.108u 2.298s 0:02.41 99.1% 5+181k 0+0io 0pf+0w >> time ./sockloop 1 > 0.127u 2.278s 0:02.41 99.1% 5+177k 0+0io 0pf+0w >> time ./sockloop 10 # number of iterations > is changed according to arg (see code) > 0.054u 2.239s 0:02.30 99.1% 5+181k 0+0io 0pf+0w >> time ./sockloop 10 > 0.069u 2.199s 0:02.27 99.1% 6+184k 0+0io 0pf+0w >> time ./sockloop 10 > 0.086u 2.185s 0:02.28 99.1% 5+178k 0+0io 0pf+0w >> time ./sockloop 100 > 0.101u 2.393s 0:02.51 99.2% 5+179k 0+0io 0pf+0w >> time ./sockloop 100 > 0.085u 2.505s 0:02.60 99.2% 5+180k 0+0io 0pf+0w >> time ./sockloop 100 > 0.054u 2.441s 0:02.50 99.6% 5+178k 0+0io 0pf+0w >> time ./sockloop 1000 > 0.093u 2.739s 0:02.84 99.2% 5+181k 0+0io 0pf+0w >> time ./sockloop 1000 > 0.085u 2.797s 0:02.89 99.3% 5+180k 0+0io 0pf+0w >> time ./sockloop 1000 > 0.117u 2.689s 0:02.82 98.9% 5+179k 0+0io 0pf+0w > > > The results of first optimization (only buckets management) > >> time ./sockloop 1 > 0.125u 1.938s 0:02.06 99.5% 5+180k 0+0io 0pf+0w >> time ./sockloop 1 > 0.070u 1.993s 0:02.06 100.0% 5+180k 0+0io 0pf+0w >> time ./sockloop 1 > 0.110u 1.953s 0:02.06 100.0% 5+177k 0+0io 0pf+0w >> time ./sockloop 10 > 0.093u 1.776s 0:01.87 99.4% 5+180k 0+0io 0pf+0w >> time ./sockloop 10 > 0.116u 1.754s 0:01.87 99.4% 5+181k 0+0io 0pf+0w >> time ./sockloop 10 > 0.093u 1.777s 0:01.87 99.4% 5+181k 0+0io 0pf+0w >> time ./sockloop 100 > 0.100u 2.182s 0:02.29 99.5% 5+180k 0+0io 0pf+0w >> time ./sockloop 100 > 0.093u 2.174s 0:02.27 99.5% 5+180k 0+0io 0pf+0w >> time ./sockloop 100 > 0.078u 2.158s 0:02.24 99.1% 5+180k 0+0io 0pf+0w >> time ./sockloop 1000 > 0.101u 2.403s 0:02.51 99.6% 5+180k 0+0io 0pf+0w >> time ./sockloop 1000 > 0.124u 2.381s 0:02.52 99.2% 5+180k 0+0io 0pf+0w >> time ./sockloop 1000 > 0.125u 2.373s 0:02.51 99.2% 5+178k 0+0io 0pf+0w > > > > The results of both optimizations > >> time ./sockloop 1 > 0.062u 1.785s 0:01.85 99.4% 5+180k 0+0io 0pf+0w >> time ./sockloop 1 > 0.124u 1.722s 0:01.85 99.4% 5+180k 0+0io 0pf+0w >> time ./sockloop 1 > 0.087u 1.759s 0:01.85 98.9% 5+177k 0+0io 0pf+0w >> time ./sockloop 10 > 0.069u 1.684s 0:01.75 99.4% 5+181k 0+0io 0pf+0w >> time ./sockloop 10 > 0.070u 1.673s 0:01.74 100.0% 5+180k 0+0io 0pf+0w >> time ./sockloop 10 > 0.070u 1.672s 0:01.74 100.0% 5+177k 0+0io 0pf+0w >> time ./sockloop 100 > 0.077u 2.102s 0:02.18 99.5% 5+180k 0+0io 0pf+0w >> time ./sockloop 100 > 0.116u 2.062s 0:02.18 99.5% 5+180k 0+0io 0pf+0w >> time ./sockloop 100 > 0.055u 2.126s 0:02.19 99.0% 5+178k 0+0io 0pf+0w >> time ./sockloop 1000 > 0.077u 2.298s 0:02.39 98.7% 5+181k 0+0io 0pf+0w >> time ./sockloop 1000 > 0.070u 2.340s 0:02.42 99.5% 5+178k 0+0io 0pf+0w >> time ./sockloop 1000 > 0.054u 2.320s 0:02.39 99.1% 5+179k 0+0io 0pf+0w > > > the patch is for uma_core.c from RELENG_5, but i checked > uma_core.c in CURRENT - it's the same regarding to thiese > improvements. I don't have any commit rights, so the patch > is just for reviewing. Here it is: > > --- sys/vm/uma_core.c.orig Wed Jun 29 21:46:52 2005 > +++ sys/vm/uma_core.c Wed Jun 29 23:09:32 2005 > @@ -1830,8 +1830,7 @@ > > if (bucket) { > if (bucket->ub_cnt > 0) { > - bucket->ub_cnt--; > - item = bucket->ub_bucket[bucket->ub_cnt]; > + item = bucket->ub_bucket[--bucket->ub_cnt]; > #ifdef INVARIANTS > bucket->ub_bucket[bucket->ub_cnt] = NULL; > #endif > @@ -2252,7 +2251,7 @@ > cache = &zone->uz_cpu[cpu]; > > zfree_start: > - bucket = cache->uc_freebucket; > + bucket = cache->uc_allocbucket; > > if (bucket) { > /* > @@ -2263,8 +2262,7 @@ > if (bucket->ub_cnt < bucket->ub_entries) { > KASSERT(bucket->ub_bucket[bucket->ub_cnt] == NULL, > ("uma_zfree: Freeing to non free bucket index.")); > - bucket->ub_bucket[bucket->ub_cnt] = item; > - bucket->ub_cnt++; > + bucket->ub_bucket[bucket->ub_cnt++] = item; > #ifdef INVARIANTS > ZONE_LOCK(zone); > if (keg->uk_flags & UMA_ZONE_MALLOC) > @@ -2275,7 +2273,7 @@ > #endif > CPU_UNLOCK(cpu); > return; > - } else if (cache->uc_allocbucket) { > + } else if (cache->uc_freebucket) { > #ifdef UMA_DEBUG_ALLOC > printf("uma_zfree: Swapping buckets.\n"); > #endif > @@ -2283,8 +2281,7 @@ > * We have run out of space in our freebucket. > * See if we can switch with our alloc bucket. > */ > - if (cache->uc_allocbucket->ub_cnt < > - cache->uc_freebucket->ub_cnt) { > + if (cache->uc_freebucket->ub_cnt == 0) { > bucket = cache->uc_freebucket; > cache->uc_freebucket = cache->uc_allocbucket; > cache->uc_allocbucket = bucket; > > > if one will decide to commit first optimization (about buckets), > then there must some adjustments be made also > regarding correct statistics gathering. > > Regards, > Andriy Tkachuk. > > > > _______________________________________________ > freebsd-hackers@freebsd.org mailing list > http://lists.freebsd.org/mailman/listinfo/freebsd-hackers > To unsubscribe, send any mail to "freebsd-hackers-unsubscribe@freebsd.org" > From owner-freebsd-hackers@FreeBSD.ORG Thu Jun 30 02:01:36 2005 Return-Path: X-Original-To: freebsd-hackers@freebsd.org 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 EADB016A41C for ; Thu, 30 Jun 2005 02:01:36 +0000 (GMT) (envelope-from gayn.winters@mail.bristolsystems.com) Received: from dns.bristolsystems.com (h-68-167-239-98.lsanca54.covad.net [68.167.239.98]) by mx1.FreeBSD.org (Postfix) with ESMTP id C8B9A43D53 for ; Thu, 30 Jun 2005 02:01:36 +0000 (GMT) (envelope-from gayn.winters@mail.bristolsystems.com) Received: from workdog ([192.168.1.201]) by dns.bristolsystems.com (8.11.6/8.11.6) with ESMTP id j5U21ag19009 for ; Wed, 29 Jun 2005 19:01:36 -0700 From: "Gayn Winters" To: Date: Wed, 29 Jun 2005 19:01:31 -0700 Message-ID: <003701c57d17$a3068340$c901a8c0@workdog> MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit X-Priority: 3 (Normal) X-MSMail-Priority: Normal X-Mailer: Microsoft Outlook, Build 10.0.4024 X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2900.2180 Importance: Normal Subject: ICH6R RAID X-BeenThere: freebsd-hackers@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: Technical Discussions relating to FreeBSD List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 30 Jun 2005 02:01:37 -0000 It appears that I'm not the only one struggling with the RAID1 using Intel's ICH6R. (My mobo is a Tyan S5150 with two identical 80GB WD SATA drives.) Using either 5.4-RELEASE or 6.0-CURRENT-SNAP004 the OS seems to load from the release CD but fails to boot from the RAID array. (5.4 drops into boot loader and 6.0 can't find the OS.) Both operating systems boot fine without a RAID1 array and both disks come up. I even tried building the mirror then disabling one drive using the firmware setup. The firmware says then to have the OS rebuild the mirror. OK,... The OS then boots fine to ad4 and can see ad6. I can dd if=/dev/ad4 of=/dev/ad6 successfully, but I cannot get atacontrol to rebuild the mirror. Maybe this approach will work, and I'm doing something wrong... Now man ata(4) indicates that only up to ICH5 is supported in 5.4 while up to ICH6 is supported in 6.0, but the hardware archives indicate that sos's MK3 patches made it into 5.4-RELEASE, and 6.0 "fully" supports the ICH6R. However, I'm actually not sure the precise story here. Has anyone out there actually booted FreeBSD using mirrored SATA drives with an ICH6R? If so, how did you do it and what version did you use? I could really use some help! Thanks, -gayn From owner-freebsd-hackers@FreeBSD.ORG Thu Jun 30 03:26:59 2005 Return-Path: X-Original-To: freebsd-hackers@freebsd.org 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 9C02E16A41C for ; Thu, 30 Jun 2005 03:26:59 +0000 (GMT) (envelope-from ncb@cs.wisc.edu) Received: from delicious.cs.wisc.edu (delicious.cs.wisc.edu [128.105.167.24]) by mx1.FreeBSD.org (Postfix) with ESMTP id 54DE143D58 for ; Thu, 30 Jun 2005 03:26:59 +0000 (GMT) (envelope-from ncb@cs.wisc.edu) Received: from delicious.cs.wisc.edu (localhost [127.0.0.1]) by delicious.cs.wisc.edu (8.13.1/8.13.1) with ESMTP id j5U3Qw8A007237 for ; Wed, 29 Jun 2005 22:26:58 -0500 Received: from localhost (ncb@localhost) by delicious.cs.wisc.edu (8.13.1/8.13.1/Submit) with ESMTP id j5U3QwTl007234 for ; Wed, 29 Jun 2005 22:26:58 -0500 X-Authentication-Warning: delicious.cs.wisc.edu: ncb owned process doing -bs Date: Wed, 29 Jun 2005 22:26:58 -0500 (CDT) From: "Nathan C. Burnett" To: freebsd-hackers@freebsd.org Message-ID: MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII Subject: buffer locking X-BeenThere: freebsd-hackers@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: Technical Discussions relating to FreeBSD List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 30 Jun 2005 03:26:59 -0000 I'm working in FreeBSD 5.3-RELEASE. In various places in the buffer management code (e.g. ibwrite()) the buffer lock reference count is checked (see below), presumably to make sure the buffer is safely locked before working with it. Is there a reason that it's not neccesary to ensure that the current thread is the lockholder? This seems like it could lead to a race condition where, say ibwrite, is content because SOMEONE has the buffer locked, even if it's not the current thread. Thanks, -Nate From owner-freebsd-hackers@FreeBSD.ORG Thu Jun 30 05:00:19 2005 Return-Path: X-Original-To: hackers@freebsd.org 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 8AF1F16A41C for ; Thu, 30 Jun 2005 05:00:19 +0000 (GMT) (envelope-from grog@lemis.com) Received: from blackwater.lemis.com (wantadilla.lemis.com [192.109.197.135]) by mx1.FreeBSD.org (Postfix) with ESMTP id 29CEC43D1F for ; Thu, 30 Jun 2005 05:00:18 +0000 (GMT) (envelope-from grog@lemis.com) Received: by blackwater.lemis.com (Postfix, from userid 1004) id 20F4C856A6; Thu, 30 Jun 2005 14:30:17 +0930 (CST) Date: Thu, 30 Jun 2005 14:30:17 +0930 From: Greg 'groggy' Lehey To: FreeBSD Hackers Message-ID: <20050630050017.GU31528@wantadilla.lemis.com> Mime-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha1; protocol="application/pgp-signature"; boundary="SDZNRjzUoAX9KAL/" Content-Disposition: inline User-Agent: Mutt/1.4.2.1i Organization: The FreeBSD Project Phone: +61-8-8388-8286 Fax: +61-8-8388-8725 Mobile: +61-418-838-708 WWW-Home-Page: http://www.FreeBSD.org/ X-PGP-Fingerprint: 9A1B 8202 BCCE B846 F92F 09AC 22E6 F290 507A 4223 Cc: Subject: Suurce code navigation tools with call graph? X-BeenThere: freebsd-hackers@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: Technical Discussions relating to FreeBSD List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 30 Jun 2005 05:00:19 -0000 --SDZNRjzUoAX9KAL/ Content-Type: text/plain; charset=us-ascii Content-Disposition: inline I'm currently in the position of needing to cut a large program into two halves and insert a clean API between them. To do this I need to get a good understanding of how the control flow works, and I'm looking for tools that might help me. So far I've seen: - etags will follow the control flow downwards with the find-tag command (M-. in Emacs). It's useful at times, but a little pedestrian for what I want to do. - cscope will show me all callers for a function. This is closer, but it's still not overly easy to read. - Source navigator (snavigator) gives a graphical representation of the downwards control tree for a function. It doesn't seem to be able to go in the other direction, i.e show what functions call a specific function. - doxygen does the same thing. Arguably the graphic representation is nicer. - kscope is a KDE wrapper for cscope. It seems to come closest to what I'm looking for in that it will show the callers, but the form in which it does so is painful. In particular, there doesn't seem to be any way to view the source code round the call. If that's the best there is, I can live with it. But is it the best? Does anybody have a better tool? And yes, I've looked through /usr/ports/devel, but with 1536 ports, it's easy to miss things. Greg -- The virus contained in this message was not detected. Finger grog@FreeBSD.org for PGP public key. See complete headers for address and phone numbers. --SDZNRjzUoAX9KAL/ Content-Type: application/pgp-signature Content-Disposition: inline -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.2.6 (FreeBSD) iD8DBQFCw3xhIubykFB6QiMRArVeAJ44LLY4kxYWtXXYi/gh9Z8YjDV2qQCeJNie owqtP8yYQsiK474hLl4tw+Q= =NWwP -----END PGP SIGNATURE----- --SDZNRjzUoAX9KAL/-- From owner-freebsd-hackers@FreeBSD.ORG Thu Jun 30 05:06:37 2005 Return-Path: X-Original-To: freebsd-hackers@freebsd.org 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 C87CD16A41C for ; Thu, 30 Jun 2005 05:06:37 +0000 (GMT) (envelope-from fbsd.hackers@gmail.com) Received: from rproxy.gmail.com (rproxy.gmail.com [64.233.170.201]) by mx1.FreeBSD.org (Postfix) with ESMTP id 655BD43D48 for ; Thu, 30 Jun 2005 05:06:37 +0000 (GMT) (envelope-from fbsd.hackers@gmail.com) Received: by rproxy.gmail.com with SMTP id i8so48430rne for ; Wed, 29 Jun 2005 22:06:36 -0700 (PDT) DomainKey-Signature: a=rsa-sha1; q=dns; c=nofws; s=beta; d=gmail.com; h=received:message-id:date:from:reply-to:to:subject:cc:in-reply-to:mime-version:content-type:content-transfer-encoding:content-disposition:references; b=B57d1ez0rnEBtX/d2ZDmzLbXHO7JpLrXzBCVi4X3Vefzbf0Jx8OXBOpY2xTa1g2XKndcwOKTtTVfHdrA2TBgRVnsTvgQYDFtM0Yl7ypuGkXLKfC/pgZEDFMlaioRWiEgh5wSK2qujG5Fl4a8GWSuZ3HK+2zRymC8FqY6euWGcPc= Received: by 10.38.181.12 with SMTP id d12mr335291rnf; Wed, 29 Jun 2005 22:06:36 -0700 (PDT) Received: by 10.38.11.46 with HTTP; Wed, 29 Jun 2005 22:06:36 -0700 (PDT) Message-ID: Date: Thu, 30 Jun 2005 01:06:36 -0400 From: Pablo Mora To: John Baldwin In-Reply-To: <200506290501.31301.jhb@FreeBSD.org> Mime-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: quoted-printable Content-Disposition: inline References: <200506271318.36748.jhb@FreeBSD.org> <200506290501.31301.jhb@FreeBSD.org> Cc: freebsd-hackers@freebsd.org Subject: Re: problem handling POSIX thread on FreeBSD X-BeenThere: freebsd-hackers@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list Reply-To: Pablo Mora List-Id: Technical Discussions relating to FreeBSD List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 30 Jun 2005 05:06:37 -0000 >Not sure I understand the question. What do you mean by S.O? =20 , sorry by my badly english, the correct word is O.S (operative system). >you saying that since the threads are POSIX, that you would >expect the program to act the same on all Operating Systems? exactly, that thought before your answer. I thought that a same code was executed of the same form so much in Solaris, in GNU/Linux and FreeBSD. At least than had shown the same results. really I do not know because Linux and solaris they show me: hilo1: puntero contiene 0 hilo2: puntero contiene 0 hilo1: puntero contiene 0 hilo2: puntero contiene 3 hilo1: puntero contiene 2 hilo2: puntero contiene 6 hilo1: puntero contiene 4 hilo2: puntero contiene 9 hilo1: puntero contiene 6 hilo2: puntero contiene 12 hilo1: puntero contiene 8 hilo2: puntero contiene 15 hilo1: puntero contiene 10 hilo2: puntero contiene 18 hilo1: puntero contiene 12 hilo2: puntero contiene 21 hilo1: puntero contiene 14 hilo2: puntero contiene 24 hilo1: puntero contiene 16 finaliza hilo1 con id 1082231728 hilo2: puntero contiene 27 finaliza hilo2 con id 1090624432 fin hilo 2 sadly in my university we work with Solaris:' ( ---------------------------------------------------------------------------= ----------------------- I repeat part of the code: /* file: test.c */ .... #include char buffer[512]; pthread_mutex_t mutex, mutex2; pthread_t hilo1, hilo2; void f1(void* ptr) { int i,n=3D10; int valor=3D0; char*p=3D(char*)ptr; for(i=3D0;i X-Original-To: freebsd-hackers@freebsd.org 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 87E5516A41C for ; Thu, 30 Jun 2005 11:03:22 +0000 (GMT) (envelope-from des@des.no) Received: from tim.des.no (tim.des.no [194.63.250.121]) by mx1.FreeBSD.org (Postfix) with ESMTP id 3F3A543D55 for ; Thu, 30 Jun 2005 11:03:22 +0000 (GMT) (envelope-from des@des.no) Received: from tim.des.no (localhost [127.0.0.1]) by spam.des.no (Postfix) with ESMTP id D885760F5; Thu, 30 Jun 2005 13:03:16 +0200 (CEST) Received: from xps.des.no (des.no [80.203.228.37]) by tim.des.no (Postfix) with ESMTP id C79E360ED; Thu, 30 Jun 2005 13:03:16 +0200 (CEST) Received: by xps.des.no (Postfix, from userid 1001) id B6B8F33C74; Thu, 30 Jun 2005 13:03:16 +0200 (CEST) To: "Gayn Winters" References: <003701c57d17$a3068340$c901a8c0@workdog> From: des@des.no (=?iso-8859-1?q?Dag-Erling_Sm=F8rgrav?=) Date: Thu, 30 Jun 2005 13:03:16 +0200 In-Reply-To: <003701c57d17$a3068340$c901a8c0@workdog> (Gayn Winters's message of "Wed, 29 Jun 2005 19:01:31 -0700") Message-ID: <86y88shzt7.fsf@xps.des.no> User-Agent: Gnus/5.110002 (No Gnus v0.2) Emacs/21.3 (berkeley-unix) MIME-Version: 1.0 Content-Type: text/plain; charset=iso-8859-1 Content-Transfer-Encoding: quoted-printable X-Spam-Tests: ALL_TRUSTED,AWL,BAYES_00 X-Spam-Learn: ham X-Spam-Score: -5.2/5.0 X-Spam-Checker-Version: SpamAssassin 3.0.4 (2005-06-05) on tim.des.no Cc: freebsd-hackers@freebsd.org Subject: Re: ICH6R RAID X-BeenThere: freebsd-hackers@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: Technical Discussions relating to FreeBSD List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 30 Jun 2005 11:03:22 -0000 "Gayn Winters" writes: > Now man ata(4) indicates that only up to ICH5 is supported in 5.4 while > up to ICH6 is supported in 6.0, but the hardware archives indicate that > sos's MK3 patches made it into 5.4-RELEASE, and 6.0 "fully" supports the > ICH6R. However, I'm actually not sure the precise story here. 5.4 does not have MK3. > Has anyone out there actually booted FreeBSD using mirrored SATA drives > with an ICH6R? If so, how did you do it and what version did you use? Nothing special. I started out with a hand-rolled bootable livecd of -CURRENT with the MK3 patches when they first became available, and did a manual install (no sysinstall, fdisk + disklabel + newfs + tar) DES --=20 Dag-Erling Sm=F8rgrav - des@des.no From owner-freebsd-hackers@FreeBSD.ORG Thu Jun 30 12:15:43 2005 Return-Path: X-Original-To: freebsd-hackers@freebsd.org 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 0B6ED16A41C for ; Thu, 30 Jun 2005 12:15:43 +0000 (GMT) (envelope-from max@love2party.net) Received: from moutng.kundenserver.de (moutng.kundenserver.de [212.227.126.183]) by mx1.FreeBSD.org (Postfix) with ESMTP id 8F9EE43D53 for ; Thu, 30 Jun 2005 12:15:42 +0000 (GMT) (envelope-from max@love2party.net) Received: from p54A3E725.dip.t-dialin.net [84.163.231.37] (helo=donor.laier.local) by mrelayeu.kundenserver.de with ESMTP (Nemesis), id 0MKwtQ-1DnxxE0804-0007xu; Thu, 30 Jun 2005 14:15:40 +0200 From: Max Laier To: freebsd-hackers@freebsd.org Date: Thu, 30 Jun 2005 14:15:31 +0200 User-Agent: KMail/1.8 References: <000d01c57cf7$b9b6f9f0$29931bd9@ertpc> In-Reply-To: <000d01c57cf7$b9b6f9f0$29931bd9@ertpc> MIME-Version: 1.0 Content-Type: multipart/signed; boundary="nextPart1192332.03hU8Kq6Lb"; protocol="application/pgp-signature"; micalg=pgp-sha1 Content-Transfer-Encoding: 7bit Message-Id: <200506301415.38106.max@love2party.net> X-Provags-ID: kundenserver.de abuse@kundenserver.de login:61c499deaeeba3ba5be80f48ecc83056 Cc: ant Subject: Re: hot path optimizations in uma_zalloc() & uma_zfree() X-BeenThere: freebsd-hackers@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: Technical Discussions relating to FreeBSD List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 30 Jun 2005 12:15:43 -0000 --nextPart1192332.03hU8Kq6Lb Content-Type: text/plain; charset="koi8-r" Content-Transfer-Encoding: quoted-printable Content-Disposition: inline On Thursday 30 June 2005 00:08, ant wrote: > I just tryed to make buckets management in perCPU cache like in > Solaris (see paper of Jeff Bonwick - Magazines and Vmem) > and got perfomance gain around 10% in my test program. > Then i made another minor code optimization and got another 10%. > The program just creates and destroys sockets in loop. > > I suppose the reason of first gain lies in increasing of cpu cache hits. > In current fbsd code allocations and freeings deal with > separate buckets. Buckets are changed when one of them > became full or empty first. In Solaris this work is pure LIFO: > i.e. alloc() and free() work with one bucket - the current bucket > (it is called magazine there), that's why cache hit rate is bigger. > > Another optimization is very trivial, for example: > - bucket->ub_cnt--; > - item =3D bucket->ub_bucket[bucket->ub_cnt]; > + item =3D bucket->ub_bucket[--bucket->ub_cnt]; > (see the patch) Might be me, but this doesn't change the generated object code at all (modu= lo=20 the changed __line__ in debugging). > the patch is for uma_core.c from RELENG_5, but i checked > uma_core.c in CURRENT - it's the same regarding to thiese > improvements. I don't have any commit rights, so the patch > is just for reviewing. Here it is: > > --- sys/vm/uma_core.c.orig Wed Jun 29 21:46:52 2005 > +++ sys/vm/uma_core.c Wed Jun 29 23:09:32 2005 > @@ -1830,8 +1830,7 @@ > > if (bucket) { > if (bucket->ub_cnt > 0) { > - bucket->ub_cnt--; > - item =3D bucket->ub_bucket[bucket->ub_cnt]; > + item =3D bucket->ub_bucket[--bucket->ub_cnt]; > #ifdef INVARIANTS > bucket->ub_bucket[bucket->ub_cnt] =3D NULL; > #endif Okay, but no effect according to my reading of the object code. > @@ -2263,8 +2262,7 @@ > if (bucket->ub_cnt < bucket->ub_entries) { > KASSERT(bucket->ub_bucket[bucket->ub_cnt] =3D=3D NULL, > ("uma_zfree: Freeing to non free bucket index.")); > - bucket->ub_bucket[bucket->ub_cnt] =3D item; > - bucket->ub_cnt++; > + bucket->ub_bucket[bucket->ub_cnt++] =3D item; This changes semantics, as far as I understand. Might be a consequence of = the=20 other work you are doing, but doesn't seem right from a first glance. =2D-=20 /"\ Best regards, | mlaier@freebsd.org \ / Max Laier | ICQ #67774661 X http://pf4freebsd.love2party.net/ | mlaier@EFnet / \ ASCII Ribbon Campaign | Against HTML Mail and News --nextPart1192332.03hU8Kq6Lb Content-Type: application/pgp-signature -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.4.1 (FreeBSD) iD8DBQBCw+JqXyyEoT62BG0RAr95AJ9vjKZpC3esckfOCbHaqLwJvG5VmgCeJWsY bp4IPxkZoF6bHvZ0fYJUoHc= =80+J -----END PGP SIGNATURE----- --nextPart1192332.03hU8Kq6Lb-- From owner-freebsd-hackers@FreeBSD.ORG Thu Jun 30 03:38:00 2005 Return-Path: X-Original-To: hackers@FreeBSD.org 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 7C71416A41C; Thu, 30 Jun 2005 03:38:00 +0000 (GMT) (envelope-from jroberson@chesapeake.net) Received: from webaccess-cl.virtdom.com (webaccess-cl.virtdom.com [12.26.83.25]) by mx1.FreeBSD.org (Postfix) with ESMTP id EDC8243D1D; Thu, 30 Jun 2005 03:37:59 +0000 (GMT) (envelope-from jroberson@chesapeake.net) Received: from [10.0.0.1] (67-40-23-118.tukw.qwest.net [67.40.23.118]) (authenticated bits=0) by webaccess-cl.virtdom.com (8.13.1/8.13.1) with ESMTP id j5U3buRU015803; Wed, 29 Jun 2005 23:37:57 -0400 (EDT) (envelope-from jroberson@chesapeake.net) Date: Wed, 29 Jun 2005 20:37:17 -0700 (PDT) From: Jeff Roberson X-X-Sender: jroberson@10.0.0.1 To: Robert Watson In-Reply-To: <20050629234429.A87930@fledge.watson.org> Message-ID: <20050629203638.V12343@10.0.0.1> References: <000d01c57cf7$b9b6f9f0$29931bd9@ertpc> <20050629234429.A87930@fledge.watson.org> MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII; format=flowed X-Virus-Scanned: clamd / ClamAV version 0.75.1, clamav-milter version 0.75c on webaccess-cl.virtdom.com X-Virus-Status: Clean X-Mailman-Approved-At: Thu, 30 Jun 2005 12:20:05 +0000 Cc: jeff@FreeBSD.org, hackers@FreeBSD.org, bmilekic@FreeBSD.org, ant Subject: Re: hot path optimizations in uma_zalloc() & uma_zfree() X-BeenThere: freebsd-hackers@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: Technical Discussions relating to FreeBSD List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 30 Jun 2005 03:38:00 -0000 On Wed, 29 Jun 2005, Robert Watson wrote: > > On Thu, 30 Jun 2005, ant wrote: > >> I just tryed to make buckets management in perCPU cache like in Solaris >> (see paper of Jeff Bonwick - Magazines and Vmem) and got perfomance gain >> around 10% in my test program. Then i made another minor code optimization >> and got another 10%. The program just creates and destroys sockets in loop. > > This sounds great -- I'm off to bed now (.uk time and all), but will run some > benchmarks locally tomorrow. I've recently started investigating using the > PMC support in 6.x to look at cache behavior in the network-related fast > paths, but haven't gotten too far as yet. > > Thanks, > > Robert N M Watson Do you keep two buckets still? If so, this is something that I've always intended to do, but never got around to. I'm glad someone has taken the initiative. Will review the patch shortly. > >> >> I suppose the reason of first gain lies in increasing of cpu cache hits. >> In current fbsd code allocations and freeings deal with >> separate buckets. Buckets are changed when one of them >> became full or empty first. In Solaris this work is pure LIFO: >> i.e. alloc() and free() work with one bucket - the current bucket >> (it is called magazine there), that's why cache hit rate is bigger. >> >> Another optimization is very trivial, for example: >> - bucket->ub_cnt--; >> - item = bucket->ub_bucket[bucket->ub_cnt]; >> + item = bucket->ub_bucket[--bucket->ub_cnt]; >> (see the patch) >> >> >> The test program: >> >> #include >> #include >> >> main(int argc, char *argv[]) >> { >> int *fd, n, i,j, iters=100000; >> >> n = atoi(argv[1]); >> fd = (int*) malloc(sizeof(*fd) * n); >> >> iters /= n; >> for (i=0; i> for (j=0; j> fd[j] = socket(AF_UNIX, SOCK_STREAM, 0); >> for (j=0; j> close(fd[j]); >> } >> } >> >> >> >> The results with current uma_core.c >> >>> time ./sockloop 1 # first arg is the >> number of sockets that created in one iteration >> 0.093u 2.650s 0:02.75 99.6% 5+180k 0+0io 0pf+0w >>> time ./sockloop 1 >> 0.108u 2.298s 0:02.41 99.1% 5+181k 0+0io 0pf+0w >>> time ./sockloop 1 >> 0.127u 2.278s 0:02.41 99.1% 5+177k 0+0io 0pf+0w >>> time ./sockloop 10 # number of iterations >> is changed according to arg (see code) >> 0.054u 2.239s 0:02.30 99.1% 5+181k 0+0io 0pf+0w >>> time ./sockloop 10 >> 0.069u 2.199s 0:02.27 99.1% 6+184k 0+0io 0pf+0w >>> time ./sockloop 10 >> 0.086u 2.185s 0:02.28 99.1% 5+178k 0+0io 0pf+0w >>> time ./sockloop 100 >> 0.101u 2.393s 0:02.51 99.2% 5+179k 0+0io 0pf+0w >>> time ./sockloop 100 >> 0.085u 2.505s 0:02.60 99.2% 5+180k 0+0io 0pf+0w >>> time ./sockloop 100 >> 0.054u 2.441s 0:02.50 99.6% 5+178k 0+0io 0pf+0w >>> time ./sockloop 1000 >> 0.093u 2.739s 0:02.84 99.2% 5+181k 0+0io 0pf+0w >>> time ./sockloop 1000 >> 0.085u 2.797s 0:02.89 99.3% 5+180k 0+0io 0pf+0w >>> time ./sockloop 1000 >> 0.117u 2.689s 0:02.82 98.9% 5+179k 0+0io 0pf+0w >> >> >> The results of first optimization (only buckets management) >> >>> time ./sockloop 1 >> 0.125u 1.938s 0:02.06 99.5% 5+180k 0+0io 0pf+0w >>> time ./sockloop 1 >> 0.070u 1.993s 0:02.06 100.0% 5+180k 0+0io 0pf+0w >>> time ./sockloop 1 >> 0.110u 1.953s 0:02.06 100.0% 5+177k 0+0io 0pf+0w >>> time ./sockloop 10 >> 0.093u 1.776s 0:01.87 99.4% 5+180k 0+0io 0pf+0w >>> time ./sockloop 10 >> 0.116u 1.754s 0:01.87 99.4% 5+181k 0+0io 0pf+0w >>> time ./sockloop 10 >> 0.093u 1.777s 0:01.87 99.4% 5+181k 0+0io 0pf+0w >>> time ./sockloop 100 >> 0.100u 2.182s 0:02.29 99.5% 5+180k 0+0io 0pf+0w >>> time ./sockloop 100 >> 0.093u 2.174s 0:02.27 99.5% 5+180k 0+0io 0pf+0w >>> time ./sockloop 100 >> 0.078u 2.158s 0:02.24 99.1% 5+180k 0+0io 0pf+0w >>> time ./sockloop 1000 >> 0.101u 2.403s 0:02.51 99.6% 5+180k 0+0io 0pf+0w >>> time ./sockloop 1000 >> 0.124u 2.381s 0:02.52 99.2% 5+180k 0+0io 0pf+0w >>> time ./sockloop 1000 >> 0.125u 2.373s 0:02.51 99.2% 5+178k 0+0io 0pf+0w >> >> >> >> The results of both optimizations >> >>> time ./sockloop 1 >> 0.062u 1.785s 0:01.85 99.4% 5+180k 0+0io 0pf+0w >>> time ./sockloop 1 >> 0.124u 1.722s 0:01.85 99.4% 5+180k 0+0io 0pf+0w >>> time ./sockloop 1 >> 0.087u 1.759s 0:01.85 98.9% 5+177k 0+0io 0pf+0w >>> time ./sockloop 10 >> 0.069u 1.684s 0:01.75 99.4% 5+181k 0+0io 0pf+0w >>> time ./sockloop 10 >> 0.070u 1.673s 0:01.74 100.0% 5+180k 0+0io 0pf+0w >>> time ./sockloop 10 >> 0.070u 1.672s 0:01.74 100.0% 5+177k 0+0io 0pf+0w >>> time ./sockloop 100 >> 0.077u 2.102s 0:02.18 99.5% 5+180k 0+0io 0pf+0w >>> time ./sockloop 100 >> 0.116u 2.062s 0:02.18 99.5% 5+180k 0+0io 0pf+0w >>> time ./sockloop 100 >> 0.055u 2.126s 0:02.19 99.0% 5+178k 0+0io 0pf+0w >>> time ./sockloop 1000 >> 0.077u 2.298s 0:02.39 98.7% 5+181k 0+0io 0pf+0w >>> time ./sockloop 1000 >> 0.070u 2.340s 0:02.42 99.5% 5+178k 0+0io 0pf+0w >>> time ./sockloop 1000 >> 0.054u 2.320s 0:02.39 99.1% 5+179k 0+0io 0pf+0w >> >> >> the patch is for uma_core.c from RELENG_5, but i checked >> uma_core.c in CURRENT - it's the same regarding to thiese >> improvements. I don't have any commit rights, so the patch >> is just for reviewing. Here it is: >> >> --- sys/vm/uma_core.c.orig Wed Jun 29 21:46:52 2005 >> +++ sys/vm/uma_core.c Wed Jun 29 23:09:32 2005 >> @@ -1830,8 +1830,7 @@ >> >> if (bucket) { >> if (bucket->ub_cnt > 0) { >> - bucket->ub_cnt--; >> - item = bucket->ub_bucket[bucket->ub_cnt]; >> + item = bucket->ub_bucket[--bucket->ub_cnt]; >> #ifdef INVARIANTS >> bucket->ub_bucket[bucket->ub_cnt] = NULL; >> #endif >> @@ -2252,7 +2251,7 @@ >> cache = &zone->uz_cpu[cpu]; >> >> zfree_start: >> - bucket = cache->uc_freebucket; >> + bucket = cache->uc_allocbucket; >> >> if (bucket) { >> /* >> @@ -2263,8 +2262,7 @@ >> if (bucket->ub_cnt < bucket->ub_entries) { >> KASSERT(bucket->ub_bucket[bucket->ub_cnt] == NULL, >> ("uma_zfree: Freeing to non free bucket index.")); >> - bucket->ub_bucket[bucket->ub_cnt] = item; >> - bucket->ub_cnt++; >> + bucket->ub_bucket[bucket->ub_cnt++] = item; >> #ifdef INVARIANTS >> ZONE_LOCK(zone); >> if (keg->uk_flags & UMA_ZONE_MALLOC) >> @@ -2275,7 +2273,7 @@ >> #endif >> CPU_UNLOCK(cpu); >> return; >> - } else if (cache->uc_allocbucket) { >> + } else if (cache->uc_freebucket) { >> #ifdef UMA_DEBUG_ALLOC >> printf("uma_zfree: Swapping buckets.\n"); >> #endif >> @@ -2283,8 +2281,7 @@ >> * We have run out of space in our freebucket. >> * See if we can switch with our alloc bucket. >> */ >> - if (cache->uc_allocbucket->ub_cnt < >> - cache->uc_freebucket->ub_cnt) { >> + if (cache->uc_freebucket->ub_cnt == 0) { >> bucket = cache->uc_freebucket; >> cache->uc_freebucket = cache->uc_allocbucket; >> cache->uc_allocbucket = bucket; >> >> >> if one will decide to commit first optimization (about buckets), >> then there must some adjustments be made also >> regarding correct statistics gathering. >> >> Regards, >> Andriy Tkachuk. >> >> >> >> _______________________________________________ >> freebsd-hackers@freebsd.org mailing list >> http://lists.freebsd.org/mailman/listinfo/freebsd-hackers >> To unsubscribe, send any mail to "freebsd-hackers-unsubscribe@freebsd.org" >> > From owner-freebsd-hackers@FreeBSD.ORG Thu Jun 30 13:00:06 2005 Return-Path: X-Original-To: hackers@FreeBSD.org 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 DAF5A16A41C; Thu, 30 Jun 2005 13:00:06 +0000 (GMT) (envelope-from andrit@ukr.net) Received: from kitty.ukr.net (kitty.ukr.net [212.42.65.67]) by mx1.FreeBSD.org (Postfix) with ESMTP id 7E09843D48; Thu, 30 Jun 2005 13:00:04 +0000 (GMT) (envelope-from andrit@ukr.net) Received: from dialup-146.209.sitel.com.ua ([217.27.146.209] helo=ertpc) by kitty.ukr.net with smtp ID 1Dnye9-000CAH-HL ; Thu, 30 Jun 2005 16:00:02 +0300 Message-ID: <007501c57d73$9ba574b0$d1921bd9@ertpc> From: "ant" To: "Jeff Roberson" , "Robert Watson" References: <000d01c57cf7$b9b6f9f0$29931bd9@ertpc> <20050629234429.A87930@fledge.watson.org> <20050629203638.V12343@10.0.0.1> Date: Thu, 30 Jun 2005 15:52:39 +0300 MIME-Version: 1.0 Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: 7bit X-Priority: 3 X-MSMail-Priority: Normal X-Mailer: Microsoft Outlook Express 6.00.2600.0000 X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2600.0000 Cc: jeff@FreeBSD.org, hackers@FreeBSD.org, bmilekic@FreeBSD.org Subject: Re: hot path optimizations in uma_zalloc() & uma_zfree() X-BeenThere: freebsd-hackers@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: Technical Discussions relating to FreeBSD List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 30 Jun 2005 13:00:07 -0000 > Do you keep two buckets still? If so, this is something that I've always > intended to do, but never got around to. I'm glad someone has taken the > initiative. Will review the patch shortly. yes, shure. Linux keeps only one array, that is 2 times large of bucket and it copies half of this array from or to buckets. The positive effect of this, that in balanced allocs & frees (and when number of allocs or frees in one iteration is not larger than bucket size) they will deal only with one array without some switches. In our case, there may be balanced situations, when we will have continuousely switching between buckets. Anyway, the drawback of linux approach is the copy operation. In more general cases i suppose it will be slower. Anyway we still need 2 buckets, else insted of switching between them we will have thrashing in switching between our bucket and full or free zone's list, which must be made with zone's locking. -- Andriy Tkachuk. From owner-freebsd-hackers@FreeBSD.ORG Thu Jun 30 13:27:35 2005 Return-Path: X-Original-To: hackers@freebsd.org 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 C116D16A41C for ; Thu, 30 Jun 2005 13:27:35 +0000 (GMT) (envelope-from gustavodn@gmail.com) Received: from wproxy.gmail.com (wproxy.gmail.com [64.233.184.195]) by mx1.FreeBSD.org (Postfix) with ESMTP id 7D89B43D1D for ; Thu, 30 Jun 2005 13:27:35 +0000 (GMT) (envelope-from gustavodn@gmail.com) Received: by wproxy.gmail.com with SMTP id i4so92058wra for ; Thu, 30 Jun 2005 06:27:34 -0700 (PDT) DomainKey-Signature: a=rsa-sha1; q=dns; c=nofws; s=beta; d=gmail.com; h=received:message-id:date:from:reply-to:to:subject:in-reply-to:mime-version:content-type:content-transfer-encoding:content-disposition:references; b=Cc9k6r2BpYbpHzeT/Do4VZwPLcLGFWuQte7jmjqptTste2+8OiYN+VLEuc/UEAxpi8dsw+4nCyW6NRuq00Q7VkaVlWiDw8tGyfPddvvUg2d6upbda9igwGC0Ldetv6IHpWQrFm//fZkDdV5rK6rP8XjZlGibd61UfRx32/XEjGU= Received: by 10.54.47.59 with SMTP id u59mr370090wru; Thu, 30 Jun 2005 06:27:34 -0700 (PDT) Received: by 10.54.34.25 with HTTP; Thu, 30 Jun 2005 06:27:34 -0700 (PDT) Message-ID: <50af0a2605063006273cd0af03@mail.gmail.com> Date: Thu, 30 Jun 2005 10:27:34 -0300 From: Gustavo De Nardin To: hackers@freebsd.org In-Reply-To: <20050630050017.GU31528@wantadilla.lemis.com> Mime-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: quoted-printable Content-Disposition: inline References: <20050630050017.GU31528@wantadilla.lemis.com> Cc: Subject: Re: Suurce code navigation tools with call graph? X-BeenThere: freebsd-hackers@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list Reply-To: x List-Id: Technical Discussions relating to FreeBSD List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 30 Jun 2005 13:27:35 -0000 On 30/06/05, Greg 'groggy' Lehey wrote: > Does anybody have a better tool? And yes, I've looked through > /usr/ports/devel, but with 1536 ports, it's easy to miss things. I like Global: /usr/ports/devel/global --=20 (nil) From owner-freebsd-hackers@FreeBSD.ORG Thu Jun 30 13:30:02 2005 Return-Path: X-Original-To: hackers@freebsd.org 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 085A516A41C for ; Thu, 30 Jun 2005 13:30:02 +0000 (GMT) (envelope-from gustavodn@gmail.com) Received: from wproxy.gmail.com (wproxy.gmail.com [64.233.184.196]) by mx1.FreeBSD.org (Postfix) with ESMTP id AB8A943D4C for ; Thu, 30 Jun 2005 13:30:01 +0000 (GMT) (envelope-from gustavodn@gmail.com) Received: by wproxy.gmail.com with SMTP id i4so92511wra for ; Thu, 30 Jun 2005 06:30:01 -0700 (PDT) DomainKey-Signature: a=rsa-sha1; q=dns; c=nofws; s=beta; d=gmail.com; h=received:message-id:date:from:reply-to:to:subject:in-reply-to:mime-version:content-type:content-transfer-encoding:content-disposition:references; b=HN78DR7g5wbf8VDZi98zGgDQwOe/rWC3x1R0pFgZ537k6TZi5bBoZeVDtlQUwkQwZlJxllGhTslhSKuKZA5GA33MO1H3fDKAJSr302uXkptQ+6xjxRnxR7Ofes7Rszo8iDrzhyDf8O5xUSrXy8R3eNphsub3NM1UBcQdtKUiBLI= Received: by 10.54.39.67 with SMTP id m67mr381497wrm; Thu, 30 Jun 2005 06:30:00 -0700 (PDT) Received: by 10.54.34.25 with HTTP; Thu, 30 Jun 2005 06:30:00 -0700 (PDT) Message-ID: <50af0a2605063006306ab2054d@mail.gmail.com> Date: Thu, 30 Jun 2005 10:30:00 -0300 From: Gustavo De Nardin To: hackers@freebsd.org In-Reply-To: <50af0a2605063006273cd0af03@mail.gmail.com> Mime-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: quoted-printable Content-Disposition: inline References: <20050630050017.GU31528@wantadilla.lemis.com> <50af0a2605063006273cd0af03@mail.gmail.com> Cc: Subject: Re: Suurce code navigation tools with call graph? X-BeenThere: freebsd-hackers@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list Reply-To: x List-Id: Technical Discussions relating to FreeBSD List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 30 Jun 2005 13:30:02 -0000 On 30/06/05, Gustavo De Nardin wrote: > I like Global: >=20 > /usr/ports/devel/global >=20 > (Sorry for the re-reply...) ... a quick usage guide: cd src gtags htags lynx ./HTML --=20 (nil) From owner-freebsd-hackers@FreeBSD.ORG Thu Jun 30 13:32:20 2005 Return-Path: X-Original-To: freebsd-hackers@freebsd.org 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 BAC6A16A41C for ; Thu, 30 Jun 2005 13:32:20 +0000 (GMT) (envelope-from max@love2party.net) Received: from moutng.kundenserver.de (moutng.kundenserver.de [212.227.126.188]) by mx1.FreeBSD.org (Postfix) with ESMTP id 4F05D43D4C for ; Thu, 30 Jun 2005 13:32:20 +0000 (GMT) (envelope-from max@love2party.net) Received: from p54A3E725.dip.t-dialin.net [84.163.231.37] (helo=donor.laier.local) by mrelayeu.kundenserver.de with ESMTP (Nemesis), id 0MKwtQ-1Dnz9O2CpK-0005Li; Thu, 30 Jun 2005 15:32:18 +0200 From: Max Laier To: freebsd-hackers@freebsd.org Date: Thu, 30 Jun 2005 15:32:10 +0200 User-Agent: KMail/1.8 References: <000d01c57cf7$b9b6f9f0$29931bd9@ertpc> <200506301415.38106.max@love2party.net> In-Reply-To: <200506301415.38106.max@love2party.net> MIME-Version: 1.0 Content-Type: multipart/signed; boundary="nextPart5186526.3QMbNfkO8T"; protocol="application/pgp-signature"; micalg=pgp-sha1 Content-Transfer-Encoding: 7bit Message-Id: <200506301532.16330.max@love2party.net> X-Provags-ID: kundenserver.de abuse@kundenserver.de login:61c499deaeeba3ba5be80f48ecc83056 Cc: ant Subject: Re: hot path optimizations in uma_zalloc() & uma_zfree() X-BeenThere: freebsd-hackers@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: Technical Discussions relating to FreeBSD List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 30 Jun 2005 13:32:20 -0000 --nextPart5186526.3QMbNfkO8T Content-Type: text/plain; charset="iso-8859-6" Content-Transfer-Encoding: quoted-printable Content-Disposition: inline On Thursday 30 June 2005 14:15, Max Laier wrote: > On Thursday 30 June 2005 00:08, ant wrote: > > @@ -2263,8 +2262,7 @@ > > if (bucket->ub_cnt < bucket->ub_entries) { > > KASSERT(bucket->ub_bucket[bucket->ub_cnt] =3D=3D NULL, > > ("uma_zfree: Freeing to non free bucket index.")); > > - bucket->ub_bucket[bucket->ub_cnt] =3D item; > > - bucket->ub_cnt++; > > + bucket->ub_bucket[bucket->ub_cnt++] =3D item; > > This changes semantics, as far as I understand. Might be a consequence of > the other work you are doing, but doesn't seem right from a first glance. Ignore that, I was reading things backward - sorry for the noise. =2D-=20 /"\ Best regards, | mlaier@freebsd.org \ / Max Laier | ICQ #67774661 X http://pf4freebsd.love2party.net/ | mlaier@EFnet / \ ASCII Ribbon Campaign | Against HTML Mail and News --nextPart5186526.3QMbNfkO8T Content-Type: application/pgp-signature -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.4.1 (FreeBSD) iD8DBQBCw/RgXyyEoT62BG0RAiIzAJ9hXHpyKAxNI1uu4QIRHLnvVWacPgCfWFNT VGQb3sGFbbNGlVwiWqVbOGE= =vQUx -----END PGP SIGNATURE----- --nextPart5186526.3QMbNfkO8T-- From owner-freebsd-hackers@FreeBSD.ORG Thu Jun 30 13:41:39 2005 Return-Path: X-Original-To: hackers@freebsd.org 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 61A0116A41C; Thu, 30 Jun 2005 13:41:39 +0000 (GMT) (envelope-from evantd@washington.edu) Received: from innosense.washington.edu (c-24-19-1-105.hsd1.wa.comcast.net [24.19.1.105]) by mx1.FreeBSD.org (Postfix) with ESMTP id 3FFCD43D4C; Thu, 30 Jun 2005 13:41:39 +0000 (GMT) (envelope-from evantd@washington.edu) Received: by innosense.washington.edu (Postfix, from userid 1001) id B642CBF31; Thu, 30 Jun 2005 06:40:25 -0700 (PDT) Date: Thu, 30 Jun 2005 06:40:25 -0700 From: Evan Dower To: Greg 'groggy' Lehey Message-ID: <20050630134025.GI54283@innosense.washington.edu> References: <20050630050017.GU31528@wantadilla.lemis.com> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20050630050017.GU31528@wantadilla.lemis.com> User-Agent: Mutt/1.4.2.1i Cc: FreeBSD Hackers Subject: Re: Suurce code navigation tools with call graph? X-BeenThere: freebsd-hackers@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: Technical Discussions relating to FreeBSD List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 30 Jun 2005 13:41:39 -0000 I am reminded of Thu, Jun 30, 2005 at 02:30:17PM +0930 when Greg 'groggy' Lehey said: > I'm currently in the position of needing to cut a large program into > two halves and insert a clean API between them. To do this I need to > get a good understanding of how the control flow works, and I'm > looking for tools that might help me. So far I've seen: > > - etags will follow the control flow downwards with the find-tag > command (M-. in Emacs). It's useful at times, but a little > pedestrian for what I want to do. > - cscope will show me all callers for a function. This is closer, but > it's still not overly easy to read. > - Source navigator (snavigator) gives a graphical representation of > the downwards control tree for a function. It doesn't seem to be > able to go in the other direction, i.e show what functions call a > specific function. > - doxygen does the same thing. Arguably the graphic representation is > nicer. > - kscope is a KDE wrapper for cscope. It seems to come closest to > what I'm looking for in that it will show the callers, but the form > in which it does so is painful. In particular, there doesn't seem > to be any way to view the source code round the call. > > If that's the best there is, I can live with it. But is it the best? > Does anybody have a better tool? And yes, I've looked through > /usr/ports/devel, but with 1536 ports, it's easy to miss things. > > Greg As I understand it, doxygen can be configured to produce both call graphs and called-by graphs. -- Evan Dower Software Development Engineer Amazon.com, Inc. Public key: http://students.washington.edu/evantd/pgp-pub-key.txt Key fingerprint = D321 FA24 4BDA F82D 53A9 5B27 7D15 5A4F 033F 887D From owner-freebsd-hackers@FreeBSD.ORG Thu Jun 30 13:55:10 2005 Return-Path: X-Original-To: freebsd-hackers@freebsd.org 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 82EBA16A41C; Thu, 30 Jun 2005 13:55:10 +0000 (GMT) (envelope-from jhb@FreeBSD.org) Received: from mv.twc.weather.com (mv.twc.weather.com [65.212.71.225]) by mx1.FreeBSD.org (Postfix) with ESMTP id 376FA43D1F; Thu, 30 Jun 2005 13:55:10 +0000 (GMT) (envelope-from jhb@FreeBSD.org) Received: from [10.50.41.231] (Not Verified[65.202.103.25]) by mv.twc.weather.com with NetIQ MailMarshal (v6, 0, 3, 8) id ; Thu, 30 Jun 2005 10:08:56 -0400 From: John Baldwin To: freebsd-hackers@freebsd.org Date: Thu, 30 Jun 2005 09:55:09 -0400 User-Agent: KMail/1.8 References: <000d01c57cf7$b9b6f9f0$29931bd9@ertpc> In-Reply-To: <000d01c57cf7$b9b6f9f0$29931bd9@ertpc> MIME-Version: 1.0 Content-Type: text/plain; charset="koi8-r" Content-Transfer-Encoding: 7bit Content-Disposition: inline Message-Id: <200506300955.10155.jhb@FreeBSD.org> Cc: hackers@freebsd.org, ant Subject: Re: hot path optimizations in uma_zalloc() & uma_zfree() X-BeenThere: freebsd-hackers@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: Technical Discussions relating to FreeBSD List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 30 Jun 2005 13:55:10 -0000 On Wednesday 29 June 2005 06:08 pm, ant wrote: > Hi folks. > > I just tryed to make buckets management in perCPU cache like in > Solaris (see paper of Jeff Bonwick - Magazines and Vmem) > and got perfomance gain around 10% in my test program. > Then i made another minor code optimization and got another 10%. > The program just creates and destroys sockets in loop. > > I suppose the reason of first gain lies in increasing of cpu cache hits. > In current fbsd code allocations and freeings deal with > separate buckets. Buckets are changed when one of them > became full or empty first. In Solaris this work is pure LIFO: > i.e. alloc() and free() work with one bucket - the current bucket > (it is called magazine there), that's why cache hit rate is bigger. > > Another optimization is very trivial, for example: > - bucket->ub_cnt--; > - item = bucket->ub_bucket[bucket->ub_cnt]; > + item = bucket->ub_bucket[--bucket->ub_cnt]; > (see the patch) This produces no change in the object code though as gcc is smart enough to implement both cases the same. I ran ministat against your tests with 1000 sockets loop and there isn't a lot of difference in the user times: x one.u + two.u * three.u +--------------------------------------------------------------------------+ |* * * x x + x ++ | | |__________A__M________| |_________M____A____|__________|_A______M_____|| +--------------------------------------------------------------------------+ N Min Max Median Avg Stddev x 3 0.085 0.117 0.093 0.098333333 0.016653328 + 3 0.101 0.125 0.124 0.11666667 0.013576941 No difference proven at 95.0% confidence * 3 0.054 0.077 0.07 0.067 0.011789826 No difference proven at 95.0% confidence There is some difference in the system times though: > /usr/src/tools/tools/ministat/ministat one.s two.s three.s x one.s + two.s * three.s +--------------------------------------------------------------------------+ |* * * ++ + x x x| ||__A__| |MA_| |_______A_______|| +--------------------------------------------------------------------------+ N Min Max Median Avg Stddev x 3 2.689 2.797 2.739 2.7416667 0.05404936 + 3 2.373 2.403 2.381 2.3856667 0.015534907 Difference at 95.0% confidence -0.356 +/- 0.0901334 -12.9848% +/- 3.28754% (Student's t, pooled s = 0.039766) * 3 2.298 2.34 2.32 2.3193333 0.021007935 Difference at 95.0% confidence -0.422333 +/- 0.0929396 -15.4043% +/- 3.38989% (Student's t, pooled s = 0.0410041) There is also some difference between the second and third runs though not huge. Given that your ++ and -- optimizations don't produce any actual changes in the compiled code I think that is more due to your testing environment. A much better test might be to reboot into single user mode and run the socket loop program with 10000 or 100000 sockets and run that in a loop 20 times for each case and log the output. That should give you some better benchmarks with less noise from your environment. If you haven't used ministat before (/usr/src/tools/tools/ministat), it's a neat little tool. You just hand it data files that contain one number per line and it does the work for you. Also, given that here are SMP implications here, it might be fruitful to have another benchmark which spawned several threads (one per CPU maybe?) and had each of them sit in the same loop. -- John Baldwin <>< http://www.FreeBSD.org/~jhb/ "Power Users Use the Power to Serve" = http://www.FreeBSD.org From owner-freebsd-hackers@FreeBSD.ORG Thu Jun 30 13:55:10 2005 Return-Path: X-Original-To: hackers@freebsd.org 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 82EBA16A41C; Thu, 30 Jun 2005 13:55:10 +0000 (GMT) (envelope-from jhb@FreeBSD.org) Received: from mv.twc.weather.com (mv.twc.weather.com [65.212.71.225]) by mx1.FreeBSD.org (Postfix) with ESMTP id 376FA43D1F; Thu, 30 Jun 2005 13:55:10 +0000 (GMT) (envelope-from jhb@FreeBSD.org) Received: from [10.50.41.231] (Not Verified[65.202.103.25]) by mv.twc.weather.com with NetIQ MailMarshal (v6, 0, 3, 8) id ; Thu, 30 Jun 2005 10:08:56 -0400 From: John Baldwin To: freebsd-hackers@freebsd.org Date: Thu, 30 Jun 2005 09:55:09 -0400 User-Agent: KMail/1.8 References: <000d01c57cf7$b9b6f9f0$29931bd9@ertpc> In-Reply-To: <000d01c57cf7$b9b6f9f0$29931bd9@ertpc> MIME-Version: 1.0 Content-Type: text/plain; charset="koi8-r" Content-Transfer-Encoding: 7bit Content-Disposition: inline Message-Id: <200506300955.10155.jhb@FreeBSD.org> Cc: hackers@freebsd.org, ant Subject: Re: hot path optimizations in uma_zalloc() & uma_zfree() X-BeenThere: freebsd-hackers@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: Technical Discussions relating to FreeBSD List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 30 Jun 2005 13:55:10 -0000 On Wednesday 29 June 2005 06:08 pm, ant wrote: > Hi folks. > > I just tryed to make buckets management in perCPU cache like in > Solaris (see paper of Jeff Bonwick - Magazines and Vmem) > and got perfomance gain around 10% in my test program. > Then i made another minor code optimization and got another 10%. > The program just creates and destroys sockets in loop. > > I suppose the reason of first gain lies in increasing of cpu cache hits. > In current fbsd code allocations and freeings deal with > separate buckets. Buckets are changed when one of them > became full or empty first. In Solaris this work is pure LIFO: > i.e. alloc() and free() work with one bucket - the current bucket > (it is called magazine there), that's why cache hit rate is bigger. > > Another optimization is very trivial, for example: > - bucket->ub_cnt--; > - item = bucket->ub_bucket[bucket->ub_cnt]; > + item = bucket->ub_bucket[--bucket->ub_cnt]; > (see the patch) This produces no change in the object code though as gcc is smart enough to implement both cases the same. I ran ministat against your tests with 1000 sockets loop and there isn't a lot of difference in the user times: x one.u + two.u * three.u +--------------------------------------------------------------------------+ |* * * x x + x ++ | | |__________A__M________| |_________M____A____|__________|_A______M_____|| +--------------------------------------------------------------------------+ N Min Max Median Avg Stddev x 3 0.085 0.117 0.093 0.098333333 0.016653328 + 3 0.101 0.125 0.124 0.11666667 0.013576941 No difference proven at 95.0% confidence * 3 0.054 0.077 0.07 0.067 0.011789826 No difference proven at 95.0% confidence There is some difference in the system times though: > /usr/src/tools/tools/ministat/ministat one.s two.s three.s x one.s + two.s * three.s +--------------------------------------------------------------------------+ |* * * ++ + x x x| ||__A__| |MA_| |_______A_______|| +--------------------------------------------------------------------------+ N Min Max Median Avg Stddev x 3 2.689 2.797 2.739 2.7416667 0.05404936 + 3 2.373 2.403 2.381 2.3856667 0.015534907 Difference at 95.0% confidence -0.356 +/- 0.0901334 -12.9848% +/- 3.28754% (Student's t, pooled s = 0.039766) * 3 2.298 2.34 2.32 2.3193333 0.021007935 Difference at 95.0% confidence -0.422333 +/- 0.0929396 -15.4043% +/- 3.38989% (Student's t, pooled s = 0.0410041) There is also some difference between the second and third runs though not huge. Given that your ++ and -- optimizations don't produce any actual changes in the compiled code I think that is more due to your testing environment. A much better test might be to reboot into single user mode and run the socket loop program with 10000 or 100000 sockets and run that in a loop 20 times for each case and log the output. That should give you some better benchmarks with less noise from your environment. If you haven't used ministat before (/usr/src/tools/tools/ministat), it's a neat little tool. You just hand it data files that contain one number per line and it does the work for you. Also, given that here are SMP implications here, it might be fruitful to have another benchmark which spawned several threads (one per CPU maybe?) and had each of them sit in the same loop. -- John Baldwin <>< http://www.FreeBSD.org/~jhb/ "Power Users Use the Power to Serve" = http://www.FreeBSD.org From owner-freebsd-hackers@FreeBSD.ORG Thu Jun 30 14:44:40 2005 Return-Path: X-Original-To: freebsd-hackers@freebsd.org 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 4433016A41C for ; Thu, 30 Jun 2005 14:44:40 +0000 (GMT) (envelope-from andrit@ukr.net) Received: from storage.ukr.net (storage.ukr.net [212.42.65.69]) by mx1.FreeBSD.org (Postfix) with ESMTP id EEC5543D1F for ; Thu, 30 Jun 2005 14:44:39 +0000 (GMT) (envelope-from andrit@ukr.net) Received: from dialup-146.222.sitel.com.ua ([217.27.146.222] helo=ertpc) by storage.ukr.net with smtp ID 1Do0HN-000HC9-J8 ; Thu, 30 Jun 2005 17:44:38 +0300 Message-ID: <003901c57d82$37891b80$de921bd9@ertpc> From: "Andriy Tkachuk" To: "Max Laier" , References: <000d01c57cf7$b9b6f9f0$29931bd9@ertpc> <200506301415.38106.max@love2party.net> Date: Thu, 30 Jun 2005 17:35:17 +0300 MIME-Version: 1.0 Content-Type: text/plain; charset="koi8-r" Content-Transfer-Encoding: 7bit X-Priority: 3 X-MSMail-Priority: Normal X-Mailer: Microsoft Outlook Express 6.00.2600.0000 X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2600.0000 Cc: Subject: Re: hot path optimizations in uma_zalloc() & uma_zfree() X-BeenThere: freebsd-hackers@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: Technical Discussions relating to FreeBSD List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 30 Jun 2005 14:44:40 -0000 I just checked the object code - you right, it almost the same: - bucket->ub_bucket[bucket->ub_cnt] = item; - 22b9: 0f bf 43 08 movswl 0x8(%ebx),%eax - 22bd: 8b 4d 0c mov 0xc(%ebp),%ecx - 22c0: 89 4c 83 0c mov %ecx,0xc(%ebx,%eax,4) - bucket->ub_cnt++; - 22c4: 8d 42 01 lea 0x1(%edx),%eax - 22c7: 66 89 43 08 mov %ax,0x8(%ebx) + bucket->ub_bucket[bucket->ub_cnt++] = item; + 22b9: 0f bf c2 movswl %dx,%eax + 22bc: 8b 4d 0c mov 0xc(%ebp),%ecx + 22bf: 89 4c 83 0c mov %ecx,0xc(%ebx,%eax,4) + 22c3: 8d 42 01 lea 0x1(%edx),%eax + 22c6: 66 89 43 08 mov %ax,0x8(%ebx) but still there is some minor difference in first line. I'm not familiar with assembler, can somebody explain whether this difference is assential or not? in decrementation there is no difference at all: - bucket->ub_cnt--; + item = bucket->ub_bucket[--bucket->ub_cnt]; 1bbe: 66 ff 49 08 decw 0x8(%ecx) - item = bucket->ub_bucket[bucket->ub_cnt]; 1bc2: 0f bf 41 08 movswl 0x8(%ecx),%eax 1bc6: 8b 44 81 0c mov 0xc(%ecx,%eax,4),%eax 1bca: 89 45 f0 mov %eax,0xfffffff0(%ebp) ----- Original Message ----- From: "Max Laier" To: Cc: "ant" Sent: Thursday, June 30, 2005 3:15 PM Subject: Re: hot path optimizations in uma_zalloc() & uma_zfree() > Another optimization is very trivial, for example: > - bucket->ub_cnt--; > - item = bucket->ub_bucket[bucket->ub_cnt]; > + item = bucket->ub_bucket[--bucket->ub_cnt]; > (see the patch) Might be me, but this doesn't change the generated object code at all (modulo the changed __line__ in debugging). From owner-freebsd-hackers@FreeBSD.ORG Thu Jun 30 15:15:47 2005 Return-Path: X-Original-To: freebsd-hackers@freebsd.org 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 3C3AE16A41F; Thu, 30 Jun 2005 15:15:47 +0000 (GMT) (envelope-from deischen@freebsd.org) Received: from mail.ntplx.net (mail.ntplx.net [204.213.176.10]) by mx1.FreeBSD.org (Postfix) with ESMTP id D48A343D53; Thu, 30 Jun 2005 15:15:46 +0000 (GMT) (envelope-from deischen@freebsd.org) Received: from sea.ntplx.net (sea.ntplx.net [204.213.176.11]) by mail.ntplx.net (8.13.4/8.13.4/NETPLEX) with ESMTP id j5UFFjPA024012; Thu, 30 Jun 2005 11:15:45 -0400 (EDT) Date: Thu, 30 Jun 2005 11:15:45 -0400 (EDT) From: Daniel Eischen X-X-Sender: eischen@sea.ntplx.net To: Pablo Mora In-Reply-To: Message-ID: MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII X-Virus-Scanned: by AMaViS and Clam AntiVirus (mail.ntplx.net) Cc: freebsd-hackers@freebsd.org Subject: Re: problem handling POSIX thread on FreeBSD X-BeenThere: freebsd-hackers@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list Reply-To: Daniel Eischen List-Id: Technical Discussions relating to FreeBSD List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 30 Jun 2005 15:15:47 -0000 On Thu, 30 Jun 2005, Pablo Mora wrote: > >Not sure I understand the question. What do you mean by S.O? > > , sorry by my badly english, the correct word is O.S (operative system). > > >you saying that since the threads are POSIX, that you would >expect > the program to act the same on all Operating Systems? > > exactly, that thought before your answer. I thought that a same code > was executed of the same form so much in Solaris, in GNU/Linux and > FreeBSD. At least than had shown the same results. Create your mutexes as PTHREAD_MUTEX_ERRORCHECK mutexes, then check the result of pthread_mutex_lock() and pthread_mutex_unlock(): pthread_mutexattr_t attr; pthread_mutex_t mutex1; pthread_mutex_t mutex2; ... pthread_mutexattr_init(&attr); pthread_mutexattr_settype(&attr, PTHREAD_MUTEX_ERRORCHECK); pthread_mutex_init(&mutex1, &attr); pthread_mutex_init(&mutex2, &attr); ... ret = pthread_mutex_lock(&mutex1); if (ret != 0) printf("pthread_mutex_lock on mutex1 failed, error %d\n", ret); ... ret = pthread_mutex_unlock(&mutex2); if (ret != 0) printf("pthread_mutex_unlock on mutex2 failed, error %d\n", ret); With your program modified as above, repeat your tests on Linux, Solaris, and FreeBSD. POSIX says this about pthread_mutex_lock() and pthread_mutex_unlock(): If the mutex type is PTHREAD_MUTEX_NORMAL, deadlock detection shall not be provided. Attempting to relock the mutex causes deadlock. If a thread attempts to unlock a mutex that it has not locked or a mutex which is unlocked, undefined behavior results. If the mutex type is PTHREAD_MUTEX_ERRORCHECK, then error checking shall be provided. If a thread attempts to relock a mutex that it has already locked, an error shall be returned. If a thread attempts to unlock a mutex that it has not locked or a mutex which is unlocked, an error shall be returned. If the mutex type is PTHREAD_MUTEX_RECURSIVE, then the mutex shall maintain the concept of a lock count. When a thread successfully acquires a mutex for the first time, the lock count shall be set to one. Every time a thread relocks this mutex, the lock count shall be incremented by one. Each time the thread unlocks the mutex, the lock count shall be decremented by one. When the lock count reaches zero, the mutex shall become available for other threads to acquire. If a thread attempts to unlock a mutex that it has not locked or a mutex which is unlocked, an error shall be returned. If the mutex type is PTHREAD_MUTEX_DEFAULT, attempting to recursively lock the mutex results in undefined behavior. Attempting to unlock the mutex if it was not locked by the calling thread results in undefined behavior. Attempting to unlock the mutex if it is not locked results in undefined behavior. Please do yourself a favor and buy or borrow the POSIX threads book John mentioned earlier (by Butenhof). -- DE From owner-freebsd-hackers@FreeBSD.ORG Thu Jun 30 16:31:39 2005 Return-Path: X-Original-To: hackers@freebsd.org 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 2DCCE16A41C for ; Thu, 30 Jun 2005 16:31:39 +0000 (GMT) (envelope-from ntarmos@All-Evil.ceid.upatras.gr) Received: from hermes.ceid.upatras.gr (hermes.ceid.upatras.gr [150.140.141.168]) by mx1.FreeBSD.org (Postfix) with SMTP id 0914F43D1F for ; Thu, 30 Jun 2005 16:31:37 +0000 (GMT) (envelope-from ntarmos@All-Evil.ceid.upatras.gr) Received: (qmail 21100 invoked by uid 1004); 30 Jun 2005 16:31:34 -0000 Received: from ntarmos@All-Evil.ceid.upatras.gr by hermes by uid 1001 with qmail-scanner-1.21st (clamscan: 0.70-rc. spamassassin: 2.63. Clear:RC:1(150.140.141.181):. Processed in 0.029316 secs); 30 Jun 2005 16:31:34 -0000 X-Qmail-Scanner-Mail-From: ntarmos@All-Evil.ceid.upatras.gr via hermes X-Qmail-Scanner: 1.21st (Clear:RC:1(150.140.141.181):. Processed in 0.029316 secs) Received: from diogenis.ceid.upatras.gr (150.140.141.181) by hermes.ceid.upatras.gr with SMTP; 30 Jun 2005 16:31:34 -0000 Received: (qmail 20720 invoked from network); 30 Jun 2005 16:31:33 -0000 Received: from all-evil.ceid.upatras.gr (150.140.143.230) by diogenis.ceid.upatras.gr with SMTP; 30 Jun 2005 16:31:33 -0000 Received: from localhost (localhost.localdomain [127.0.0.1]) by All-Evil.ceid.upatras.gr (Postfix) with ESMTP id C40FF33C4A; Thu, 30 Jun 2005 19:31:33 +0300 (EEST) Received: from All-Evil.ceid.upatras.gr ([127.0.0.1]) by localhost (All-Evil [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id 28394-09; Thu, 30 Jun 2005 19:31:26 +0300 (EEST) Received: by All-Evil.ceid.upatras.gr (Postfix, from userid 1000) id 7C28333B9B; Thu, 30 Jun 2005 19:31:26 +0300 (EEST) Date: Thu, 30 Jun 2005 19:31:26 +0300 From: Nikos Ntarmos To: ant Message-ID: <20050630163126.GA7365@diogenis.ceid.upatras.gr> References: <000d01c57cf7$b9b6f9f0$29931bd9@ertpc> Mime-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha1; protocol="application/pgp-signature"; boundary="61jdw2sOBCFtR2d/" Content-Disposition: inline In-Reply-To: <000d01c57cf7$b9b6f9f0$29931bd9@ertpc> Organization: NetCInS Lab., C.E.I.D., U. of Patras, Greece WWW-Homepage: http://noth.ceid.upatras.gr/ X-PGP-Fingerprint: 9680 60A7 DE60 0298 B1F0 9B22 9BA2 7569 CF95 160A Office-Phone: +30-2610-996919 Office-Fax: +30-2610-969011 GPS-Info: 38.2594N, 21.7428E User-Agent: Mutt/1.5.9i X-Virus-Scanned: by amavisd-new-20030616-p10 (Debian) at example.com Cc: hackers@freebsd.org Subject: Re: hot path optimizations in uma_zalloc() & uma_zfree() X-BeenThere: freebsd-hackers@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: Technical Discussions relating to FreeBSD List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 30 Jun 2005 16:31:39 -0000 --61jdw2sOBCFtR2d/ Content-Type: multipart/mixed; boundary="EVF5PPMfhYS0aIcm" Content-Disposition: inline --EVF5PPMfhYS0aIcm Content-Type: text/plain; charset=us-ascii Content-Disposition: inline Hi there. I wouldn't have gone into this if ant hadn't produced that 10% figure for the speed improvement with simply reordering of increments and dereferences (although jhb@ reported the speed-up he noticed was much less than that). I attach* a patch that: (i) incorporates ant's exchange of uc_freebucket for uc_allocbucket, and (ii) throws away the uma_bucket.ub_cnt counter of free bucket entries, in favor of a pointer -- uma_bucket.ub_last -- to the last free bucket entry. If a simple reordering is capable of producing a 10% improvement, this change should do much better, since it saves the 'add-' in the 'add-and-dereference' process of using arrays and counters. The semantics of the pointer closely follow those of the ub_cnt counter: ub_last - ub_bucket should equal the old value of ub_cnt. I grep'ed through the whole source repository and the uses of uma_bucket.ub_cnt seem confined within sys/vm/uma_core.c, so this change must be quite self-contained -- i.e. the change in the fields of uma_bucket doesn't seem to affect any other part of the system. One could argue that it may make the code a bit less readable, but it only affects uma_core.c, so it may be worth the "inconvenience". I don't have a FreeBSD box around any more, so I can't test this patch. Heck, I can't either check it for syntax errors and such, so don't throw things at me if this doesn't even compile. Can somebody with the time and resources give it a try? \n\n * Also online at http://noth.ceid.upatras.gr/Misc/uma_bucket.diff to avoid being bitten by mailers auto{wrapp,indent}ing the diff content. --EVF5PPMfhYS0aIcm Content-Type: text/plain; charset=us-ascii Content-Disposition: attachment; filename="uma_bucket.diff" Content-Transfer-Encoding: quoted-printable diff -urbB src.orig/sys/vm/uma_core.c src/sys/vm/uma_core.c --- src.orig/sys/vm/uma_core.c 2005-06-30 19:09:06.777623184 +0300 +++ src/sys/vm/uma_core.c 2005-06-30 19:12:59.907182104 +0300 @@ -322,7 +322,7 @@ #ifdef INVARIANTS bzero(bucket->ub_bucket, sizeof(void *) * ubz->ubz_entries); #endif - bucket->ub_cnt =3D 0; + bucket->ub_last =3D bucket->ub_bucket; bucket->ub_entries =3D ubz->ubz_entries; } =20 @@ -559,11 +559,11 @@ if (zone->uz_keg->uk_flags & UMA_ZONE_MALLOC) mzone =3D 1; =20 - while (bucket->ub_cnt > 0) { - bucket->ub_cnt--; - item =3D bucket->ub_bucket[bucket->ub_cnt]; + while (bucket->ub_last !=3D bucket->ub_bucket) { + bucket->ub_last--; + item =3D *(bucket->ub_last); #ifdef INVARIANTS - bucket->ub_bucket[bucket->ub_cnt] =3D NULL; + *(bucket->ub_last) =3D NULL; KASSERT(item !=3D NULL, ("bucket_drain: botched ptr, item is NULL")); #endif @@ -1820,11 +1820,11 @@ bucket =3D cache->uc_allocbucket; =20 if (bucket) { - if (bucket->ub_cnt > 0) { - bucket->ub_cnt--; - item =3D bucket->ub_bucket[bucket->ub_cnt]; + if (bucket->ub_last !=3D bucket->ub_bucket) { + bucket->ub_last--; + item =3D *(bucket->ub_last); #ifdef INVARIANTS - bucket->ub_bucket[bucket->ub_cnt] =3D NULL; + *(bucket->ub_last) =3D NULL; #endif KASSERT(item !=3D NULL, ("uma_zalloc: Bucket pointer mangled.")); @@ -1851,7 +1851,7 @@ * We have run out of items in our allocbucket. * See if we can switch with our free bucket. */ - if (cache->uc_freebucket->ub_cnt > 0) { + if (cache->uc_freebucket->ub_last !=3D cache->uc_freebucket->ub_bucket)= { #ifdef UMA_DEBUG_ALLOC printf("uma_zalloc: Swapping empty with" " alloc.\n"); @@ -1880,12 +1880,12 @@ cache =3D &zone->uz_cpu[cpu]; bucket =3D cache->uc_allocbucket; if (bucket !=3D NULL) { - if (bucket->ub_cnt > 0) { + if (bucket->ub_last !=3D bucket->ub_bucket) { ZONE_UNLOCK(zone); goto zalloc_start; } bucket =3D cache->uc_freebucket; - if (bucket !=3D NULL && bucket->ub_cnt > 0) { + if (bucket !=3D NULL && bucket->ub_last !=3D bucket->ub_bucket) { ZONE_UNLOCK(zone); goto zalloc_start; } @@ -1897,7 +1897,7 @@ =20 /* Our old one is now a free bucket */ if (cache->uc_allocbucket) { - KASSERT(cache->uc_allocbucket->ub_cnt =3D=3D 0, + KASSERT(cache->uc_allocbucket->ub_last =3D=3D cache->uc_allocbucket->ub_= backet, ("uma_zalloc_arg: Freeing a non free bucket.")); LIST_INSERT_HEAD(&zone->uz_free_bucket, cache->uc_allocbucket, ub_link); @@ -1906,7 +1906,7 @@ =20 /* Check the free list for a new alloc bucket */ if ((bucket =3D LIST_FIRST(&zone->uz_full_bucket)) !=3D NULL) { - KASSERT(bucket->ub_cnt !=3D 0, + KASSERT(bucket->ub_last !=3D bucket->ub_bucket, ("uma_zalloc_arg: Returning an empty bucket.")); =20 LIST_REMOVE(bucket, ub_link); @@ -2069,14 +2069,14 @@ { uma_bucket_t bucket; uma_slab_t slab; - int16_t saved; + void ** saved; int max, origflags =3D flags; =20 /* * Try this zone's free list first so we don't allocate extra buckets. */ if ((bucket =3D LIST_FIRST(&zone->uz_free_bucket)) !=3D NULL) { - KASSERT(bucket->ub_cnt =3D=3D 0, + KASSERT(bucket->ub_last =3D=3D bucket->ub_bucket, ("uma_zalloc_bucket: Bucket on free list is not empty.")); LIST_REMOVE(bucket, ub_link); } else { @@ -2106,14 +2106,13 @@ #endif zone->uz_fills++; =20 - max =3D MIN(bucket->ub_entries, zone->uz_count); + max =3D bucket->ub_bucket + MIN(bucket->ub_entries, zone->uz_count); /* Try to keep the buckets totally full */ - saved =3D bucket->ub_cnt; - while (bucket->ub_cnt < max && + saved =3D bucket->ub_last; + while (bucket->ub_last < max && (slab =3D uma_zone_slab(zone, flags)) !=3D NULL) { - while (slab->us_freecount && bucket->ub_cnt < max) { - bucket->ub_bucket[bucket->ub_cnt++] =3D - uma_slab_alloc(zone, slab); + while (slab->us_freecount && bucket->ub_last < max) { + *(bucket->ub_last++) =3D uma_slab_alloc(zone, slab); } =20 /* Don't block on the next fill */ @@ -2128,34 +2127,34 @@ * own it. */ if (zone->uz_init !=3D NULL) { - int i; + void ** i; =20 ZONE_UNLOCK(zone); - for (i =3D saved; i < bucket->ub_cnt; i++) - if (zone->uz_init(bucket->ub_bucket[i], + for (i =3D saved; i < bucket->ub_last; i++) + if (zone->uz_init(*i, zone->uz_keg->uk_size, origflags) !=3D 0) break; /* * If we couldn't initialize the whole bucket, put the * rest back onto the freelist. */ - if (i !=3D bucket->ub_cnt) { - int j; + if (i !=3D bucket->ub_last) { + void ** j; =20 - for (j =3D i; j < bucket->ub_cnt; j++) { - uma_zfree_internal(zone, bucket->ub_bucket[j], + for (j =3D i; j < bucket->ub_last; j++) { + uma_zfree_internal(zone, *j, NULL, SKIP_FINI); #ifdef INVARIANTS - bucket->ub_bucket[j] =3D NULL; + (*j) =3D NULL; #endif } - bucket->ub_cnt =3D i; + bucket->ub_last =3D i; } ZONE_LOCK(zone); } =20 zone->uz_fills--; - if (bucket->ub_cnt !=3D 0) { + if (bucket->ub_last !=3D bucket->ub_bucket) { LIST_INSERT_HEAD(&zone->uz_full_bucket, bucket, ub_link); return (1); @@ -2281,7 +2280,7 @@ cache =3D &zone->uz_cpu[cpu]; =20 zfree_start: - bucket =3D cache->uc_freebucket; + bucket =3D cache->uc_allocbucket; =20 if (bucket) { /* @@ -2289,14 +2288,14 @@ * check to be slightly out of sync. */ =20 - if (bucket->ub_cnt < bucket->ub_entries) { - KASSERT(bucket->ub_bucket[bucket->ub_cnt] =3D=3D NULL, + if (bucket->ub_last < (bucket->ub_bucket + bucket->ub_entries)) { + KASSERT(*(bucket->ub_last) =3D=3D NULL, ("uma_zfree: Freeing to non free bucket index.")); - bucket->ub_bucket[bucket->ub_cnt] =3D item; - bucket->ub_cnt++; + *(bucket->ub_last) =3D item; + bucket->ub_last++; critical_exit(); return; - } else if (cache->uc_allocbucket) { + } else if (cache->uc_freebucket) { #ifdef UMA_DEBUG_ALLOC printf("uma_zfree: Swapping buckets.\n"); #endif @@ -2304,8 +2303,7 @@ * We have run out of space in our freebucket. * See if we can switch with our alloc bucket. */ - if (cache->uc_allocbucket->ub_cnt < - cache->uc_freebucket->ub_cnt) { + if (cache->uc_freebucket->ub_last =3D=3D cache->uc_freebucket->ub_bucke= t) { bucket =3D cache->uc_freebucket; cache->uc_freebucket =3D cache->uc_allocbucket; cache->uc_allocbucket =3D bucket; @@ -2332,14 +2330,14 @@ cpu =3D curcpu; cache =3D &zone->uz_cpu[cpu]; if (cache->uc_freebucket !=3D NULL) { - if (cache->uc_freebucket->ub_cnt < + if ((cache->uc_freebucket->ub_last - cache->uc_freebucket->ub_bucket) < cache->uc_freebucket->ub_entries) { ZONE_UNLOCK(zone); goto zfree_start; } if (cache->uc_allocbucket !=3D NULL && - (cache->uc_allocbucket->ub_cnt < - cache->uc_freebucket->ub_cnt)) { + ((cache->uc_allocbucket->ub_last - cache->uc_allocbucket->ub_bucket) < + (cache->uc_freebucket->ub_last - cache->uc_freebucket->ub_bucket))) { ZONE_UNLOCK(zone); goto zfree_start; } @@ -2353,8 +2351,8 @@ #ifdef UMA_DEBUG_ALLOC printf("uma_zfree: Putting old bucket on the free list.\n"); #endif - /* ub_cnt is pointing to the last free item */ - KASSERT(bucket->ub_cnt !=3D 0, + /* ub_last is pointing to the last free item */ + KASSERT(bucket->ub_last !=3D bucket->ub_bucket, ("uma_zfree: Attempting to insert an empty bucket onto the full list= =2E\n")); LIST_INSERT_HEAD(&zone->uz_full_bucket, bucket, ub_link); @@ -2707,9 +2705,9 @@ { printf("alloc: %p(%d), free: %p(%d)\n", cache->uc_allocbucket, - cache->uc_allocbucket?cache->uc_allocbucket->ub_cnt:0, + cache->uc_allocbucket?(cache->uc_allocbucket->ub_last - cache->uc_allocb= ucket->ub_bucket):0, cache->uc_freebucket, - cache->uc_freebucket?cache->uc_freebucket->ub_cnt:0); + cache->uc_freebucket?(cache->uc_freebucket->ub_last - cache->uc_freebuck= et->ub_bucket):0); } =20 void @@ -2795,9 +2793,9 @@ continue; cache =3D &z->uz_cpu[cpu]; if (cache->uc_allocbucket !=3D NULL) - cachefree +=3D cache->uc_allocbucket->ub_cnt; + cachefree +=3D (cache->uc_allocbucket->ub_last - cache->uc_allocbucke= t->ub_bucket); if (cache->uc_freebucket !=3D NULL) - cachefree +=3D cache->uc_freebucket->ub_cnt; + cachefree +=3D (cache->uc_freebucket->ub_last - cache->uc_freebucket-= >ub_bucket); alloc +=3D cache->uc_allocs; cache->uc_allocs =3D 0; } @@ -2805,7 +2803,7 @@ alloc +=3D z->uz_allocs; =20 LIST_FOREACH(bucket, &z->uz_full_bucket, ub_link) { - cachefree +=3D bucket->ub_cnt; + cachefree +=3D (bucket->ub_last - bucket->ub_bucket); } totalfree =3D zk->uk_free + cachefree; len =3D snprintf(offset, linesize, diff -urbB src.orig/sys/vm/uma_int.h src/sys/vm/uma_int.h --- src.orig/sys/vm/uma_int.h 2005-06-30 19:09:00.625558440 +0300 +++ src/sys/vm/uma_int.h 2005-06-30 18:41:16.515541616 +0300 @@ -166,7 +166,7 @@ =20 struct uma_bucket { LIST_ENTRY(uma_bucket) ub_link; /* Link into the zone */ - int16_t ub_cnt; /* Count of free items. */ + void **ub_last; /* Pointer to last free item */ int16_t ub_entries; /* Max items. */ void *ub_bucket[]; /* actual allocation storage */ }; --EVF5PPMfhYS0aIcm-- --61jdw2sOBCFtR2d/ Content-Type: application/pgp-signature; name="signature.asc" Content-Description: Digital signature Content-Disposition: inline -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.4.1 (GNU/Linux) Comment: Nikos "Nikolai" Ntarmos iD8DBQFCxB5em6J1ac+VFgoRAsx8AJwNcVJI3cnVpyqCSPobkPWM5tjmYACfUGaI lf44GqlwcEbJwBdbUIS7ICU= =UOn7 -----END PGP SIGNATURE----- --61jdw2sOBCFtR2d/-- From owner-freebsd-hackers@FreeBSD.ORG Thu Jun 30 16:50:10 2005 Return-Path: X-Original-To: freebsd-hackers@FreeBSD.org 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 E881316A41C for ; Thu, 30 Jun 2005 16:50:09 +0000 (GMT) (envelope-from tataz@tataz.chchile.org) Received: from postfix4-1.free.fr (postfix4-1.free.fr [213.228.0.62]) by mx1.FreeBSD.org (Postfix) with ESMTP id 8153643D1D for ; Thu, 30 Jun 2005 16:50:09 +0000 (GMT) (envelope-from tataz@tataz.chchile.org) Received: from tatooine.tataz.chchile.org (vol75-8-82-233-239-98.fbx.proxad.net [82.233.239.98]) by postfix4-1.free.fr (Postfix) with ESMTP id CF307318286 for ; Thu, 30 Jun 2005 18:50:07 +0200 (CEST) Received: by tatooine.tataz.chchile.org (Postfix, from userid 1000) id 96F6D405B; Thu, 30 Jun 2005 18:50:17 +0200 (CEST) Date: Thu, 30 Jun 2005 18:50:17 +0200 From: Jeremie Le Hen To: freebsd-hackers@FreeBSD.org Message-ID: <20050630165017.GH49933@obiwan.tataz.chchile.org> Mime-Version: 1.0 Content-Type: text/plain; charset=iso-8859-1 Content-Disposition: inline Content-Transfer-Encoding: 8bit User-Agent: Mutt/1.5.9i Cc: Subject: ProPolice and FreeBSD X-BeenThere: freebsd-hackers@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: Technical Discussions relating to FreeBSD List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 30 Jun 2005 16:50:10 -0000 Hello, maybe this question should be asked on -threads@, I'm not sure. If it is, please tell me and I will redirect my mail. I'm working on upgrading the ProPolice/SSP patch [1] to -CURRENT. I initially used the patch against FreeBSD 5.1 to know which file I should modify and in which way in the source tree, but I used the newest patch against gcc 3.4.1 for gcc specific stuffs. After a little work, I got a full FreeBSD built with SSP functions compiled in libc (it is also possible to compile it in libgcc but, AFAIU, this would require the SSP stuff to be statically built in all binaries since FreeBSD doesn't provide a shared libgcc). I also read somewhere that some guys of the hardened Debian project have made a libssp, but I find this a little bit overkill (comments ?). I recompiled host(1), libc and libpthread with debugging symbol. Now the questions. All binaries linked against libpthread immediately get a SIGSEGV : %%% coyote:libc# gdb /usr/bin/host GNU gdb 6.1.1 [FreeBSD] Copyright 2004 Free Software Foundation, Inc. GDB is free software, covered by the GNU General Public License, and you are welcome to change it and/or distribute copies of it under certain conditions. Type "show copying" to see the conditions. There is absolutely no warranty for GDB. Type "show warranty" for details. This GDB was configured as "i386-marcel-freebsd"... (gdb) r Starting program: /usr/bin/host warning: Unable to get location for thread creation breakpoint: generic error [New LWP 100135] Program received signal SIGSEGV, Segmentation fault. [Switching to LWP 100135] _thr_cancel_enter (thread=0x0) at /usr/src/lib/libpthread/thread/thr_cancel.c:269 269 THR_THREAD_LOCK(thread, thread); (gdb) bt full #0 _thr_cancel_enter (thread=0x0) at /usr/src/lib/libpthread/thread/thr_cancel.c:269 No locals. #1 0x282dd51b in __open (path=0x281bc0c0 "ÀÀ\033( \220\033(", flags=0) at /usr/src/lib/libpthread/thread/thr_open.c:53 curthread = (struct pthread *) 0x0 ret = 0 mode = 0 #2 0x2838f40b in __guard_setup () at /usr/src/lib/libc/sys/stack_protector.c:51 fd = 0 #3 0x283cbe22 in lseek () from /lib/libc.so.6 No symbol table info available. #4 0x28316dd1 in _init () from /lib/libc.so.6 No symbol table info available. #5 0x281b8000 in ?? () No symbol table info available. #6 0x281ad6fc in ?? () from /libexec/ld-elf.so.1 No symbol table info available. #7 0xbfbfeca8 in ?? () No symbol table info available. #8 0x2818cc79 in find_symdef () from /libexec/ld-elf.so.1 No symbol table info available. #9 0x2818b759 in _rtld () from /libexec/ld-elf.so.1 No symbol table info available. #10 0x2818a98e in .rtld_start () from /libexec/ld-elf.so.1 No symbol table info available. %%% __guard_setup() is the constructor of the SSP patch, it generates a random cookie for the application runtime : %%% static void __guard_setup(void) __attribute__ ((constructor)); static void __guard_setup(void) { int fd; if (__guard[0]!=0) return; fd = open ("/dev/urandom", 0); if (fd != -1) { ssize_t size = read (fd, (char*)&__guard, sizeof(__guard)); close (fd) ; if (size == sizeof(__guard)) return; } /* If a random generator can't be used, the protector switches the guard to the "terminator canary" */ ((char*)__guard)[0] = 0; ((char*)__guard)[1] = 0; ((char*)__guard)[2] = '\n'; ((char*)__guard)[3] = 255; } %%% I am neither a gcc hacker nor a thread guru, so I have no clue on how to resolve this issue. Advices are welcome. Thanks. Regards, [1] http://www.trl.ibm.com/projects/security/ssp/ -- Jeremie Le Hen < jeremie at le-hen dot org >< ttz at chchile dot org > From owner-freebsd-hackers@FreeBSD.ORG Thu Jun 30 17:03:06 2005 Return-Path: X-Original-To: freebsd-hackers@FreeBSD.org 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 9552716A41C for ; Thu, 30 Jun 2005 17:03:06 +0000 (GMT) (envelope-from rik@cronyx.ru) Received: from hanoi.cronyx.ru (hanoi.cronyx.ru [144.206.181.53]) by mx1.FreeBSD.org (Postfix) with ESMTP id 0608F43D1F for ; Thu, 30 Jun 2005 17:03:05 +0000 (GMT) (envelope-from rik@cronyx.ru) Received: (from root@localhost) by hanoi.cronyx.ru (8.13.0/vak/3.0) id j5UH042q008256 for freebsd-hackers@FreeBSD.org.checked; Thu, 30 Jun 2005 21:00:04 +0400 (MSD) (envelope-from rik@cronyx.ru) Received: from [144.206.181.94] (hi.cronyx.ru [144.206.181.94]) by hanoi.cronyx.ru (8.13.0/vak/3.0) with ESMTP id j5UGxIjb008232 for ; Thu, 30 Jun 2005 20:59:18 +0400 (MSD) (envelope-from rik@cronyx.ru) Message-ID: <42C424EA.70306@cronyx.ru> Date: Thu, 30 Jun 2005 20:59:22 +0400 From: Roman Kurakin User-Agent: Mozilla Thunderbird 0.9 (Windows/20041103) X-Accept-Language: en-us, en MIME-Version: 1.0 To: freebsd-hackers@FreeBSD.org Content-Type: text/plain; charset=KOI8-R; format=flowed Content-Transfer-Encoding: 7bit Cc: Subject: Malloc while freeing some object X-BeenThere: freebsd-hackers@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: Technical Discussions relating to FreeBSD List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 30 Jun 2005 17:03:06 -0000 Hi, One simple question on programming style. Is it ok to call malloc while we releasing some object? rik From owner-freebsd-hackers@FreeBSD.ORG Thu Jun 30 17:25:54 2005 Return-Path: X-Original-To: freebsd-hackers@FreeBSD.org 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 C3C0E16A41C; Thu, 30 Jun 2005 17:25:54 +0000 (GMT) (envelope-from tataz@tataz.chchile.org) Received: from postfix3-2.free.fr (postfix3-2.free.fr [213.228.0.169]) by mx1.FreeBSD.org (Postfix) with ESMTP id 5300C43D1D; Thu, 30 Jun 2005 17:25:54 +0000 (GMT) (envelope-from tataz@tataz.chchile.org) Received: from tatooine.tataz.chchile.org (vol75-8-82-233-239-98.fbx.proxad.net [82.233.239.98]) by postfix3-2.free.fr (Postfix) with ESMTP id DD5AAC085; Thu, 30 Jun 2005 19:25:52 +0200 (CEST) Received: by tatooine.tataz.chchile.org (Postfix, from userid 1000) id B9819405B; Thu, 30 Jun 2005 19:26:03 +0200 (CEST) Date: Thu, 30 Jun 2005 19:26:03 +0200 From: Jeremie Le Hen To: freebsd-hackers@FreeBSD.org Message-ID: <20050630172602.GI49933@obiwan.tataz.chchile.org> References: <20050630165017.GH49933@obiwan.tataz.chchile.org> Mime-Version: 1.0 Content-Type: text/plain; charset=iso-8859-1 Content-Disposition: inline Content-Transfer-Encoding: 8bit In-Reply-To: <20050630165017.GH49933@obiwan.tataz.chchile.org> User-Agent: Mutt/1.5.9i Cc: freebsd-threads@FreeBSD.org Subject: Re: ProPolice and pthreads (was: ProPolice and FreeBSD) X-BeenThere: freebsd-hackers@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: Technical Discussions relating to FreeBSD List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 30 Jun 2005 17:25:54 -0000 [ I'm not snipping anything since I'm Cc'ing to -threads@. ] On Thu, Jun 30, 2005 at 06:50:17PM +0200, Jeremie Le Hen wrote: > Hello, > > maybe this question should be asked on -threads@, I'm not sure. If it > is, please tell me and I will redirect my mail. > > I'm working on upgrading the ProPolice/SSP patch [1] to -CURRENT. I > initially used the patch against FreeBSD 5.1 to know which file I > should modify and in which way in the source tree, but I used the > newest patch against gcc 3.4.1 for gcc specific stuffs. > > After a little work, I got a full FreeBSD built with SSP functions > compiled in libc (it is also possible to compile it in libgcc but, > AFAIU, this would require the SSP stuff to be statically built in > all binaries since FreeBSD doesn't provide a shared libgcc). I also > read somewhere that some guys of the hardened Debian project have made > a libssp, but I find this a little bit overkill (comments ?). > > I recompiled host(1), libc and libpthread with debugging symbol. > > Now the questions. All binaries linked against libpthread immediately > get a SIGSEGV : > %%% > coyote:libc# gdb /usr/bin/host > GNU gdb 6.1.1 [FreeBSD] > Copyright 2004 Free Software Foundation, Inc. > GDB is free software, covered by the GNU General Public License, and you are > welcome to change it and/or distribute copies of it under certain conditions. > Type "show copying" to see the conditions. > There is absolutely no warranty for GDB. Type "show warranty" for details. > This GDB was configured as "i386-marcel-freebsd"... > (gdb) r > Starting program: /usr/bin/host > warning: Unable to get location for thread creation breakpoint: generic error > [New LWP 100135] > > Program received signal SIGSEGV, Segmentation fault. > [Switching to LWP 100135] > _thr_cancel_enter (thread=0x0) > at /usr/src/lib/libpthread/thread/thr_cancel.c:269 > 269 THR_THREAD_LOCK(thread, thread); > (gdb) bt full > #0 _thr_cancel_enter (thread=0x0) > at /usr/src/lib/libpthread/thread/thr_cancel.c:269 > No locals. > #1 0x282dd51b in __open (path=0x281bc0c0 "ÀÀ\033( \220\033(", flags=0) > at /usr/src/lib/libpthread/thread/thr_open.c:53 > curthread = (struct pthread *) 0x0 > ret = 0 > mode = 0 > #2 0x2838f40b in __guard_setup () > at /usr/src/lib/libc/sys/stack_protector.c:51 > fd = 0 > #3 0x283cbe22 in lseek () from /lib/libc.so.6 > No symbol table info available. > #4 0x28316dd1 in _init () from /lib/libc.so.6 > No symbol table info available. > #5 0x281b8000 in ?? () > No symbol table info available. > #6 0x281ad6fc in ?? () from /libexec/ld-elf.so.1 > No symbol table info available. > #7 0xbfbfeca8 in ?? () > No symbol table info available. > #8 0x2818cc79 in find_symdef () from /libexec/ld-elf.so.1 > No symbol table info available. > #9 0x2818b759 in _rtld () from /libexec/ld-elf.so.1 > No symbol table info available. > #10 0x2818a98e in .rtld_start () from /libexec/ld-elf.so.1 > No symbol table info available. > %%% > > __guard_setup() is the constructor of the SSP patch, it generates a > random cookie for the application runtime : > %%% > static void __guard_setup(void) __attribute__ ((constructor)); > static void > __guard_setup(void) > { > int fd; > if (__guard[0]!=0) return; > fd = open ("/dev/urandom", 0); > if (fd != -1) { > ssize_t size = read (fd, (char*)&__guard, sizeof(__guard)); > close (fd) ; > if (size == sizeof(__guard)) return; > } > /* If a random generator can't be used, the protector switches the guard > to the "terminator canary" */ > ((char*)__guard)[0] = 0; ((char*)__guard)[1] = 0; > ((char*)__guard)[2] = '\n'; ((char*)__guard)[3] = 255; > } > %%% > > I am neither a gcc hacker nor a thread guru, so I have no clue on how to > resolve this issue. Advices are welcome. > > Thanks. > > Regards, > [1] http://www.trl.ibm.com/projects/security/ssp/ cognet@ sent me the following patch and it makes pthreaded programs work like a charm. He also said me that this change will be surely needed for libthr. %%% cvs diff: Diffing . Index: thr_open.c =================================================================== RCS file: /nfs/donald/repo/FreeBSD/src/lib/libpthread/thread/thr_open.c,v retrieving revision 1.16 diff -u -p -r1.16 thr_open.c --- thr_open.c 9 Dec 2003 02:20:56 -0000 1.16 +++ thr_open.c 30 Jun 2005 17:19:03 -0000 @@ -45,11 +45,14 @@ __weak_reference(__open, open); int __open(const char *path, int flags,...) { - struct pthread *curthread = _get_curthread(); + struct pthread *curthread; int ret; int mode = 0; va_list ap; + if (_thr_initial == NULL) + _libpthread_init(NULL); + curthread = _get_curthread(); _thr_cancel_enter(curthread); /* Check if the file is being created: */ %%% For now, I'm including this in my ProPolice patch. Regards, -- Jeremie Le Hen < jeremie at le-hen dot org >< ttz at chchile dot org > From owner-freebsd-hackers@FreeBSD.ORG Thu Jun 30 17:42:11 2005 Return-Path: X-Original-To: hackers@freebsd.org 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 E835316A41F for ; Thu, 30 Jun 2005 17:42:11 +0000 (GMT) (envelope-from jmg@hydrogen.funkthat.com) Received: from hydrogen.funkthat.com (gate.funkthat.com [69.17.45.168]) by mx1.FreeBSD.org (Postfix) with ESMTP id 41D1A43D48 for ; Thu, 30 Jun 2005 17:42:11 +0000 (GMT) (envelope-from jmg@hydrogen.funkthat.com) Received: from hydrogen.funkthat.com (localhost.funkthat.com [127.0.0.1]) by hydrogen.funkthat.com (8.13.3/8.13.3) with ESMTP id j5UHg9XL089212; Thu, 30 Jun 2005 10:42:09 -0700 (PDT) (envelope-from jmg@hydrogen.funkthat.com) Received: (from jmg@localhost) by hydrogen.funkthat.com (8.13.3/8.13.3/Submit) id j5UHg8Fl089211; Thu, 30 Jun 2005 10:42:08 -0700 (PDT) (envelope-from jmg) Date: Thu, 30 Jun 2005 10:42:08 -0700 From: John-Mark Gurney To: ant Message-ID: <20050630174208.GL727@funkthat.com> Mail-Followup-To: ant , hackers@freebsd.org References: <000d01c57cf7$b9b6f9f0$29931bd9@ertpc> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <000d01c57cf7$b9b6f9f0$29931bd9@ertpc> User-Agent: Mutt/1.4.2.1i X-Operating-System: FreeBSD 5.4-RELEASE-p1 i386 X-PGP-Fingerprint: B7 EC EF F8 AE ED A7 31 96 7A 22 B3 D8 56 36 F4 X-Files: The truth is out there X-URL: http://resnet.uoregon.edu/~gurney_j/ X-Resume: http://resnet.uoregon.edu/~gurney_j/resume.html Cc: hackers@freebsd.org Subject: Re: hot path optimizations in uma_zalloc() & uma_zfree() X-BeenThere: freebsd-hackers@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list Reply-To: John-Mark Gurney List-Id: Technical Discussions relating to FreeBSD List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 30 Jun 2005 17:42:12 -0000 ant wrote this message on Thu, Jun 30, 2005 at 01:08 +0300: > I just tryed to make buckets management in perCPU cache like in > Solaris (see paper of Jeff Bonwick - Magazines and Vmem) > and got perfomance gain around 10% in my test program. > Then i made another minor code optimization and got another 10%. > The program just creates and destroys sockets in loop. > > I suppose the reason of first gain lies in increasing of cpu cache hits. > In current fbsd code allocations and freeings deal with > separate buckets. Buckets are changed when one of them > became full or empty first. In Solaris this work is pure LIFO: > i.e. alloc() and free() work with one bucket - the current bucket > (it is called magazine there), that's why cache hit rate is bigger. If you do like the paper does, and use the buckets for allocating buckets, I would recommend you drop the free bucket list from the pool... If bucket allocations are as cheap as they are suppose to be, there is no need to keep a local list of empty buckets.. :) Just following the principal stated in the paper of letting well optimized parts do their part... P.S. I have most of a userland implementation of this done. Since someone else has done kernel, I'll solely target userland for the code now. -- John-Mark Gurney Voice: +1 415 225 5579 "All that I will do, has been done, All that I have, has not." From owner-freebsd-hackers@FreeBSD.ORG Thu Jun 30 17:43:20 2005 Return-Path: X-Original-To: freebsd-hackers@freebsd.org 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 6120B16A41C for ; Thu, 30 Jun 2005 17:43:20 +0000 (GMT) (envelope-from jhb@FreeBSD.org) Received: from mv.twc.weather.com (mv.twc.weather.com [65.212.71.225]) by mx1.FreeBSD.org (Postfix) with ESMTP id 1731443D58 for ; Thu, 30 Jun 2005 17:43:19 +0000 (GMT) (envelope-from jhb@FreeBSD.org) Received: from [10.50.41.231] (Not Verified[65.202.103.25]) by mv.twc.weather.com with NetIQ MailMarshal (v6, 0, 3, 8) id ; Thu, 30 Jun 2005 13:57:05 -0400 From: John Baldwin To: freebsd-hackers@freebsd.org Date: Thu, 30 Jun 2005 13:28:42 -0400 User-Agent: KMail/1.8 References: <000d01c57cf7$b9b6f9f0$29931bd9@ertpc> <200506301415.38106.max@love2party.net> <003901c57d82$37891b80$de921bd9@ertpc> In-Reply-To: <003901c57d82$37891b80$de921bd9@ertpc> MIME-Version: 1.0 Content-Type: text/plain; charset="koi8-r" Content-Transfer-Encoding: 7bit Content-Disposition: inline Message-Id: <200506301328.43333.jhb@FreeBSD.org> Cc: Max Laier , Andriy Tkachuk Subject: Re: hot path optimizations in uma_zalloc() & uma_zfree() X-BeenThere: freebsd-hackers@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: Technical Discussions relating to FreeBSD List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 30 Jun 2005 17:43:20 -0000 On Thursday 30 June 2005 10:35 am, Andriy Tkachuk wrote: > I just checked the object code - you right, it almost the same: > > - bucket->ub_bucket[bucket->ub_cnt] = item; > - 22b9: 0f bf 43 08 movswl 0x8(%ebx),%eax > - 22bd: 8b 4d 0c mov 0xc(%ebp),%ecx > - 22c0: 89 4c 83 0c mov %ecx,0xc(%ebx,%eax,4) > - bucket->ub_cnt++; > - 22c4: 8d 42 01 lea 0x1(%edx),%eax > - 22c7: 66 89 43 08 mov %ax,0x8(%ebx) > + bucket->ub_bucket[bucket->ub_cnt++] = item; > + 22b9: 0f bf c2 movswl %dx,%eax > + 22bc: 8b 4d 0c mov 0xc(%ebp),%ecx > + 22bf: 89 4c 83 0c mov %ecx,0xc(%ebx,%eax,4) > + 22c3: 8d 42 01 lea 0x1(%edx),%eax > + 22c6: 66 89 43 08 mov %ax,0x8(%ebx) > > but still there is some minor difference in first line. > I'm not familiar with assembler, can somebody explain > whether this difference is assential or not? It just uses the stored value of the variable in %dx instead of loading it from memory at 0x8(%ebx). When I compiled a simple test program here locally I got identical object code though. > in decrementation there is no difference at all: > > - bucket->ub_cnt--; > + item = bucket->ub_bucket[--bucket->ub_cnt]; > 1bbe: 66 ff 49 08 decw 0x8(%ecx) > - item = bucket->ub_bucket[bucket->ub_cnt]; > 1bc2: 0f bf 41 08 movswl 0x8(%ecx),%eax > 1bc6: 8b 44 81 0c mov 0xc(%ecx,%eax,4),%eax > 1bca: 89 45 f0 mov %eax,0xfffffff0(%ebp) > > > ----- Original Message ----- > From: "Max Laier" > To: > Cc: "ant" > Sent: Thursday, June 30, 2005 3:15 PM > Subject: Re: hot path optimizations in uma_zalloc() & uma_zfree() > > > Another optimization is very trivial, for example: > > - bucket->ub_cnt--; > > - item = bucket->ub_bucket[bucket->ub_cnt]; > > + item = bucket->ub_bucket[--bucket->ub_cnt]; > > (see the patch) > > Might be me, but this doesn't change the generated object code at all > (modulo the changed __line__ in debugging). > > > > _______________________________________________ > freebsd-hackers@freebsd.org mailing list > http://lists.freebsd.org/mailman/listinfo/freebsd-hackers > To unsubscribe, send any mail to "freebsd-hackers-unsubscribe@freebsd.org" -- John Baldwin <>< http://www.FreeBSD.org/~jhb/ "Power Users Use the Power to Serve" = http://www.FreeBSD.org From owner-freebsd-hackers@FreeBSD.ORG Thu Jun 30 18:02:54 2005 Return-Path: X-Original-To: freebsd-hackers@freebsd.org 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 ED58A16A41C for ; Thu, 30 Jun 2005 18:02:54 +0000 (GMT) (envelope-from dmitry.mityugov@gmail.com) Received: from wproxy.gmail.com (wproxy.gmail.com [64.233.184.204]) by mx1.FreeBSD.org (Postfix) with ESMTP id A617D43D1D for ; Thu, 30 Jun 2005 18:02:54 +0000 (GMT) (envelope-from dmitry.mityugov@gmail.com) Received: by wproxy.gmail.com with SMTP id i4so145564wra for ; Thu, 30 Jun 2005 11:02:54 -0700 (PDT) DomainKey-Signature: a=rsa-sha1; q=dns; c=nofws; s=beta; d=gmail.com; h=received:message-id:date:from:reply-to:to:subject:cc:in-reply-to:mime-version:content-type:content-transfer-encoding:content-disposition:references; b=Jn2UyGFlAMOLuRj49HZmeuneXA/DQ9WzC3vrqDWJ7taiJ44vExZILNXkpYjYqfmoIYUpRV7Ouf0DF5GNIDX8KJhV7OFOYCmyFFRE6OE6uyN9rUgmvdFJ4Lq0CSEYc5PuvlF7817s7DotHGmX0DWMeDBHKXwx07ugmdr6bvCIdHo= Received: by 10.54.11.58 with SMTP id 58mr563471wrk; Thu, 30 Jun 2005 11:02:29 -0700 (PDT) Received: by 10.54.56.33 with HTTP; Thu, 30 Jun 2005 11:02:29 -0700 (PDT) Message-ID: Date: Thu, 30 Jun 2005 22:02:29 +0400 From: Dmitry Mityugov To: Roman Kurakin In-Reply-To: <42C424EA.70306@cronyx.ru> Mime-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: quoted-printable Content-Disposition: inline References: <42C424EA.70306@cronyx.ru> Cc: freebsd-hackers@freebsd.org Subject: Re: Malloc while freeing some object X-BeenThere: freebsd-hackers@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list Reply-To: Dmitry Mityugov List-Id: Technical Discussions relating to FreeBSD List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 30 Jun 2005 18:02:55 -0000 On 6/30/05, Roman Kurakin wrote: > Hi, >=20 > One simple question on programming style. Is it ok > to call malloc while we releasing some object? Are you releasing it in another thread? Is it a C++ object? How are you releasing it? --=20 Dmitry "We live less by imagination than despite it" - Rockwell Kent, "N by E" From owner-freebsd-hackers@FreeBSD.ORG Thu Jun 30 18:33:06 2005 Return-Path: X-Original-To: freebsd-hackers@freebsd.org 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 A90B716A41C for ; Thu, 30 Jun 2005 18:33:06 +0000 (GMT) (envelope-from rik@cronyx.ru) Received: from hanoi.cronyx.ru (hanoi.cronyx.ru [144.206.181.53]) by mx1.FreeBSD.org (Postfix) with ESMTP id 2FC7043D48 for ; Thu, 30 Jun 2005 18:33:05 +0000 (GMT) (envelope-from rik@cronyx.ru) Received: (from root@localhost) by hanoi.cronyx.ru (8.13.0/vak/3.0) id j5UIU4VE008966 for freebsd-hackers@freebsd.org.checked; Thu, 30 Jun 2005 22:30:04 +0400 (MSD) (envelope-from rik@cronyx.ru) Received: from [144.206.181.94] (hi.cronyx.ru [144.206.181.94]) by hanoi.cronyx.ru (8.13.0/vak/3.0) with ESMTP id j5UIRJ1s008938; Thu, 30 Jun 2005 22:27:19 +0400 (MSD) (envelope-from rik@cronyx.ru) Message-ID: <42C4398C.5060808@cronyx.ru> Date: Thu, 30 Jun 2005 22:27:24 +0400 From: Roman Kurakin User-Agent: Mozilla Thunderbird 0.9 (Windows/20041103) X-Accept-Language: en-us, en MIME-Version: 1.0 To: Dmitry Mityugov References: <42C424EA.70306@cronyx.ru> In-Reply-To: Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit Cc: freebsd-hackers@freebsd.org Subject: Re: Malloc while freeing some object X-BeenThere: freebsd-hackers@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: Technical Discussions relating to FreeBSD List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 30 Jun 2005 18:33:06 -0000 Dmitry Mityugov wrote: >On 6/30/05, Roman Kurakin wrote: > > >>Hi, >> >> One simple question on programming style. Is it ok >>to call malloc while we releasing some object? >> >> >Are you releasing it in another thread? Is it a C++ object? How are > >you releasing it? > > This was general question. In fact I've found that ttyfree() function from kernel code allocates tempory variables to free tty. I didn't expect such behaviour. I always thought that deallocation of smth should need other alloc. rik From owner-freebsd-hackers@FreeBSD.ORG Thu Jun 30 20:13:59 2005 Return-Path: X-Original-To: freebsd-hackers@freebsd.org 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 7BD3A16A41C for ; Thu, 30 Jun 2005 20:13:59 +0000 (GMT) (envelope-from jos@catnook.com) Received: from w250.z064001178.sjc-ca.dsl.cnc.net (209-204-181-78.dsl.static.sonic.net [209.204.181.78]) by mx1.FreeBSD.org (Postfix) with SMTP id 51E1A43D1F for ; Thu, 30 Jun 2005 20:13:56 +0000 (GMT) (envelope-from jos@catnook.com) Received: (qmail 29119 invoked by uid 1000); 30 Jun 2005 20:14:18 -0000 Date: Thu, 30 Jun 2005 13:13:56 -0701 From: Jos Backus To: freebsd-hackers@freebsd.org Message-ID: <20050630201418.GA28088@lizzy.catnook.local> Mail-Followup-To: freebsd-hackers@freebsd.org References: <20050630050017.GU31528@wantadilla.lemis.com> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20050630050017.GU31528@wantadilla.lemis.com> User-Agent: Mutt/1.5.9i Subject: Re: Suurce code navigation tools with call graph? X-BeenThere: freebsd-hackers@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list Reply-To: jos@catnook.com List-Id: Technical Discussions relating to FreeBSD List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 30 Jun 2005 20:13:59 -0000 Not free, but /usr/ports/devel/linux-understand_c should do what you want. It's a pretty nice code spelunking tool, too. -- Jos Backus jos at catnook.com From owner-freebsd-hackers@FreeBSD.ORG Fri Jul 1 05:39:40 2005 Return-Path: X-Original-To: freebsd-hackers@freebsd.org 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 5AC8116A41C for ; Fri, 1 Jul 2005 05:39:40 +0000 (GMT) (envelope-from imura@ryu16.org) Received: from mail.ryu16.org (usen-221x249x107x70.ap-US01.usen.ad.jp [221.249.107.70]) by mx1.FreeBSD.org (Postfix) with ESMTP id 95AB343D1F for ; Fri, 1 Jul 2005 05:39:38 +0000 (GMT) (envelope-from imura@ryu16.org) Received: from redeye.xt.ryu16.org (localhost [127.0.0.1]) by mail.ryu16.org (8.12.9p1/8.12.9) with ESMTP id j615dcn7041232; Fri, 1 Jul 2005 14:39:38 +0900 (JST) (envelope-from imura@redeye.xt.ryu16.org) Received: (from imura@localhost) by redeye.xt.ryu16.org (8.12.9p1/8.12.9/Submit) id j615dbOf041231; Fri, 1 Jul 2005 14:39:37 +0900 (JST) (envelope-from imura) Date: Fri, 1 Jul 2005 14:39:37 +0900 From: "R. Imura" To: Jilles Tjoelker Message-ID: <20050701053937.GA40965%imura@ryu16.org> References: <20050620152649.GA1201@stack.nl> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20050620152649.GA1201@stack.nl> User-Agent: Mutt/1.4.1i-ja.1 Cc: freebsd-hackers@freebsd.org Subject: Re: what(1) on kernel binary X-BeenThere: freebsd-hackers@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: Technical Discussions relating to FreeBSD List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 01 Jul 2005 05:39:40 -0000 Hi, On Mon, Jun 20, 2005 at 05:26:49PM +0200, Jilles Tjoelker wrote: > On FreeBSD 4.x, one could easily determine the version and compilation > date of a kernel binary like this: > > jilles@toad /home/jilles% what /kernel > /kernel: > FreeBSD 4.11-STABLE #20: Mon May 9 18:43:52 CEST 2005 > > On FreeBSD 5.x/6.x with GCC 3.x, this doesn't work anymore. > > The cause is that these two arrays (in /sys/conf/newvers.sh) are now both > aligned to a 32-byte boundary, so there are 28 null bytes between @(#) > and the version number: > > char sccspad[32 - 4 /* sizeof(sccs) */] = { '\\0' }; > char sccs[4] = { '@', '(', '#', ')' }; > > A possible solution is to change the two arrays to a single one > containing 28 null bytes and @(#). > > char sccs[32] = { '\\0', '\\0', '\\0', '\\0', '\\0', '\\0', '\\0', > '\\0', '\\0', '\\0', '\\0', '\\0', '\\0', '\\0', '\\0', '\\0', '\\0', > '\\0', '\\0', '\\0', '\\0', '\\0', '\\0', '\\0', '\\0', '\\0', '\\0', > '\\0', '@', '(', '#', ')' }; It works ok with the former option(A), but it doesn't with latter(B) with my FreeBSD box. (A) cc -c vers.c (B) cc -c -O2 -frename-registers -pipe -fno-strict-aliasing -Wall -Wredundant-decls -Wnested-externs -Wstrict-prototypes -Wmissing-prototypes -Wpointer-arith -Winline -Wcast-qual -fformat-extensions -std=c99 -g -nostdinc -I- -I. -I/usr/src/sys -I/usr/src/sys/contrib/dev/acpica -I/usr/src/sys/contrib/altq -I/usr/src/sys/contrib/ipfilter -I/usr/src/sys/contrib/pf -I/usr/src/sys/contrib/dev/ath -I/usr/src/sys/contrib/dev/ath/freebsd -I/usr/src/sys/contrib/ngatm -I/usr/src/sys/dev/twa -D_KERNEL -include opt_global.h -fno-common -finline-limit=8000 --param inline-unit-growth=100 --param large-function-growth=1000 -fno-omit-frame-pointer -mcmodel=kernel -mno-red-zone -mfpmath=387 -mno-sse -mno-sse2 -mno-mmx -mno-3dnow -msoft-float -fno-asynchronous-unwind-tables -ffreestanding -Werror vers.c IMHO, the simplest solution is duplicate writing ${VERSION} like this, but this would let kernel be 20-30bytes bigger. ------------------------------- cat << EOF > vers.c $COPYRIGHT char sccs[] = "@(#)${VERSION} #${v}: ${t}"; char version[] = "${VERSION} #${v}: ${t}\\n ${u}@${h}:${d}\\n"; char ostype[] = "${TYPE}"; char osrelease[] = "${RELEASE}"; int osreldate = ${RELDATE}; char kern_ident[] = "${i}"; EOF ------------------------------- Regards, - R. Imura From owner-freebsd-hackers@FreeBSD.ORG Fri Jul 1 09:11:43 2005 Return-Path: X-Original-To: freebsd-hackers@freebsd.org 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 5E4B916A41C for ; Fri, 1 Jul 2005 09:11:43 +0000 (GMT) (envelope-from shiner_chen@yahoo.com.cn) Received: from web15510.mail.cnb.yahoo.com (web15510.mail.cnb.yahoo.com [202.165.102.39]) by mx1.FreeBSD.org (Postfix) with SMTP id 9AA0E43D1F for ; Fri, 1 Jul 2005 09:11:42 +0000 (GMT) (envelope-from shiner_chen@yahoo.com.cn) Received: (qmail 10052 invoked by uid 60001); 1 Jul 2005 09:11:40 -0000 DomainKey-Signature: a=rsa-sha1; q=dns; c=nofws; s=s1024; d=yahoo.com.cn; h=Message-ID:Received:Date:From:Subject:To:MIME-Version:Content-Type:Content-Transfer-Encoding; b=gpo7jqU2qpoLNcDVSTE/+wvllaeAL0C++HSaFXfR6alb3qaX7/89jpLBfWQfno5iOQ0k6XWwfKeaAntmv9Cf66+ZolKWDjBAO9YI+n4Z6ABF08/NW1rCOozn2jCJK+rOkoliLD5MbyTEiDMYDUMTb3mELtAU7zuMxad8uoUpDl4= ; Message-ID: <20050701091140.10050.qmail@web15510.mail.cnb.yahoo.com> Received: from [61.187.16.2] by web15510.mail.cnb.yahoo.com via HTTP; Fri, 01 Jul 2005 17:11:40 CST Date: Fri, 1 Jul 2005 17:11:40 +0800 (CST) From: shiner chen To: freebsd-hackers@freebsd.org MIME-Version: 1.0 Content-Type: text/plain; charset=gb2312 Content-Transfer-Encoding: 8bit X-Content-Filtered-By: Mailman/MimeDel 2.1.5 Subject: How ignore the arp request X-BeenThere: freebsd-hackers@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: Technical Discussions relating to FreeBSD List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 01 Jul 2005 09:11:43 -0000 I want to establish a web-cluster.Now i face with the problem how to configure the virtual ip in back-end server and how to ignore the arp request to virtual ip of back-end server. who can tell me ? please detail it !thanks shiner --------------------------------- DO YOU YAHOO!? ÑÅ»¢Ãâ·ÑGÓÊÏ䣭ÖйúµÚÒ»¾øÎÞÀ¬»øÓʼþɧÈų¬´óÓÊÏä From owner-freebsd-hackers@FreeBSD.ORG Fri Jul 1 11:25:50 2005 Return-Path: X-Original-To: freebsd-hackers@freebsd.org 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 C803716A41C for ; Fri, 1 Jul 2005 11:25:50 +0000 (GMT) (envelope-from vd@datamax.bg) Received: from jengal.datamax.bg (jengal.datamax.bg [82.103.104.21]) by mx1.FreeBSD.org (Postfix) with ESMTP id 81B5643D1D for ; Fri, 1 Jul 2005 11:25:50 +0000 (GMT) (envelope-from vd@datamax.bg) Received: from sinanica.bg.datamax (sinanica.bg.datamax [192.168.10.1]) by jengal.datamax.bg (Postfix) with QMQP id 0C00A87C8; Fri, 1 Jul 2005 14:25:49 +0300 (EEST) Received: (nullmailer pid 46961 invoked by uid 1004); Fri, 01 Jul 2005 11:25:49 -0000 Date: Fri, 1 Jul 2005 14:25:49 +0300 From: Vasil Dimov To: shiner chen Message-ID: <20050701112549.GA43582@sinanica.bg.datamax> References: <20050701091140.10050.qmail@web15510.mail.cnb.yahoo.com> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20050701091140.10050.qmail@web15510.mail.cnb.yahoo.com> X-OS: FreeBSD 5.4-STABLE User-Agent: Mutt/1.5.9i Cc: freebsd-hackers@freebsd.org Subject: Re: How ignore the arp request X-BeenThere: freebsd-hackers@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list Reply-To: vd@datamax.bg List-Id: Technical Discussions relating to FreeBSD List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 01 Jul 2005 11:25:50 -0000 On Fri, Jul 01, 2005 at 05:11:40PM +0800, shiner chen wrote: > I want to establish a web-cluster.Now i face with the problem how to > configure the virtual ip in back-end server and how to ignore the arp > request to virtual ip of back-end server. who can tell me ? please detail > it !thanks > ifconfig -arp? ipfw? From owner-freebsd-hackers@FreeBSD.ORG Thu Jun 30 21:09:56 2005 Return-Path: X-Original-To: freebsd-hackers@FreeBSD.org 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 5664016A41C for ; Thu, 30 Jun 2005 21:09:56 +0000 (GMT) (envelope-from keramida@ceid.upatras.gr) Received: from kane.otenet.gr (kane.otenet.gr [195.170.0.95]) by mx1.FreeBSD.org (Postfix) with ESMTP id B622A43D53 for ; Thu, 30 Jun 2005 21:09:54 +0000 (GMT) (envelope-from keramida@ceid.upatras.gr) Received: from gothmog.gr (patr530-a160.otenet.gr [212.205.215.160]) by kane.otenet.gr (8.13.4/8.13.4/Debian-1) with ESMTP id j5UL9ahC006380; Fri, 1 Jul 2005 00:09:43 +0300 Received: from gothmog.gr (gothmog [127.0.0.1]) by gothmog.gr (8.13.4/8.13.4) with ESMTP id j5UL9UAA001142; Fri, 1 Jul 2005 00:09:30 +0300 (EEST) (envelope-from keramida@ceid.upatras.gr) Received: (from giorgos@localhost) by gothmog.gr (8.13.4/8.13.4/Submit) id j5UL9I5s001133; Fri, 1 Jul 2005 00:09:18 +0300 (EEST) (envelope-from keramida@ceid.upatras.gr) Date: Fri, 1 Jul 2005 00:09:17 +0300 From: Giorgos Keramidas To: Roman Kurakin Message-ID: <20050630210917.GB685@gothmog.gr> References: <42C424EA.70306@cronyx.ru> <42C4398C.5060808@cronyx.ru> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <42C4398C.5060808@cronyx.ru> X-Mailman-Approved-At: Fri, 01 Jul 2005 11:51:54 +0000 Cc: freebsd-hackers@FreeBSD.org, Dmitry Mityugov Subject: Re: Malloc while freeing some object X-BeenThere: freebsd-hackers@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: Technical Discussions relating to FreeBSD List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 30 Jun 2005 21:09:56 -0000 On 2005-06-30 22:27, Roman Kurakin wrote: >Dmitry Mityugov wrote: >>On 6/30/05, Roman Kurakin wrote: >>> One simple question on programming style. Is it ok to call malloc >>> while we releasing some object? >> >> Are you releasing it in another thread? Is it a C++ object? How are >> you releasing it? > > This was general question. In fact I've found that ttyfree() function > from kernel code allocates tempory variables to free tty. I didn't > expect such behaviour. I always thought that deallocation of smth > should need other alloc. Not necessarily. This could be a problem if you are implementing the allocator itself, and start an infinite recursion or end up deadlocking against the allocator which waits the allocator to finish, which waits the allocator... etc. Users of a general purpose memory allocator don't generally have to worry about the same thing though ;-) From owner-freebsd-hackers@FreeBSD.ORG Fri Jul 1 11:51:30 2005 Return-Path: X-Original-To: freebsd-hackers@freebsd.org 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 D999616A41C for ; Fri, 1 Jul 2005 11:51:30 +0000 (GMT) (envelope-from L@ust.dk) Received: from mail.ust.dk (cpe.atm2-0-71395.0x3ef3a826.bynxx18.customer.tele.dk [62.243.168.38]) by mx1.FreeBSD.org (Postfix) with ESMTP id 8CDB843D1D for ; Fri, 1 Jul 2005 11:51:29 +0000 (GMT) (envelope-from L@ust.dk) Received: from [127.0.0.1] (localhost.ipfw.dk [127.0.0.1]) by mail.ust.dk (Postfix) with ESMTP id 3C4C86115 for ; Fri, 1 Jul 2005 13:51:28 +0200 (CEST) Message-ID: <42C52E3C.2050500@ust.dk> Date: Fri, 01 Jul 2005 13:51:24 +0200 From: "Laust S. Jespersen" User-Agent: Mozilla Thunderbird 1.0.2 (Windows/20050317) X-Accept-Language: en-us, en MIME-Version: 1.0 To: freebsd-hackers@freebsd.org References: <20050701091140.10050.qmail@web15510.mail.cnb.yahoo.com> <20050701112549.GA43582@sinanica.bg.datamax> In-Reply-To: <20050701112549.GA43582@sinanica.bg.datamax> Content-Type: text/plain; charset=ISO-8859-15; format=flowed Content-Transfer-Encoding: 7bit X-Mailman-Approved-At: Fri, 01 Jul 2005 11:52:27 +0000 Subject: Re: How ignore the arp request X-BeenThere: freebsd-hackers@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: Technical Discussions relating to FreeBSD List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 01 Jul 2005 11:51:31 -0000 Vasil Dimov wrote: > On Fri, Jul 01, 2005 at 05:11:40PM +0800, shiner chen wrote: > >>I want to establish a web-cluster.Now i face with the problem how to >>configure the virtual ip in back-end server and how to ignore the arp >>request to virtual ip of back-end server. who can tell me ? please detail >>it !thanks >> > > ifconfig -arp? > ipfw? > _______________________________________________ > freebsd-hackers@freebsd.org mailing list > http://lists.freebsd.org/mailman/listinfo/freebsd-hackers > To unsubscribe, send any mail to "freebsd-hackers-unsubscribe@freebsd.org" > I would go with something along the lines of: spread and wackamole with maybe a bit of mod_backhand thrown in for loadbalancing. -- Med venlig hilsen / Best Regards Laust Jespersen http://www.ust.dk ====================================================================== Viking Rule of Acquisition 1: Remember where you beached the long ship From owner-freebsd-hackers@FreeBSD.ORG Fri Jul 1 12:04:18 2005 Return-Path: X-Original-To: freebsd-hackers@FreeBSD.org 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 6467C16A41C; Fri, 1 Jul 2005 12:04:18 +0000 (GMT) (envelope-from oli@aker.isnic.is) Received: from aker.isnic.is (aker.isnic.is [193.4.58.91]) by mx1.FreeBSD.org (Postfix) with ESMTP id 2B2E043D1F; Fri, 1 Jul 2005 12:04:16 +0000 (GMT) (envelope-from oli@aker.isnic.is) Received: by aker.isnic.is (Postfix, from userid 1000) id 8F8958A01D; Fri, 1 Jul 2005 12:04:13 +0000 (UTC) Date: Fri, 1 Jul 2005 12:04:13 +0000 From: Olafur Osvaldsson To: freebsd-hackers@FreeBSD.org Message-ID: <20050701120413.GL14411@isnic.is> Mail-Followup-To: freebsd-hackers@FreeBSD.org, rwatson@FreeBSD.org Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline Content-Transfer-Encoding: quoted-printable User-Agent: Mutt/1.4.2.1i Cc: rwatson@FreeBSD.org Subject: Help regarding panics within sb* (sbdrop) functions in FreeBSD 5 X-BeenThere: freebsd-hackers@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: Technical Discussions relating to FreeBSD List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 01 Jul 2005 12:04:18 -0000 Hi, I've been experiencing for some time now crashes of a few of my FreeBSD systems wich seem to panic in the sbdrop functions, I have atleast two dumps that point to this. Both seem to happen because of an unexpected NULL value. This is on a 5.4-RELEASE-p1 FreeBSD 5.4-RELEASE-p1 #6: Tue Jun 28 13:42:14 = UTC 2005 And these crashes have been happening since early 5 series. Every time one of these crashes occur there are entries in the system log: Jun 21 14:21:38 bastet kernel: bge0: discard frame w/o packet header Jun 21 14:23:39 bastet kernel: bge0: discard frame w/o packet header Jun 21 14:23:59 bastet kernel: bge0: discard frame w/o packet header Jun 21 14:24:33 bastet kernel: me w/o packet header Jun 21 14:24:38 bastet kernel: bge0: discard frame w/o packet header =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D For instance, the last panic was in sbdrop_locked: #0 doadump () at pcpu.h:159 #1 0xc060c5ef in boot (howto=3D260) at /usr/src/sys/kern/kern_shutdown.c:4= 10 #2 0xc060c915 in panic (fmt=3D0xc081c602 "sbdrop") at /usr/src/sys/kern/ke= rn_shutdown.c:566 #3 0xc0647000 in sbdrop_locked (sb=3D0xc5620484, len=3D3793) at /usr/src/s= ys/kern/uipc_socket2.c:1149 #4 0xc06a3957 in tcp_input (m=3D0xc39d4600, off0=3D20) at /usr/src/sys/net= inet/tcp_input.c:2195 #5 0xc069b2e5 in ip_input (m=3D0xc39d4600) at /usr/src/sys/netinet/ip_inpu= t.c:776 #6 0xc067e01b in netisr_processqueue (ni=3D0xc08da998) at /usr/src/sys/net= /netisr.c:233 #7 0xc067e216 in swi_net (dummy=3D0x0) at /usr/src/sys/net/netisr.c:346 #8 0xc05f8599 in ithread_loop (arg=3D0xc351d400) at /usr/src/sys/kern/kern= _intr.c:547 #9 0xc05f7635 in fork_exit (callout=3D0xc05f8440 , arg=3D0xc= 351d400, frame=3D0xe684dd48) at /usr/src/sys/kern/kern_fork.c:791 #10 0xc079fe1c in fork_trampoline () at /usr/src/sys/i386/i386/exception.s:= 209 #3 0xc0647000 in sbdrop_locked (sb=3D0xc5620484, len=3D3793) at /usr/src/s= ys/kern/uipc_socket2.c:1149 1149 panic("sbdrop"); (kgdb) list 1144 1145 next =3D (m =3D sb->sb_mb) ? m->m_nextpkt : 0; 1146 while (len > 0) { 1147 if (m =3D=3D 0) { 1148 if (next =3D=3D 0) 1149 panic("sbdrop"); 1150 m =3D next; 1151 next =3D m->m_nextpkt; 1152 continue; 1153 } 1154 if (m->m_len > len) { 1155 m->m_len -=3D len; 1156 m->m_data +=3D len; 1157 sb->sb_cc -=3D len; 1158 if (m->m_type !=3D MT_DATA && m->m_type != =3D MT_HEADER && 1159 m->m_type !=3D MT_OOBDATA) 1160 sb->sb_ctl -=3D len; 1161 break; 1162 } 1163 len -=3D m->m_len; 1164 sbfree(sb, m); 1165 m =3D m_free(m); 1166 } My questions are these: Is it not possible that m_nextpkt is NULL if the current is the last one in the buffer? Why does that require a panic, could it not drop the frames for a resend? =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D Another dump I have from earlier on this same machine panics in sbappendadd= r_locked: #0 doadump () at pcpu.h:159 #1 0xc060560f in boot (howto=3D260) at /usr/src/sys/kern/kern_shutdown.c:3= 97 #2 0xc0605935 in panic (fmt=3D0xc080f8d8 "sbappendaddr_locked") at /usr/src/sys/kern/kern_shutdown.c:553 #3 0xc063f6f9 in sbappendaddr_locked (sb=3D0xc923941c, asa=3D0xc086cd60, m= 0=3D0xc9ca0100,=20 control=3D0xc9ca0100) at /usr/src/sys/kern/uipc_socket2.c:934 #4 0xc0696082 in raw_append (last=3D0x0, ip=3D0xc4054810, n=3D0xc9ca0100) at /usr/src/sys/netinet/raw_ip.c:169 #5 0xc06962ed in rip_input (m=3D0xc9ca0100, off=3D20) at /usr/src/sys/neti= net/raw_ip.c:231 #6 0xc0692b71 in ip_input (m=3D0xc9ca0100) at /usr/src/sys/netinet/ip_inpu= t.c:739 #7 0xc06761ef in netisr_processqueue (ni=3D0xc08ccf38) at /usr/src/sys/net= /netisr.c:233 #8 0xc06763ea in swi_net (dummy=3D0x0) at /usr/src/sys/net/netisr.c:346 #9 0xc05f14fd in ithread_loop (arg=3D0xc3491d00) at /usr/src/sys/kern/kern= _intr.c:547 #10 0xc05f05ad in fork_exit (callout=3D0xc05f13a4 , arg=3D0xc= 3491d00, frame=3D0xe680ad48) at /usr/src/sys/kern/kern_fork.c:811 #11 0xc079558c in fork_trampoline () at /usr/src/sys/i386/i386/exception.s:= 209 #3 0xc063f6f9 in sbappendaddr_locked (sb=3D0xc923941c, asa=3D0xc086cd60, m= 0=3D0xc9ca0100,=20 control=3D0xc9ca0100) at /usr/src/sys/kern/uipc_socket2.c:934 934 panic("sbappendaddr_locked"); (kgdb) list 929 int space =3D asa->sa_len; 930 931 SOCKBUF_LOCK_ASSERT(sb); 932 933 if (m0 && (m0->m_flags & M_PKTHDR) =3D=3D 0) 934 panic("sbappendaddr_locked"); 935 if (m0) 936 space +=3D m0->m_pkthdr.len; 937 space +=3D m_length(control, &n); 938 =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D For me these crashes have only happened on machines running Bind 9, and all= of those that have contacted me as far as I can remember are also running bind on th= e machines that get the "discard frame w/o packet header" message before crash, this s= eems to indicate that bind is triggering something that is not expected. Unfortunately this is not repeatable as far as I know but I'm willing to do= almost anything to help with finding the cause of this problem and fixing it. I'm not an experienced hacker so please bear with me. I know that there are quite a few people experiencing this problem since ma= ny have sent me queries regarding the "discard frame w/o packet header" since I ask= ed about that on the lists a long time ago. /Oli --=20 Olafur Osvaldsson Systems Administrator Internet a Islandi hf. Tel: +354 525-5291 Email: oli@isnic.is From owner-freebsd-hackers@FreeBSD.ORG Fri Jul 1 13:47:20 2005 Return-Path: X-Original-To: freebsd-hackers@freebsd.org 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 96F3B16A41C for ; Fri, 1 Jul 2005 13:47:20 +0000 (GMT) (envelope-from jhb@FreeBSD.org) Received: from mv.twc.weather.com (mv.twc.weather.com [65.212.71.225]) by mx1.FreeBSD.org (Postfix) with ESMTP id 4BD5C43D49 for ; Fri, 1 Jul 2005 13:47:20 +0000 (GMT) (envelope-from jhb@FreeBSD.org) Received: from [10.50.41.231] (Not Verified[65.202.103.25]) by mv.twc.weather.com with NetIQ MailMarshal (v6, 0, 3, 8) id ; Fri, 01 Jul 2005 10:01:07 -0400 From: John Baldwin To: freebsd-hackers@freebsd.org Date: Fri, 1 Jul 2005 09:40:12 -0400 User-Agent: KMail/1.8 References: <20050620152649.GA1201@stack.nl> <20050701053937.GA40965%imura@ryu16.org> In-Reply-To: <20050701053937.GA40965%imura@ryu16.org> MIME-Version: 1.0 Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: 7bit Content-Disposition: inline Message-Id: <200507010940.13672.jhb@FreeBSD.org> Cc: Jilles Tjoelker , "R. Imura" Subject: Re: what(1) on kernel binary X-BeenThere: freebsd-hackers@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: Technical Discussions relating to FreeBSD List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 01 Jul 2005 13:47:20 -0000 On Friday 01 July 2005 01:39 am, R. Imura wrote: > Hi, > > On Mon, Jun 20, 2005 at 05:26:49PM +0200, Jilles Tjoelker wrote: > > On FreeBSD 4.x, one could easily determine the version and compilation > > date of a kernel binary like this: > > > > jilles@toad /home/jilles% what /kernel > > /kernel: > > FreeBSD 4.11-STABLE #20: Mon May 9 18:43:52 CEST 2005 > > > > On FreeBSD 5.x/6.x with GCC 3.x, this doesn't work anymore. > > > > The cause is that these two arrays (in /sys/conf/newvers.sh) are now both > > aligned to a 32-byte boundary, so there are 28 null bytes between @(#) > > and the version number: > > > > char sccspad[32 - 4 /* sizeof(sccs) */] = { '\\0' }; > > char sccs[4] = { '@', '(', '#', ')' }; > > > > A possible solution is to change the two arrays to a single one > > containing 28 null bytes and @(#). > > > > char sccs[32] = { '\\0', '\\0', '\\0', '\\0', '\\0', '\\0', '\\0', > > '\\0', '\\0', '\\0', '\\0', '\\0', '\\0', '\\0', '\\0', '\\0', '\\0', > > '\\0', '\\0', '\\0', '\\0', '\\0', '\\0', '\\0', '\\0', '\\0', '\\0', > > '\\0', '@', '(', '#', ')' }; > > It works ok with the former option(A), but it doesn't with latter(B) with > my FreeBSD box. > > (A) cc -c vers.c > > (B) cc -c -O2 -frename-registers -pipe -fno-strict-aliasing -Wall > -Wredundant-decls -Wnested-externs -Wstrict-prototypes > -Wmissing-prototypes -Wpointer-arith -Winline -Wcast-qual > -fformat-extensions -std=c99 -g -nostdinc -I- -I. -I/usr/src/sys > -I/usr/src/sys/contrib/dev/acpica -I/usr/src/sys/contrib/altq > -I/usr/src/sys/contrib/ipfilter -I/usr/src/sys/contrib/pf > -I/usr/src/sys/contrib/dev/ath -I/usr/src/sys/contrib/dev/ath/freebsd > -I/usr/src/sys/contrib/ngatm -I/usr/src/sys/dev/twa -D_KERNEL -include > opt_global.h -fno-common -finline-limit=8000 --param inline-unit-growth=100 > --param large-function-growth=1000 -fno-omit-frame-pointer -mcmodel=kernel > -mno-red-zone -mfpmath=387 -mno-sse -mno-sse2 -mno-mmx -mno-3dnow > -msoft-float -fno-asynchronous-unwind-tables -ffreestanding -Werror vers.c > > IMHO, the simplest solution is duplicate writing ${VERSION} like this, > but this would let kernel be 20-30bytes bigger. > > ------------------------------- > cat << EOF > vers.c > $COPYRIGHT > char sccs[] = "@(#)${VERSION} #${v}: ${t}"; > char version[] = "${VERSION} #${v}: ${t}\\n ${u}@${h}:${d}\\n"; > char ostype[] = "${TYPE}"; > char osrelease[] = "${RELEASE}"; > int osreldate = ${RELDATE}; > char kern_ident[] = "${i}"; > EOF > ------------------------------- Hmm, this is what I came up with when talking to bde@: --- newvers.sh 15 Jan 2005 13:25:41 -0000 1.68 +++ newvers.sh 22 Jun 2005 14:40:48 -0000 @@ -83,15 +83,15 @@ touch version v=`cat version` u=${USER:-root} d=`pwd` h=${HOSTNAME:-`hostname`} t=`date` i=`${MAKE:-make} -V KERN_IDENT` +fullversion="${VERSION} #${v}: ${t}\n ${u}@${h}:${d}"; cat << EOF > vers.c $COPYRIGHT -char sccspad[32 - 4 /* sizeof(sccs) */] = { '\\0' }; -char sccs[4] = { '@', '(', '#', ')' }; -char version[] = "${VERSION} #${v}: ${t}\\n ${u}@${h}:${d}\\n"; -char ostype[] = "${TYPE}"; -char osrelease[] = "${RELEASE}"; -int osreldate = ${RELDATE}; -char kern_ident[] = "${i}"; +const char sccs[] = "@(#)${fullversion}"; +const char version[] = "${fullversion}"; +const char ostype[] = "${TYPE}"; +const char osrelease[] = "${RELEASE}"; +const int osreldate = ${RELDATE}; +const char kern_ident[] = "${i}"; EOF does sccs[] only need to include the version up to the first \n? bde@ noticed that what seemed to stop once it hit \n. -- John Baldwin <>< http://www.FreeBSD.org/~jhb/ "Power Users Use the Power to Serve" = http://www.FreeBSD.org From owner-freebsd-hackers@FreeBSD.ORG Fri Jul 1 14:39:33 2005 Return-Path: X-Original-To: freebsd-hackers@FreeBSD.org 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 1DDF916A41C; Fri, 1 Jul 2005 14:39:33 +0000 (GMT) (envelope-from imura@ryu16.org) Received: from mail.ryu16.org (usen-221x249x107x70.ap-US01.usen.ad.jp [221.249.107.70]) by mx1.FreeBSD.org (Postfix) with ESMTP id 6016143D1D; Fri, 1 Jul 2005 14:39:31 +0000 (GMT) (envelope-from imura@ryu16.org) Received: from redeye.xt.ryu16.org (localhost [127.0.0.1]) by mail.ryu16.org (8.12.9p1/8.12.9) with ESMTP id j61EdVn7054711; Fri, 1 Jul 2005 23:39:31 +0900 (JST) (envelope-from imura@redeye.xt.ryu16.org) Received: (from imura@localhost) by redeye.xt.ryu16.org (8.12.9p1/8.12.9/Submit) id j61EdUtY054709; Fri, 1 Jul 2005 23:39:30 +0900 (JST) (envelope-from imura) Date: Fri, 1 Jul 2005 23:39:30 +0900 From: "R. Imura" To: John Baldwin Message-ID: <20050701143930.GA54441%imura@ryu16.org> References: <20050620152649.GA1201@stack.nl> <20050701053937.GA40965%imura@ryu16.org> <200507010940.13672.jhb@FreeBSD.org> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <200507010940.13672.jhb@FreeBSD.org> User-Agent: Mutt/1.4.1i-ja.1 Cc: freebsd-hackers@FreeBSD.org, Jilles Tjoelker Subject: Re: what(1) on kernel binary X-BeenThere: freebsd-hackers@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: Technical Discussions relating to FreeBSD List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 01 Jul 2005 14:39:33 -0000 Hi, On Fri, Jul 01, 2005 at 09:40:12AM -0400, John Baldwin wrote: > does sccs[] only need to include the version up to the first \n? bde@ noticed > that what seemed to stop once it hit \n. what.c says like this. while ((c = getchar()) != EOF && c && c != '"' && c != '>' && c != '\\' && c != '\n') putchar(c); According to cvs repo, \n is a terminater since 4.4BSD Lite. I don't know before 4.4BSD Lite. I don't know about sccs neither. Regards, - R. Imura From owner-freebsd-hackers@FreeBSD.ORG Fri Jul 1 17:06:02 2005 Return-Path: X-Original-To: freebsd-hackers@freebsd.org 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 23BF616A41C for ; Fri, 1 Jul 2005 17:06:02 +0000 (GMT) (envelope-from sam@errno.com) Received: from ebb.errno.com (ebb.errno.com [66.127.85.87]) by mx1.FreeBSD.org (Postfix) with ESMTP id E816943D1F for ; Fri, 1 Jul 2005 17:05:59 +0000 (GMT) (envelope-from sam@errno.com) Received: from [66.127.85.94] ([66.127.85.94]) (authenticated bits=0) by ebb.errno.com (8.12.9/8.12.6) with ESMTP id j61H5ums012185 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=NO); Fri, 1 Jul 2005 10:05:59 -0700 (PDT) (envelope-from sam@errno.com) Message-ID: <42C5780C.5050706@errno.com> Date: Fri, 01 Jul 2005 10:06:20 -0700 From: Sam Leffler Organization: Errno Consulting User-Agent: Mozilla Thunderbird 1.0.2 (Macintosh/20050317) X-Accept-Language: en-us, en MIME-Version: 1.0 To: Sam Pierson References: In-Reply-To: Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit Cc: FreeBSD Hackers Subject: Re: Accurate/Fine-grained timing of latency in atheros drivers X-BeenThere: freebsd-hackers@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: Technical Discussions relating to FreeBSD List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 01 Jul 2005 17:06:02 -0000 Sam Pierson wrote: > Hey guys, > > In a current project, I need to find out exactly how long it takes to send > a 802.11 packet and how much time is spent in the following stages: > > send time - time spent constructing message, including context switches > and other delays and the time it takes to transfer the message to the > network card. You didn't provide enough info to really answer this but it sounds like it's time spent prior to handing the packet to the h/w in which case you need to augment the existing code. Atheros h/w uses dma so "time it takes to transfer the message to the network card" is kinda nebulous. If you want to know when the h/w starts dma then you can mark a tx descriptor to get an interrupt when it's processed but unless you poll the tx dma registers you cannot tell when dma has started and even then you can only get an approximation. The better thing to do is use a bus analyzer and watch for particular data patterns and/or addresses. > > access time - delay which we experience waiting to access the transmitting > channel. Normally this would include the RTS and CTS queuing signals, > but for this application, I have to disable them. Is it possible that no time > is spent waiting here, if I have disabled the whole CSMA scheme on the > hardware level? Depends. Regardless you'll need to monitor at the h/w level with an analyzer. > > propagation time - how long it takes to get to the receiver, once it has left > our card You must monitor the medium unless sniffing for the ack is good enough. > > receive time - how long it takes for the receiving network card to get the > message and notify the host that it has something to read. You need h/w monitoring. > > Am I going to have to put in hardware interrupts to time these events or > are such tools already available? You need to expose the pci bus and use an analyzer for much of this. Sam From owner-freebsd-hackers@FreeBSD.ORG Fri Jul 1 20:25:53 2005 Return-Path: X-Original-To: hackers@freebsd.org 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 C4D6D16A41C; Fri, 1 Jul 2005 20:25:53 +0000 (GMT) (envelope-from mime@traveller.cz) Received: from ss.eunet.cz (ss.eunet.cz [193.85.228.13]) by mx1.FreeBSD.org (Postfix) with ESMTP id 5801443D1F; Fri, 1 Jul 2005 20:25:52 +0000 (GMT) (envelope-from mime@traveller.cz) Received: from localhost.i.cz (ss.eunet.cz [193.85.228.13]) by ss.eunet.cz (8.13.1/8.13.1) with ESMTP id j61KPlTB038338; Fri, 1 Jul 2005 22:25:48 +0200 (CEST) (envelope-from mime@traveller.cz) From: Michal Mertl To: Daniel Eischen In-Reply-To: <1119455157.1401.9.camel@genius1.i.cz> References: <1119455157.1401.9.camel@genius1.i.cz> Content-Type: text/plain Date: Fri, 01 Jul 2005 22:25:46 +0200 Message-Id: <1120249546.749.25.camel@genius1.i.cz> Mime-Version: 1.0 X-Mailer: Evolution 2.2.3 FreeBSD GNOME Team Port Content-Transfer-Encoding: 7bit Cc: Dag-Erling =?ISO-8859-1?Q?Sm=F8rgrav?= , hackers@freebsd.org, Charles Sprickman Subject: Re: Nagios and threads X-BeenThere: freebsd-hackers@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: Technical Discussions relating to FreeBSD List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 01 Jul 2005 20:25:53 -0000 On Wed, 22 Jun 2005, I wrote: > Daniel Eischen wrote: > > On Tue, 21 Jun 2005, Michal Mertl wrote: > > > > > Dag-Erling Smrgrav wrote: > > > > Charles Sprickman writes: > > > > > 1. FreeBSD and threads. On FreeBSD there's a native user-level > > > > > implementation of threads called 'pthread' and there's also an > > > > > optional ports collection 'linuxthreads' that uses kernel hooks. > > > > > > > > This is only the case for FreeBSD 4. FreeBSD 5 has native threads. > > > > > > Yes, the description on Nagios page is not precise but unfortunately > > > Nagios still has some problems even on 5.4. I wasn't able to find out > > > what was wrong and the problem dissappeared when I had to replace the > > > computer with single-processor one. The symptoms I observed were that > > > every several days one Nagios process was consuming all the CPU doing > > > hundreds of thousands of syscalls per second. It got always stuck around > > > the time when the the daily cron job run. > > > > > > I did a ktrace on the stuck process and tried to abort it to have the > > > core but I've lost the ktrace output and it never saved the core :-(. > > > > > > I'll install it on another machine and try to diagnose the problem some > > > more. > > > > You gotta try it on -stable. > > OK. I installed Nagios on a SMP computer with fresh -stable. I tried to > stress the disk but until now Nagios hasn't hung. > > Michal Just FYI - I really wasn't able to provoke the hang. I've no idea if the reason is my upgrade to STABLE or something else. I can only confirm what went on this thread - Nagios seems to have lots of short lived children (for the tests) which are probably created with fork and the main process is multithreaded. Michal From owner-freebsd-hackers@FreeBSD.ORG Fri Jul 1 20:41:21 2005 Return-Path: X-Original-To: hackers@freebsd.org 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 B10AD16A41C; Fri, 1 Jul 2005 20:41:21 +0000 (GMT) (envelope-from andrit@ukr.net) Received: from storage.ukr.net (storage.ukr.net [212.42.65.69]) by mx1.FreeBSD.org (Postfix) with ESMTP id 698BE43D49; Fri, 1 Jul 2005 20:41:21 +0000 (GMT) (envelope-from andrit@ukr.net) Received: from dialup-147.45.sitel.com.ua ([217.27.147.45] helo=ertpc) by storage.ukr.net with smtp ID 1DoSK7-000OtC-B2 ; Fri, 01 Jul 2005 23:41:19 +0300 Message-ID: <003001c57e7d$3684c5d0$2d931bd9@ertpc> From: "Andriy Tkachuk" To: "John Baldwin" References: <000d01c57cf7$b9b6f9f0$29931bd9@ertpc> <200506300955.10155.jhb@FreeBSD.org> Date: Fri, 1 Jul 2005 15:49:53 +0300 MIME-Version: 1.0 Content-Type: text/plain; charset="koi8-r" Content-Transfer-Encoding: 7bit X-Priority: 3 X-MSMail-Priority: Normal X-Mailer: Microsoft Outlook Express 6.00.2600.0000 X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2600.0000 Cc: hackers@freebsd.org Subject: Re: hot path optimizations in uma_zalloc() & uma_zfree() X-BeenThere: freebsd-hackers@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: Technical Discussions relating to FreeBSD List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 01 Jul 2005 20:41:21 -0000 > I ran ministat against your tests with 1000 sockets loop and there isn't a lot > of difference in the user times: it was not supposed to be (the difference in the user times) From owner-freebsd-hackers@FreeBSD.ORG Fri Jul 1 21:02:07 2005 Return-Path: X-Original-To: freebsd-hackers@freebsd.org 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 3745116A41C; Fri, 1 Jul 2005 21:02:07 +0000 (GMT) (envelope-from andrit@ukr.net) Received: from kitty.ukr.net (kitty.ukr.net [212.42.65.67]) by mx1.FreeBSD.org (Postfix) with ESMTP id BA69443D1D; Fri, 1 Jul 2005 21:02:06 +0000 (GMT) (envelope-from andrit@ukr.net) Received: from dialup-148.13.sitel.com.ua ([217.27.148.13] helo=ertpc) by kitty.ukr.net with smtp ID 1DoSeA-0004if-1K ; Sat, 02 Jul 2005 00:02:05 +0300 Message-ID: <008f01c57e80$1b38fb40$2d931bd9@ertpc> From: "Andriy Tkachuk" To: "John Baldwin" , References: <000d01c57cf7$b9b6f9f0$29931bd9@ertpc> <200506301415.38106.max@love2party.net> <003901c57d82$37891b80$de921bd9@ertpc> <200506301328.43333.jhb@FreeBSD.org> Date: Sat, 2 Jul 2005 00:01:41 +0300 MIME-Version: 1.0 Content-Type: text/plain; charset="koi8-r" Content-Transfer-Encoding: 7bit X-Priority: 3 X-MSMail-Priority: Normal X-Mailer: Microsoft Outlook Express 6.00.2600.0000 X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2600.0000 Cc: Max Laier Subject: Re: hot path optimizations in uma_zalloc() & uma_zfree() X-BeenThere: freebsd-hackers@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: Technical Discussions relating to FreeBSD List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 01 Jul 2005 21:02:07 -0000 > On Thursday 30 June 2005 10:35 am, Andriy Tkachuk wrote: > > I just checked the object code - you right, it almost the same: > > > > - bucket->ub_bucket[bucket->ub_cnt] = item; > > - 22b9: 0f bf 43 08 movswl 0x8(%ebx),%eax > > - 22bd: 8b 4d 0c mov 0xc(%ebp),%ecx > > - 22c0: 89 4c 83 0c mov %ecx,0xc(%ebx,%eax,4) > > - bucket->ub_cnt++; > > - 22c4: 8d 42 01 lea 0x1(%edx),%eax > > - 22c7: 66 89 43 08 mov %ax,0x8(%ebx) > > + bucket->ub_bucket[bucket->ub_cnt++] = item; > > + 22b9: 0f bf c2 movswl %dx,%eax > > + 22bc: 8b 4d 0c mov 0xc(%ebp),%ecx > > + 22bf: 89 4c 83 0c mov %ecx,0xc(%ebx,%eax,4) > > + 22c3: 8d 42 01 lea 0x1(%edx),%eax > > + 22c6: 66 89 43 08 mov %ax,0x8(%ebx) > > > > but still there is some minor difference in first line. > > I'm not familiar with assembler, can somebody explain > > whether this difference is assential or not? > > It just uses the stored value of the variable in %dx instead of loading it > from memory at 0x8(%ebx). When I compiled a simple test program here locally > I got identical object code though. Probaly this is the reason of throughput increasing. I want to note, that all tests where made on my home workstation. And each new test was made with new kernel just after rebooting in ttyv withoud X-server. I think the noise was not assential. Ministats against second & third optimization showed this results: (for different number of sockets created & destroyed in one iteration) > /usr/src/tools/tools/ministat/ministat -c 99.5 sockloop_stat2_o1_sys_1000 sockloop_stat2_o2_sys_1000 x sockloop_stat2_o1_sys_1000 + sockloop_stat2_o2_sys_1000 +--------------------------------------------------------------------------+ |+ + + x x x| ||______________A_____________| |_______M__A__________| | +--------------------------------------------------------------------------+ N Min Max Median Avg Stddev x 3 2.373 2.403 2.381 2.3856667 0.015534907 + 3 2.298 2.34 2.32 2.3193333 0.021007935 No difference proven at 99.5% confidence > /usr/src/tools/tools/ministat/ministat -c 99.5 sockloop_stat2_o1_sys_100 sockloop_stat2_o2_sys_100 x sockloop_stat2_o1_sys_100 + sockloop_stat2_o2_sys_100 +--------------------------------------------------------------------------+ |+ + + x x x | | |___________________A__M_______________| |_______AM_____|| +--------------------------------------------------------------------------+ N Min Max Median Avg Stddev x 3 2.158 2.182 2.174 2.1713333 0.012220202 + 3 2.062 2.126 2.102 2.0966667 0.032331615 No difference proven at 99.5% confidence > /usr/src/tools/tools/ministat/ministat -c 99.5 sockloop_stat2_o1_sys_10 sockloop_stat2_o2_sys_10 x sockloop_stat2_o1_sys_10 + sockloop_stat2_o2_sys_10 +--------------------------------------------------------------------------+ | + | | + + x xx | ||_M_A____| |________A___M___|| +--------------------------------------------------------------------------+ N Min Max Median Avg Stddev x 3 1.754 1.777 1.776 1.769 0.013 + 3 1.672 1.684 1.673 1.6763333 0.0066583281 Difference at 99.5% confidence -0.0926667 +/- 0.060488 -5.23836% +/- 3.41934% (Student's t, pooled s = 0.010328) > /usr/src/tools/tools/ministat/ministat -c 99.5 sockloop_stat2_o1_sys_1 sockloop_stat2_o2_sys_1 x sockloop_stat2_o1_sys_1 + sockloop_stat2_o2_sys_1 +--------------------------------------------------------------------------+ |+ + + x x x| ||________AM_______| |____M_A_______| | +--------------------------------------------------------------------------+ N Min Max Median Avg Stddev x 3 1.938 1.993 1.953 1.9613333 0.028431204 + 3 1.722 1.785 1.759 1.7553333 0.031659648 Difference at 99.5% confidence -0.206 +/- 0.176222 -10.5031% +/- 8.98479% (Student's t, pooled s = 0.0300888) and for default confidence (95%) this results: > /usr/src/tools/tools/ministat/ministat sockloop_stat2_o1_sys_1000 sockloop_stat2_o2_sys_1000 x sockloop_stat2_o1_sys_1000 + sockloop_stat2_o2_sys_1000 +--------------------------------------------------------------------------+ |+ + + x x x| ||______________A_____________| |_______M__A__________| | +--------------------------------------------------------------------------+ N Min Max Median Avg Stddev x 3 2.373 2.403 2.381 2.3856667 0.015534907 + 3 2.298 2.34 2.32 2.3193333 0.021007935 Difference at 95.0% confidence -0.0663333 +/- 0.0418758 -2.78049% +/- 1.75531% (Student's t, pooled s = 0.0184752) > /usr/src/tools/tools/ministat/ministat sockloop_stat2_o1_sys_100 sockloop_stat2_o2_sys_100 x sockloop_stat2_o1_sys_100 + sockloop_stat2_o2_sys_100 +--------------------------------------------------------------------------+ |+ + + x x x | | |___________________A__M_______________| |_______AM_____|| +--------------------------------------------------------------------------+ N Min Max Median Avg Stddev x 3 2.158 2.182 2.174 2.1713333 0.012220202 + 3 2.062 2.126 2.102 2.0966667 0.032331615 Difference at 95.0% confidence -0.0746667 +/- 0.0553965 -3.43875% +/- 2.55127% (Student's t, pooled s = 0.0244404) Resume: the difference is present and it is more for smaller deviations in balanced allocs & frees. It is up to 10% if deviation is minimal. -- Andriy Tkachuk. From owner-freebsd-hackers@FreeBSD.ORG Fri Jul 1 21:57:25 2005 Return-Path: X-Original-To: hackers@freebsd.org 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 2D00C16A421 for ; Fri, 1 Jul 2005 21:57:25 +0000 (GMT) (envelope-from andrit@ukr.net) Received: from kitty.ukr.net (kitty.ukr.net [212.42.65.67]) by mx1.FreeBSD.org (Postfix) with ESMTP id DEE2043D48 for ; Fri, 1 Jul 2005 21:57:24 +0000 (GMT) (envelope-from andrit@ukr.net) Received: from [80.84.191.150] (helo=ertpc) by kitty.ukr.net with smtp ID 1DoTVa-0009Ob-E7 for hackers@freebsd.org; Sat, 02 Jul 2005 00:57:23 +0300 Message-ID: <00ad01c57e87$d417ee30$2d931bd9@ertpc> From: "Andriy Tkachuk" To: Date: Sat, 2 Jul 2005 00:55:46 +0300 MIME-Version: 1.0 Content-Type: text/plain; charset="koi8-r" Content-Transfer-Encoding: 7bit X-Priority: 3 X-MSMail-Priority: Normal X-Mailer: Microsoft Outlook Express 6.00.2600.0000 X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2600.0000 Cc: Subject: Re: hot path optimizations in uma_zalloc() & uma_zfree() X-BeenThere: freebsd-hackers@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: Technical Discussions relating to FreeBSD List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 01 Jul 2005 21:57:25 -0000 > if one will decide to commit first optimization (about buckets), > then there must some adjustments be made also > regarding correct statistics gathering. It seems that all is fine with statistics, i mistook. From owner-freebsd-hackers@FreeBSD.ORG Fri Jul 1 22:47:38 2005 Return-Path: X-Original-To: freebsd-hackers@freebsd.org 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 1FF8A16A41C for ; Fri, 1 Jul 2005 22:47:38 +0000 (GMT) (envelope-from gayn.winters@mail.bristolsystems.com) Received: from dns.bristolsystems.com (h-68-167-239-98.lsanca54.covad.net [68.167.239.98]) by mx1.FreeBSD.org (Postfix) with ESMTP id E5F4843D1D for ; Fri, 1 Jul 2005 22:47:37 +0000 (GMT) (envelope-from gayn.winters@mail.bristolsystems.com) Received: from workdog ([192.168.1.201]) by dns.bristolsystems.com (8.11.6/8.11.6) with ESMTP id j61MlWg24338; Fri, 1 Jul 2005 15:47:32 -0700 From: "Gayn Winters" To: "=?iso-8859-1?Q?'=22Dag-Erling_Sm=F8rgrav=22'?=" , "'Masashi SAKURADA'" Date: Fri, 1 Jul 2005 15:47:22 -0700 Message-ID: <021201c57e8e$dbc65070$c901a8c0@workdog> MIME-Version: 1.0 Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: quoted-printable X-Priority: 3 (Normal) X-MSMail-Priority: Normal X-Mailer: Microsoft Outlook, Build 10.0.4024 In-Reply-To: <86y88shzt7.fsf@xps.des.no> X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2900.2180 Importance: Normal Cc: freebsd-hackers@freebsd.org Subject: RE: ICH6R RAID X-BeenThere: freebsd-hackers@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: Technical Discussions relating to FreeBSD List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 01 Jul 2005 22:47:38 -0000 Hi! Thanks for the info. Thus to get ICH6R supported on 5.4 I need to load 5.4R onto one drive, apply the mk3 patch, recompile, reboot, build a release bootable CD, shutdown, reset the hardware to RAID1, and reload from the new CD. This ought to work like it does using 6.0-CURRENT-SNAP004 (which I am now happy with). The suggestion below to avoid sysinstall and craft the array by hand doesn't seem to use the hardware RAID1 supported by ICH6R. 1. How exactly do I know when a patch (mk3 in this case) is in a release? 2. If the above strategy makes sense, how can I get the latest mk3 for 5.4? 3. If I'm missing something, e.g. around sysinstall, what am I missing? (Sakurada-san suggested using atacontrol create.. to build ar0 with a degraded array (that I got to work), but if the above strategy works, I think this won't be necessary, unless again I'm missing something! 4. I'm leaning towards just using software RAID (gmirror) for this system, which must be a production system when it is up. Both 5.4 and 6.0 look hopeless for different reasons. Thoughts on this? Thanks for the help! -gayn > -----Original Message----- > From: "Dag-Erling Sm=F8rgrav" [mailto:des@des.no]=20 > Sent: Thursday, June 30, 2005 4:03 AM > To: Gayn Winters > Cc: freebsd-hackers@freebsd.org > Subject: Re: ICH6R RAID >=20 >=20 > "Gayn Winters" writes: > > Now man ata(4) indicates that only up to ICH5 is supported=20 > in 5.4 while > > up to ICH6 is supported in 6.0, but the hardware archives=20 > indicate that > > sos's MK3 patches made it into 5.4-RELEASE, and 6.0 "fully"=20 > supports the > > ICH6R. However, I'm actually not sure the precise story here. >=20 > 5.4 does not have MK3. >=20 > > Has anyone out there actually booted FreeBSD using mirrored=20 > SATA drives > > with an ICH6R? If so, how did you do it and what version=20 > did you use? >=20 > Nothing special. I started out with a hand-rolled bootable livecd of > -CURRENT with the MK3 patches when they first became available, and > did a manual install (no sysinstall, fdisk + disklabel + newfs + tar) >=20 > DES > --=20 > Dag-Erling Sm=F8rgrav - des@des.no >=20 From owner-freebsd-hackers@FreeBSD.ORG Sat Jul 2 10:11:47 2005 Return-Path: X-Original-To: freebsd-hackers@freebsd.org 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 DC0DC16A41C for ; Sat, 2 Jul 2005 10:11:47 +0000 (GMT) (envelope-from sebastien.b@swissinfo.org) Received: from md1.swissinfo.org (md1.swissinfo.org [146.159.4.92]) by mx1.FreeBSD.org (Postfix) with ESMTP id 60A8643D1D for ; Sat, 2 Jul 2005 10:11:46 +0000 (GMT) (envelope-from sebastien.b@swissinfo.org) Received: from mail.swissinfo.org ([194.6.181.33]) by md1.swissinfo.org (phad1.swissinfo.org [146.159.6.9]) (MDaemon.PRO.v7.2.1.R) with ESMTP id 03-md50000552320.msg for ; Sat, 02 Jul 2005 12:11:43 +0200 Received: from AAmiens-152-1-18-135.w83-192.abo.wanadoo.fr (83.192.199.135) by mail.swissinfo.org (7.0.020) (authenticated as sebastien.b) id 41539420044EA7C9 for freebsd-hackers@freebsd.org; Sat, 2 Jul 2005 12:11:43 +0200 From: Seb To: freebsd-hackers@freebsd.org Date: Sat, 2 Jul 2005 12:12:04 +0200 User-Agent: KMail/1.8 References: <200506251203.13569.sebastien.b@swissinfo.org> <200506291155.50929.sebastien.b@swissinfo.org> <20050629134029.GA220@pm514-9.comsys.ntu-kpi.kiev.ua> In-Reply-To: <20050629134029.GA220@pm514-9.comsys.ntu-kpi.kiev.ua> MIME-Version: 1.0 Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: quoted-printable Content-Disposition: inline Message-Id: <200507021212.05048.sebastien.b@swissinfo.org> X-Spam-Processed: phad1.swissinfo.org, Sat, 02 Jul 2005 12:11:43 +0200 (not processed: message from valid local sender) X-MDRemoteIP: 194.6.181.33 X-Return-Path: sebastien.b@swissinfo.org X-MDaemon-Deliver-To: freebsd-hackers@freebsd.org X-MDAV-Processed: phad1.swissinfo.org, Sat, 02 Jul 2005 12:11:43 +0200 Subject: Re: Accessing filesystem from a KLD X-BeenThere: freebsd-hackers@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: Technical Discussions relating to FreeBSD List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 02 Jul 2005 10:11:48 -0000 Andrey Simonenko wrote=A0: > You got page fault from namei(), which is called from vn_open() to lookup > a path name. namei() tries to obtain a reference on current directory for > the current thread. This current directory (fd_cdir field) is NULL in > your kthread. At this point a page fault in kernel address space is > generated. You were right :) It works now. > Can you change fd_cdir in kthread to rootvnode I don't know, haven't > checked this yet. =20 It works - and that's what NDISulator does. You also need to set fd_rdir. Thanks ! Mike Silbersack wrote : > Ask damien.bergamini@free.fr for his code that does exactly what you're=20 > asking for. :) I've looked at Damien's source, but AFAIK in his driver, the firmware is=20 loaded from userspace through an ioctl call on the network interface. From owner-freebsd-hackers@FreeBSD.ORG Sat Jul 2 10:29:18 2005 Return-Path: X-Original-To: hackers@freebsd.org 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 22FD316A41C for ; Sat, 2 Jul 2005 10:29:18 +0000 (GMT) (envelope-from andrit@ukr.net) Received: from storage.ukr.net (storage.ukr.net [212.42.65.69]) by mx1.FreeBSD.org (Postfix) with ESMTP id CA1A943D1D for ; Sat, 2 Jul 2005 10:29:17 +0000 (GMT) (envelope-from andrit@ukr.net) Received: from [80.84.191.52] (helo=ertpc) by storage.ukr.net with smtp ID 1DofFL-000Jjc-1y ; Sat, 02 Jul 2005 13:29:15 +0300 Message-ID: <001401c57ef0$dd489720$34bf5450@ertpc> From: "Andriy Tkachuk" To: "Nikos Ntarmos" References: <000d01c57cf7$b9b6f9f0$29931bd9@ertpc> <20050630163126.GA7365@diogenis.ceid.upatras.gr> Date: Sat, 2 Jul 2005 13:27:00 +0300 MIME-Version: 1.0 Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: 7bit X-Priority: 3 X-MSMail-Priority: Normal X-Mailer: Microsoft Outlook Express 6.00.2600.0000 X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2600.0000 Cc: hackers@freebsd.org Subject: Re: hot path optimizations in uma_zalloc() & uma_zfree() X-BeenThere: freebsd-hackers@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: Technical Discussions relating to FreeBSD List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 02 Jul 2005 10:29:18 -0000 I have doubts it will works: - item = bucket->ub_bucket[--bucket->ub_cnt]; - 1bbe: 66 ff 49 08 decw 0x8(%ecx) - 1bc2: 0f bf 41 08 movswl 0x8(%ecx),%eax - 1bc6: 8b 44 81 14 mov 0x14(%ecx,%eax,4),%eax - 1bca: 89 45 f0 mov %eax,0xfffffff0(%ebp) + item = *(--bucket->ub_last); + 1bbe: 8b 51 0c mov 0xc(%ecx),%edx + 1bc1: 8d 42 fc lea 0xfffffffc(%edx),%eax + 1bc4: 89 41 0c mov %eax,0xc(%ecx) + 1bc7: 8b 52 fc mov 0xfffffffc(%edx),%edx + 1bca: 89 55 f0 mov %edx,0xfffffff0(%ebp) here even more refereces to memory in your variant. - bucket->ub_bucket[bucket->ub_cnt++] = item; - 22b9: 0f bf c2 movswl %dx,%eax - 22bc: 8b 4d 0c mov 0xc(%ebp),%ecx - 22bf: 89 4c 83 14 mov %ecx,0x14(%ebx,%eax,4) - 22c3: 8d 42 01 lea 0x1(%edx),%eax - 22c6: 66 89 43 08 mov %ax,0x8(%ebx) + *(bucket->ub_last++) = item; + 22b9: 8b 43 0c mov 0xc(%ebx),%eax + 22bc: 8b 55 0c mov 0xc(%ebp),%edx + 22bf: 89 10 mov %edx,(%eax) + 22c1: 83 43 0c 04 addl $0x4,0xc(%ebx) ----- Original Message ----- From: "Nikos Ntarmos" To: "ant" Cc: Sent: Thursday, June 30, 2005 7:31 PM Subject: Re: hot path optimizations in uma_zalloc() & uma_zfree() > Hi there. > > I wouldn't have gone into this if ant hadn't produced that 10% figure > for the speed improvement with simply reordering of increments and > dereferences (although jhb@ reported the speed-up he noticed was much > less than that). > > I attach* a patch that: (i) incorporates ant's exchange of uc_freebucket > for uc_allocbucket, and (ii) throws away the uma_bucket.ub_cnt counter > of free bucket entries, in favor of a pointer -- uma_bucket.ub_last -- > to the last free bucket entry. If a simple reordering is capable of > producing a 10% improvement, this change should do much better, since it > saves the 'add-' in the 'add-and-dereference' process of using arrays > and counters. The semantics of the pointer closely follow those of the > ub_cnt counter: ub_last - ub_bucket should equal the old value of > ub_cnt. > > I grep'ed through the whole source repository and the uses of > uma_bucket.ub_cnt seem confined within sys/vm/uma_core.c, so this change > must be quite self-contained -- i.e. the change in the fields of > uma_bucket doesn't seem to affect any other part of the system. One > could argue that it may make the code a bit less readable, but it only > affects uma_core.c, so it may be worth the "inconvenience". > > I don't have a FreeBSD box around any more, so I can't test this patch. > Heck, I can't either check it for syntax errors and such, so don't throw > things at me if this doesn't even compile. Can somebody with the time > and resources give it a try? > > \n\n > > * Also online at http://noth.ceid.upatras.gr/Misc/uma_bucket.diff > to avoid being bitten by mailers auto{wrapp,indent}ing the diff > content. > From owner-freebsd-hackers@FreeBSD.ORG Sat Jul 2 12:39:28 2005 Return-Path: X-Original-To: freebsd-hackers@freebsd.org 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 DBC3A16A41C for ; Sat, 2 Jul 2005 12:39:28 +0000 (GMT) (envelope-from stsp@stsp.in-berlin.de) Received: from einhorn.in-berlin.de (einhorn.in-berlin.de [192.109.42.8]) by mx1.FreeBSD.org (Postfix) with ESMTP id 6EA8543D1F for ; Sat, 2 Jul 2005 12:39:28 +0000 (GMT) (envelope-from stsp@stsp.in-berlin.de) X-Envelope-From: stsp@stsp.in-berlin.de X-Envelope-To: Received: from stud.seeling33.de (p54BE965E.dip0.t-ipconnect.de [84.190.150.94]) (authenticated bits=0) by einhorn.in-berlin.de (8.12.10/8.12.10/Debian-4) with ESMTP id j62CdP1t013520 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=NOT) for ; Sat, 2 Jul 2005 14:39:25 +0200 Received: by stud.seeling33.de (Postfix, from userid 1000) id 07710F7CC; Sat, 2 Jul 2005 14:33:25 +0200 (CEST) Date: Sat, 2 Jul 2005 14:33:25 +0200 From: stsp@stsp.in-berlin.de To: freebsd-hackers@freebsd.org Message-ID: <20050702123325.GA13307@stud.seeling33.de> Mail-Followup-To: freebsd-hackers@freebsd.org Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline User-Agent: Mutt/1.5.6i X-Spam-Score: (-1.063) BAYES_00,FORGED_RCVD_HELO,NO_REAL_NAME X-Scanned-By: MIMEDefang_at_IN-Berlin_e.V. on 192.109.42.8 Subject: wake on lan support for sis driver (NetSemi chip) X-BeenThere: freebsd-hackers@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: Technical Discussions relating to FreeBSD List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 02 Jul 2005 12:39:29 -0000 Hello, I have written a patch that teaches the sis driver to put the NatSemi DP83815 chip into wake on lan mode on system shutdown. A _very_ sketchy, but working, version, that still includes debugging related macro craft that won't be in the final version, can be found at http://stsp.in-berlin.de/wol/ Currently, the patch puts the card into "wake on Magic Packet" mode, and leaves it at that. There is no configurability at all. Ideally, I'd like the wake mode (None (default), Broadcast, Unicast, Magic Packet, etc) and special things like "SecureOn" passwords to be run-time configurable. The best idea I came up with is defining a set of wake on lan related ioctls, and adding commands to ifconfig that use them to hand user requests such as "put my card into wake on broadcast mode, please" down to the driver. With such a framework in place, adding wake on lan support for other cards would only require a driver to implement ioctls that match wake on lan features supported by the driver/chip, and voila, it's run-time configurable as well. This design also creates a unified user interface independent of the underlying driver, pretty much like 'ethtool' does on linux. Is there anything wrong with such a design, or does anyone have a better idea how to make the driver run-time configurable? I am not aware of any other network driver in the tree that implements wake on lan. But if there were any, I would of course adapt my patch to their behaviour. Any comments on the patch in general are also appreciated (Note that I've read style(9) by now, and I know that I need to make a few fixes here and there ;) thanks, stefan From owner-freebsd-hackers@FreeBSD.ORG Sat Jul 2 14:25:16 2005 Return-Path: X-Original-To: freebsd-hackers@freebsd.org 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 E007316A41C for ; Sat, 2 Jul 2005 14:25:16 +0000 (GMT) (envelope-from des@des.no) Received: from tim.des.no (tim.des.no [194.63.250.121]) by mx1.FreeBSD.org (Postfix) with ESMTP id 97BD843D1F for ; Sat, 2 Jul 2005 14:25:16 +0000 (GMT) (envelope-from des@des.no) Received: from tim.des.no (localhost [127.0.0.1]) by spam.des.no (Postfix) with ESMTP id F27BB6144; Sat, 2 Jul 2005 16:25:09 +0200 (CEST) Received: from xps.des.no (des.no [80.203.228.37]) by tim.des.no (Postfix) with ESMTP id D41B96103; Sat, 2 Jul 2005 16:25:09 +0200 (CEST) Received: by xps.des.no (Postfix, from userid 1001) id BE8D933D38; Sat, 2 Jul 2005 16:25:09 +0200 (CEST) To: "Gayn Winters" References: <021201c57e8e$dbc65070$c901a8c0@workdog> From: des@des.no (=?iso-8859-1?q?Dag-Erling_Sm=F8rgrav?=) Date: Sat, 02 Jul 2005 16:25:09 +0200 In-Reply-To: <021201c57e8e$dbc65070$c901a8c0@workdog> (Gayn Winters's message of "Fri, 1 Jul 2005 15:47:22 -0700") Message-ID: <86k6k9e14q.fsf@xps.des.no> User-Agent: Gnus/5.110002 (No Gnus v0.2) Emacs/21.3 (berkeley-unix) MIME-Version: 1.0 Content-Type: text/plain; charset=iso-8859-1 Content-Transfer-Encoding: quoted-printable X-Spam-Tests: ALL_TRUSTED,AWL,BAYES_00 X-Spam-Learn: ham X-Spam-Score: -5.2/5.0 X-Spam-Checker-Version: SpamAssassin 3.0.4 (2005-06-05) on tim.des.no Cc: freebsd-hackers@freebsd.org Subject: Re: ICH6R RAID X-BeenThere: freebsd-hackers@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: Technical Discussions relating to FreeBSD List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 02 Jul 2005 14:25:17 -0000 "Gayn Winters" writes: > Thus to get ICH6R supported on 5.4 I need to load 5.4R onto one drive, > apply the mk3 patch, recompile, reboot, build a release bootable CD, > shutdown, reset the hardware to RAID1, and reload from the new CD. This > ought to work like it does using 6.0-CURRENT-SNAP004 (which I am now > happy with). The suggestion below to avoid sysinstall and craft the > array by hand doesn't seem to use the hardware RAID1 supported by ICH6R. I don't quite follow that. > 1. How exactly do I know when a patch (mk3 in this case) is in a > release? by tracking release notes and / or commit logs > 2. If the above strategy makes sense, how can I get the latest mk3 for > 5.4? you can't. > 3. If I'm missing something, e.g. around sysinstall, what am I missing? > (Sakurada-san suggested using atacontrol create.. to build ar0 with a > degraded array (that I got to work), but if the above strategy works, I > think this won't be necessary, unless again I'm missing something! just configure the array in BIOS before installing. > 4. I'm leaning towards just using software RAID (gmirror) for this > system, which must be a production system when it is up. Both 5.4 and > 6.0 look hopeless for different reasons. Thoughts on this? I don't understand what you mean by hopeless. DES --=20 Dag-Erling Sm=F8rgrav - des@des.no From owner-freebsd-hackers@FreeBSD.ORG Sat Jul 2 15:34:55 2005 Return-Path: X-Original-To: hackers@freebsd.org 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 3B3F216A41C for ; Sat, 2 Jul 2005 15:34:55 +0000 (GMT) (envelope-from luke@foolishgames.com) Received: from mail.foolishgames.com (mail.foolishgames.com [216.55.178.45]) by mx1.FreeBSD.org (Postfix) with ESMTP id 1622443D48 for ; Sat, 2 Jul 2005 15:34:54 +0000 (GMT) (envelope-from luke@foolishgames.com) Received: from [192.168.0.49] (24-247-121-236.dhcp.klmz.mi.charter.com [24.247.121.236]) (authenticated bits=0) by mail.foolishgames.com (8.13.4/8.12.11) with ESMTP id j62FYoWb029279 (version=TLSv1/SSLv3 cipher=RC4-SHA bits=128 verify=NO) for ; Sat, 2 Jul 2005 08:34:54 -0700 (PDT) (envelope-from luke@foolishgames.com) X-Authentication-Warning: mail.foolishgames.com: Host 24-247-121-236.dhcp.klmz.mi.charter.com [24.247.121.236] claimed to be [192.168.0.49] X-Habeas-Swe-5: Sender Warranted Email (SWE) (tm). The sender of this Mime-Version: 1.0 (Apple Message framework v730) X-Habeas-Swe-8: Message (HCM) and not spam. Please report use of this X-Habeas-Swe-3: like Habeas SWE (tm) X-Habeas-Swe-6: email in exchange for a license for this Habeas X-Habeas-Swe-1: winter into spring Content-Type: text/plain; charset=US-ASCII; delsp=yes; format=flowed Message-Id: X-Habeas-Swe-9: mark in spam to . X-Habeas-Swe-4: Copyright 2002 Habeas (tm) Content-Transfer-Encoding: 7bit From: Lucas Holt X-Habeas-Swe-7: warrant mark warrants that this is a Habeas Compliant X-Habeas-Swe-2: brightly anticipated Date: Sat, 2 Jul 2005 11:34:35 -0400 To: hackers@freebsd.org X-Mailer: Apple Mail (2.730) Cc: Subject: 6 current snap 004 troubles X-BeenThere: freebsd-hackers@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: Technical Discussions relating to FreeBSD List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 02 Jul 2005 15:34:55 -0000 I just attempted to install the last current snap from june on one of my systems. About half way through the bootup process from the cd, the kernel dies with a cant divide by zero error. This occurs a little after trying to initialize my first sata drive. It does a connect, disconnect, connect on the device and then i hit the error. Is there a useful way to save the dmesg output without using a serial cable? (i don't have one) If not, i'll just type it up. I'd like to see this fixed by release as 5.4 does not support my sata controller out of the box. Lucas Holt Luke@FoolishGames.com ________________________________________________________ FoolishGames.com (Jewel Fan Site) JustJournal.com (Free blogging) FoolishGames.net (Enemy Territory IoM site) Think PC.. in 2006 you can own an Apple PCintosh. Whats next, windows works? From owner-freebsd-hackers@FreeBSD.ORG Sat Jul 2 16:22:09 2005 Return-Path: X-Original-To: freebsd-hackers@freebsd.org 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 450B216A41C for ; Sat, 2 Jul 2005 16:22:09 +0000 (GMT) (envelope-from ah0k@na.rim.or.jp) Received: from mail.jnsr.jp (usen-221x255x183x112.ap-US01.usen.ad.jp [221.255.183.112]) by mx1.FreeBSD.org (Postfix) with ESMTP id E1AF243D1F for ; Sat, 2 Jul 2005 16:22:07 +0000 (GMT) (envelope-from ah0k@na.rim.or.jp) Received: from localhost (localhost [127.0.0.1]) by romeo.jnsr.com (Postfix) with ESMTP id AA6D249; Thu, 30 Jun 2005 11:28:37 +0900 (JST) Date: Thu, 30 Jun 2005 11:28:37 +0900 (JST) Message-Id: <20050630.112837.130156743.ah0k@na.rim.or.jp> To: gayn.winters@mail.bristolsystems.com From: Masashi SAKURADA In-Reply-To: <003701c57d17$a3068340$c901a8c0@workdog> References: <003701c57d17$a3068340$c901a8c0@workdog> X-My-URL: http://www.ah0k.com/ x-pgp-public-key-url: http://www.ah0k.com/personal/c1868.html X-My-Uname: FreeBSD 4.11-RELEASE-p10 #33: Sun Jun 26 04:34:57 JST 2005 X-Mailer: Mew version 4.2 on Emacs 21.4 / Mule 5.0 (SAKAKI) Mime-Version: 1.0 Content-Type: Text/Plain; charset=us-ascii Content-Transfer-Encoding: 7bit Cc: freebsd-hackers@freebsd.org Subject: Re: ICH6R RAID X-BeenThere: freebsd-hackers@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: Technical Discussions relating to FreeBSD List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 02 Jul 2005 16:22:09 -0000 Hello, Gayn, From: "Gayn Winters" Subject: ICH6R RAID Date: Wed, 29 Jun 2005 19:01:31 -0700 > I even tried building the mirror then disabling one drive using the > firmware setup. The firmware says then to have the OS rebuild the > mirror. OK,... The OS then boots fine to ad4 and can see ad6. I can dd > if=/dev/ad4 of=/dev/ad6 successfully, but I cannot get atacontrol to > rebuild the mirror. Maybe this approach will work, and I'm doing > something wrong... I dont know if this is right way. Why don't you try atacontrol(8). Install minimal stuff to ad4, then try atacontrol create RAID1 0 /dev/ad4 /dev/ad6. Reboot by install CD, You can see ar0 and choose it to install what you want. ------------------------------------------Masashi SAKURADA/AH0K/JR2GMC E-mail: ah0k@na.rim.or.jp URL: http://www.ah0k.com/ PGP-fingerprint: 9332 0E9F 78AB E793 0E9F 84C6 FA74 3A11 3235 EC1E PGP-Public-Key: http://www.ah0k.com/personal/c1868.html From owner-freebsd-hackers@FreeBSD.ORG Sat Jul 2 19:36:09 2005 Return-Path: X-Original-To: hackers@freebsd.org 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 6857916A41C; Sat, 2 Jul 2005 19:36:09 +0000 (GMT) (envelope-from scottl@samsco.org) Received: from pooker.samsco.org (pooker.samsco.org [168.103.85.57]) by mx1.FreeBSD.org (Postfix) with ESMTP id 657E343D1F; Sat, 2 Jul 2005 19:36:07 +0000 (GMT) (envelope-from scottl@samsco.org) Received: from [192.168.254.11] (junior.samsco.home [192.168.254.11]) (authenticated bits=0) by pooker.samsco.org (8.13.3/8.13.3) with ESMTP id j62JhIGT094414; Sat, 2 Jul 2005 13:43:18 -0600 (MDT) (envelope-from scottl@samsco.org) Message-ID: <42C6ECA1.8060705@samsco.org> Date: Sat, 02 Jul 2005 13:36:01 -0600 From: Scott Long User-Agent: Mozilla/5.0 (X11; U; FreeBSD i386; en-US; rv:1.7.8) Gecko/20050615 X-Accept-Language: en-us, en MIME-Version: 1.0 To: current , hackers@freebsd.org Content-Type: text/plain; charset=us-ascii; format=flowed Content-Transfer-Encoding: 7bit X-Spam-Status: No, score=-2.8 required=3.8 tests=ALL_TRUSTED autolearn=failed version=3.0.2 X-Spam-Checker-Version: SpamAssassin 3.0.2 (2004-11-16) on pooker.samsco.org Cc: re@freebsd.org Subject: 6.0-CURRENT-SNAP005 snapshots available X-BeenThere: freebsd-hackers@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: Technical Discussions relating to FreeBSD List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 02 Jul 2005 19:36:09 -0000 All, I've just uploaded ISO images for the July snapshot of 6.0-CURRENT. They are available at: ftp://ftp.freebsd.org/pub/FreeBSD/snapshots/Jul_2005 It looks like some sites are still syncing them, so please check back if they are not available at your favorite mirror. This will likely be the last snapshot of 6.0-CURRENT before the RELENG_6 branch is made. I've written a brief README.TXT and placed it in with the image files to document the changes and known problems with this release. Please download these images and test them so that we can make 6.0 and excellent release. Thanks, Scott