From owner-freebsd-hackers@FreeBSD.ORG Sun Mar 8 12:36:18 2009 Return-Path: Delivered-To: freebsd-hackers@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 93D511065675 for ; Sun, 8 Mar 2009 12:36:18 +0000 (UTC) (envelope-from ticso@cicely7.cicely.de) Received: from raven.bwct.de (raven.bwct.de [85.159.14.73]) by mx1.freebsd.org (Postfix) with ESMTP id 1838B8FC18 for ; Sun, 8 Mar 2009 12:36:17 +0000 (UTC) (envelope-from ticso@cicely7.cicely.de) Received: from cicely5.cicely.de ([10.1.1.7]) by raven.bwct.de (8.13.4/8.13.4) with ESMTP id n28CaFqp015103 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=OK); Sun, 8 Mar 2009 13:36:16 +0100 (CET) (envelope-from ticso@cicely7.cicely.de) Received: from cicely7.cicely.de (cicely7.cicely.de [10.1.1.9]) by cicely5.cicely.de (8.14.2/8.14.2) with ESMTP id n28Ca9lS019398 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=NO); Sun, 8 Mar 2009 13:36:10 +0100 (CET) (envelope-from ticso@cicely7.cicely.de) Received: from cicely7.cicely.de (localhost [127.0.0.1]) by cicely7.cicely.de (8.14.2/8.14.2) with ESMTP id n28Ca9IG083909; Sun, 8 Mar 2009 13:36:09 +0100 (CET) (envelope-from ticso@cicely7.cicely.de) Received: (from ticso@localhost) by cicely7.cicely.de (8.14.2/8.14.2/Submit) id n28Ca9I9083908; Sun, 8 Mar 2009 13:36:09 +0100 (CET) (envelope-from ticso) Date: Sun, 8 Mar 2009 13:36:09 +0100 From: Bernd Walter To: "Rick C. Petty" Message-ID: <20090308123608.GC82478@cicely7.cicely.de> References: <200903041938.n24Jcqdr060153@lurza.secnetix.de> <20090304195614.GA179@britannica.bec.de> <20090306203057.GA49994@keira.kiwi-computer.com> <20090306214738.GA50654@keira.kiwi-computer.com> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20090306214738.GA50654@keira.kiwi-computer.com> X-Operating-System: FreeBSD cicely7.cicely.de 7.0-STABLE i386 User-Agent: Mutt/1.5.11 X-Spam-Status: No, score=-4.4 required=5.0 tests=ALL_TRUSTED=-1.8, AWL=0.045, BAYES_00=-2.599 autolearn=ham version=3.2.5 X-Spam-Checker-Version: SpamAssassin 3.2.5 (2008-06-10) on spamd.cicely.de Cc: Octavian Covalschi , freebsd-hackers@freebsd.org Subject: Re: Spin down HDD after disk sync or before power off X-BeenThere: freebsd-hackers@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list Reply-To: ticso@cicely.de List-Id: Technical Discussions relating to FreeBSD List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 08 Mar 2009 12:36:19 -0000 On Fri, Mar 06, 2009 at 03:47:38PM -0600, Rick C. Petty wrote: > On Fri, Mar 06, 2009 at 03:30:14PM -0600, Octavian Covalschi wrote: > > Why is spinning down is bad for HDD ? I believe it's better to spindown a > > drive, > > instead of cutting power too sudden. > > Comparing those two, I'd say it shouldn't matter (although probably a > forced spindown may be better). But pulling power from a drive does not > mean the drive immediately stops doing stuff. My understanding is that without power the heads just slamm into landing zone, while it can be done in a controlled smooth way with power. > I was just saying spindown on disks is bad in the first place. Sure, you > might save some wear and tear on the bearings, but you risk problems with > the heads on both spindown and spinup. In other words, if you can avoid > power-cycling your drives, they should last longer (in that you're less > likely to destroy the heads). This depends on the disks. Desktop and especially mobile drives are designed to sustain more spin downs, but are not designed for rotating a long time. But of course if you intend to spin up directly after spin down it might be bad for them as well, since it isn't really saving spinning time. This is nothing, which should be done on reboot, but for halts it might be reasonable to do. -- B.Walter http://www.bwct.de Modbus/TCP Ethernet I/O Baugruppen, ARM basierte FreeBSD Rechner uvm. From owner-freebsd-hackers@FreeBSD.ORG Sun Mar 8 14:20:07 2009 Return-Path: Delivered-To: freebsd-hackers@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 723FE106564A for ; Sun, 8 Mar 2009 14:20:07 +0000 (UTC) (envelope-from freebsd@jayloden.com) Received: from mail.jayloden.com (www.jayloden.com [66.150.227.71]) by mx1.freebsd.org (Postfix) with ESMTP id 516AB8FC16 for ; Sun, 8 Mar 2009 14:20:07 +0000 (UTC) (envelope-from freebsd@jayloden.com) Received: from [192.168.15.104] (c-98-221-217-95.hsd1.nj.comcast.net [98.221.217.95]) by mail.jayloden.com (Postfix) with ESMTP id 252CB3160205 for ; Sun, 8 Mar 2009 10:03:12 -0400 (EDT) Message-ID: <49B3D01E.1010600@jayloden.com> Date: Sun, 08 Mar 2009 10:03:10 -0400 From: Jay Loden User-Agent: Thunderbird 2.0.0.19 (Macintosh/20081209) MIME-Version: 1.0 To: freebsd-hackers@freebsd.org Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 7bit Subject: CPU user/kernel time given the PID 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, 08 Mar 2009 14:20:07 -0000 I'm working on FreeBSD support for a Python library called psutil for reading process information in a cross-platform fashion. Each platform-specific module is written in C, so the majority of the FreeBSD code is a C interface to various process information. I've been having some trouble working out how to get CPU user/kernel time for a given PID. I took a look at the source to top and ps but neither really helped since they don't seem to cover the info I was looking for (or I missed it). I'm not sure if there's a better way to go about this but I've been looking at sysctl and the kinfo_proc struct - is there somewhere more appropriate to retrieve this information? If the kinfo_proc struct is the way to go, then do I want to use ki_runtime, ki_swtime or something else, and does that mean there's no distinction between user/kern time for a process? If anyone has code samples or recommended docs to get me pointed in the right direction that would be great. Thanks, -Jay From owner-freebsd-hackers@FreeBSD.ORG Sun Mar 8 18:00:31 2009 Return-Path: Delivered-To: freebsd-hackers@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id C63EB106566B for ; Sun, 8 Mar 2009 18:00:31 +0000 (UTC) (envelope-from bsd.quest@googlemail.com) Received: from mail-ew0-f166.google.com (mail-ew0-f166.google.com [209.85.219.166]) by mx1.freebsd.org (Postfix) with ESMTP id 076BA8FC0A for ; Sun, 8 Mar 2009 18:00:30 +0000 (UTC) (envelope-from bsd.quest@googlemail.com) Received: by ewy10 with SMTP id 10so594561ewy.43 for ; Sun, 08 Mar 2009 11:00:30 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=googlemail.com; s=gamma; h=domainkey-signature:mime-version:received:in-reply-to:references :date:message-id:subject:from:to:cc:content-type; bh=+lNyuEo09HyRE1isnCV/MfvJIg+xLCn4mvr2h4UGhIw=; b=NBQrmEmiNLhWwjOhKlT7t6Ow0u00xvWFS33dkavOlHTi9ibLHGNWuCdmTszHfjmGpk tho2gpUYItEjtxJE9ADse4NSxPk0WNEpAe0k2AYB0IWZGsc+F3FQU4wuHG04lVIjyLLK FPatE0asx7UuewJNXBqb61GZCfthG7d1LO7pw= DomainKey-Signature: a=rsa-sha1; c=nofws; d=googlemail.com; s=gamma; h=mime-version:in-reply-to:references:date:message-id:subject:from:to :cc:content-type; b=GeWMrK3Tp55RNH5Yg/soO0ak466CsVygo/nd3n4wa5iQ33iSicvuYCtX+pqnEq4xTa YhopNgr+tYhBpgr6Zgg8aUZlekuzLUE5sFnZqr7v57X6SLtxH7q5tvMg1ABJ6meCAeSS MxI+bQe+5y1sBgVNo9+xIn6HNcNKOSm7e5aws= MIME-Version: 1.0 Received: by 10.210.58.17 with SMTP id g17mr1803489eba.42.1236535230004; Sun, 08 Mar 2009 11:00:30 -0700 (PDT) In-Reply-To: References: <671bb5fc0903040829m7c7ab79ay612868bb4260bd21@mail.gmail.com> Date: Sun, 8 Mar 2009 19:00:29 +0100 Message-ID: <671bb5fc0903081100x25dc6f4g829039f2ac51015c@mail.gmail.com> From: Alexej Sokolov To: Robert Watson Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 7bit X-Content-Filtered-By: Mailman/MimeDel 2.1.5 Cc: freebsd-hackers@freebsd.org Subject: Re: uma_zone 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, 08 Mar 2009 18:00:32 -0000 2009/3/7 Robert Watson > On Wed, 4 Mar 2009, Alexej Sokolov wrote: > > how can I get the size and pointer of some allocated uma zone ? For >> example: zone_pack >> > > Could you tell us a bit more about the context in which you want to do > this? Interrupt kontext. > Normally kernel modules acquire pointers to globally visible zones via a > symbol dependency resolved by the kernel linker (zone_pack is a globally > visible symbol in the kernel). But what about the size ? Do the UMA zones have fixed sizes? What I want to do is to remap zone_pack into the user space in order to give user applications access to mbuf clusters with frames. > Our general userspace monitoring tools, such as vmstat -z, don't display > the UMA zone pointers, and a pointer to the zone is not exported by the > sysctls it depends on, currently, but if you run kgdb on kernel.symbols you > should be able to print out the address of the global zone_pack directly. > > Robert N M Watson > Computer Laboratory > University of Cambridge Thanx a lot! From owner-freebsd-hackers@FreeBSD.ORG Sun Mar 8 21:56:53 2009 Return-Path: Delivered-To: freebsd-hackers@FreeBSD.ORG Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id AFA761065673 for ; Sun, 8 Mar 2009 21:56:53 +0000 (UTC) (envelope-from olli@lurza.secnetix.de) Received: from lurza.secnetix.de (lurza.secnetix.de [IPv6:2a01:170:102f::2]) by mx1.freebsd.org (Postfix) with ESMTP id 2D2768FC1D for ; Sun, 8 Mar 2009 21:56:52 +0000 (UTC) (envelope-from olli@lurza.secnetix.de) Received: from lurza.secnetix.de (localhost [127.0.0.1]) by lurza.secnetix.de (8.14.3/8.14.3) with ESMTP id n28LupOp085566; Sun, 8 Mar 2009 22:56:51 +0100 (CET) (envelope-from oliver.fromme@secnetix.de) Received: (from olli@localhost) by lurza.secnetix.de (8.14.3/8.14.3/Submit) id n28Lup7e085565; Sun, 8 Mar 2009 22:56:51 +0100 (CET) (envelope-from olli) Date: Sun, 8 Mar 2009 22:56:51 +0100 (CET) Message-Id: <200903082156.n28Lup7e085565@lurza.secnetix.de> From: Oliver Fromme To: freebsd-hackers@FreeBSD.ORG, freebsd@jayloden.com In-Reply-To: <49B3D01E.1010600@jayloden.com> X-Newsgroups: list.freebsd-hackers User-Agent: tin/1.8.3-20070201 ("Scotasay") (UNIX) (FreeBSD/6.4-PRERELEASE-20080904 (i386)) MIME-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 8bit X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-2.1.2 (lurza.secnetix.de [127.0.0.1]); Sun, 08 Mar 2009 22:56:52 +0100 (CET) Cc: Subject: Re: CPU user/kernel time given the PID X-BeenThere: freebsd-hackers@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list Reply-To: freebsd-hackers@FreeBSD.ORG, freebsd@jayloden.com List-Id: Technical Discussions relating to FreeBSD List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 08 Mar 2009 21:56:54 -0000 Jay Loden wrote: > I'm working on FreeBSD support for a Python library called psutil for reading > process information in a cross-platform fashion. Each platform-specific module > is written in C, so the majority of the FreeBSD code is a C interface to various > process information. I've been having some trouble working out how to get CPU > user/kernel time for a given PID. I took a look at the source to top and ps but > neither really helped since they don't seem to cover the info I was looking for > (or I missed it). > > I'm not sure if there's a better way to go about this but I've been looking at > sysctl and the kinfo_proc struct - is there somewhere more appropriate to > retrieve this information? If the kinfo_proc struct is the way to go, then do I > want to use ki_runtime, ki_swtime or something else, and does that mean there's > no distinction between user/kern time for a process? If anyone has code samples > or recommended docs to get me pointed in the right direction that would be great. ps(1) and top(1) both use ki_pctcpu, see the getpcpu() function in src/bin/ps/print.c and format_next_process() in src/usr.bin/top/machine.c As far as I know, there is no distinction between user- mode and kernel-mode CPU time per process. It should also be noted that the kernel's time cannot always be attributed to a certain userland process. I would even guess is that the majority of the CPU time spent in the kernel is not on behalf of a specific userland process. Best regards Oliver -- Oliver Fromme, secnetix GmbH & Co. KG, Marktplatz 29, 85567 Grafing b. M. Handelsregister: Registergericht Muenchen, HRA 74606, Geschäftsfuehrung: secnetix Verwaltungsgesellsch. mbH, Handelsregister: Registergericht Mün- chen, HRB 125758, Geschäftsführer: Maik Bachmann, Olaf Erb, Ralf Gebhart FreeBSD-Dienstleistungen, -Produkte und mehr: http://www.secnetix.de/bsd "C is quirky, flawed, and an enormous success." -- Dennis M. Ritchie. From owner-freebsd-hackers@FreeBSD.ORG Mon Mar 9 00:33:31 2009 Return-Path: Delivered-To: freebsd-hackers@FreeBSD.ORG Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 460B110656C1 for ; Mon, 9 Mar 2009 00:33:31 +0000 (UTC) (envelope-from freebsd@jayloden.com) Received: from mail.jayloden.com (www.jayloden.com [66.150.227.71]) by mx1.freebsd.org (Postfix) with ESMTP id 231718FC0C for ; Mon, 9 Mar 2009 00:33:30 +0000 (UTC) (envelope-from freebsd@jayloden.com) Received: from [192.168.15.104] (c-98-221-217-95.hsd1.nj.comcast.net [98.221.217.95]) by mail.jayloden.com (Postfix) with ESMTP id 3F6D83160205 for ; Sun, 8 Mar 2009 20:33:30 -0400 (EDT) Message-ID: <49B463D7.9010401@jayloden.com> Date: Sun, 08 Mar 2009 20:33:27 -0400 From: Jay Loden User-Agent: Thunderbird 2.0.0.19 (Macintosh/20081209) MIME-Version: 1.0 To: freebsd-hackers@FreeBSD.ORG References: <200903082156.n28Lup7e085565@lurza.secnetix.de> In-Reply-To: <200903082156.n28Lup7e085565@lurza.secnetix.de> Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 7bit Cc: Subject: Re: CPU user/kernel time given the PID 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, 09 Mar 2009 00:33:31 -0000 Oliver Fromme wrote: > ps(1) and top(1) both use ki_pctcpu, see the getpcpu() > function in src/bin/ps/print.c and format_next_process() > in src/usr.bin/top/machine.c Hi Oliver, thanks for the reply. I noticed the same after some digging through the source code for ps and top. While CPU usage % is a useful number also, I was hoping to be able to get CPU time(s). Possibly that information simply isn't available on FreeBSD like it is for other OSes. > As far as I know, there is no distinction between user- > mode and kernel-mode CPU time per process. It should > also be noted that the kernel's time cannot always be > attributed to a certain userland process. I would even > guess is that the majority of the CPU time spent in the > kernel is not on behalf of a specific userland process. I would suspect the same, but I did notice that times() does return separate values for user/system time on FreeBSD, so that implies that the system is able to differentiate between the two somehow. If you can get it from within the current running process the data must be there but I've no idea what interface (if any) exists to read that information for other processes. -Jay From owner-freebsd-hackers@FreeBSD.ORG Mon Mar 9 01:21:40 2009 Return-Path: Delivered-To: freebsd-hackers@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id E20D2106564A for ; Mon, 9 Mar 2009 01:21:40 +0000 (UTC) (envelope-from dan@dan.emsphone.com) Received: from email1.allantgroup.com (email1.emsphone.com [199.67.51.115]) by mx1.freebsd.org (Postfix) with ESMTP id 93CC88FC15 for ; Mon, 9 Mar 2009 01:21:40 +0000 (UTC) (envelope-from dan@dan.emsphone.com) Received: from dan.emsphone.com (dan.emsphone.com [199.67.51.101]) by email1.allantgroup.com (8.14.0/8.14.0) with ESMTP id n291LdD6051868 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=NO) for ; Sun, 8 Mar 2009 20:21:39 -0500 (CDT) (envelope-from dan@dan.emsphone.com) Received: from dan.emsphone.com (smmsp@localhost [127.0.0.1]) by dan.emsphone.com (8.14.3/8.14.3) with ESMTP id n291LdD9094468 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=NO) for ; Sun, 8 Mar 2009 20:21:39 -0500 (CDT) (envelope-from dan@dan.emsphone.com) Received: (from dan@localhost) by dan.emsphone.com (8.14.3/8.14.3/Submit) id n291Lbef094421; Sun, 8 Mar 2009 20:21:37 -0500 (CDT) (envelope-from dan) Date: Sun, 8 Mar 2009 20:21:37 -0500 From: Dan Nelson To: Jay Loden Message-ID: <20090309012137.GG3398@dan.emsphone.com> References: <200903082156.n28Lup7e085565@lurza.secnetix.de> <49B463D7.9010401@jayloden.com> MIME-Version: 1.0 Content-Type: multipart/mixed; boundary="Kj7319i9nmIyA2yE" Content-Disposition: inline In-Reply-To: <49B463D7.9010401@jayloden.com> X-OS: FreeBSD 7.1-STABLE User-Agent: Mutt/1.5.19 (2009-01-05) X-Virus-Scanned: ClamAV version 0.94.1, clamav-milter version 0.94.1 on email1.allantgroup.com X-Virus-Status: Clean X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-2.0.2 (email1.allantgroup.com [199.67.51.78]); Sun, 08 Mar 2009 20:21:39 -0500 (CDT) X-Scanned-By: MIMEDefang 2.45 Cc: freebsd-hackers@freebsd.org Subject: Re: CPU user/kernel time given the PID 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, 09 Mar 2009 01:21:41 -0000 --Kj7319i9nmIyA2yE Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In the last episode (Mar 08), Jay Loden said: > Oliver Fromme wrote: > > ps(1) and top(1) both use ki_pctcpu, see the getpcpu() function in > > src/bin/ps/print.c and format_next_process() in > > src/usr.bin/top/machine.c > > Hi Oliver, thanks for the reply. I noticed the same after some digging > through the source code for ps and top. While CPU usage % is a useful > number also, I was hoping to be able to get CPU time(s). Possibly that > information simply isn't available on FreeBSD like it is for other OSes. I was wondering why you were having so much trouble finding what you were looking for, and then I realized I have a patch that I have never submitted a PR for: the addition of "systime" and "usertime" ps keywords :) It simply reads the rusage struct, and returns the same values that getrusage() does. -- Dan Nelson dnelson@allantgroup.com --Kj7319i9nmIyA2yE Content-Type: text/plain; charset=us-ascii Content-Disposition: attachment; filename="ps.diff" Index: extern.h =================================================================== RCS file: /home/ncvs/src/bin/ps/extern.h,v retrieving revision 1.37 diff -u -p -r1.37 extern.h --- extern.h 23 Jun 2004 23:48:09 -0000 1.37 +++ extern.h 7 Jan 2005 06:46:15 -0000 @@ -78,11 +78,13 @@ int s_uname(KINFO *); void showkey(void); void started(KINFO *, VARENT *); void state(KINFO *, VARENT *); +void systime(KINFO *, VARENT *); void tdev(KINFO *, VARENT *); void tname(KINFO *, VARENT *); void ucomm(KINFO *, VARENT *); void uname(KINFO *, VARENT *); void upr(KINFO *, VARENT *); +void usertime(KINFO *, VARENT *); void vsize(KINFO *, VARENT *); void wchan(KINFO *, VARENT *); __END_DECLS Index: keyword.c =================================================================== RCS file: /home/ncvs/src/bin/ps/keyword.c,v retrieving revision 1.76 diff -u -p -r1.76 keyword.c --- keyword.c 6 Apr 2006 03:24:31 -0000 1.76 +++ keyword.c 2 Mar 2007 17:23:10 -0000 @@ -185,6 +185,7 @@ static VAR var[] = { UINT, UIDFMT, 0}, {"svuid", "SVUID", NULL, 0, kvar, NULL, UIDLEN, KOFF(ki_svuid), UINT, UIDFMT, 0}, + {"systime", "SYSTIME", NULL, USER, systime, NULL, 9, 0, CHAR, NULL, 0}, {"tdev", "TDEV", NULL, 0, tdev, NULL, 4, 0, CHAR, NULL, 0}, {"time", "TIME", NULL, USER, cputime, NULL, 9, 0, CHAR, NULL, 0}, {"tpgid", "TPGID", NULL, 0, kvar, NULL, 4, KOFF(ki_tpgid), UINT, @@ -203,6 +204,7 @@ static VAR var[] = { "lx", 0}, {"user", "USER", NULL, LJUST|DSIZ, uname, s_uname, USERLEN, 0, CHAR, NULL, 0}, + {"usertime", "USERTIME", NULL, USER, usertime, NULL, 9, 0, CHAR, NULL, 0}, {"usrpri", "", "upr", 0, NULL, NULL, 0, 0, CHAR, NULL, 0}, {"vsize", "", "vsz", 0, NULL, NULL, 0, 0, CHAR, NULL, 0}, {"vsz", "VSZ", NULL, 0, vsize, NULL, 5, 0, CHAR, NULL, 0}, Index: print.c =================================================================== RCS file: /home/ncvs/src/bin/ps/print.c,v retrieving revision 1.95 diff -u -p -r1.95 print.c --- print.c 17 Sep 2007 05:27:18 -0000 1.95 +++ print.c 11 Oct 2007 19:54:02 -0000 @@ -551,6 +551,79 @@ cputime(KINFO *k, VARENT *ve) } void +systime(KINFO *k, VARENT *ve) +{ + VAR *v; + long secs; + long psecs; /* "parts" of a second. first micro, then centi */ + char obuff[128]; + static char decimal_point; + + if (decimal_point == '\0') + decimal_point = localeconv()->decimal_point[0]; + v = ve->var; + if (!k->ki_valid) { + secs = 0; + psecs = 0; + } else { + /* + * This counts time spent handling interrupts. We could + * fix this, but it is not 100% trivial (and interrupt + * time fractions only work on the sparc anyway). XXX + */ + secs = k->ki_p->ki_rusage.ru_stime.tv_sec; + psecs = k->ki_p->ki_rusage.ru_stime.tv_usec; + if (sumrusage) { + secs += k->ki_p->ki_childstime.tv_sec; + psecs += k->ki_p->ki_childstime.tv_usec; + } + /* + * round and scale to 100's + */ + psecs = (psecs + 5000) / 10000; + secs += psecs / 100; + psecs = psecs % 100; + } + (void)snprintf(obuff, sizeof(obuff), "%3ld:%02ld%c%02ld", + secs / 60, secs % 60, decimal_point, psecs); + (void)printf("%*s", v->width, obuff); +} + +void +usertime(KINFO *k, VARENT *ve) +{ + VAR *v; + long secs; + long psecs; /* "parts" of a second. first micro, then centi */ + char obuff[128]; + static char decimal_point; + + if (decimal_point == '\0') + decimal_point = localeconv()->decimal_point[0]; + v = ve->var; + if (!k->ki_valid) { + secs = 0; + psecs = 0; + } else { + secs = k->ki_p->ki_rusage.ru_utime.tv_sec; + psecs = k->ki_p->ki_rusage.ru_utime.tv_usec; + if (sumrusage) { + secs += k->ki_p->ki_childutime.tv_sec; + psecs += k->ki_p->ki_childutime.tv_usec; + } + /* + * round and scale to 100's + */ + psecs = (psecs + 5000) / 10000; + secs += psecs / 100; + psecs = psecs % 100; + } + (void)snprintf(obuff, sizeof(obuff), "%3ld:%02ld%c%02ld", + secs / 60, secs % 60, decimal_point, psecs); + (void)printf("%*s", v->width, obuff); +} + +void elapsed(KINFO *k, VARENT *ve) { VAR *v; Index: ps.1 =================================================================== RCS file: /home/ncvs/src/bin/ps/ps.1,v retrieving revision 1.89 diff -u -p -r1.89 ps.1 --- ps.1 17 Sep 2006 17:40:06 -0000 1.89 +++ ps.1 2 Mar 2007 17:23:11 -0000 @@ -571,6 +571,8 @@ symbolic process state (alias saved gid from a setgid executable .It Cm svuid saved UID from a setuid executable +.It Cm systime +accumulated system CPU time .It Cm tdev control terminal device number .It Cm time @@ -599,6 +601,8 @@ scheduling priority on return from syste .Cm usrpri ) .It Cm user user name (from UID) +.It Cm usertime +accumulated user CPU time .It Cm vsz virtual size in Kbytes (alias .Cm vsize ) --Kj7319i9nmIyA2yE-- From owner-freebsd-hackers@FreeBSD.ORG Mon Mar 9 02:03:16 2009 Return-Path: Delivered-To: freebsd-hackers@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 773E7106566B for ; Mon, 9 Mar 2009 02:03:16 +0000 (UTC) (envelope-from david@catwhisker.org) Received: from albert.catwhisker.org (adsl-63-193-123-122.dsl.snfc21.pacbell.net [63.193.123.122]) by mx1.freebsd.org (Postfix) with ESMTP id 2671B8FC1A for ; Mon, 9 Mar 2009 02:03:15 +0000 (UTC) (envelope-from david@catwhisker.org) Received: from albert.catwhisker.org (localhost [127.0.0.1]) by albert.catwhisker.org (8.14.3/8.14.3) with ESMTP id n2923FGF055354; Sun, 8 Mar 2009 19:03:15 -0700 (PDT) (envelope-from david@albert.catwhisker.org) Received: (from david@localhost) by albert.catwhisker.org (8.14.3/8.14.3/Submit) id n2923FTG055353; Sun, 8 Mar 2009 19:03:15 -0700 (PDT) (envelope-from david) Date: Sun, 8 Mar 2009 19:03:15 -0700 From: David Wolfskill To: Jay Loden Message-ID: <20090309020315.GW4315@albert.catwhisker.org> Mail-Followup-To: David Wolfskill , Jay Loden , freebsd-hackers@freebsd.org References: <200903082156.n28Lup7e085565@lurza.secnetix.de> <49B463D7.9010401@jayloden.com> Mime-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha1; protocol="application/pgp-signature"; boundary="SvF6CGw9fzJC4Rcx" Content-Disposition: inline In-Reply-To: <49B463D7.9010401@jayloden.com> User-Agent: Mutt/1.4.2.3i Cc: freebsd-hackers@freebsd.org Subject: Re: CPU user/kernel time given the PID 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, 09 Mar 2009 02:03:16 -0000 --SvF6CGw9fzJC4Rcx Content-Type: text/plain; charset=us-ascii Content-Disposition: inline Content-Transfer-Encoding: quoted-printable On Sun, Mar 08, 2009 at 08:33:27PM -0400, Jay Loden wrote: > Oliver Fromme wrote: > > ps(1) and top(1) both use ki_pctcpu, see the getpcpu() > > function in src/bin/ps/print.c and format_next_process() > > in src/usr.bin/top/machine.c >=20 > Hi Oliver, thanks for the reply. I noticed the same after some digging th= rough > the source code for ps and top. While CPU usage % is a useful number also= , I was > hoping to be able to get CPU time(s). Possibly that information simply is= n't > available on FreeBSD like it is for other OSes. Have you checked to see if you can make use of the information provided by procfs(5)? In particular, I note: =2E.. status The process status. This file is read-only and returns a sing= le line containing multiple space-separated fields as follows: o command name o process id =2E.. o the process start time in seconds and microseconds, comma separated. o the user time in seconds and microseconds, comma separated. o the system time in seconds and microseconds, comma separat= ed. o the wait channel message =2E... Thus, on my laptop, I see: g1-35(6.4-S)[1] cat /proc/`pgrep firefox-bin`/status firefox-bin 1735 1730 1549 1454 - noflags 1236526247,367664 3289,390208 477= ,843140 -kse- 1001 1001 1001,1001,1001,0,20,68,69,1004 - g1-35(6.4-S)[2]=20 So above-listed items would be: * firefox-bin * 1735 =2E.. * 1236526247,367664 * 3289,390208 * 477,843140 * -kse- * -kse- =2E... Granted, not every machine will necessarily have PROCFS in the kernel configuration, but it is in GENERIC. > ... Peace, david --=20 David H. Wolfskill david@catwhisker.org Depriving a girl or boy of an opportunity for education is evil. See http://www.catwhisker.org/~david/publickey.gpg for my public key. --SvF6CGw9fzJC4Rcx Content-Type: application/pgp-signature Content-Disposition: inline -----BEGIN PGP SIGNATURE----- Version: GnuPG v2.0.9 (FreeBSD) iEYEARECAAYFAkm0eOIACgkQmprOCmdXAD2eWACcCdNwXWnI5mbQJlYrn9BTNjI2 c9MAn3/DBD1gU5+SzZizc4RGPDoLLsdn =hYcW -----END PGP SIGNATURE----- --SvF6CGw9fzJC4Rcx-- From owner-freebsd-hackers@FreeBSD.ORG Mon Mar 9 13:35:41 2009 Return-Path: Delivered-To: freebsd-hackers@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 44BF71065674 for ; Mon, 9 Mar 2009 13:35:41 +0000 (UTC) (envelope-from freebsd@jayloden.com) Received: from mail.jayloden.com (www.jayloden.com [66.150.227.71]) by mx1.freebsd.org (Postfix) with ESMTP id 203DF8FC2E for ; Mon, 9 Mar 2009 13:35:39 +0000 (UTC) (envelope-from freebsd@jayloden.com) Received: from [192.168.15.104] (c-98-221-217-95.hsd1.nj.comcast.net [98.221.217.95]) by mail.jayloden.com (Postfix) with ESMTP id 8F5CA6D605A8; Mon, 9 Mar 2009 09:35:38 -0400 (EDT) Message-ID: <49B51B28.8040604@jayloden.com> Date: Mon, 09 Mar 2009 09:35:36 -0400 From: Jay Loden User-Agent: Thunderbird 2.0.0.19 (Macintosh/20081209) MIME-Version: 1.0 To: Dan Nelson References: <200903082156.n28Lup7e085565@lurza.secnetix.de> <49B463D7.9010401@jayloden.com> <20090309012137.GG3398@dan.emsphone.com> In-Reply-To: <20090309012137.GG3398@dan.emsphone.com> Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 7bit Cc: freebsd-hackers@freebsd.org Subject: Re: CPU user/kernel time given the PID 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, 09 Mar 2009 13:35:41 -0000 Dan Nelson wrote: > I was wondering why you were having so much trouble finding what you were > looking for, and then I realized I have a patch that I have never submitted > a PR for: the addition of "systime" and "usertime" ps keywords :) It simply > reads the rusage struct, and returns the same values that getrusage() does. Dan, this is great, exactly what I was looking for, didn't think to look for 'rusage' in the values in kinfo_proc. Thanks! -Jay From owner-freebsd-hackers@FreeBSD.ORG Mon Mar 9 17:22:17 2009 Return-Path: Delivered-To: freebsd-hackers@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id C2AB7106581A for ; Mon, 9 Mar 2009 17:22:17 +0000 (UTC) (envelope-from jhb@freebsd.org) Received: from cyrus.watson.org (cyrus.watson.org [65.122.17.42]) by mx1.freebsd.org (Postfix) with ESMTP id E2FFB8FC7C for ; Mon, 9 Mar 2009 17:20:25 +0000 (UTC) (envelope-from jhb@freebsd.org) Received: from server.baldwin.cx (pool-98-109-39-197.nwrknj.fios.verizon.net [98.109.39.197]) by cyrus.watson.org (Postfix) with ESMTPSA id 7EA0A46B58; Mon, 9 Mar 2009 13:20:25 -0400 (EDT) Received: from localhost (john@localhost [127.0.0.1]) (authenticated bits=0) by server.baldwin.cx (8.14.3/8.14.3) with ESMTP id n29HKJJb018829; Mon, 9 Mar 2009 13:20:19 -0400 (EDT) (envelope-from jhb@freebsd.org) From: John Baldwin To: freebsd-hackers@freebsd.org Date: Mon, 9 Mar 2009 08:21:25 -0400 User-Agent: KMail/1.9.7 References: <671bb5fc0903060813s284673e2t4d3c77b0ed6abc54@mail.gmail.com> In-Reply-To: <671bb5fc0903060813s284673e2t4d3c77b0ed6abc54@mail.gmail.com> MIME-Version: 1.0 Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: 7bit Content-Disposition: inline Message-Id: <200903090821.25871.jhb@freebsd.org> X-Greylist: Sender succeeded SMTP AUTH authentication, not delayed by milter-greylist-2.0.2 (server.baldwin.cx [127.0.0.1]); Mon, 09 Mar 2009 13:20:19 -0400 (EDT) X-Virus-Scanned: ClamAV version 0.94.2, clamav-milter version 0.94.2 on server.baldwin.cx X-Virus-Status: Clean X-Spam-Status: No, score=-4.1 required=4.2 tests=ALL_TRUSTED,AWL,BAYES_00, DATE_IN_PAST_03_06 autolearn=ham version=3.1.3 X-Spam-Checker-Version: SpamAssassin 3.1.3 (2006-06-01) on server.baldwin.cx Cc: Alexej Sokolov Subject: Re: wrong data in remapped buffer 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, 09 Mar 2009 17:22:46 -0000 On Friday 06 March 2009 11:13:38 am Alexej Sokolov wrote: > Hello, > I try to MALLOC a buffer in kern, then remap it with vm_map_find(), to space > of user process. > Some times the remapped buffer in user space contain incorrect data. What architecture are you using? On some archs like amd64, small mallocs (<= PAGE_SIZE) don't use the kmem_map or kmem_object. -- John Baldwin From owner-freebsd-hackers@FreeBSD.ORG Mon Mar 9 18:27:03 2009 Return-Path: Delivered-To: freebsd-hackers@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id E8220106564A for ; Mon, 9 Mar 2009 18:27:03 +0000 (UTC) (envelope-from cliftonr@lava.net) Received: from outgoing01.lava.net (cake.lava.net [IPv6:2001:1888:0:1:230:48ff:fe5b:3b50]) by mx1.freebsd.org (Postfix) with ESMTP id 352228FC12 for ; Mon, 9 Mar 2009 18:27:03 +0000 (UTC) (envelope-from cliftonr@lava.net) Received: from malasada.lava.net (malasada.lava.net [64.65.64.17]) by outgoing01.lava.net (Postfix) with ESMTP id 5184ED0069; Mon, 9 Mar 2009 08:27:02 -1000 (HST) Received: by malasada.lava.net (Postfix, from userid 102) id 04804153882; Mon, 9 Mar 2009 08:27:01 -1000 (HST) Date: Mon, 9 Mar 2009 08:27:01 -1000 From: Clifton Royston To: freebsd-hackers@freebsd.org Message-ID: <20090309182700.GA20062@lava.net> Mail-Followup-To: freebsd-hackers@freebsd.org, Martin Badie References: <20090308120022.523F81065672@hub.freebsd.org> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20090308120022.523F81065672@hub.freebsd.org> User-Agent: Mutt/1.4.2.2i Cc: Martin Badie Subject: Re: freebsd-hackers Digest, Vol 310, Issue 6 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, 09 Mar 2009 18:27:04 -0000 On Sun, Mar 08, 2009 at 12:00:22PM +0000, freebsd-hackers-request@freebsd.org wrote: > Date: Sat, 7 Mar 2009 13:08:56 -0800 (PST) > From: Martin Badie > Subject: select.h FD_SETSIZE and Qmail-Postfix test > To: freebsd-hackers@freebsd.org > Message-ID: <67469.69113.qm@web59906.mail.ac4.yahoo.com> > Content-Type: text/plain; charset=us-ascii > > Hi, > > There is a test that I am doing with FreeBSD and Linux. This test > involves qmail and postfix comparison. Both FreeBSD and Linux seems > to have 1024 File Descriptor limit. (FD_SETSIZE in select.h in > FreeBSD) . > > To have a better concurrency in qmail on smtp level. I have used a > patch named big-todo patch also used big-concurrency patch. These > patches helps me to increase concurrency in operating system. I set > concurrent connection to 500(tcpserver -c 500). There is no problem > until around 400-500 active smtp connection. But if the total smtp > connection exceeds 500, load average increases to ~40-50 but cpu > system time arises to %50-60. The strange issue is that, this load > increases when the connection is limited to accept 500 connections > but the tool I use is configured to 700 (more than 500) connections. > Normally ucspi-tcp software limits connection to 500 ( -c 500) I > suspect it is something to do with Operating system level. > > Additionally I have also patched FreeBSD kernel with 4096 FD_SETSIZE > in select.h in kernel and booted with that kernel. I have also > compiled qmail from scratch to accept 2040 connections (in > conf-spawn) but there is no change I mean I still can't get more than > decent 500 connections with acceptable load average. > > I have also used postfix on both Linux FreeBSD: > > default_process_limit = 500 > smtpd_client_connection_count_limit = 500 > > but I still get strange load when connection raises more than 500 > > I suspect something is missing or need to be configured on the operating system level (both Linux and FreeBSD) One point which you might be missing is that both FreeBSD and Linux (and I think most other modern OSes) have long since deprecated the select interface for high performance/high concurrency software. On FreeBSD the preferred mechanism is kqueue, and IIRC Postfix prefers to build with the kqueue interface on FreeBSD. Linux uses something else which escapes me at the moment; perhaps epoll? This makes benchmarks on select() primarily of historic interest. -- Clifton -- Clifton Royston -- cliftonr@iandicomputing.com / cliftonr@lava.net President - I and I Computing * http://www.iandicomputing.com/ Custom programming, network design, systems and network consulting services From owner-freebsd-hackers@FreeBSD.ORG Mon Mar 9 19:38:57 2009 Return-Path: Delivered-To: freebsd-hackers@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 8BFC01065691 for ; Mon, 9 Mar 2009 19:38:57 +0000 (UTC) (envelope-from bsd.quest@googlemail.com) Received: from mail-ew0-f166.google.com (mail-ew0-f166.google.com [209.85.219.166]) by mx1.freebsd.org (Postfix) with ESMTP id C276F8FC13 for ; Mon, 9 Mar 2009 19:38:56 +0000 (UTC) (envelope-from bsd.quest@googlemail.com) Received: by ewy10 with SMTP id 10so939036ewy.43 for ; Mon, 09 Mar 2009 12:38:55 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=googlemail.com; s=gamma; h=domainkey-signature:mime-version:received:in-reply-to:references :date:message-id:subject:from:to:cc:content-type; bh=hi4LQqO3/NiJmvN8+QozCZW+soBNsJLHnIPDN606j6s=; b=Pmt0fVgkPoPt4GTveNziz3Z6Qs+WOcMhCltUbugiLaQpCgAfzWPauAruwRo0BKAFkB K41mptxS4kng4RX/I7Fdp1P9bwxzEJjeB7iKQtm3CfI71aSZU+TgbwiG827Egngk0//N TmetYaTctLzYUktJFLQNus0kUR5+Zm1OuRp/s= DomainKey-Signature: a=rsa-sha1; c=nofws; d=googlemail.com; s=gamma; h=mime-version:in-reply-to:references:date:message-id:subject:from:to :cc:content-type; b=LNjnlwB8fyqlUBA6Kj3IVD0vDCZe00c2DDOW75A92nIzyo9Nr2jOgEhvK05WK7oCgs +atXKrmuf2I/Gn46Hk9r+5S6+Y+01c011JoRiE39umWUKY4rhzvqFRhHzBgDJR20xGKp hE73G+qaCquHhnes0VBn4BgJqpbXhRPgD5+L8= MIME-Version: 1.0 Received: by 10.210.21.6 with SMTP id 6mr2745685ebu.74.1236627535749; Mon, 09 Mar 2009 12:38:55 -0700 (PDT) In-Reply-To: <200903090821.25871.jhb@freebsd.org> References: <671bb5fc0903060813s284673e2t4d3c77b0ed6abc54@mail.gmail.com> <200903090821.25871.jhb@freebsd.org> Date: Mon, 9 Mar 2009 20:38:55 +0100 Message-ID: <671bb5fc0903091238q2c4e4bd7m661333a509395b61@mail.gmail.com> From: Alexej Sokolov To: John Baldwin Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 7bit X-Content-Filtered-By: Mailman/MimeDel 2.1.5 Cc: freebsd-hackers@freebsd.org Subject: Re: wrong data in remapped buffer 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, 09 Mar 2009 19:38:58 -0000 2009/3/9 John Baldwin > On Friday 06 March 2009 11:13:38 am Alexej Sokolov wrote: > > Hello, > > I try to MALLOC a buffer in kern, then remap it with vm_map_find(), to > space > > of user process. > > Some times the remapped buffer in user space contain incorrect data. > > What architecture are you using? On some archs like amd64, small mallocs > (<= > PAGE_SIZE) don't use the kmem_map or kmem_object. > > -- > John Baldwin > anyway , the error happens only some times... I think there is other reason. My hardware is amd64 % uname -ms FreeBSD i386 From owner-freebsd-hackers@FreeBSD.ORG Mon Mar 9 20:42:31 2009 Return-Path: Delivered-To: freebsd-hackers@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id F21FB1065881 for ; Mon, 9 Mar 2009 20:42:31 +0000 (UTC) (envelope-from jhb@freebsd.org) Received: from cyrus.watson.org (cyrus.watson.org [65.122.17.42]) by mx1.freebsd.org (Postfix) with ESMTP id C22E18FC20 for ; Mon, 9 Mar 2009 20:42:31 +0000 (UTC) (envelope-from jhb@freebsd.org) Received: from server.baldwin.cx (pool-98-109-39-197.nwrknj.fios.verizon.net [98.109.39.197]) by cyrus.watson.org (Postfix) with ESMTPSA id 5DBFC46B03; Mon, 9 Mar 2009 16:42:31 -0400 (EDT) Received: from localhost (john@localhost [127.0.0.1]) (authenticated bits=0) by server.baldwin.cx (8.14.3/8.14.3) with ESMTP id n29KgPx4020061; Mon, 9 Mar 2009 16:42:25 -0400 (EDT) (envelope-from jhb@freebsd.org) From: John Baldwin To: Alexej Sokolov Date: Mon, 9 Mar 2009 16:18:32 -0400 User-Agent: KMail/1.9.7 References: <671bb5fc0903060813s284673e2t4d3c77b0ed6abc54@mail.gmail.com> <200903090821.25871.jhb@freebsd.org> <671bb5fc0903091238q2c4e4bd7m661333a509395b61@mail.gmail.com> In-Reply-To: <671bb5fc0903091238q2c4e4bd7m661333a509395b61@mail.gmail.com> MIME-Version: 1.0 Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: 7bit Content-Disposition: inline Message-Id: <200903091618.32955.jhb@freebsd.org> X-Greylist: Sender succeeded SMTP AUTH authentication, not delayed by milter-greylist-2.0.2 (server.baldwin.cx [127.0.0.1]); Mon, 09 Mar 2009 16:42:25 -0400 (EDT) X-Virus-Scanned: ClamAV 0.94.2/9082/Mon Mar 9 15:45:18 2009 on server.baldwin.cx X-Virus-Status: Clean X-Spam-Status: No, score=-4.4 required=4.2 tests=ALL_TRUSTED,AWL,BAYES_00 autolearn=ham version=3.1.3 X-Spam-Checker-Version: SpamAssassin 3.1.3 (2006-06-01) on server.baldwin.cx Cc: freebsd-hackers@freebsd.org Subject: Re: wrong data in remapped buffer 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, 09 Mar 2009 20:42:32 -0000 On Monday 09 March 2009 3:38:55 pm Alexej Sokolov wrote: > 2009/3/9 John Baldwin > > > On Friday 06 March 2009 11:13:38 am Alexej Sokolov wrote: > > > Hello, > > > I try to MALLOC a buffer in kern, then remap it with vm_map_find(), to > > space > > > of user process. > > > Some times the remapped buffer in user space contain incorrect data. > > > > What architecture are you using? On some archs like amd64, small mallocs > > (<= > > PAGE_SIZE) don't use the kmem_map or kmem_object. > > > > -- > > John Baldwin > > > anyway , the error happens only some times... I think there is other reason. > My hardware is amd64 > % uname -ms > FreeBSD i386 i386 always uses kmem for malloc(9). -- John Baldwin From owner-freebsd-hackers@FreeBSD.ORG Mon Mar 9 22:17:17 2009 Return-Path: Delivered-To: freebsd-hackers@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 5A631106567C for ; Mon, 9 Mar 2009 22:17:17 +0000 (UTC) (envelope-from rick@kiwi-computer.com) Received: from kiwi-computer.com (keira.kiwi-computer.com [63.224.10.3]) by mx1.freebsd.org (Postfix) with SMTP id 00D3F8FC1E for ; Mon, 9 Mar 2009 22:17:16 +0000 (UTC) (envelope-from rick@kiwi-computer.com) Received: (qmail 77341 invoked by uid 2001); 9 Mar 2009 22:17:15 -0000 Date: Mon, 9 Mar 2009 16:17:15 -0600 From: "Rick C. Petty" To: ticso@cicely.de Message-ID: <20090309221715.GA77196@keira.kiwi-computer.com> References: <200903041938.n24Jcqdr060153@lurza.secnetix.de> <20090304195614.GA179@britannica.bec.de> <20090306203057.GA49994@keira.kiwi-computer.com> <20090306214738.GA50654@keira.kiwi-computer.com> <20090308123608.GC82478@cicely7.cicely.de> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20090308123608.GC82478@cicely7.cicely.de> User-Agent: Mutt/1.4.2.3i Cc: Octavian Covalschi , freebsd-hackers@freebsd.org Subject: Re: Spin down HDD after disk sync or before power off X-BeenThere: freebsd-hackers@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list Reply-To: rick-freebsd2008@kiwi-computer.com List-Id: Technical Discussions relating to FreeBSD List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 09 Mar 2009 22:17:17 -0000 On Sun, Mar 08, 2009 at 01:36:09PM +0100, Bernd Walter wrote: > On Fri, Mar 06, 2009 at 03:47:38PM -0600, Rick C. Petty wrote: > > On Fri, Mar 06, 2009 at 03:30:14PM -0600, Octavian Covalschi wrote: > > > Why is spinning down is bad for HDD ? I believe it's better to spindown a > > > drive, > > > instead of cutting power too sudden. > > > > Comparing those two, I'd say it shouldn't matter (although probably a > > forced spindown may be better). But pulling power from a drive does not > > mean the drive immediately stops doing stuff. > > My understanding is that without power the heads just slamm into > landing zone, while it can be done in a controlled smooth way with > power. Nope, according to a coworker (whose wife works for an HDD manufacturer), the spindle motor is shunted and the generated electricity is used to properly land the head. My coworker also tells me that some new drives are actually parking the heads off the disk, which as I understand is a much more difficult task since you have to worry about vertical separation when you bring the heads back between the platters. > > I was just saying spindown on disks is bad in the first place. Sure, you > > might save some wear and tear on the bearings, but you risk problems with > > the heads on both spindown and spinup. In other words, if you can avoid > > power-cycling your drives, they should last longer (in that you're less > > likely to destroy the heads). > > This depends on the disks. > Desktop and especially mobile drives are designed to sustain more > spin downs, but are not designed for rotating a long time. > But of course if you intend to spin up directly after spin down it > might be bad for them as well, since it isn't really saving spinning > time. That may be; I know nothing about differences with mobile drives. If this is true, I'd like to find some replacement 2.5" drives which are intended for continuous spinning. > This is nothing, which should be done on reboot, but for halts it > might be reasonable to do. Not sure what you're trying to say here, but I am for the idea of issuing a spindown request if we know the power is to be cycled. If spindown are issued for all halts, I hope someone makes that a kernel tunable. What I was hoping is that someone could point me to the "spinup" command as I have a drive which does not spin up until it receives this command. Any takers? -- Rick C. Petty From owner-freebsd-hackers@FreeBSD.ORG Mon Mar 9 22:20:53 2009 Return-Path: Delivered-To: freebsd-hackers@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id DB57910656BE for ; Mon, 9 Mar 2009 22:20:53 +0000 (UTC) (envelope-from timothy@redaelli.eu) Received: from an-out-0708.google.com (an-out-0708.google.com [209.85.132.246]) by mx1.freebsd.org (Postfix) with ESMTP id A267F8FC20 for ; Mon, 9 Mar 2009 22:20:53 +0000 (UTC) (envelope-from timothy@redaelli.eu) Received: by an-out-0708.google.com with SMTP id b38so873794ana.13 for ; Mon, 09 Mar 2009 15:20:52 -0700 (PDT) MIME-Version: 1.0 Received: by 10.220.99.201 with SMTP id v9mr2119587vcn.50.1236635319109; Mon, 09 Mar 2009 14:48:39 -0700 (PDT) Date: Mon, 9 Mar 2009 22:48:39 +0100 Message-ID: From: Timothy Redaelli To: freebsd-hackers@freebsd.org Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 7bit Subject: lockf: Invalid argument on pipe 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, 09 Mar 2009 22:20:54 -0000 Hi, Why can't I do a lockf on a file descriptor that does not point a real file (such as stderr, stdout, or a character device)? Since it works under NetBSD, Linux, Solaris. For portability between systems I hope I can do it under FreeBSD. The following code is simple, but It reproduce the problem. Under non-FreeBSD systems, It will block before the puts. Instead under FreeBSD the lockf calls return error and, so, the lock does not works. Any suggest? #include #include #include #include int main(int argc, char *argv[]) { char tmp[256]; if (lockf(2, F_LOCK, 0) == -1) perror("lock"); snprintf (tmp, 256, "%s XXX", argv[0]); if (!argv[1] || strcmp(argv[1], "XXX")) system(tmp); puts("You should see it only after ctrl+c"); return EXIT_SUCCESS; } -- Timothy Redaelli IT Consultant Email: timothy@redaelli.eu Mobile: +39 (338) 1187273 WWW: http://www.redaelli.eu/ From owner-freebsd-hackers@FreeBSD.ORG Mon Mar 9 22:31:10 2009 Return-Path: Delivered-To: freebsd-hackers@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 93DDE106567F for ; Mon, 9 Mar 2009 22:31:10 +0000 (UTC) (envelope-from joerg@britannica.bec.de) Received: from www.sonnenberger.org (www.ostsee-abc.de [62.206.222.50]) by mx1.freebsd.org (Postfix) with ESMTP id 4A4F08FC08 for ; Mon, 9 Mar 2009 22:31:09 +0000 (UTC) (envelope-from joerg@britannica.bec.de) Received: from britannica.bec.de (www.sonnenberger.org [192.168.1.10]) by www.sonnenberger.org (Postfix) with ESMTP id 31963667A8 for ; Mon, 9 Mar 2009 23:22:51 +0100 (CET) Received: by britannica.bec.de (Postfix, from userid 1000) id D13DB8DAC6; Mon, 9 Mar 2009 23:22:56 +0100 (CET) Date: Mon, 9 Mar 2009 23:22:56 +0100 From: Joerg Sonnenberger To: freebsd-hackers@freebsd.org Message-ID: <20090309222256.GA16286@britannica.bec.de> Mail-Followup-To: freebsd-hackers@freebsd.org References: <200903041938.n24Jcqdr060153@lurza.secnetix.de> <20090304195614.GA179@britannica.bec.de> <20090306203057.GA49994@keira.kiwi-computer.com> <20090306214738.GA50654@keira.kiwi-computer.com> <20090308123608.GC82478@cicely7.cicely.de> <20090309221715.GA77196@keira.kiwi-computer.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20090309221715.GA77196@keira.kiwi-computer.com> User-Agent: Mutt/1.5.18 (2008-05-17) Subject: Re: Spin down HDD after disk sync or before power off 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, 09 Mar 2009 22:31:11 -0000 On Mon, Mar 09, 2009 at 04:17:15PM -0600, Rick C. Petty wrote: > What I was hoping is that someone could point me to the "spinup" command as > I have a drive which does not spin up until it receives this command. Any > takers? There is no such command. Disks are supposed to spin up at the first read/write automatically. It can take a while though. Joerg From owner-freebsd-hackers@FreeBSD.ORG Mon Mar 9 23:19:39 2009 Return-Path: Delivered-To: freebsd-hackers@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 420B91065673 for ; Mon, 9 Mar 2009 23:19:39 +0000 (UTC) (envelope-from ticso@cicely7.cicely.de) Received: from raven.bwct.de (raven.bwct.de [85.159.14.73]) by mx1.freebsd.org (Postfix) with ESMTP id DD4238FC17 for ; Mon, 9 Mar 2009 23:19:38 +0000 (UTC) (envelope-from ticso@cicely7.cicely.de) Received: from cicely5.cicely.de ([10.1.1.7]) by raven.bwct.de (8.13.4/8.13.4) with ESMTP id n29NJaoo070548 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=OK); Tue, 10 Mar 2009 00:19:36 +0100 (CET) (envelope-from ticso@cicely7.cicely.de) Received: from cicely7.cicely.de (cicely7.cicely.de [10.1.1.9]) by cicely5.cicely.de (8.14.2/8.14.2) with ESMTP id n29NJXL3099116 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=NO); Tue, 10 Mar 2009 00:19:33 +0100 (CET) (envelope-from ticso@cicely7.cicely.de) Received: from cicely7.cicely.de (localhost [127.0.0.1]) by cicely7.cicely.de (8.14.2/8.14.2) with ESMTP id n29NJX5h007780; Tue, 10 Mar 2009 00:19:33 +0100 (CET) (envelope-from ticso@cicely7.cicely.de) Received: (from ticso@localhost) by cicely7.cicely.de (8.14.2/8.14.2/Submit) id n29NJWfW007779; Tue, 10 Mar 2009 00:19:32 +0100 (CET) (envelope-from ticso) Date: Tue, 10 Mar 2009 00:19:32 +0100 From: Bernd Walter To: "Rick C. Petty" Message-ID: <20090309231932.GE6840@cicely7.cicely.de> References: <200903041938.n24Jcqdr060153@lurza.secnetix.de> <20090304195614.GA179@britannica.bec.de> <20090306203057.GA49994@keira.kiwi-computer.com> <20090306214738.GA50654@keira.kiwi-computer.com> <20090308123608.GC82478@cicely7.cicely.de> <20090309221715.GA77196@keira.kiwi-computer.com> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20090309221715.GA77196@keira.kiwi-computer.com> X-Operating-System: FreeBSD cicely7.cicely.de 7.0-STABLE i386 User-Agent: Mutt/1.5.11 X-Spam-Status: No, score=-4.4 required=5.0 tests=ALL_TRUSTED=-1.8, AWL=0.045, BAYES_00=-2.599 autolearn=ham version=3.2.5 X-Spam-Checker-Version: SpamAssassin 3.2.5 (2008-06-10) on spamd.cicely.de Cc: Octavian Covalschi , freebsd-hackers@freebsd.org, ticso@cicely.de Subject: Re: Spin down HDD after disk sync or before power off X-BeenThere: freebsd-hackers@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list Reply-To: ticso@cicely.de List-Id: Technical Discussions relating to FreeBSD List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 09 Mar 2009 23:19:39 -0000 On Mon, Mar 09, 2009 at 04:17:15PM -0600, Rick C. Petty wrote: > On Sun, Mar 08, 2009 at 01:36:09PM +0100, Bernd Walter wrote: > > On Fri, Mar 06, 2009 at 03:47:38PM -0600, Rick C. Petty wrote: > > > On Fri, Mar 06, 2009 at 03:30:14PM -0600, Octavian Covalschi wrote: > > > > Why is spinning down is bad for HDD ? I believe it's better to spindown a > > > > drive, > > > > instead of cutting power too sudden. > > > > > > Comparing those two, I'd say it shouldn't matter (although probably a > > > forced spindown may be better). But pulling power from a drive does not > > > mean the drive immediately stops doing stuff. > > > > My understanding is that without power the heads just slamm into > > landing zone, while it can be done in a controlled smooth way with > > power. > > Nope, according to a coworker (whose wife works for an HDD manufacturer), > the spindle motor is shunted and the generated electricity is used to > properly land the head. My coworker also tells me that some new drives are > actually parking the heads off the disk, which as I understand is a much > more difficult task since you have to worry about vertical separation when > you bring the heads back between the platters. The ramp load/unload thing is true: http://www.hitachigst.com/tech/techlib.nsf/techdocs/9076679E3EE4003E86256FAB005825FB/$file/LoadUnload_white_paper_FINAL.pdf Some drives also have the ramp on the inner side. This highly disagrees with the loud clank noise that some disks are doing on power loss. The myth about generating emergency power from spindle rotation is very old, but people from (other?) HDD manufactorers denied that. The above document claims that their drives are also doing power reclaiming from rotation. Another used technology however is using the air current from the rotation or a loaded spring. > > > I was just saying spindown on disks is bad in the first place. Sure, you > > > might save some wear and tear on the bearings, but you risk problems with > > > the heads on both spindown and spinup. In other words, if you can avoid > > > power-cycling your drives, they should last longer (in that you're less > > > likely to destroy the heads). > > > > This depends on the disks. > > Desktop and especially mobile drives are designed to sustain more > > spin downs, but are not designed for rotating a long time. > > But of course if you intend to spin up directly after spin down it > > might be bad for them as well, since it isn't really saving spinning > > time. > > That may be; I know nothing about differences with mobile drives. If this > is true, I'd like to find some replacement 2.5" drives which are intended > for continuous spinning. There are a lots of drives available, the market first came up with blade systems. The unfortunate thing is that 2,5" for contiuous use are usually high speed drives, which takes a lot of power, which makes them a bad choice for 24/7 low power devices. > > This is nothing, which should be done on reboot, but for halts it > > might be reasonable to do. > > Not sure what you're trying to say here, but I am for the idea of > issuing a spindown request if we know the power is to be cycled. If > spindown are issued for all halts, I hope someone makes that a kernel > tunable. I ment, that we shouldn't do this for shutdown -r. In all other cases I asume that it can't hurt even if it is not required for specific drives. > What I was hoping is that someone could point me to the "spinup" command as > I have a drive which does not spin up until it receives this command. Any > takers? For CAM there is camcontrol start. Not sure about ATA drives. -- B.Walter http://www.bwct.de Modbus/TCP Ethernet I/O Baugruppen, ARM basierte FreeBSD Rechner uvm. From owner-freebsd-hackers@FreeBSD.ORG Mon Mar 9 23:35:59 2009 Return-Path: Delivered-To: freebsd-hackers@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 5E247106566C for ; Mon, 9 Mar 2009 23:35:59 +0000 (UTC) (envelope-from rwatson@FreeBSD.org) Received: from cyrus.watson.org (cyrus.watson.org [65.122.17.42]) by mx1.freebsd.org (Postfix) with ESMTP id 397BA8FC17 for ; Mon, 9 Mar 2009 23:35:59 +0000 (UTC) (envelope-from rwatson@FreeBSD.org) Received: from fledge.watson.org (fledge.watson.org [65.122.17.41]) by cyrus.watson.org (Postfix) with ESMTPS id CC24146B03; Mon, 9 Mar 2009 19:35:58 -0400 (EDT) Date: Mon, 9 Mar 2009 23:35:58 +0000 (GMT) From: Robert Watson X-X-Sender: robert@fledge.watson.org To: Timothy Redaelli In-Reply-To: Message-ID: References: User-Agent: Alpine 2.00 (BSF 1167 2008-08-23) MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII; format=flowed Cc: freebsd-hackers@freebsd.org Subject: Re: lockf: Invalid argument on pipe 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, 09 Mar 2009 23:35:59 -0000 On Mon, 9 Mar 2009, Timothy Redaelli wrote: > Why can't I do a lockf on a file descriptor that does not point a real file > (such as stderr, stdout, or a character device)? > > Since it works under NetBSD, Linux, Solaris. For portability between systems > I hope I can do it under FreeBSD. > > The following code is simple, but It reproduce the problem. Under > non-FreeBSD systems, It will block before the puts. Instead under FreeBSD > the lockf calls return error and, so, the lock does not works. Could you file a PR for this, with pretty much this e-mail and sample code included? There's no real reason not for it to work other than that it is likely not implemented for devfs; that should be easy to fix it but opening a PR will help us keep track of the fact that it wants to be fixed. thanks, Robert N M Watson Computer Laboratory University of Cambridge > > Any suggest? > > > #include > #include > #include > #include > > int main(int argc, char *argv[]) { > char tmp[256]; > > if (lockf(2, F_LOCK, 0) == -1) > perror("lock"); > snprintf (tmp, 256, "%s XXX", argv[0]); > if (!argv[1] || strcmp(argv[1], "XXX")) > system(tmp); > puts("You should see it only after ctrl+c"); > return EXIT_SUCCESS; > } > > > -- > Timothy Redaelli > IT Consultant > Email: timothy@redaelli.eu > Mobile: +39 (338) 1187273 > WWW: http://www.redaelli.eu/ > _______________________________________________ > 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 Mar 10 01:04:56 2009 Return-Path: Delivered-To: hackers@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id BE98C106566C; Tue, 10 Mar 2009 01:04:56 +0000 (UTC) (envelope-from ken@mthelicon.com) Received: from hercules.mthelicon.com (hercules.mthelicon.com [IPv6:2001:49f0:2023::2]) by mx1.freebsd.org (Postfix) with ESMTP id 8AEB98FC20; Tue, 10 Mar 2009 01:04:56 +0000 (UTC) (envelope-from ken@mthelicon.com) Received: from feathers.peganest.com (78-33-110-3.static-adsl.entanet.co.uk [78.33.110.3] (may be forged)) (authenticated bits=0) by hercules.mthelicon.com (8.14.3/8.14.3) with ESMTP id n2A14sdA099826 (version=TLSv1/SSLv3 cipher=DHE-DSS-AES256-SHA bits=256 verify=NO); Tue, 10 Mar 2009 01:04:55 GMT (envelope-from ken@mthelicon.com) From: Pegasus Mc Cleaft Organization: Feathers To: current@freebsd.org, hackers@freebsd.org Date: Tue, 10 Mar 2009 01:04:53 +0000 User-Agent: KMail/1.11.0 (FreeBSD/8.0-CURRENT; KDE/4.2.0; amd64; ; ) MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Content-Disposition: inline Message-Id: <200903100104.53847.ken@mthelicon.com> Cc: Subject: bsdtar lockup on Current-03/10/2009 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, 10 Mar 2009 01:04:57 -0000 Hi Current & Hackers, I was wondering if anyone else is seeing this problem: Any use of bsdtar to create a new archive causes the process to be unresponsive to all signals and consumes 100% cpu time. The machine I am testing on is a Core 2 quad running in AMD64 (8 gigs ram, zfs boot, root, et al.) I have tried disabling the zil and prefetch as a precaution but can still cause the failure by doing the command below(trying to eliminate zfs writes as being the problem): #tar -cvf /dev/null * Unarchiving from tar seems to work OK. The bug may have been introduced a few days ago. I just noticed my machine doing this tonight when I tried to do a portupgrade and the creation of the backups locked up. Thanks, Peg From owner-freebsd-hackers@FreeBSD.ORG Tue Mar 10 10:16:29 2009 Return-Path: Delivered-To: freebsd-hackers@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id B47801065674; Tue, 10 Mar 2009 10:16:29 +0000 (UTC) (envelope-from bsd.quest@googlemail.com) Received: from ey-out-2122.google.com (ey-out-2122.google.com [74.125.78.25]) by mx1.freebsd.org (Postfix) with ESMTP id 13DA78FC17; Tue, 10 Mar 2009 10:16:28 +0000 (UTC) (envelope-from bsd.quest@googlemail.com) Received: by ey-out-2122.google.com with SMTP id d26so243417eyd.7 for ; Tue, 10 Mar 2009 03:16:27 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=googlemail.com; s=gamma; h=domainkey-signature:mime-version:received:in-reply-to:references :date:message-id:subject:from:to:cc:content-type; bh=3Owz2yeo/udxA60DkPWIfHEFn7QdMyjot61wFrsIdmM=; b=oCrbliutHZeWSyZd8UfopBdSRT956heqTuKke/nC8Q2I5tQ9b/VOkX+jW5lXPeY9uH bbm+Uy1EjkNM2KxoEZWR+CUcChSMVBYeaOtDeayzz7EC8J7+i9jbLziuGKkagy0NP9iL dmgSAO0WfWSjVMJWEVhiP81+8bdPHqoZ5LiKQ= DomainKey-Signature: a=rsa-sha1; c=nofws; d=googlemail.com; s=gamma; h=mime-version:in-reply-to:references:date:message-id:subject:from:to :cc:content-type; b=Gi2UqT7ocmAuRe3x1o84KjMs/AOH+2XN2iId0GTLOEtD6gvfvxI2i5cjqc/K18iafx aEOPeBvUrelDcqhH35txnHebiO7PGMbbeaRnCey85EHXmgTGcGEL19jKMK3DZwgLKHNp x4YGiXck6WhMUpHYCt8YrkqCfpJsZN+JON0Yw= MIME-Version: 1.0 Received: by 10.210.43.10 with SMTP id q10mr4443811ebq.58.1236680187807; Tue, 10 Mar 2009 03:16:27 -0700 (PDT) In-Reply-To: <200903091618.32955.jhb@freebsd.org> References: <671bb5fc0903060813s284673e2t4d3c77b0ed6abc54@mail.gmail.com> <200903090821.25871.jhb@freebsd.org> <671bb5fc0903091238q2c4e4bd7m661333a509395b61@mail.gmail.com> <200903091618.32955.jhb@freebsd.org> Date: Tue, 10 Mar 2009 11:16:27 +0100 Message-ID: <671bb5fc0903100316s16c0ae36ocaac3cdab955584d@mail.gmail.com> From: Alexej Sokolov To: John Baldwin Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 7bit X-Content-Filtered-By: Mailman/MimeDel 2.1.5 Cc: freebsd-hackers@freebsd.org Subject: Re: wrong data in remapped buffer 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, 10 Mar 2009 10:16:30 -0000 2009/3/9 John Baldwin > On Monday 09 March 2009 3:38:55 pm Alexej Sokolov wrote: > > 2009/3/9 John Baldwin > > > > > On Friday 06 March 2009 11:13:38 am Alexej Sokolov wrote: > > > > Hello, > > > > I try to MALLOC a buffer in kern, then remap it with vm_map_find(), > to > > > space > > > > of user process. > > > > Some times the remapped buffer in user space contain incorrect data. > > > > > > What architecture are you using? On some archs like amd64, small > mallocs > > > (<= > > > PAGE_SIZE) don't use the kmem_map or kmem_object. > > > > > > -- > > > John Baldwin > > > > > anyway , the error happens only some times... I think there is other > reason. > > My hardware is amd64 > > % uname -ms > > FreeBSD i386 > > i386 always uses kmem for malloc(9). > > -- > John Baldwin ok, and what should be a reason of inconsistent data after remapping ? From owner-freebsd-hackers@FreeBSD.ORG Tue Mar 10 11:17:21 2009 Return-Path: Delivered-To: freebsd-hackers@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 3B71B1065670; Tue, 10 Mar 2009 11:17:21 +0000 (UTC) (envelope-from kostikbel@gmail.com) Received: from mail.terabit.net.ua (mail.terabit.net.ua [195.137.202.147]) by mx1.freebsd.org (Postfix) with ESMTP id D1A488FC14; Tue, 10 Mar 2009 11:17:20 +0000 (UTC) (envelope-from kostikbel@gmail.com) Received: from skuns.zoral.com.ua ([91.193.166.194] helo=mail.zoral.com.ua) by mail.terabit.net.ua with esmtps (TLSv1:AES256-SHA:256) (Exim 4.63 (FreeBSD)) (envelope-from ) id 1LgzxW-000F20-2T; Tue, 10 Mar 2009 13:17:18 +0200 Received: from deviant.kiev.zoral.com.ua (root@deviant.kiev.zoral.com.ua [10.1.1.148]) by mail.zoral.com.ua (8.14.2/8.14.2) with ESMTP id n2ABHCcv078931 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=NO); Tue, 10 Mar 2009 13:17:13 +0200 (EET) (envelope-from kostikbel@gmail.com) Received: from deviant.kiev.zoral.com.ua (kostik@localhost [127.0.0.1]) by deviant.kiev.zoral.com.ua (8.14.3/8.14.3) with ESMTP id n2ABHCM1035303; Tue, 10 Mar 2009 13:17:12 +0200 (EET) (envelope-from kostikbel@gmail.com) Received: (from kostik@localhost) by deviant.kiev.zoral.com.ua (8.14.3/8.14.3/Submit) id n2ABHCd2035302; Tue, 10 Mar 2009 13:17:12 +0200 (EET) (envelope-from kostikbel@gmail.com) X-Authentication-Warning: deviant.kiev.zoral.com.ua: kostik set sender to kostikbel@gmail.com using -f Date: Tue, 10 Mar 2009 13:17:12 +0200 From: Kostik Belousov To: Robert Watson Message-ID: <20090310111712.GA41617@deviant.kiev.zoral.com.ua> References: Mime-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha1; protocol="application/pgp-signature"; boundary="144W9TlQWTjTIokZ" Content-Disposition: inline In-Reply-To: User-Agent: Mutt/1.4.2.3i X-Virus-Scanned: ClamAV version 0.94.2, clamav-milter version 0.94.2 on skuns.kiev.zoral.com.ua X-Virus-Status: Clean X-Spam-Status: No, score=-4.4 required=5.0 tests=ALL_TRUSTED,AWL,BAYES_00 autolearn=ham version=3.2.5 X-Spam-Checker-Version: SpamAssassin 3.2.5 (2008-06-10) on skuns.kiev.zoral.com.ua X-Virus-Scanned: mail.terabit.net.ua 1LgzxW-000F20-2T 791fe1b427910e47b5228cf7b23cc224 X-Terabit: YES Cc: Timothy Redaelli , freebsd-hackers@freebsd.org Subject: Re: lockf: Invalid argument on pipe 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, 10 Mar 2009 11:17:21 -0000 --144W9TlQWTjTIokZ Content-Type: text/plain; charset=us-ascii Content-Disposition: inline Content-Transfer-Encoding: quoted-printable On Mon, Mar 09, 2009 at 11:35:58PM +0000, Robert Watson wrote: >=20 > On Mon, 9 Mar 2009, Timothy Redaelli wrote: >=20 > >Why can't I do a lockf on a file descriptor that does not point a real= =20 > >file (such as stderr, stdout, or a character device)? > > > >Since it works under NetBSD, Linux, Solaris. For portability between=20 > >systems I hope I can do it under FreeBSD. > > > >The following code is simple, but It reproduce the problem. Under=20 > >non-FreeBSD systems, It will block before the puts. Instead under FreeBS= D=20 > >the lockf calls return error and, so, the lock does not works. >=20 > Could you file a PR for this, with pretty much this e-mail and sample cod= e=20 > included? There's no real reason not for it to work other than that it i= s=20 > likely not implemented for devfs; that should be easy to fix it but openi= ng=20 > a PR will help us keep track of the fact that it wants to be fixed. >=20 > thanks, >=20 > Robert N M Watson > Computer Laboratory > University of Cambridge >=20 > > > >Any suggest? > > > > > >#include > >#include > >#include > >#include > > > >int main(int argc, char *argv[]) { > > char tmp[256]; > > > > if (lockf(2, F_LOCK, 0) =3D=3D -1) > > perror("lock"); > > snprintf (tmp, 256, "%s XXX", argv[0]); > > if (!argv[1] || strcmp(argv[1], "XXX")) > > system(tmp); > > puts("You should see it only after ctrl+c"); > > return EXIT_SUCCESS; > >} > > It is explicitely disabled in devfs code. The following patch works for me. diff --git a/sys/fs/devfs/devfs_vnops.c b/sys/fs/devfs/devfs_vnops.c index 1087452..b890da7 100644 --- a/sys/fs/devfs/devfs_vnops.c +++ b/sys/fs/devfs/devfs_vnops.c @@ -452,14 +452,6 @@ devfs_access(struct vop_access_args *ap) =20 /* ARGSUSED */ static int -devfs_advlock(struct vop_advlock_args *ap) -{ - - return (ap->a_flags & F_FLOCK ? EOPNOTSUPP : EINVAL); -} - -/* ARGSUSED */ -static int devfs_close(struct vop_close_args *ap) { struct vnode *vp =3D ap->a_vp, *oldvp; @@ -1552,7 +1544,6 @@ static struct vop_vector devfs_specops =3D { .vop_default =3D &default_vnodeops, =20 .vop_access =3D devfs_access, - .vop_advlock =3D devfs_advlock, .vop_bmap =3D VOP_PANIC, .vop_close =3D devfs_close, .vop_create =3D VOP_PANIC, --144W9TlQWTjTIokZ Content-Type: application/pgp-signature Content-Disposition: inline -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.4.9 (FreeBSD) iEYEARECAAYFAkm2TDcACgkQC3+MBN1Mb4ip3wCdG+LG9sAemurNZw9ETgifBSpZ ms0AnjsLZMVyjLxvBUCfW9mkTw3N/sJ2 =HjD0 -----END PGP SIGNATURE----- --144W9TlQWTjTIokZ-- From owner-freebsd-hackers@FreeBSD.ORG Tue Mar 10 13:39:58 2009 Return-Path: Delivered-To: freebsd-hackers@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id D075C1065673 for ; Tue, 10 Mar 2009 13:39:58 +0000 (UTC) (envelope-from jhb@freebsd.org) Received: from cyrus.watson.org (cyrus.watson.org [65.122.17.42]) by mx1.freebsd.org (Postfix) with ESMTP id A11DD8FC17 for ; Tue, 10 Mar 2009 13:39:58 +0000 (UTC) (envelope-from jhb@freebsd.org) Received: from server.baldwin.cx (pool-98-109-39-197.nwrknj.fios.verizon.net [98.109.39.197]) by cyrus.watson.org (Postfix) with ESMTPSA id 4DC3B46B0D; Tue, 10 Mar 2009 09:39:58 -0400 (EDT) Received: from localhost (john@localhost [127.0.0.1]) (authenticated bits=0) by server.baldwin.cx (8.14.3/8.14.3) with ESMTP id n2ADdYC4026352; Tue, 10 Mar 2009 09:39:52 -0400 (EDT) (envelope-from jhb@freebsd.org) From: John Baldwin To: Alexej Sokolov Date: Tue, 10 Mar 2009 09:31:33 -0400 User-Agent: KMail/1.9.7 References: <671bb5fc0903060813s284673e2t4d3c77b0ed6abc54@mail.gmail.com> <200903091618.32955.jhb@freebsd.org> <671bb5fc0903100316s16c0ae36ocaac3cdab955584d@mail.gmail.com> In-Reply-To: <671bb5fc0903100316s16c0ae36ocaac3cdab955584d@mail.gmail.com> MIME-Version: 1.0 Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: 7bit Content-Disposition: inline Message-Id: <200903100931.34071.jhb@freebsd.org> X-Greylist: Sender succeeded SMTP AUTH authentication, not delayed by milter-greylist-2.0.2 (server.baldwin.cx [127.0.0.1]); Tue, 10 Mar 2009 09:39:52 -0400 (EDT) X-Virus-Scanned: ClamAV 0.94.2/9084/Tue Mar 10 03:11:13 2009 on server.baldwin.cx X-Virus-Status: Clean X-Spam-Status: No, score=-4.4 required=4.2 tests=ALL_TRUSTED,AWL,BAYES_00 autolearn=ham version=3.1.3 X-Spam-Checker-Version: SpamAssassin 3.1.3 (2006-06-01) on server.baldwin.cx Cc: freebsd-hackers@freebsd.org Subject: Re: wrong data in remapped buffer 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, 10 Mar 2009 13:39:59 -0000 On Tuesday 10 March 2009 6:16:27 am Alexej Sokolov wrote: > 2009/3/9 John Baldwin > > > On Monday 09 March 2009 3:38:55 pm Alexej Sokolov wrote: > > > 2009/3/9 John Baldwin > > > > > > > On Friday 06 March 2009 11:13:38 am Alexej Sokolov wrote: > > > > > Hello, > > > > > I try to MALLOC a buffer in kern, then remap it with vm_map_find(), > > to > > > > space > > > > > of user process. > > > > > Some times the remapped buffer in user space contain incorrect data. > > > > > > > > What architecture are you using? On some archs like amd64, small > > mallocs > > > > (<= > > > > PAGE_SIZE) don't use the kmem_map or kmem_object. > > > > > > > > -- > > > > John Baldwin > > > > > > > anyway , the error happens only some times... I think there is other > > reason. > > > My hardware is amd64 > > > % uname -ms > > > FreeBSD i386 > > > > i386 always uses kmem for malloc(9). > > > > -- > > John Baldwin > > ok, > and what should be a reason of inconsistent data after remapping ? I don't know off the top of my head. I'm not really sure your use of vm_map_find() is correct, but I don't know it well enough to comment further. -- John Baldwin From owner-freebsd-hackers@FreeBSD.ORG Tue Mar 10 16:05:53 2009 Return-Path: Delivered-To: freebsd-hackers@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 735841065674 for ; Tue, 10 Mar 2009 16:05:53 +0000 (UTC) (envelope-from bsd.quest@googlemail.com) Received: from nf-out-0910.google.com (nf-out-0910.google.com [64.233.182.186]) by mx1.freebsd.org (Postfix) with ESMTP id 0A9198FC1F for ; Tue, 10 Mar 2009 16:05:52 +0000 (UTC) (envelope-from bsd.quest@googlemail.com) Received: by nf-out-0910.google.com with SMTP id d21so331192nfb.33 for ; Tue, 10 Mar 2009 09:05:52 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=googlemail.com; s=gamma; h=domainkey-signature:mime-version:received:date:message-id:subject :from:to:content-type; bh=PmG1YxYICK/mLIH0a1HsyYflxfCiwi1vFJnGGYeA6VI=; b=ow6FZAjbwOEV2hmx8jRcL5fE8L49VoDzcLOSqENIcdm9Iuw8bhS2tITn0EZx/IUze1 9+nMe8hKZx6tzpG0wdUMxhlR69Ej9InuzQ3yj/PHLJoYQxHERKPl+MlG/Mi2lTsDfO89 OKxWBmR54rNGRdXj8CCUHk1BAZytueSJoD6ls= DomainKey-Signature: a=rsa-sha1; c=nofws; d=googlemail.com; s=gamma; h=mime-version:date:message-id:subject:from:to:content-type; b=Jej0b816d2xCftVD2vdDn44F046FsQhqmxZ+weZ4o8rzmYqNaDF8e2UPLp/Mn1uZfR IP/OnbNH7sV+nkg6716SiiQRgsVJKOuBdYq/uxgm3rrsJ94DlJu7ThyCv7dOnfKwPsS7 gQnyHaVD57n56HjeFuCGj2HolBqWx438p2lvo= MIME-Version: 1.0 Received: by 10.210.56.7 with SMTP id e7mr535411eba.21.1236701152103; Tue, 10 Mar 2009 09:05:52 -0700 (PDT) Date: Tue, 10 Mar 2009 17:05:52 +0100 Message-ID: <671bb5fc0903100905u7484cd1dp9faefc8bc208a6a6@mail.gmail.com> From: Alexej Sokolov To: freebsd-hackers@freebsd.org Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 7bit X-Content-Filtered-By: Mailman/MimeDel 2.1.5 Subject: write protection by mmap of /dev/mem doesn't work 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, 10 Mar 2009 16:05:53 -0000 hello, How can I mmap some memory regions with PROT_WRITE protection flag ? What i do: /* Open mem device */ if ((devmem_fd = open("/dev/mem", O_RDWR)) == -1){ perror("/dev/mem"); exit (1); } then if I try to mmap some memory region with PROT_READ it goes Ok. But by PROT_WRITE it doesn't work: sp = mmap ( 0, MCLBYTES, /* Size of remapped buffer = size of mbuf cluster */ PROT_WRITE, MAP_SHARED, devmem_fd, phys_addr /* Physical addres of packet buffer from descriptor */ ); I get by PROT_WRITE " segmentation fault" What is the problem here ? And question again: How can I do it possible to remapp the kernel memory region to user space process through /dev/mem and give to this user process write permissions to remmaped space ? Thanx From owner-freebsd-hackers@FreeBSD.ORG Tue Mar 10 16:32:44 2009 Return-Path: Delivered-To: freebsd-hackers@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id F12901065678 for ; Tue, 10 Mar 2009 16:32:44 +0000 (UTC) (envelope-from bsd.quest@googlemail.com) Received: from mail-ew0-f166.google.com (mail-ew0-f166.google.com [209.85.219.166]) by mx1.freebsd.org (Postfix) with ESMTP id 5D8038FC1F for ; Tue, 10 Mar 2009 16:32:43 +0000 (UTC) (envelope-from bsd.quest@googlemail.com) Received: by ewy10 with SMTP id 10so1414724ewy.43 for ; Tue, 10 Mar 2009 09:32:43 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=googlemail.com; s=gamma; h=domainkey-signature:mime-version:received:in-reply-to:references :date:message-id:subject:from:to:content-type; bh=cqYGnPQLkzw3FQ1lQ3V3AtpeLSZf32YBav85I+0d26s=; b=qbrWRLRet4uBzyYtvswlf44l0nRovQnDAv3YoPsrizeIL238XZvZrgQG1rEwbaFz4k VMLC0S1LHu817ccwQOoJIrs1KIVvT2tCji4HwpBUIZjr2mIz23W1zpuIZsD3x3NzNRYm gG8Bv8jUljFrUwmBnOOmMLBnEI2nBU/n2P2cQ= DomainKey-Signature: a=rsa-sha1; c=nofws; d=googlemail.com; s=gamma; h=mime-version:in-reply-to:references:date:message-id:subject:from:to :content-type; b=bfCV8uXMx8H6fR2iDusqO1wgUXIT59FBNJC8ztweVABwx2uNVJlufz42tMCtcJPu/z fVE3CbXQJ3HHjJV4/6ZiEnm77rkeGKrRTmo4joLU0WCu5CRvYOo7ALYGorn5KX3zHmZZ +/fcG2HJNqI1VNsUgGMvtMQjmHlEhSUOpLsGA= MIME-Version: 1.0 Received: by 10.210.136.10 with SMTP id j10mr552977ebd.52.1236702763331; Tue, 10 Mar 2009 09:32:43 -0700 (PDT) In-Reply-To: <671bb5fc0903100905u7484cd1dp9faefc8bc208a6a6@mail.gmail.com> References: <671bb5fc0903100905u7484cd1dp9faefc8bc208a6a6@mail.gmail.com> Date: Tue, 10 Mar 2009 17:32:43 +0100 Message-ID: <671bb5fc0903100932y71e6c78bq8904224959e24e55@mail.gmail.com> From: Alexej Sokolov To: freebsd-hackers@freebsd.org Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 7bit X-Content-Filtered-By: Mailman/MimeDel 2.1.5 Subject: Fwd: write protection by mmap of /dev/mem doesn't work 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, 10 Mar 2009 16:32:45 -0000 Sorry, it was my mistake ! seg fault was by reading of data. To do this should PROT_READ|PROT_WRITE be setted. Now it works! Alexej ---------- Forwarded message ---------- From: Alexej Sokolov Date: 2009/3/10 Subject: write protection by mmap of /dev/mem doesn't work To: freebsd-hackers@freebsd.org hello, How can I mmap some memory regions with PROT_WRITE protection flag ? What i do: /* Open mem device */ if ((devmem_fd = open("/dev/mem", O_RDWR)) == -1){ perror("/dev/mem"); exit (1); } then if I try to mmap some memory region with PROT_READ it goes Ok. But by PROT_WRITE it doesn't work: sp = mmap ( 0, MCLBYTES, /* Size of remapped buffer = size of mbuf cluster */ PROT_WRITE, MAP_SHARED, devmem_fd, phys_addr /* Physical addres of packet buffer from descriptor */ ); I get by PROT_WRITE " segmentation fault" What is the problem here ? And question again: How can I do it possible to remapp the kernel memory region to user space process through /dev/mem and give to this user process write permissions to remmaped space ? Thanx From owner-freebsd-hackers@FreeBSD.ORG Tue Mar 10 17:26:28 2009 Return-Path: Delivered-To: freebsd-hackers@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 92019106566B for ; Tue, 10 Mar 2009 17:26:28 +0000 (UTC) (envelope-from vasanth.raonaik@gmail.com) Received: from rv-out-0506.google.com (rv-out-0506.google.com [209.85.198.235]) by mx1.freebsd.org (Postfix) with ESMTP id 67B1C8FC12 for ; Tue, 10 Mar 2009 17:26:28 +0000 (UTC) (envelope-from vasanth.raonaik@gmail.com) Received: by rv-out-0506.google.com with SMTP id f6so2501473rvb.43 for ; Tue, 10 Mar 2009 10:26:27 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:mime-version:received:date:message-id:subject :from:to:content-type; bh=tRwqRSb5PC8RZkvcHqrq/Oynu8CEhbOIMKarFzBNug8=; b=k4TcqiDtgeFDtR10fiLSKBwtUaiZGVVyV7NpfwH/iZkxe8J/wh4xP1rdKlfn3Icczy xbe5uQzx1M2xHsITo8mVKBG46U5eUV6U3asmeNbC+tq+w2TCOrP905Bm40LvXXzIDpim QLvNShAXGbH3MMLXcL7aXVAFFQ4c9A18RbdOE= DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=mime-version:date:message-id:subject:from:to:content-type; b=MvDQewBBqipF+1tpDE8A+O9d5Dx2zWjZWvzoh9bCJk9A/1sjgJnFyDC7y9qp3M60Hp Rn+3azTWtBU6VA+v4drXkvjVOHxwNq0x+T0miq1UspBS1ZGVepRfrTt9yoNL6P9TCAHo El6ags+lD6EVyn50lDFCvYKQsd9rSQUaMCXX8= MIME-Version: 1.0 Received: by 10.141.36.17 with SMTP id o17mr3816807rvj.261.1236703997328; Tue, 10 Mar 2009 09:53:17 -0700 (PDT) Date: Tue, 10 Mar 2009 22:23:17 +0530 Message-ID: From: vasanth raonaik To: freebsd-hackers@freebsd.org Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 7bit X-Content-Filtered-By: Mailman/MimeDel 2.1.5 Subject: Debugging init process. 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, 10 Mar 2009 17:26:29 -0000 Hello Team, I need to debug init process. I am not able to attach init to gdb and it throws GNU gdb 6.5 [juniper_2006a_411] Copyright (C) 2006 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-specifix.com-freebsd"... (gdb) attach 1 Attaching to program: /var/tmp/abhi/init, process 1 ptrace: Invalid argument. (gdb) Can any one help me out in debugging init step execution. Thanks in advance, Vasanth From owner-freebsd-hackers@FreeBSD.ORG Tue Mar 10 20:13:51 2009 Return-Path: Delivered-To: freebsd-hackers@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id E39F91065672 for ; Tue, 10 Mar 2009 20:13:51 +0000 (UTC) (envelope-from pluknet@gmail.com) Received: from fg-out-1718.google.com (fg-out-1718.google.com [72.14.220.152]) by mx1.freebsd.org (Postfix) with ESMTP id 70DC48FC1C for ; Tue, 10 Mar 2009 20:13:51 +0000 (UTC) (envelope-from pluknet@gmail.com) Received: by fg-out-1718.google.com with SMTP id l26so834941fgb.35 for ; Tue, 10 Mar 2009 13:13:50 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:mime-version:received:in-reply-to:references :date:message-id:subject:from:to:cc:content-type :content-transfer-encoding; bh=9aU9RzDtKSET9O4LC2Pn4OwgwJNrs5J/3hbzXnQeb4Y=; b=Pmtncs1WGhaEdEZuFIorQzTky2z3guBFZk7ebn+0yg1tkoFGCRWiPQGXZRiOlFb9gr 7kORTU0InoMphZ/Zf892T4F5VfVUjNH1fTGlZazs5z9F66XPo3d2cIXAwCzmUNB7Ybay EPm+QJxBnk61M0ytsxyWiV1ArAnsd+adKmcQs= DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=mime-version:in-reply-to:references:date:message-id:subject:from:to :cc:content-type:content-transfer-encoding; b=FbwWin2UFMlET1GNT+J1dZ+joeHwjMnaUWG++FUWx8NZ+Am2lMRGIEf7cCJG+en3yn S7qv82EjJNcuCcZ5amI4RWv9dJSL+1szhcgxLZMCSTytUtTcCi2Hc+PFpBclpbiaaM+T soIZPhySAy5X+vVYmMZJyU4Tkwpz5ThLhBcMY= MIME-Version: 1.0 Received: by 10.86.98.18 with SMTP id v18mr5324705fgb.46.1236716030408; Tue, 10 Mar 2009 13:13:50 -0700 (PDT) In-Reply-To: References: Date: Tue, 10 Mar 2009 23:13:50 +0300 Message-ID: From: pluknet To: vasanth raonaik Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 7bit Cc: freebsd-hackers@freebsd.org Subject: Re: Debugging init process. 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, 10 Mar 2009 20:13:52 -0000 2009/3/10 vasanth raonaik : > Hello Team, > > I need to debug init process. I am not able to attach init to gdb and it > throws > That is because init is a system process, which you cannot trace by design (see ptrace(2)). $ ps -o flags -p 1 F 10004200 , where from ps(1): P_SYSTEM 0x00200 System proc: no sigs, stats or swapping -- wbr, pluknet From owner-freebsd-hackers@FreeBSD.ORG Tue Mar 10 21:51:44 2009 Return-Path: Delivered-To: freebsd-hackers@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id B51E31065688 for ; Tue, 10 Mar 2009 21:51:44 +0000 (UTC) (envelope-from gabor@FreeBSD.org) Received: from server.mypc.hu (server.mypc.hu [87.229.73.95]) by mx1.freebsd.org (Postfix) with ESMTP id 700718FC16 for ; Tue, 10 Mar 2009 21:51:44 +0000 (UTC) (envelope-from gabor@FreeBSD.org) Received: from localhost (localhost [127.0.0.1]) by server.mypc.hu (Postfix) with ESMTP id 4110D14D8737 for ; Tue, 10 Mar 2009 22:33:13 +0100 (CET) X-Virus-Scanned: amavisd-new at t-hosting.hu Received: from server.mypc.hu ([127.0.0.1]) by localhost (server.mypc.hu [127.0.0.1]) (amavisd-new, port 10024) with LMTP id huOqDjc99TgT for ; Tue, 10 Mar 2009 22:33:12 +0100 (CET) Received: from [192.168.1.105] (catv-80-98-231-64.catv.broadband.hu [80.98.231.64]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (No client certificate requested) by server.mypc.hu (Postfix) with ESMTPSA id 9FDA414D86CB for ; Tue, 10 Mar 2009 22:33:12 +0100 (CET) Message-ID: <49B6DC95.9070607@FreeBSD.org> Date: Tue, 10 Mar 2009 22:33:09 +0100 From: =?ISO-8859-1?Q?G=E1bor_K=F6vesd=E1n?= User-Agent: Thunderbird 2.0.0.19 (Windows/20081209) MIME-Version: 1.0 To: freebsd-hackers@freebsd.org Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit Subject: fgetc doubts 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, 10 Mar 2009 21:51:46 -0000 Hello, I have a problem when reading files with fgetc when a 0xff character comes. In my code the reading stops at that point as if EOF had been reached, but that's not actually the case. The code is here: http://p4web.freebsd.org/@md=d&cd=//&c=Nsd@//depot/projects/soc2008/gabor_textproc/grep/file.c?ac=64&rev1=40 And the problem occurs in grep_fgetln() when the buffers is being filled in: for (; i < bufsiz && !grep_feof(f); i++) binbuf[i] = grep_fgetc(f); Thanks in advance, -- Gabor Kovesdan FreeBSD Volunteer EMAIL: gabor@FreeBSD.org .:|:. gabor@kovesdan.org WEB: http://people.FreeBSD.org/~gabor .:|:. http://kovesdan.org From owner-freebsd-hackers@FreeBSD.ORG Tue Mar 10 21:55:13 2009 Return-Path: Delivered-To: freebsd-hackers@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id D8DB4106566B; Tue, 10 Mar 2009 21:55:13 +0000 (UTC) (envelope-from ed@hoeg.nl) Received: from palm.hoeg.nl (mx0.hoeg.nl [IPv6:2001:7b8:613:100::211]) by mx1.freebsd.org (Postfix) with ESMTP id 73C808FC21; Tue, 10 Mar 2009 21:55:13 +0000 (UTC) (envelope-from ed@hoeg.nl) Received: by palm.hoeg.nl (Postfix, from userid 1000) id 405E41CE0D; Tue, 10 Mar 2009 22:55:12 +0100 (CET) Date: Tue, 10 Mar 2009 22:55:12 +0100 From: Ed Schouten To: =?iso-8859-1?Q?G=E1bor_K=F6vesd=E1n?= Message-ID: <20090310215512.GI31961@hoeg.nl> References: <49B6DC95.9070607@FreeBSD.org> MIME-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha1; protocol="application/pgp-signature"; boundary="cpvLTH7QU4gwfq3S" Content-Disposition: inline In-Reply-To: <49B6DC95.9070607@FreeBSD.org> User-Agent: Mutt/1.5.19 (2009-01-05) Cc: FreeBSD Hackers Subject: Re: fgetc doubts 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, 10 Mar 2009 21:55:14 -0000 --cpvLTH7QU4gwfq3S Content-Type: text/plain; charset=iso-8859-1 Content-Disposition: inline Content-Transfer-Encoding: quoted-printable * G=E1bor K=F6vesd=E1n wrote: > Hello, > > I have a problem when reading files with fgetc when a 0xff character =20 > comes. In my code the reading stops at that point as if EOF had been =20 > reached, but that's not actually the case. > The code is here: =20 > http://p4web.freebsd.org/@md=3Dd&cd=3D//&c=3DNsd@//depot/projects/soc2008= /gabor_textproc/grep/file.c?ac=3D64&rev1=3D40 > And the problem occurs in grep_fgetln() when the buffers is being filled = in: > for (; i < bufsiz && !grep_feof(f); i++) > binbuf[i] =3D grep_fgetc(f); > > Thanks in advance, Sign extension bug? --=20 Ed Schouten WWW: http://80386.nl/ --cpvLTH7QU4gwfq3S Content-Type: application/pgp-signature Content-Disposition: inline -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.4.9 (FreeBSD) iEYEARECAAYFAkm24cAACgkQ52SDGA2eCwUtBwCdEsgo+GCh/s9IIz4Bo3Bb0UTz 7ogAniwJ7zFgftoYNVyZXhPZeLYxbg14 =Lwct -----END PGP SIGNATURE----- --cpvLTH7QU4gwfq3S-- From owner-freebsd-hackers@FreeBSD.ORG Tue Mar 10 22:00:52 2009 Return-Path: Delivered-To: freebsd-hackers@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id D8DAD106566B for ; Tue, 10 Mar 2009 22:00:52 +0000 (UTC) (envelope-from gabor@FreeBSD.org) Received: from server.mypc.hu (server.mypc.hu [87.229.73.95]) by mx1.freebsd.org (Postfix) with ESMTP id 941CF8FC08 for ; Tue, 10 Mar 2009 22:00:52 +0000 (UTC) (envelope-from gabor@FreeBSD.org) Received: from localhost (localhost [127.0.0.1]) by server.mypc.hu (Postfix) with ESMTP id 5E1CB14D8737; Tue, 10 Mar 2009 23:00:51 +0100 (CET) X-Virus-Scanned: amavisd-new at t-hosting.hu Received: from server.mypc.hu ([127.0.0.1]) by localhost (server.mypc.hu [127.0.0.1]) (amavisd-new, port 10024) with LMTP id iS61BWXdlLpY; Tue, 10 Mar 2009 23:00:50 +0100 (CET) Received: from [192.168.1.105] (catv-80-98-231-64.catv.broadband.hu [80.98.231.64]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (No client certificate requested) by server.mypc.hu (Postfix) with ESMTPSA id 737CB14D86CB; Tue, 10 Mar 2009 23:00:50 +0100 (CET) Message-ID: <49B6E30F.7020205@FreeBSD.org> Date: Tue, 10 Mar 2009 23:00:47 +0100 From: =?ISO-8859-1?Q?G=E1bor_K=F6vesd=E1n?= User-Agent: Thunderbird 2.0.0.19 (Windows/20081209) MIME-Version: 1.0 To: Ed Schouten References: <49B6DC95.9070607@FreeBSD.org> <20090310215512.GI31961@hoeg.nl> In-Reply-To: <20090310215512.GI31961@hoeg.nl> Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 8bit Cc: FreeBSD Hackers Subject: Re: fgetc doubts 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, 10 Mar 2009 22:00:53 -0000 Ed Schouten escribió: > * Gábor Kövesdán wrote: > >> Hello, >> >> I have a problem when reading files with fgetc when a 0xff character >> comes. In my code the reading stops at that point as if EOF had been >> reached, but that's not actually the case. >> The code is here: >> http://p4web.freebsd.org/@md=d&cd=//&c=Nsd@//depot/projects/soc2008/gabor_textproc/grep/file.c?ac=64&rev1=40 >> And the problem occurs in grep_fgetln() when the buffers is being filled in: >> for (; i < bufsiz && !grep_feof(f); i++) >> binbuf[i] = grep_fgetc(f); >> >> Thanks in advance, >> > > Sign extension bug? > I tried to substitute everything with int, because fgetc can return some error code afaik, but using int didn't help. -- Gabor Kovesdan FreeBSD Volunteer EMAIL: gabor@FreeBSD.org .:|:. gabor@kovesdan.org WEB: http://people.FreeBSD.org/~gabor .:|:. http://kovesdan.org From owner-freebsd-hackers@FreeBSD.ORG Tue Mar 10 22:24:33 2009 Return-Path: Delivered-To: freebsd-hackers@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 6652B106564A; Tue, 10 Mar 2009 22:24:33 +0000 (UTC) (envelope-from delphij@delphij.net) Received: from tarsier.delphij.net (delphij-pt.tunnel.tserv2.fmt.ipv6.he.net [IPv6:2001:470:1f03:2c9::2]) by mx1.freebsd.org (Postfix) with ESMTP id 03C858FC20; Tue, 10 Mar 2009 22:24:33 +0000 (UTC) (envelope-from delphij@delphij.net) Received: from tarsier.geekcn.org (tarsier.geekcn.org [211.166.10.233]) (using TLSv1 with cipher ADH-CAMELLIA256-SHA (256/256 bits)) (No client certificate requested) by tarsier.delphij.net (Postfix) with ESMTPS id BA8CD28448; Wed, 11 Mar 2009 06:24:31 +0800 (CST) Received: from localhost (tarsier.geekcn.org [211.166.10.233]) by tarsier.geekcn.org (Postfix) with ESMTP id 0E031EB60AB; Wed, 11 Mar 2009 06:24:31 +0800 (CST) X-Virus-Scanned: amavisd-new at geekcn.org Received: from tarsier.geekcn.org ([211.166.10.233]) by localhost (mail.geekcn.org [211.166.10.233]) (amavisd-new, port 10024) with ESMTP id 44E0whA1uH9f; Wed, 11 Mar 2009 06:24:26 +0800 (CST) Received: from charlie.delphij.net (adsl-76-237-33-62.dsl.pltn13.sbcglobal.net [76.237.33.62]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (No client certificate requested) by tarsier.geekcn.org (Postfix) with ESMTPSA id A6909EB571C; Wed, 11 Mar 2009 06:24:24 +0800 (CST) DomainKey-Signature: a=rsa-sha1; s=default; d=delphij.net; c=nofws; q=dns; h=message-id:date:from:reply-to:organization:user-agent: mime-version:to:cc:subject:references:in-reply-to: x-enigmail-version:openpgp:content-type:content-transfer-encoding; b=Z0NP4nXiKXqh3NLEAhqKyGFCkgvc7HDZwx/05nUsqxzREN3g9mBJtbEdnzmZC5L5B LoBK0CEVkvCXOD0+oEJwA== Message-ID: <49B6E895.9040701@delphij.net> Date: Tue, 10 Mar 2009 15:24:21 -0700 From: Xin LI Organization: The FreeBSD Project User-Agent: Thunderbird 2.0.0.19 (X11/20090217) MIME-Version: 1.0 To: =?ISO-8859-1?Q?G=E1bor_K=F6vesd=E1n?= References: <49B6DC95.9070607@FreeBSD.org> <20090310215512.GI31961@hoeg.nl> <49B6E30F.7020205@FreeBSD.org> In-Reply-To: <49B6E30F.7020205@FreeBSD.org> X-Enigmail-Version: 0.95.7 OpenPGP: id=18EDEBA0; url=http://www.delphij.net/delphij.asc Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 8bit Cc: Ed Schouten , FreeBSD Hackers Subject: Re: fgetc doubts X-BeenThere: freebsd-hackers@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list Reply-To: d@delphij.net List-Id: Technical Discussions relating to FreeBSD List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 10 Mar 2009 22:24:33 -0000 -----BEGIN PGP SIGNED MESSAGE----- Hash: SHA1 Hi, Gábor, Gábor Kövesdán wrote: > Ed Schouten escribió: >> * Gábor Kövesdán wrote: >> >>> Hello, >>> >>> I have a problem when reading files with fgetc when a 0xff character >>> comes. In my code the reading stops at that point as if EOF had been >>> reached, but that's not actually the case. >>> The code is here: >>> http://p4web.freebsd.org/@md=d&cd=//&c=Nsd@//depot/projects/soc2008/gabor_textproc/grep/file.c?ac=64&rev1=40 >>> >>> And the problem occurs in grep_fgetln() when the buffers is being >>> filled in: >>> for (; i < bufsiz && !grep_feof(f); i++) >>> binbuf[i] = grep_fgetc(f); >>> >>> Thanks in advance, >>> >> >> Sign extension bug? >> > I tried to substitute everything with int, because fgetc can return some > error code afaik, but using int didn't help. Is binbuf[] an array of char or unsigned char? If it's signed char then you may want something like ch = binbufptr[0] & 0xff I guess. Cheers, - -- Xin LI http://www.delphij.net/ FreeBSD - The Power to Serve! -----BEGIN PGP SIGNATURE----- Version: GnuPG v2.0.11 (FreeBSD) iEYEARECAAYFAkm26JUACgkQi+vbBBjt66CePwCgtXlqAYcdP6G1EUUtGk0nu7vD I1sAoIJ+Hpop5mIHDdbfcXAbwMsqht2P =A8DH -----END PGP SIGNATURE----- From owner-freebsd-hackers@FreeBSD.ORG Tue Mar 10 22:46:47 2009 Return-Path: Delivered-To: freebsd-hackers@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 60D0F106564A for ; Tue, 10 Mar 2009 22:46:47 +0000 (UTC) (envelope-from gabor@FreeBSD.org) Received: from server.mypc.hu (server.mypc.hu [87.229.73.95]) by mx1.freebsd.org (Postfix) with ESMTP id 1B3648FC14 for ; Tue, 10 Mar 2009 22:46:47 +0000 (UTC) (envelope-from gabor@FreeBSD.org) Received: from localhost (localhost [127.0.0.1]) by server.mypc.hu (Postfix) with ESMTP id 500BC14D7FBF; Tue, 10 Mar 2009 23:46:45 +0100 (CET) X-Virus-Scanned: amavisd-new at t-hosting.hu Received: from server.mypc.hu ([127.0.0.1]) by localhost (server.mypc.hu [127.0.0.1]) (amavisd-new, port 10024) with LMTP id WpqgnLr03Kfp; Tue, 10 Mar 2009 23:46:44 +0100 (CET) Received: from [192.168.1.105] (catv-80-98-231-64.catv.broadband.hu [80.98.231.64]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (No client certificate requested) by server.mypc.hu (Postfix) with ESMTPSA id 8341E14D7FBE; Tue, 10 Mar 2009 23:46:44 +0100 (CET) Message-ID: <49B6EDD1.5070602@FreeBSD.org> Date: Tue, 10 Mar 2009 23:46:41 +0100 From: =?ISO-8859-1?Q?G=E1bor_K=F6vesd=E1n?= User-Agent: Thunderbird 2.0.0.19 (Windows/20081209) MIME-Version: 1.0 To: d@delphij.net References: <49B6DC95.9070607@FreeBSD.org> <20090310215512.GI31961@hoeg.nl> <49B6E30F.7020205@FreeBSD.org> <49B6E895.9040701@delphij.net> In-Reply-To: <49B6E895.9040701@delphij.net> Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 8bit Cc: Ed Schouten , FreeBSD Hackers Subject: Re: fgetc doubts 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, 10 Mar 2009 22:46:47 -0000 Xin LI escribió: > > Is binbuf[] an array of char or unsigned char? If it's signed char then > you may want something like ch = binbufptr[0] & 0xff I guess. > Hi, thanks, it is now satrting to work, binbuf was of signed int. But now, I've got one more of that strange character at the end of the output, while it's not really there. -- Gabor Kovesdan FreeBSD Volunteer EMAIL: gabor@FreeBSD.org .:|:. gabor@kovesdan.org WEB: http://people.FreeBSD.org/~gabor .:|:. http://kovesdan.org From owner-freebsd-hackers@FreeBSD.ORG Tue Mar 10 22:53:15 2009 Return-Path: Delivered-To: freebsd-hackers@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 7A2541065677 for ; Tue, 10 Mar 2009 22:53:15 +0000 (UTC) (envelope-from jimmy@mammothcheese.ca) Received: from smtp124.rog.mail.re2.yahoo.com (smtp124.rog.mail.re2.yahoo.com [206.190.53.29]) by mx1.freebsd.org (Postfix) with SMTP id 0ED0E8FC20 for ; Tue, 10 Mar 2009 22:53:14 +0000 (UTC) (envelope-from jimmy@mammothcheese.ca) Received: (qmail 62596 invoked from network); 10 Mar 2009 22:26:34 -0000 Received: from unknown (HELO ?72.138.160.206?) (jimmy@72.138.160.206 with plain) by smtp124.rog.mail.re2.yahoo.com with SMTP; 10 Mar 2009 22:26:34 -0000 X-YMail-OSG: gKhN.QoVM1l4_4YKpE5zfRlXIx.ck70K0Zsz2zZDaLP.efOdCojm5AgVK2lvcv4QDQ-- X-Yahoo-Newman-Property: ymail-3 Message-ID: <49B6E91A.4040604@mammothcheese.ca> Date: Tue, 10 Mar 2009 18:26:34 -0400 From: James Bailie User-Agent: Thunderbird 2.0.0.19 (X11/20090116) MIME-Version: 1.0 To: freebsd-hackers@freebsd.org References: <49B6DC95.9070607@FreeBSD.org> In-Reply-To: <49B6DC95.9070607@FreeBSD.org> Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 8bit Subject: Re: fgetc doubts X-BeenThere: freebsd-hackers@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list Reply-To: jimmy@mammothcheese.ca List-Id: Technical Discussions relating to FreeBSD List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 10 Mar 2009 22:53:15 -0000 fgetc() returns an int so that EOF may be distinguished from valid return values. Valid values are 8-bit values. EOF is a 32-bit value. EOF is a 32-bit two's-complement -1 (0xffffffff), and -1 input is 8-bit two's-complement -1 (0xff). When fgetc() casts this to an int, it becomes 0x000000ff, or 255, and thus the two values may be distinguished from each other. I haven't looked at your code, but you are probably comparing EOF with the value returned by fgetc() after it has been cast to a char. EOF is getting cast to a char implicitly in the comparison, so the comparison becomes a comparison between 0xff and 0xff. You need to test the int returned by fgetc() for EOF before assigning it to a char. Gábor Kövesdán wrote: > Hello, > > I have a problem when reading files with fgetc when a 0xff character > comes. In my code the reading stops at that point as if EOF had been > reached, but that's not actually the case. > The code is here: > http://p4web.freebsd.org/@md=d&cd=//&c=Nsd@//depot/projects/soc2008/gabor_textproc/grep/file.c?ac=64&rev1=40 > > And the problem occurs in grep_fgetln() when the buffers is being filled > in: > for (; i < bufsiz && !grep_feof(f); i++) > binbuf[i] = grep_fgetc(f); > > Thanks in advance, > -- James Bailie http://www.mammothcheese.ca From owner-freebsd-hackers@FreeBSD.ORG Tue Mar 10 22:59:18 2009 Return-Path: Delivered-To: freebsd-hackers@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id CB5C7106564A for ; Tue, 10 Mar 2009 22:59:18 +0000 (UTC) (envelope-from jimmy@mammothcheese.ca) Received: from smtp102.rog.mail.re2.yahoo.com (smtp102.rog.mail.re2.yahoo.com [206.190.36.80]) by mx1.freebsd.org (Postfix) with SMTP id 6368A8FC15 for ; Tue, 10 Mar 2009 22:59:18 +0000 (UTC) (envelope-from jimmy@mammothcheese.ca) Received: (qmail 58990 invoked from network); 10 Mar 2009 22:59:17 -0000 Received: from unknown (HELO ?72.138.160.206?) (jimmy@72.138.160.206 with plain) by smtp102.rog.mail.re2.yahoo.com with SMTP; 10 Mar 2009 22:59:17 -0000 X-YMail-OSG: ALtQFRkVM1ntaqc3G9ZtJ1BTyxmpvekSUVLn.00R1gLTWDav.xPyH05o3dy5NbCZqQ-- X-Yahoo-Newman-Property: ymail-3 Message-ID: <49B6F0C5.8050706@mammothcheese.ca> Date: Tue, 10 Mar 2009 18:59:17 -0400 From: James Bailie User-Agent: Thunderbird 2.0.0.19 (X11/20090116) MIME-Version: 1.0 To: jimmy@mammothcheese.ca References: <49B6DC95.9070607@FreeBSD.org> <49B6E91A.4040604@mammothcheese.ca> In-Reply-To: <49B6E91A.4040604@mammothcheese.ca> Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit Cc: freebsd-hackers@freebsd.org Subject: Re: fgetc doubts X-BeenThere: freebsd-hackers@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list Reply-To: jimmy@mammothcheese.ca List-Id: Technical Discussions relating to FreeBSD List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 10 Mar 2009 22:59:19 -0000 I must correct myself. It's more likely the return value of fgetc(), after having been assigned to a char, is being sign-extended when that char is compared to the in EOF, so that the comparison becomes a comparison between 0xffffffff and 0xffffffff. James Bailie wrote: > ...EOF is getting cast to a char implicitly in the comparison, so the > comparison becomes a comparison between 0xff and 0xff. -- James Bailie http://www.mammothcheese.ca From owner-freebsd-hackers@FreeBSD.ORG Tue Mar 10 23:00:22 2009 Return-Path: Delivered-To: freebsd-hackers@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id AB7991065674 for ; Tue, 10 Mar 2009 23:00:22 +0000 (UTC) (envelope-from gabor@FreeBSD.org) Received: from server.mypc.hu (server.mypc.hu [87.229.73.95]) by mx1.freebsd.org (Postfix) with ESMTP id 66A7A8FC08 for ; Tue, 10 Mar 2009 23:00:22 +0000 (UTC) (envelope-from gabor@FreeBSD.org) Received: from localhost (localhost [127.0.0.1]) by server.mypc.hu (Postfix) with ESMTP id 8DC2214D8765; Wed, 11 Mar 2009 00:00:14 +0100 (CET) X-Virus-Scanned: amavisd-new at t-hosting.hu Received: from server.mypc.hu ([127.0.0.1]) by localhost (server.mypc.hu [127.0.0.1]) (amavisd-new, port 10024) with LMTP id KgoOwai3I7Bb; Wed, 11 Mar 2009 00:00:14 +0100 (CET) Received: from [192.168.1.105] (catv-80-98-231-64.catv.broadband.hu [80.98.231.64]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (No client certificate requested) by server.mypc.hu (Postfix) with ESMTPSA id E08B014D86CB; Wed, 11 Mar 2009 00:00:13 +0100 (CET) Message-ID: <49B6F0FB.5020307@FreeBSD.org> Date: Wed, 11 Mar 2009 00:00:11 +0100 From: =?ISO-8859-1?Q?G=E1bor_K=F6vesd=E1n?= User-Agent: Thunderbird 2.0.0.19 (Windows/20081209) MIME-Version: 1.0 To: jimmy@mammothcheese.ca References: <49B6DC95.9070607@FreeBSD.org> <49B6E91A.4040604@mammothcheese.ca> In-Reply-To: <49B6E91A.4040604@mammothcheese.ca> Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 8bit Cc: freebsd-hackers@freebsd.org Subject: Re: fgetc doubts 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, 10 Mar 2009 23:00:23 -0000 James Bailie escribió: > fgetc() returns an int so that EOF may be distinguished from valid > return values. Valid values are 8-bit values. EOF is a 32-bit value. > > EOF is a 32-bit two's-complement -1 (0xffffffff), and -1 input is 8-bit > two's-complement -1 (0xff). When fgetc() casts this to an int, it > becomes 0x000000ff, or 255, and thus the two values may be distinguished > from each other. > > I haven't looked at your code, but you are probably comparing EOF with > the value returned by fgetc() after it has been cast to a char. EOF is > getting cast to a char implicitly in the comparison, so the comparison > becomes a comparison between 0xff and 0xff. You need to test the int > returned by fgetc() for EOF before assigning it to a char. Thanks, I've found all the pieces of the puzzle from the three comments and it works now. -- Gabor Kovesdan FreeBSD Volunteer EMAIL: gabor@FreeBSD.org .:|:. gabor@kovesdan.org WEB: http://people.FreeBSD.org/~gabor .:|:. http://kovesdan.org From owner-freebsd-hackers@FreeBSD.ORG Wed Mar 11 01:40:03 2009 Return-Path: Delivered-To: freebsd-hackers@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 6BAA8106566C for ; Wed, 11 Mar 2009 01:40:03 +0000 (UTC) (envelope-from doconnor@gsoft.com.au) Received: from cain.gsoft.com.au (cain.gsoft.com.au [203.31.81.10]) by mx1.freebsd.org (Postfix) with ESMTP id DE8768FC0A for ; Wed, 11 Mar 2009 01:40:02 +0000 (UTC) (envelope-from doconnor@gsoft.com.au) Received: from inchoate.localnet (Inchoate.gsoft.com.au [203.31.81.30]) (authenticated bits=0) by cain.gsoft.com.au (8.13.8/8.13.8) with ESMTP id n2B1e0Lh011080 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=NO); Wed, 11 Mar 2009 12:10:00 +1030 (CST) (envelope-from doconnor@gsoft.com.au) From: "Daniel O'Connor" To: freebsd-hackers@freebsd.org Date: Wed, 11 Mar 2009 12:09:50 +1030 User-Agent: KMail/1.10.4 (Linux/2.6.27-11-generic; KDE/4.1.4; i686; ; ) References: In-Reply-To: MIME-Version: 1.0 Content-Type: multipart/signed; boundary="nextPart1378409.BqRvBF0HU1"; protocol="application/pgp-signature"; micalg=pgp-sha1 Content-Transfer-Encoding: 7bit Message-Id: <200903111209.58753.doconnor@gsoft.com.au> X-Spam-Score: -3.977 () ALL_TRUSTED,BAYES_00 X-Scanned-By: MIMEDefang 2.63 on 203.31.81.10 Cc: pluknet , vasanth raonaik Subject: Re: Debugging init process. 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, 11 Mar 2009 01:40:03 -0000 --nextPart1378409.BqRvBF0HU1 Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: quoted-printable Content-Disposition: inline On Wednesday 11 March 2009 06:43:50 pluknet wrote: > 2009/3/10 vasanth raonaik : > > Hello Team, > > > > I need to debug init process. I am not able to attach init to gdb and it > > throws > > That is because init is a system process, which you cannot trace by design > (see ptrace(2)). Interesting, but it doesn't really help him debug it ;) Unless there is some other way around it you can stop the kernel making it = a=20 system process by editing /usr/src/sys/kern/init_main.c around line 730 (in= =20 create_init). Although some signal code seems to specialcase PID 1 so maybe that won't wo= rk=20 either.. =2D-=20 Daniel O'Connor software and network engineer for Genesis Software - http://www.gsoft.com.au "The nice thing about standards is that there are so many of them to choose from." -- Andrew Tanenbaum GPG Fingerprint - 5596 B766 97C0 0E94 4347 295E E593 DC20 7B3F CE8C --nextPart1378409.BqRvBF0HU1 Content-Type: application/pgp-signature; name=signature.asc Content-Description: This is a digitally signed message part. -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.4.9 (GNU/Linux) iD8DBQBJtxZn5ZPcIHs/zowRAn8gAJ4rq4PGa9kAzjDnnz4XxTrSCcjwEQCgnV7U +4VAQgOGqgxyY9hVfcASiUQ= =EJg/ -----END PGP SIGNATURE----- --nextPart1378409.BqRvBF0HU1-- From owner-freebsd-hackers@FreeBSD.ORG Wed Mar 11 02:02:17 2009 Return-Path: Delivered-To: freebsd-hackers@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 38E6D1065670 for ; Wed, 11 Mar 2009 02:02:17 +0000 (UTC) (envelope-from neldredge@math.ucsd.edu) Received: from euclid.ucsd.edu (euclid.ucsd.edu [132.239.145.52]) by mx1.freebsd.org (Postfix) with ESMTP id 1A9CD8FC12 for ; Wed, 11 Mar 2009 02:02:16 +0000 (UTC) (envelope-from neldredge@math.ucsd.edu) Received: from zeno.ucsd.edu (zeno.ucsd.edu [132.239.145.22]) by euclid.ucsd.edu (8.11.7p3+Sun/8.11.7) with ESMTP id n2B22Go16527; Tue, 10 Mar 2009 19:02:16 -0700 (PDT) Received: from localhost (neldredg@localhost) by zeno.ucsd.edu (8.11.7p3+Sun/8.11.7) with ESMTP id n2B22Gd16507; Tue, 10 Mar 2009 19:02:16 -0700 (PDT) X-Authentication-Warning: zeno.ucsd.edu: neldredg owned process doing -bs Date: Tue, 10 Mar 2009 19:02:16 -0700 (PDT) From: Nate Eldredge X-X-Sender: neldredg@zeno.ucsd.edu To: vasanth raonaik In-Reply-To: Message-ID: References: MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII; format=flowed Cc: freebsd-hackers@freebsd.org Subject: Re: Debugging init process. 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, 11 Mar 2009 02:02:17 -0000 On Tue, 10 Mar 2009, vasanth raonaik wrote: > Hello Team, > > I need to debug init process. I am not able to attach init to gdb and it > throws As others mentioned, this is explicitly disabled. You could re-enable it by hacking the kernel, but it could cause other unexpected problems. Alternatively, there's always "printf debugging". What is wrong with init, that you need to debug it? It's a fairly simple program that's been around for a long time and should be pretty stable. -- Nate Eldredge neldredge@math.ucsd.edu From owner-freebsd-hackers@FreeBSD.ORG Wed Mar 11 05:13:52 2009 Return-Path: Delivered-To: freebsd-hackers@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 2254F106566B for ; Wed, 11 Mar 2009 05:13:51 +0000 (UTC) (envelope-from dillon@apollo.backplane.com) Received: from apollo.backplane.com (apollo.backplane.com [216.240.41.2]) by mx1.freebsd.org (Postfix) with ESMTP id 8BC6E8FC0A for ; Wed, 11 Mar 2009 05:13:50 +0000 (UTC) (envelope-from dillon@apollo.backplane.com) Received: from apollo.backplane.com (localhost [127.0.0.1]) by apollo.backplane.com (8.14.2/8.14.1) with ESMTP id n2B52GJo008612 for ; Tue, 10 Mar 2009 22:02:16 -0700 (PDT) Received: (from dillon@localhost) by apollo.backplane.com (8.14.2/8.13.4/Submit) id n2B52Gdr008609; Tue, 10 Mar 2009 22:02:16 -0700 (PDT) Date: Tue, 10 Mar 2009 22:02:16 -0700 (PDT) From: Matthew Dillon Message-Id: <200903110502.n2B52Gdr008609@apollo.backplane.com> To: freebsd-hackers@freebsd.org References: <49A5D6FC.1090800@freebsd.org> <49A6CF27.3000203@freebsd.org> <7d6fde3d0902260924r45ebb7c8i46cd6daf43a8171d@mail.gmail.com> Subject: Re: Google SoC 2009 Idea 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, 11 Mar 2009 05:13:52 -0000 I'll put in a plug for using DragonFly's pluggable scheduler framework :-). We (DragonFly) also offer shell accounts, git integration and publishing, a virtual kernel build/run environment for doing kernel projects, and help over IRC and email. Someone with the gumption to post the idea to multiple project lists is probably going to be qualified to do the work. It would be quite hillarious to find the projects in a position to compete for SoC people. -Matt From owner-freebsd-hackers@FreeBSD.ORG Wed Mar 11 08:46:13 2009 Return-Path: Delivered-To: freebsd-hackers@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 5683110656C4 for ; Wed, 11 Mar 2009 08:46:13 +0000 (UTC) (envelope-from v.haisman@sh.cvut.cz) Received: from service1.sh.cvut.cz (service1.sh.cvut.cz [IPv6:2001:718:2::214]) by mx1.freebsd.org (Postfix) with ESMTP id D2F5E8FC19 for ; Wed, 11 Mar 2009 08:46:12 +0000 (UTC) (envelope-from v.haisman@sh.cvut.cz) Received: from localhost (localhost [127.0.0.1]) by service1.sh.cvut.cz (Postfix) with ESMTP id 1CF31123843; Wed, 11 Mar 2009 09:46:12 +0100 (CET) X-Virus-Scanned: Debian amavisd-new at service1.sh.cvut.cz X-Spam-Score: -91.135 X-Spam-Level: X-Spam-Status: No, score=-91.135 tagged_above=-255 required=5 tests=[ALL_TRUSTED=-1.44, AWL=11.116, CRM114_HAM_00=, MISSING_HEADERS=0.189, SMTPAUTH_SHDOMAIN=-100] Received: from service1.sh.cvut.cz ([127.0.0.1]) by localhost (service1.sh.cvut.cz [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id jLqw-YyIM6PF; Wed, 11 Mar 2009 09:46:04 +0100 (CET) Received: from [192.168.1.2] (35.201.broadband4.iol.cz [85.71.201.35]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (No client certificate requested) (Authenticated sender: v.haisman@sh.cvut.cz) by service1.sh.cvut.cz (Postfix) with ESMTP id 0737F12383C; Wed, 11 Mar 2009 09:46:03 +0100 (CET) Message-ID: <49B77A45.3000204@sh.cvut.cz> Date: Wed, 11 Mar 2009 09:45:57 +0100 From: =?UTF-8?B?VsOhY2xhdiBIYWlzbWFu?= User-Agent: Thunderbird 2.0.0.19 (Windows/20081209) MIME-Version: 1.0 CC: freebsd-hackers@freebsd.org References: <49B6DC95.9070607@FreeBSD.org> In-Reply-To: <49B6DC95.9070607@FreeBSD.org> X-Enigmail-Version: 0.95.7 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Subject: Re: fgetc doubts 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, 11 Mar 2009 08:46:16 -0000 Gábor Kövesdán wrote, On 10.3.2009 22:33: > Hello, > > I have a problem when reading files with fgetc when a 0xff character > comes. In my code the reading stops at that point as if EOF had been > reached, but that's not actually the case. > The code is here: > http://p4web.freebsd.org/@md=d&cd=//&c=Nsd@//depot/projects/soc2008/gabor_textproc/grep/file.c?ac=64&rev1=40 You have a bug in the grep_fgetc() function in the BZIP case. Char type is signed on FreeBSD and you are sign extending the c variable in the "return (c)" statement. The line should read "return ((unsigned char)c)", if you want to model the function using the same semantics as C99 fgetc(). > > And the problem occurs in grep_fgetln() when the buffers is being filled > in: > for (; i < bufsiz && !grep_feof(f); i++) > binbuf[i] = grep_fgetc(f); > > Thanks in advance, > -- VH From owner-freebsd-hackers@FreeBSD.ORG Wed Mar 11 08:54:16 2009 Return-Path: Delivered-To: freebsd-hackers@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 0E6721065673 for ; Wed, 11 Mar 2009 08:54:16 +0000 (UTC) (envelope-from v.haisman@sh.cvut.cz) Received: from service1.sh.cvut.cz (service1.sh.cvut.cz [IPv6:2001:718:2::214]) by mx1.freebsd.org (Postfix) with ESMTP id BAC268FC1C for ; Wed, 11 Mar 2009 08:54:15 +0000 (UTC) (envelope-from v.haisman@sh.cvut.cz) Received: from localhost (localhost [127.0.0.1]) by service1.sh.cvut.cz (Postfix) with ESMTP id BF88012382D; Wed, 11 Mar 2009 09:54:14 +0100 (CET) X-Virus-Scanned: Debian amavisd-new at service1.sh.cvut.cz X-Spam-Score: -91.192 X-Spam-Level: X-Spam-Status: No, score=-91.192 tagged_above=-255 required=5 tests=[ALL_TRUSTED=-1.44, AWL=11.059, CRM114_HAM_00=, MISSING_HEADERS=0.189, SMTPAUTH_SHDOMAIN=-100] Received: from service1.sh.cvut.cz ([127.0.0.1]) by localhost (service1.sh.cvut.cz [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id diT0t5d00KtV; Wed, 11 Mar 2009 09:54:07 +0100 (CET) Received: from [192.168.1.2] (35.201.broadband4.iol.cz [85.71.201.35]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (No client certificate requested) (Authenticated sender: v.haisman@sh.cvut.cz) by service1.sh.cvut.cz (Postfix) with ESMTP id A5AE11237A7; Wed, 11 Mar 2009 09:54:06 +0100 (CET) Message-ID: <49B77C28.9020504@sh.cvut.cz> Date: Wed, 11 Mar 2009 09:54:00 +0100 From: =?UTF-8?B?VsOhY2xhdiBIYWlzbWFu?= User-Agent: Thunderbird 2.0.0.19 (Windows/20081209) MIME-Version: 1.0 CC: freebsd-hackers@freebsd.org References: <49B6DC95.9070607@FreeBSD.org> In-Reply-To: <49B6DC95.9070607@FreeBSD.org> X-Enigmail-Version: 0.95.7 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Subject: Re: fgetc doubts 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, 11 Mar 2009 08:54:16 -0000 Gábor Kövesdán wrote, On 10.3.2009 22:33: > Hello, [...] > And the problem occurs in grep_fgetln() when the buffers is being filled > in: > for (; i < bufsiz && !grep_feof(f); i++) > binbuf[i] = grep_fgetc(f); > Also, why are you filling the buffer char by char? All of the input streams you have there support reading by chunks. -- VH From owner-freebsd-hackers@FreeBSD.ORG Wed Mar 11 07:51:50 2009 Return-Path: Delivered-To: freebsd-hackers@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 4EDC7106564A for ; Wed, 11 Mar 2009 07:51:50 +0000 (UTC) (envelope-from alexander@leidinger.net) Received: from redbull.bpaserver.net (redbullneu.bpaserver.net [213.198.78.217]) by mx1.freebsd.org (Postfix) with ESMTP id EC2DE8FC1A for ; Wed, 11 Mar 2009 07:51:49 +0000 (UTC) (envelope-from alexander@leidinger.net) Received: from outgoing.leidinger.net (pD9E2E7B0.dip.t-dialin.net [217.226.231.176]) by redbull.bpaserver.net (Postfix) with ESMTP id 7CA902E252; Wed, 11 Mar 2009 08:51:42 +0100 (CET) Received: from webmail.leidinger.net (webmail.leidinger.net [192.168.1.102]) by outgoing.leidinger.net (Postfix) with ESMTP id EBE151B6C0B; Wed, 11 Mar 2009 08:51:38 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha256; c=simple/simple; d=Leidinger.net; s=outgoing-alex; t=1236757899; bh=tllSPbzI/PUf8BIshRBG4AJwH7QQ4gQaO vwP5x4yYs4=; h=Message-ID:Date:From:To:Cc:Subject:References: In-Reply-To:MIME-Version:Content-Type:Content-Transfer-Encoding; b=X9vkWfnCRsqAV3MZ4y2MvNpYJVA9rBArmBuftEts969mzIVbd/IktQA6/lT75YyIB Gt/VVi1wyG+EnRmBqRuTfD9NbV7SRB1Fkji+ibm3BaW4S2pABpIQrVsDkx6lbdmfJ5z 3WJVqr5KZNWMKPLNwGufmdwj7JzOOwuwLlXzOGFo+X7oqYecx0dAIMamzTztYCR/c3G M/LADBRIP1HigDLz3sGFMZuvjyZ0ZlYnSworkJB6NDobqrf9E9MLta+RfwF6ngDkJXt Xdc7ZthGckk0/3zMpvHd42ON1UcP8PkioL1UgikJx3eraXZoCxsDdM4HMlg5hwcWGDo hT3+msctw== Received: (from www@localhost) by webmail.leidinger.net (8.14.3/8.13.8/Submit) id n2B7pcYk097199; Wed, 11 Mar 2009 08:51:38 +0100 (CET) (envelope-from Alexander@Leidinger.net) Received: from pslux.cec.eu.int (pslux.cec.eu.int [158.169.9.14]) by webmail.leidinger.net (Horde Framework) with HTTP; Wed, 11 Mar 2009 08:51:38 +0100 Message-ID: <20090311085138.23982deb8g8234w0@webmail.leidinger.net> X-Priority: 3 (Normal) Date: Wed, 11 Mar 2009 08:51:38 +0100 From: Alexander Leidinger To: Nate Eldredge References: In-Reply-To: MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8; DelSp="Yes"; format="flowed" Content-Disposition: inline Content-Transfer-Encoding: 7bit User-Agent: Internet Messaging Program (IMP) H3 (4.3) / FreeBSD-8.0 X-BPAnet-MailScanner-Information: Please contact the ISP for more information X-MailScanner-ID: 7CA902E252.5774B X-BPAnet-MailScanner: Found to be clean X-BPAnet-MailScanner-SpamCheck: not spam, ORDB-RBL, SpamAssassin (not cached, score=-14.9, required 6, BAYES_00 -15.00, DKIM_SIGNED 0.00, DKIM_VERIFIED -0.00, RDNS_DYNAMIC 0.10) X-BPAnet-MailScanner-From: alexander@leidinger.net X-Spam-Status: No X-Mailman-Approved-At: Wed, 11 Mar 2009 11:20:21 +0000 Cc: freebsd-hackers@freebsd.org, vasanth raonaik Subject: Re: Debugging init process. 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, 11 Mar 2009 07:51:50 -0000 Quoting Nate Eldredge (from Tue, 10 Mar 2009 19:02:16 -0700 (PDT)): > On Tue, 10 Mar 2009, vasanth raonaik wrote: > >> Hello Team, >> >> I need to debug init process. I am not able to attach init to gdb and it >> throws > > As others mentioned, this is explicitly disabled. You could > re-enable it by hacking the kernel, but it could cause other > unexpected problems. > > Alternatively, there's always "printf debugging". > > What is wrong with init, that you need to debug it? It's a fairly > simple program that's been around for a long time and should be > pretty stable. If this is on -current and depending on the problem, dtrace may be an option (I don't know if it special-cases init or not). Bye, Alexander. -- Don't interfere with the stranger's style. http://www.Leidinger.net Alexander @ Leidinger.net: PGP ID = B0063FE7 http://www.FreeBSD.org netchild @ FreeBSD.org : PGP ID = 72077137 From owner-freebsd-hackers@FreeBSD.ORG Wed Mar 11 13:05:58 2009 Return-Path: Delivered-To: freebsd-hackers@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id D7EF510656E4 for ; Wed, 11 Mar 2009 13:05:58 +0000 (UTC) (envelope-from ed@hoeg.nl) Received: from palm.hoeg.nl (mx0.hoeg.nl [IPv6:2001:7b8:613:100::211]) by mx1.freebsd.org (Postfix) with ESMTP id 73CF38FC13 for ; Wed, 11 Mar 2009 13:05:58 +0000 (UTC) (envelope-from ed@hoeg.nl) Received: by palm.hoeg.nl (Postfix, from userid 1000) id 798A61CE0D; Wed, 11 Mar 2009 14:05:57 +0100 (CET) Date: Wed, 11 Mar 2009 14:05:57 +0100 From: Ed Schouten To: Mel Message-ID: <20090311130557.GJ31961@hoeg.nl> References: <200902251724.40212.fbsd.hackers@rachie.is-a-geek.net> MIME-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha1; protocol="application/pgp-signature"; boundary="cyV/sMl4KAhiehtf" Content-Disposition: inline In-Reply-To: <200902251724.40212.fbsd.hackers@rachie.is-a-geek.net> User-Agent: Mutt/1.5.19 (2009-01-05) Cc: FreeBSD Hackers Subject: Re: [PATCH] Support for thresholds in du(1) 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, 11 Mar 2009 13:05:59 -0000 --cyV/sMl4KAhiehtf Content-Type: text/plain; charset=us-ascii Content-Disposition: inline Content-Transfer-Encoding: quoted-printable * Mel wrote: > Example usage: > # du -xht 20m . > 29M ./contrib/binutils > 52M ./contrib/gcc > 237M ./contrib > 35M ./crypto > 28M ./lib > 20M ./share > 55M ./sys/dev > 139M ./sys > 545M . Ooh! That looks awesome! --=20 Ed Schouten WWW: http://80386.nl/ --cyV/sMl4KAhiehtf Content-Type: application/pgp-signature Content-Disposition: inline -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.4.9 (FreeBSD) iEYEARECAAYFAkm3tzUACgkQ52SDGA2eCwXklQCcDAyGXCHVxe+Yg5nTq0XSzm07 g3YAnjgHchTsJTPGSRSbu78Af/Oc6Ocm =mQVM -----END PGP SIGNATURE----- --cyV/sMl4KAhiehtf-- From owner-freebsd-hackers@FreeBSD.ORG Wed Mar 11 13:13:34 2009 Return-Path: Delivered-To: freebsd-hackers@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 9C1F810656CF for ; Wed, 11 Mar 2009 13:13:34 +0000 (UTC) (envelope-from rwatson@FreeBSD.org) Received: from cyrus.watson.org (cyrus.watson.org [65.122.17.42]) by mx1.freebsd.org (Postfix) with ESMTP id 760698FC31 for ; Wed, 11 Mar 2009 13:13:34 +0000 (UTC) (envelope-from rwatson@FreeBSD.org) Received: from fledge.watson.org (fledge.watson.org [65.122.17.41]) by cyrus.watson.org (Postfix) with ESMTPS id 1E13546B1A; Wed, 11 Mar 2009 09:13:34 -0400 (EDT) Date: Wed, 11 Mar 2009 13:13:34 +0000 (GMT) From: Robert Watson X-X-Sender: robert@fledge.watson.org To: Nate Eldredge In-Reply-To: Message-ID: References: User-Agent: Alpine 2.00 (BSF 1167 2008-08-23) MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII; format=flowed Cc: freebsd-hackers@freebsd.org, vasanth raonaik Subject: Re: Debugging init process. 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, 11 Mar 2009 13:13:35 -0000 On Tue, 10 Mar 2009, Nate Eldredge wrote: > On Tue, 10 Mar 2009, vasanth raonaik wrote: > >> I need to debug init process. I am not able to attach init to gdb and it >> throws > > As others mentioned, this is explicitly disabled. You could re-enable it by > hacking the kernel, but it could cause other unexpected problems. > > Alternatively, there's always "printf debugging". > > What is wrong with init, that you need to debug it? It's a fairly simple > program that's been around for a long time and should be pretty stable. One specific concern with debugging init is that the ptracing application will intercept all signals destined for the target application, and since signals are used to manage the system run cycle, and init becomes the parent of orphaned processes, this could lead to unexpected side effects. Also, if init exits, your system will panic :-). Last time I mucked with init, I found the best ways to debug it were: (1) Provide a LD_PRELOAD for libc that replaces getpid(), getppid(), and other things to return pid 1. (2) Run init in a jail so that if it exits, the box won't panic. (3) Use tools like ktrace on the actual init, combined with utrace() instrumentation of init so you can track its behavior "in the wild" FYI, if you do want to clear P_SYSTM, one easy way to do that is to attach kgdb to /dev/mem, and directly manipulate the flags on initproc. This comes with some risks, of course. :-) Robert N M Watson Computer Laboratory University of Cambridge From owner-freebsd-hackers@FreeBSD.ORG Wed Mar 11 13:38:42 2009 Return-Path: Delivered-To: freebsd-hackers@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 38CB8106566C for ; Wed, 11 Mar 2009 13:38:42 +0000 (UTC) (envelope-from pluknet@gmail.com) Received: from mail-fx0-f158.google.com (mail-fx0-f158.google.com [209.85.220.158]) by mx1.freebsd.org (Postfix) with ESMTP id BDED28FC08 for ; Wed, 11 Mar 2009 13:38:41 +0000 (UTC) (envelope-from pluknet@gmail.com) Received: by fxm2 with SMTP id 2so5681fxm.43 for ; Wed, 11 Mar 2009 06:38:40 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:mime-version:received:in-reply-to:references :date:message-id:subject:from:to:content-type :content-transfer-encoding; bh=DXKWCBW+vCM4/JPU0iSjTnjBshObrugDwuP/wb9mZ6Y=; b=sEQ1+bcssnSicZMpTQiLeWfkMtovzbPqdeG70KXITS7kXCxfuC2spyeDGR9wEL3c7Q DtWcbmtrogZYU83xU5YR0A7eSdlJxFNx+bDUEIZNBYd8LH0pJMzGzsIpgFSbaWGH+Uf5 QXzxkBwrWFmi0qO/V0KZJfDpurNddu3PD89TQ= DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=mime-version:in-reply-to:references:date:message-id:subject:from:to :content-type:content-transfer-encoding; b=gN+rflTt/5gyx31us+oO9KYw7pwTWVOtFW1Sql22rMJ4HCNbZLRahe6zN3WkG19L7L 5tic3AaDxNB/pYDFIa17ET/KFxuBv1P89I91ZJ0uL2eTScPXXG0RFZmoV6vFhHeM4m+A wzd+2ZpP3++dxKREzF5lh2T7EIxUTiB6t/Veg= MIME-Version: 1.0 Received: by 10.86.74.4 with SMTP id w4mr5995895fga.21.1236778719720; Wed, 11 Mar 2009 06:38:39 -0700 (PDT) In-Reply-To: References: Date: Wed, 11 Mar 2009 16:38:39 +0300 Message-ID: From: pluknet To: freebsd-hackers@freebsd.org Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: quoted-printable Subject: Non-existing p_vmspace. When is it possible? 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, 11 Mar 2009 13:38:42 -0000 Hi. I perform in FOREACH_PROC_IN_SYSTEM(), where I conditionally look at p_vmspace internals. I'd like to know the safe way to reference p_vmspace fields without potential null-dereference. I see an example in vm_pageout_oom(), where making access to p->p_vmspace fields is done without additional checks. Nevertheless I want to further catch on how it works. Currently I additionally explicitly check on P_SYSTEM and PRS_NEW, then p->p_vmspace against NULL. So I'd wish to understand if a time-window between 1) placing a new process to proclist =A0and 2) attaching vmspace to this process is possible at all, and then in what cases. I see in fork1() that a new process' (named p2 here) state is set to PRS_NEW just before LIST_INSERT_HEAD(&allproc, p2, p_list) and then (after vmspace is already attached in vm_forkproc()) is set to PRS_NORMAL. So an additional check on p_vmspace !=3D NULL is not need. Am I right? Thanks. --=20 wbr, pluknet From owner-freebsd-hackers@FreeBSD.ORG Wed Mar 11 14:38:40 2009 Return-Path: Delivered-To: freebsd-hackers@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 36634106566C for ; Wed, 11 Mar 2009 14:38:40 +0000 (UTC) (envelope-from kostikbel@gmail.com) Received: from mail.terabit.net.ua (mail.terabit.net.ua [195.137.202.147]) by mx1.freebsd.org (Postfix) with ESMTP id CD0CB8FC0C for ; Wed, 11 Mar 2009 14:38:39 +0000 (UTC) (envelope-from kostikbel@gmail.com) Received: from skuns.zoral.com.ua ([91.193.166.194] helo=mail.zoral.com.ua) by mail.terabit.net.ua with esmtps (TLSv1:AES256-SHA:256) (Exim 4.63 (FreeBSD)) (envelope-from ) id 1LhPZu-000N7s-3O; Wed, 11 Mar 2009 16:38:38 +0200 Received: from deviant.kiev.zoral.com.ua (root@deviant.kiev.zoral.com.ua [10.1.1.148]) by mail.zoral.com.ua (8.14.2/8.14.2) with ESMTP id n2BEcULU002094 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=NO); Wed, 11 Mar 2009 16:38:30 +0200 (EET) (envelope-from kostikbel@gmail.com) Received: from deviant.kiev.zoral.com.ua (kostik@localhost [127.0.0.1]) by deviant.kiev.zoral.com.ua (8.14.3/8.14.3) with ESMTP id n2BEcUe9015166; Wed, 11 Mar 2009 16:38:30 +0200 (EET) (envelope-from kostikbel@gmail.com) Received: (from kostik@localhost) by deviant.kiev.zoral.com.ua (8.14.3/8.14.3/Submit) id n2BEcUej015165; Wed, 11 Mar 2009 16:38:30 +0200 (EET) (envelope-from kostikbel@gmail.com) X-Authentication-Warning: deviant.kiev.zoral.com.ua: kostik set sender to kostikbel@gmail.com using -f Date: Wed, 11 Mar 2009 16:38:30 +0200 From: Kostik Belousov To: pluknet Message-ID: <20090311143830.GJ41617@deviant.kiev.zoral.com.ua> References: Mime-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha1; protocol="application/pgp-signature"; boundary="jlzMyYUOO8BCbMOc" Content-Disposition: inline In-Reply-To: User-Agent: Mutt/1.4.2.3i X-Virus-Scanned: ClamAV version 0.94.2, clamav-milter version 0.94.2 on skuns.kiev.zoral.com.ua X-Virus-Status: Clean X-Spam-Status: No, score=-4.4 required=5.0 tests=ALL_TRUSTED,AWL,BAYES_00 autolearn=ham version=3.2.5 X-Spam-Checker-Version: SpamAssassin 3.2.5 (2008-06-10) on skuns.kiev.zoral.com.ua X-Virus-Scanned: mail.terabit.net.ua 1LhPZu-000N7s-3O a65ca15d9dad767a3ca1ffc160bf96a9 X-Terabit: YES Cc: freebsd-hackers@freebsd.org Subject: Re: Non-existing p_vmspace. When is it possible? 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, 11 Mar 2009 14:38:40 -0000 --jlzMyYUOO8BCbMOc Content-Type: text/plain; charset=koi8-r Content-Disposition: inline Content-Transfer-Encoding: quoted-printable On Wed, Mar 11, 2009 at 04:38:39PM +0300, pluknet wrote: > Hi. >=20 > I perform in FOREACH_PROC_IN_SYSTEM(), where I conditionally > look at p_vmspace internals. I'd like to know the safe way to > reference p_vmspace fields without potential null-dereference. >=20 > I see an example in vm_pageout_oom(), where making access to > p->p_vmspace fields is done without additional checks. > Nevertheless I want to further catch on how it works. >=20 > Currently I additionally explicitly check on P_SYSTEM and PRS_NEW, > then p->p_vmspace against NULL. >=20 > So I'd wish to understand if a time-window between > 1) placing a new process to proclist > =9Aand > 2) attaching vmspace to this process > is possible at all, and then in what cases. >=20 > I see in fork1() that a new process' (named p2 here) state is set to > PRS_NEW just before LIST_INSERT_HEAD(&allproc, p2, p_list) and then > (after vmspace is already attached in vm_forkproc()) is set to PRS_NORMAL. >=20 > So an additional check on p_vmspace !=3D NULL is not need. > Am I right? The canonical sequence of doing this is, assuming p is a held pointer to a process: vm =3D vmspace_acquire_ref(p); if (vm =3D=3D NULL) { PRELE(p); return ?; } use vm; vmspace_free(vm); Look around the tree for the vmspace_acquire_ref usage. --jlzMyYUOO8BCbMOc Content-Type: application/pgp-signature Content-Disposition: inline -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.4.9 (FreeBSD) iEYEARECAAYFAkm3zOUACgkQC3+MBN1Mb4hfJACfWipoAwAy+EovspIQAF/z+Z+e iGQAn3VAiyQVG0d58CX1rgKdgmCQAC6f =d3Nx -----END PGP SIGNATURE----- --jlzMyYUOO8BCbMOc-- From owner-freebsd-hackers@FreeBSD.ORG Wed Mar 11 15:16:39 2009 Return-Path: Delivered-To: freebsd-hackers@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 5939B1065690 for ; Wed, 11 Mar 2009 15:16:39 +0000 (UTC) (envelope-from marius@nuenneri.ch) Received: from mail-fx0-f158.google.com (mail-fx0-f158.google.com [209.85.220.158]) by mx1.freebsd.org (Postfix) with ESMTP id DEDAC8FC24 for ; Wed, 11 Mar 2009 15:16:38 +0000 (UTC) (envelope-from marius@nuenneri.ch) Received: by fxm2 with SMTP id 2so41477fxm.43 for ; Wed, 11 Mar 2009 08:16:37 -0700 (PDT) MIME-Version: 1.0 Received: by 10.86.51.10 with SMTP id y10mr6049396fgy.9.1236783284206; Wed, 11 Mar 2009 07:54:44 -0700 (PDT) In-Reply-To: <20090311085138.23982deb8g8234w0@webmail.leidinger.net> References: <20090311085138.23982deb8g8234w0@webmail.leidinger.net> Date: Wed, 11 Mar 2009 15:54:44 +0100 Message-ID: From: =?ISO-8859-1?Q?Marius_N=FCnnerich?= To: Alexander Leidinger Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: quoted-printable Cc: Nate Eldredge , freebsd-hackers@freebsd.org, vasanth raonaik Subject: Re: Debugging init process. 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, 11 Mar 2009 15:16:44 -0000 On Wed, Mar 11, 2009 at 08:51, Alexander Leidinger wrote: > Quoting Nate Eldredge (from Tue, 10 Mar 2009 > 19:02:16 -0700 (PDT)): > >> On Tue, 10 Mar 2009, vasanth raonaik wrote: >> >>> Hello Team, >>> >>> I need to debug init process. I am not able to attach init to gdb and i= t >>> throws >> >> As others mentioned, this is explicitly disabled. =A0You could re-enable= it >> by hacking the kernel, but it could cause other unexpected problems. >> >> Alternatively, there's always "printf debugging". >> >> What is wrong with init, that you need to debug it? =A0It's a fairly sim= ple >> program that's been around for a long time and should be pretty stable. > > If this is on -current and depending on the problem, dtrace may be an opt= ion > (I don't know if it special-cases init or not). > DTrace is not available for userland processes yet. From owner-freebsd-hackers@FreeBSD.ORG Thu Mar 12 10:54:04 2009 Return-Path: Delivered-To: freebsd-hackers@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 5EDBB106567B for ; Thu, 12 Mar 2009 10:54:04 +0000 (UTC) (envelope-from tijl@ulyssis.org) Received: from mailrelay011.isp.belgacom.be (mailrelay011.isp.belgacom.be [195.238.6.178]) by mx1.freebsd.org (Postfix) with ESMTP id EDA858FC20 for ; Thu, 12 Mar 2009 10:54:03 +0000 (UTC) (envelope-from tijl@ulyssis.org) X-Belgacom-Dynamic: yes X-IronPort-Anti-Spam-Filtered: true X-IronPort-Anti-Spam-Result: AkIFACp/uElR9Nhz/2dsb2JhbACBTtB6hA0G Received: from 115.216-244-81.adsl-dyn.isp.belgacom.be (HELO kalimero.kotnet.org) ([81.244.216.115]) by relay.skynet.be with ESMTP; 12 Mar 2009 11:24:34 +0100 Received: from kalimero.kotnet.org (kalimero.kotnet.org [127.0.0.1]) by kalimero.kotnet.org (8.14.3/8.14.3) with ESMTP id n2CAOXiv001909; Thu, 12 Mar 2009 11:24:33 +0100 (CET) (envelope-from tijl@ulyssis.org) From: Tijl Coosemans To: freebsd-hackers@freebsd.org Date: Thu, 12 Mar 2009 11:24:32 +0100 User-Agent: KMail/1.9.10 References: <200903041938.n24Jcqdr060153@lurza.secnetix.de> <49AF9381.50709@FreeBSD.org> <49B04281.2030406@gmx.net> In-Reply-To: <49B04281.2030406@gmx.net> MIME-Version: 1.0 Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: 7bit Content-Disposition: inline Message-Id: <200903121124.33358.tijl@ulyssis.org> Cc: octavian.covalschi@gmail.com, Alexander Motin , Daniel Thiele Subject: Re: Spin down HDD after disk sync or before power off 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, 12 Mar 2009 10:54:04 -0000 On Thursday 05 March 2009 22:22:09 Daniel Thiele wrote: > Looking at the numbers in the Hitachi drive specifications Tobias an I > dug out from the Hitachi website (see replies in the Joerg Sonnenberger > branch of this thread) the normal Load/Unload count is about 30 times > higher than the Emergency Unload count. So even if an > ATA_STANDBY_IMMEDIATE command may introduce additional Load/Unload > stress on reboot it is not as bad as the stress causes by an Emergency > Unload on shutdown. Of course this only applies if the "click" sound is > really caused by an Emergency Unload. Is there a way to figure out? > Maybe the S.M.A.R.T. feature records the two kinds of power-offs. Emergency Unload is called Power-Off_Retract_Count in SMART output. From owner-freebsd-hackers@FreeBSD.ORG Thu Mar 12 11:30:23 2009 Return-Path: Delivered-To: freebsd-hackers@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id CA2DE1065673 for ; Thu, 12 Mar 2009 11:30:23 +0000 (UTC) (envelope-from tijl@ulyssis.org) Received: from mailrelay011.isp.belgacom.be (mailrelay011.isp.belgacom.be [195.238.6.178]) by mx1.freebsd.org (Postfix) with ESMTP id 66F7B8FC17 for ; Thu, 12 Mar 2009 11:30:23 +0000 (UTC) (envelope-from tijl@ulyssis.org) X-Belgacom-Dynamic: yes X-IronPort-Anti-Spam-Filtered: true X-IronPort-Anti-Spam-Result: AkIFAI6PuElR9Nhz/2dsb2JhbACBTtE7hA0G Received: from 115.216-244-81.adsl-dyn.isp.belgacom.be (HELO kalimero.kotnet.org) ([81.244.216.115]) by relay.skynet.be with ESMTP; 12 Mar 2009 12:30:21 +0100 Received: from kalimero.kotnet.org (kalimero.kotnet.org [127.0.0.1]) by kalimero.kotnet.org (8.14.3/8.14.3) with ESMTP id n2CBUHUU002395; Thu, 12 Mar 2009 12:30:17 +0100 (CET) (envelope-from tijl@ulyssis.org) From: Tijl Coosemans To: freebsd-hackers@freebsd.org Date: Thu, 12 Mar 2009 12:30:15 +0100 User-Agent: KMail/1.9.10 References: <200903050758.n257wod8088426@lurza.secnetix.de> <49B02211.1010809@abitos.org> In-Reply-To: <49B02211.1010809@abitos.org> MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Content-Disposition: inline Message-Id: <200903121230.17041.tijl@ulyssis.org> Cc: Tobias Blersch , Oliver Fromme Subject: Re: Spin down HDD after disk sync or before power off 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, 12 Mar 2009 11:30:24 -0000 On Thursday 05 March 2009 20:03:45 Tobias Blersch wrote: > http://www.hitachigst.com/tech/techlib.nsf/techdocs/28DCCB17E0EEC5A086256= =464E006E2F5B >=20 > Thats the specification for my notebooks hard drive. Section 6.6 > Reliability gives data about how to power-off the disk. It also > contains numbers of supported load/unloads and emergency unloads. > Emergency unloads are invoked when the heads are still loaded and > power fails. Quoting that document: 10.4.1 Emergency unload (...) Emergency unload is intended to be invoked in rare situations. Because this operation is inherently uncontrolled, it is more mechanically stressful than a normal unload. A single emergency unload operation is more stressful than 100 normal unloads. Use of emergency unload reduces the start/stop life of the HDD at a rate at least 100X faster than that of normal unload, and may damage the HDD. 10.4.2 Required power-off sequence (...) You may then turn off the HDD in the following order: =E2=80=A2 Issue Standby Immediate or sleep command. =E2=80=A2 Wait until COMMAND COMPLETE STATUS is returned. (It may take up= to 350ms in typical case). =E2=80=A2 Terminate power to HDD. This power-down sequence should be followed for entry into any system power-down state, or system suspend state, or system hibernation state. In a robustly designed system, emergency unload is limited to rare scenarios such as battery removal during operation. From owner-freebsd-hackers@FreeBSD.ORG Thu Mar 12 10:42:09 2009 Return-Path: Delivered-To: freebsd-hackers@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 1410210656C6 for ; Thu, 12 Mar 2009 10:42:09 +0000 (UTC) (envelope-from alexander@leidinger.net) Received: from redbull.bpaserver.net (redbullneu.bpaserver.net [213.198.78.217]) by mx1.freebsd.org (Postfix) with ESMTP id 989A08FC1C for ; Thu, 12 Mar 2009 10:42:08 +0000 (UTC) (envelope-from alexander@leidinger.net) Received: from outgoing.leidinger.net (pD9E2E424.dip.t-dialin.net [217.226.228.36]) by redbull.bpaserver.net (Postfix) with ESMTP id 5F0B12E0F8; Thu, 12 Mar 2009 11:41:59 +0100 (CET) Received: from webmail.leidinger.net (webmail.leidinger.net [192.168.1.102]) by outgoing.leidinger.net (Postfix) with ESMTP id 344C7127A80; Thu, 12 Mar 2009 11:41:56 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha256; c=simple/simple; d=Leidinger.net; s=outgoing-alex; t=1236854516; bh=fcmh2ZtaEeNqjTw7J0y8Y+9UrqEzP9s2G zcoghszKwA=; h=Message-ID:Date:From:To:Cc:Subject:References: In-Reply-To:MIME-Version:Content-Type:Content-Transfer-Encoding; b=Dtz02AaO+DZRC7sr7nSGAu5UgZ9fz3gbVHYNs08QnTE1LIVEq23A3oSanBggYqU2K g+5dVyAh4O4U1qbsXcABbKbretfQX+cudD0vJ4Z3J5OqYCvBUCrry3pQJ7mqR6KhwL8 y21Uj8j7sVSw74hHyqvRA+yRd5Vv3u318eTiZsOYPVxsDd8RVAxLOAH7AGoG+sTKkv4 zleqLzw1uxL/OJArinrjSrwjC4DbKeSmHF7NHGtBku5vy58aeF2X3/+OW7hPOzb/gZV 1xUs+Dm5SfmzSIGUslq9g1Y+GoYeiXNQTuI9J52Qz/v2cRTTwhdw4apD/YzlMc2TojA dtzV0wxOQ== Received: (from www@localhost) by webmail.leidinger.net (8.14.3/8.13.8/Submit) id n2CAftf9008498; Thu, 12 Mar 2009 11:41:55 +0100 (CET) (envelope-from Alexander@Leidinger.net) Received: from pslux.cec.eu.int (pslux.cec.eu.int [158.169.9.14]) by webmail.leidinger.net (Horde Framework) with HTTP; Thu, 12 Mar 2009 11:41:55 +0100 Message-ID: <20090312114155.19306tatpgd1ebk0@webmail.leidinger.net> X-Priority: 3 (Normal) Date: Thu, 12 Mar 2009 11:41:55 +0100 From: Alexander Leidinger To: Marius =?utf-8?b?TsO8bm5lcmljaA==?= References: <20090311085138.23982deb8g8234w0@webmail.leidinger.net> In-Reply-To: MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8; DelSp="Yes"; format="flowed" Content-Disposition: inline Content-Transfer-Encoding: quoted-printable User-Agent: Internet Messaging Program (IMP) H3 (4.3) / FreeBSD-8.0 X-BPAnet-MailScanner-Information: Please contact the ISP for more information X-MailScanner-ID: 5F0B12E0F8.D3011 X-BPAnet-MailScanner: Found to be clean X-BPAnet-MailScanner-SpamCheck: not spam, ORDB-RBL, SpamAssassin (not cached, score=-13.204, required 6, BAYES_00 -15.00, DKIM_SIGNED 0.00, DKIM_VERIFIED -0.00, MIME_8BIT_HEADER 0.30, MIME_QP_LONG_LINE 1.40, RDNS_DYNAMIC 0.10) X-BPAnet-MailScanner-From: alexander@leidinger.net X-Spam-Status: No X-Mailman-Approved-At: Thu, 12 Mar 2009 11:35:54 +0000 Cc: Nate Eldredge , freebsd-hackers@freebsd.org, vasanth raonaik Subject: Re: Debugging init process. 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, 12 Mar 2009 10:42:10 -0000 Quoting Marius N=C3=BCnnerich (from Wed, 11 Mar 2009 = =20 15:54:44 +0100): > On Wed, Mar 11, 2009 at 08:51, Alexander Leidinger > wrote: >> Quoting Nate Eldredge (from Tue, 10 Mar 2009 >> 19:02:16 -0700 (PDT)): >> >>> On Tue, 10 Mar 2009, vasanth raonaik wrote: >>> >>>> Hello Team, >>>> >>>> I need to debug init process. I am not able to attach init to gdb and i= t >>>> throws >>> >>> As others mentioned, this is explicitly disabled. =C2=A0You could re-ena= ble it >>> by hacking the kernel, but it could cause other unexpected problems. >>> >>> Alternatively, there's always "printf debugging". >>> >>> What is wrong with init, that you need to debug it? =C2=A0It's a fairly = simple >>> program that's been around for a long time and should be pretty stable. >> >> If this is on -current and depending on the problem, dtrace may be an opt= ion >> (I don't know if it special-cases init or not). >> > > DTrace is not available for userland processes yet. Depending on what is needed (it may not be needed to attach gdb, it =20 may be sufficient to have something like ktrace, the OP didn't specify =20 the problem), DTrace may suit the needs. Bye, Alexander. --=20 Your true value depends entirely on what you are compared with. http://www.Leidinger.net Alexander @ Leidinger.net: PGP ID =3D B0063FE7 http://www.FreeBSD.org netchild @ FreeBSD.org : PGP ID =3D 72077137 From owner-freebsd-hackers@FreeBSD.ORG Thu Mar 12 16:57:57 2009 Return-Path: Delivered-To: freebsd-hackers@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 66A5E1065675 for ; Thu, 12 Mar 2009 16:57:57 +0000 (UTC) (envelope-from lavalamp@spiritual-machines.org) Received: from mx04.pub.collaborativefusion.com (mx04.pub.collaborativefusion.com [206.210.72.84]) by mx1.freebsd.org (Postfix) with ESMTP id 312F58FC12 for ; Thu, 12 Mar 2009 16:57:56 +0000 (UTC) (envelope-from lavalamp@spiritual-machines.org) Received: from [192.168.2.161] ([206.210.89.202]) by mx04.pub.collaborativefusion.com (StrongMail Enterprise 4.1.1.4(4.1.1.4-47689)); Thu, 12 Mar 2009 12:57:56 -0400 X-VirtualServerGroup: Default X-MailingID: 00000::00000::00000::00000::::5 X-SMHeaderMap: mid="X-MailingID" X-Destination-ID: freebsd-hackers@freebsd.org X-SMFBL: ZnJlZWJzZC1oYWNrZXJzQGZyZWVic2Qub3Jn From: "Brian A. Seklecki" To: freebsd-hackers@freebsd.org, pgsql-performance@postgresql.org In-Reply-To: <1235404207.31655.2085.camel@soundwave.ws.pitbpa0.priv.collaborativefusion.com> References: <1235404207.31655.2085.camel@soundwave.ws.pitbpa0.priv.collaborativefusion.com> Content-Type: text/plain Date: Thu, 12 Mar 2009 12:57:56 -0400 Message-Id: <1236877076.15167.3946.camel@soundwave.ws.pitbpa0.priv.collaborativefusion.com> Mime-Version: 1.0 X-Mailer: Evolution 2.24.5 (2.24.5-1.fc10) Content-Transfer-Encoding: 7bit X-Mailman-Approved-At: Thu, 12 Mar 2009 17:19:55 +0000 Cc: spolyack@gmail.com, wmoran Subject: Re: shmmax tops out at 2G? 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, 12 Mar 2009 16:57:58 -0000 Thanks to all; with the r1.114 changes, our staff reports the following: "Postgres is able to start with a ~3GB postgresql.conf(5) $shared_buffer on 8-CURRENT/amd64: PID USERNAME THR PRI NICE SIZE RES STATE TIME WCPU COMMAND 1036 pgsql 1 44 0 3013M 79296K select 0:00 0.00% postgres kern.ipc.shmall: 786432 kern.ipc.shmmax: 3221225472 FreeBSD db0X 8.0-CURRENT FreeBSD 8.0-CURRENT #0: Thu Mar 12 09:38:36 EDT 2009 foo@db02:/usr/obj/usr/src/sys/GENERIC amd64 ~BAS On Mon, 2009-02-23 at 10:50 -0500, Brian A. Seklecki wrote: > > On Wed, 2006-Dec-13 10:50:21 -0500, Bill Moran wrote: > > >In response to Bill Moran : > > >> sysctl kern.ipc.shmmax=2200000000 > > >> kern.ipc.shmmax: 2100000000 -> -2094967296 > > Someone was nice enough to file a PR related to this: > > http://www.freebsd.org/cgi/query-pr.cgi?pr=kern/130274 > > We'd be happy to sponsor development in -current to address this > limitation. ~BAS From owner-freebsd-hackers@FreeBSD.ORG Fri Mar 13 09:50:15 2009 Return-Path: Delivered-To: freebsd-hackers@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 654EE1065673 for ; Fri, 13 Mar 2009 09:50:15 +0000 (UTC) (envelope-from freebsd-hackers@m.gmane.org) Received: from ciao.gmane.org (main.gmane.org [80.91.229.2]) by mx1.freebsd.org (Postfix) with ESMTP id E057B8FC13 for ; Fri, 13 Mar 2009 09:50:14 +0000 (UTC) (envelope-from freebsd-hackers@m.gmane.org) Received: from list by ciao.gmane.org with local (Exim 4.43) id 1Li41u-0004FC-6X for freebsd-hackers@freebsd.org; Fri, 13 Mar 2009 09:50:14 +0000 Received: from lara.cc.fer.hr ([161.53.72.113]) by main.gmane.org with esmtp (Gmexim 0.1 (Debian)) id 1AlnuQ-0007hv-00 for ; Fri, 13 Mar 2009 09:50:14 +0000 Received: from ivoras by lara.cc.fer.hr with local (Gmexim 0.1 (Debian)) id 1AlnuQ-0007hv-00 for ; Fri, 13 Mar 2009 09:50:14 +0000 X-Injected-Via-Gmane: http://gmane.org/ To: freebsd-hackers@freebsd.org From: Ivan Voras Date: Fri, 13 Mar 2009 10:49:33 +0100 Lines: 66 Message-ID: References: <1235404207.31655.2085.camel@soundwave.ws.pitbpa0.priv.collaborativefusion.com> <1236877076.15167.3946.camel@soundwave.ws.pitbpa0.priv.collaborativefusion.com> Mime-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha1; protocol="application/pgp-signature"; boundary="------------enig5E130D256A022E62CFDB41AE" X-Complaints-To: usenet@ger.gmane.org X-Gmane-NNTP-Posting-Host: lara.cc.fer.hr User-Agent: Thunderbird 2.0.0.19 (X11/20090105) In-Reply-To: <1236877076.15167.3946.camel@soundwave.ws.pitbpa0.priv.collaborativefusion.com> X-Enigmail-Version: 0.95.0 Sender: news Cc: pgsql-performance@postgresql.org Subject: Re: shmmax tops out at 2G? 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, 13 Mar 2009 09:50:15 -0000 This is an OpenPGP/MIME signed message (RFC 2440 and 3156) --------------enig5E130D256A022E62CFDB41AE Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: quoted-printable Brian A. Seklecki wrote: > Thanks to all; with the r1.114 changes, our staff reports the following= : >=20 > "Postgres is able to start with a ~3GB postgresql.conf(5) $shared_buffe= r > on 8-CURRENT/amd64: It has recently also been MFC-ed to 7-STABLE :) (beware of instabilities and debugging in -CURRENT!) > PID USERNAME THR PRI NICE SIZE RES STATE TIME WCPU COMMAND > 1036 pgsql 1 44 0 3013M 79296K select 0:00 0.00% postgre= s >=20 > kern.ipc.shmall: 786432 > kern.ipc.shmmax: 3221225472 >=20 > FreeBSD db0X 8.0-CURRENT FreeBSD 8.0-CURRENT #0: Thu Mar 12 09:38:36 ED= T > 2009 foo@db02:/usr/obj/usr/src/sys/GENERIC amd64 >=20 > ~BAS >=20 > On Mon, 2009-02-23 at 10:50 -0500, Brian A. Seklecki wrote: >>> On Wed, 2006-Dec-13 10:50:21 -0500, Bill Moran wrote: >>>> In response to Bill Moran : >>>>> sysctl kern.ipc.shmmax=3D2200000000 >>>>> kern.ipc.shmmax: 2100000000 -> -2094967296 >> Someone was nice enough to file a PR related to this: >> >> http://www.freebsd.org/cgi/query-pr.cgi?pr=3Dkern/130274 >> >> We'd be happy to sponsor development in -current to address this >> limitation. ~BAS >=20 >=20 > _______________________________________________ > freebsd-hackers@freebsd.org mailing list > http://lists.freebsd.org/mailman/listinfo/freebsd-hackers > To unsubscribe, send any mail to "freebsd-hackers-unsubscribe@freebsd.o= rg" >=20 --------------enig5E130D256A022E62CFDB41AE Content-Type: application/pgp-signature; name="signature.asc" Content-Description: OpenPGP digital signature Content-Disposition: attachment; filename="signature.asc" -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.4.6 (GNU/Linux) Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org iD8DBQFJuiw0ldnAQVacBcgRAkDrAKCRB9SD6WCBdARZrEATnVlTis2WxQCgoV7y WAddILKictTEFimgVr077ZM= =b2OD -----END PGP SIGNATURE----- --------------enig5E130D256A022E62CFDB41AE-- From owner-freebsd-hackers@FreeBSD.ORG Fri Mar 13 12:52:50 2009 Return-Path: Delivered-To: freebsd-hackers@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id DAD6D106564A for ; Fri, 13 Mar 2009 12:52:50 +0000 (UTC) (envelope-from pekka.nikander@nomadiclab.com) Received: from n2.nomadiclab.com (n2.nomadiclab.com [IPv6:2001:14b8:400:101::2]) by mx1.freebsd.org (Postfix) with ESMTP id 996E58FC16 for ; Fri, 13 Mar 2009 12:52:50 +0000 (UTC) (envelope-from pekka.nikander@nomadiclab.com) Received: from n2.nomadiclab.com (localhost [127.0.0.1]) by n2.nomadiclab.com (Postfix) with ESMTP id D03001F4AD5 for ; Fri, 13 Mar 2009 14:52:48 +0200 (EET) Received: from [127.0.0.1] (localhost [IPv6:::1]) by n2.nomadiclab.com (Postfix) with ESMTP id 9CD2F1F4AD4 for ; Fri, 13 Mar 2009 14:52:48 +0200 (EET) Message-Id: <37364E21-701A-42F9-95B7-1B3386AEDE71@nomadiclab.com> From: Pekka Nikander To: freebsd-hackers@freebsd.org Content-Type: text/plain; charset=US-ASCII; format=flowed; delsp=yes Content-Transfer-Encoding: 7bit Mime-Version: 1.0 (Apple Message framework v930.3) Date: Fri, 13 Mar 2009 14:52:48 +0200 X-Mailer: Apple Mail (2.930.3) X-Virus-Scanned: ClamAV using ClamSMTP Subject: Problems mapping an vm_object to a process memory space 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, 13 Mar 2009 12:52:51 -0000 As a part of a research project, I'm trying to build publish/subscribe shared memory semantics where the idea is to first map an vm_object as read/write to a publisher's memory space, and then a COW shadow of that later to the subscriber processes' memory space. I've got to the point where the code works most of the time, but at certain scenarios (which are hard to classify and seem slightly random) the mapping goes wrong, and either the subscriber process has no physical mapping at the supposed address or there appears some random page. To me it appears as if the vm_object, vm_map etc data structures are OK, but somehow the pmaps don't get right. I'm currently using 7.1 RELEASE on amd64, but I'm planning to try the same on -CURRENT as soon as I get it properly ported. I even tried calling pmap_enter_object explicitly before returning to the user space, but it doesn't seem to help. Another thing is that there may be some bugs related OBJ_ONEMAPPING. We need to explicitly clear it at places, and sometimes artificially bump up the vm_object reference count to avoid code related to ONEMAPPING from trashing the object's mappings. Is this a known issue? Any advice? --Pekka Nikander From owner-freebsd-hackers@FreeBSD.ORG Fri Mar 13 13:27:03 2009 Return-Path: Delivered-To: freebsd-hackers@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id EA306106564A for ; Fri, 13 Mar 2009 13:27:03 +0000 (UTC) (envelope-from avg@icyb.net.ua) Received: from citadel.icyb.net.ua (citadel.icyb.net.ua [212.40.38.140]) by mx1.freebsd.org (Postfix) with ESMTP id 1EEEE8FC14 for ; Fri, 13 Mar 2009 13:27:02 +0000 (UTC) (envelope-from avg@icyb.net.ua) Received: from odyssey.starpoint.kiev.ua (alpha-e.starpoint.kiev.ua [212.40.38.101]) by citadel.icyb.net.ua (8.8.8p3/ICyb-2.3exp) with ESMTP id PAA08386 for ; Fri, 13 Mar 2009 15:27:00 +0200 (EET) (envelope-from avg@icyb.net.ua) Message-ID: <49BA5F24.1020105@icyb.net.ua> Date: Fri, 13 Mar 2009 15:27:00 +0200 From: Andriy Gapon User-Agent: Thunderbird 2.0.0.19 (X11/20090110) MIME-Version: 1.0 To: freebsd-hackers@freebsd.org X-Enigmail-Version: 0.95.7 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 7bit Subject: intpm: multiple salves, collision ?? 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, 13 Mar 2009 13:27:04 -0000 I observe some quite odd behavior with intpm(4). I have a program that access two slaves at a high rate (no sleeps or long calculations). The typical pattern of access is: 1. SMB_WRITEB slave1 reg1 2. SMB_READB slave1 reg2 3. SMB_READB *slave2* reg 4. SMB_READB slave1 reg3 There are many iterations of this pattern in a tight loop. There is definitely only one entity that uses SMBus - no other userland programs, nothing in kernel, nothing in ACPI and BIOS. At random iteration smb ioctl would fail with EIO. This happens consistently at step 4. Debugging printf in intpm gives this: intsmb0: error = 8, status = 0x8 That is, PIIX4_SMBHSTSTAT_BUSC translated to SMB_ECOLLI. Error can not be reproduced if only one slave is accessed, no matter in what patterns. -- Andriy Gapon From owner-freebsd-hackers@FreeBSD.ORG Fri Mar 13 14:49:37 2009 Return-Path: Delivered-To: freebsd-hackers@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 3A6391065674 for ; Fri, 13 Mar 2009 14:49:37 +0000 (UTC) (envelope-from avg@freebsd.org) Received: from citadel.icyb.net.ua (citadel.icyb.net.ua [212.40.38.140]) by mx1.freebsd.org (Postfix) with ESMTP id 7C4A98FC19 for ; Fri, 13 Mar 2009 14:49:36 +0000 (UTC) (envelope-from avg@freebsd.org) Received: from odyssey.starpoint.kiev.ua (alpha-e.starpoint.kiev.ua [212.40.38.101]) by citadel.icyb.net.ua (8.8.8p3/ICyb-2.3exp) with ESMTP id QAA10081 for ; Fri, 13 Mar 2009 16:29:36 +0200 (EET) (envelope-from avg@freebsd.org) Message-ID: <49BA6DD0.1080407@freebsd.org> Date: Fri, 13 Mar 2009 16:29:36 +0200 From: Andriy Gapon User-Agent: Thunderbird 2.0.0.19 (X11/20090110) MIME-Version: 1.0 To: freebsd-hackers@freebsd.org References: <49BA5F24.1020105@icyb.net.ua> In-Reply-To: <49BA5F24.1020105@icyb.net.ua> X-Enigmail-Version: 0.95.7 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 7bit Subject: Re: intpm: multiple salves, collision ?? 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, 13 Mar 2009 14:49:37 -0000 on 13/03/2009 15:27 Andriy Gapon said the following: > I observe some quite odd behavior with intpm(4). > I have a program that access two slaves at a high rate (no sleeps or > long calculations). The typical pattern of access is: > 1. SMB_WRITEB slave1 reg1 > 2. SMB_READB slave1 reg2 > 3. SMB_READB *slave2* reg > 4. SMB_READB slave1 reg3 > > There are many iterations of this pattern in a tight loop. > There is definitely only one entity that uses SMBus - no other userland > programs, nothing in kernel, nothing in ACPI and BIOS. > > At random iteration smb ioctl would fail with EIO. This happens > consistently at step 4. Debugging printf in intpm gives this: > intsmb0: error = 8, status = 0x8 > That is, PIIX4_SMBHSTSTAT_BUSC translated to SMB_ECOLLI. > > Error can not be reproduced if only one slave is accessed, no matter in > what patterns. > Sorry for the noise, the problem seems to be in misbehavior on part of one of the slaves used by the original program. I wrote a minimalistic test program and ran it for several different combinations of slaves - the issue only occurs if a certain slave is accessed, no problems for any other slaves. I wonder what could be wrong with that slave. -- Andriy Gapon From owner-freebsd-hackers@FreeBSD.ORG Fri Mar 13 15:16:25 2009 Return-Path: Delivered-To: freebsd-hackers@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 8902B106564A for ; Fri, 13 Mar 2009 15:16:25 +0000 (UTC) (envelope-from avg@freebsd.org) Received: from citadel.icyb.net.ua (citadel.icyb.net.ua [212.40.38.140]) by mx1.freebsd.org (Postfix) with ESMTP id CB0708FC08 for ; Fri, 13 Mar 2009 15:16:24 +0000 (UTC) (envelope-from avg@freebsd.org) Received: from odyssey.starpoint.kiev.ua (alpha-e.starpoint.kiev.ua [212.40.38.101]) by citadel.icyb.net.ua (8.8.8p3/ICyb-2.3exp) with ESMTP id RAA11276 for ; Fri, 13 Mar 2009 17:16:23 +0200 (EET) (envelope-from avg@freebsd.org) Message-ID: <49BA78C6.30202@freebsd.org> Date: Fri, 13 Mar 2009 17:16:22 +0200 From: Andriy Gapon User-Agent: Thunderbird 2.0.0.19 (X11/20090110) MIME-Version: 1.0 To: freebsd-hackers@freebsd.org References: <49BA5F24.1020105@icyb.net.ua> <49BA6DD0.1080407@freebsd.org> In-Reply-To: <49BA6DD0.1080407@freebsd.org> X-Enigmail-Version: 0.95.7 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 7bit Subject: Re: intpm: multiple salves, collision [solved] 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, 13 Mar 2009 15:16:25 -0000 on 13/03/2009 16:29 Andriy Gapon said the following: > > Sorry for the noise, the problem seems to be in misbehavior on part of one of the > slaves used by the original program. I wrote a minimalistic test program and ran > it for several different combinations of slaves - the issue only occurs if a > certain slave is accessed, no problems for any other slaves. > I wonder what could be wrong with that slave. > Mystery is cleared - I should have used READW to access that slave. The slave is a little bit sloppy - it accepts READB but replies with two bytes of data, and its documentation implies that READB can be used, but I should have known better. -- Andriy Gapon From owner-freebsd-hackers@FreeBSD.ORG Fri Mar 13 18:14:58 2009 Return-Path: Delivered-To: freebsd-hackers@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id CD65F106564A for ; Fri, 13 Mar 2009 18:14:58 +0000 (UTC) (envelope-from chris@smartt.com) Received: from barium.smartt.com (barium.smartt.com [69.67.187.30]) by mx1.freebsd.org (Postfix) with ESMTP id B32148FC08 for ; Fri, 13 Mar 2009 18:14:58 +0000 (UTC) (envelope-from chris@smartt.com) Received: from [69.31.174.220] (unknown [69.31.174.220]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (No client certificate requested) by barium.smartt.com (Postfix) with ESMTPSA id D5E2B10E494 for ; Fri, 13 Mar 2009 10:56:41 -0700 (PDT) Message-ID: <49BA9E63.3040000@smartt.com> Date: Fri, 13 Mar 2009 10:56:51 -0700 From: Chris St Denis User-Agent: Thunderbird 2.0.0.19 (Windows/20081209) MIME-Version: 1.0 To: freebsd-hackers@freebsd.org Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit X-Content-Filtered-By: Mailman/MimeDel 2.1.5 Subject: Bug in tcp wrappers? 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, 13 Mar 2009 18:14:59 -0000 I think I've found a bug in libwrap/tcpwrappers. Before filing an actual bug report I want to get some feedback here first. A hosts.allow file with ~1000 ips on a single line (Haven't experimented with other quantities yet), causes network daemons that use libwrap stop accepting incoming network connections and use 100% cpu on an incoming connection. This problem appeared because sshguard placed a large number of IPs in my hosts.allow file triggering this bug. I've left the affected daemons for a long period of time (once about 8 hours) and they don't seem to come back, so I think this is more than just it taking a while to loop through a 1000 item array of IPs The production system that was affected is FreeBSD 7.0-32bit Test system is FreeBSD 7.1-32bit Example hosts.allow file (IPs are randomly generated for purposes of example) sshd : 112.110.123.63 113.11.2.126 113.11.8.6 113.19.19.22 113.197.48.68 116.48.108.244 116.48.11.19 : deny ALL : ALL : allow top output of affected system. sshd wcpu slowly crawls up to 100% over about 30 seconds or so. crash# top last pid: 692; load averages: 0.08, 0.04, 0.04 up 0+00:12:13 15:42:30 24 processes: 2 running, 22 sleeping CPU: 49.7% user, 0.0% nice, 0.2% system, 0.2% interrupt, 49.9% idle Mem: 9304K Active, 6004K Inact, 21M Wired, 32K Cache, 10M Buf, 947M Free Swap: 1995M Total, 1995M Free PID USERNAME THR PRI NICE SIZE RES STATE C TIME WCPU COMMAND 691 root 1 103 0 5760K 3660K CPU1 1 0:04 33.98% sshd 672 root 1 4 0 8436K 3888K sbwait 1 0:00 0.00% sshd 677 cstdenis 1 20 0 4460K 2288K pause 0 0:00 0.00% csh 682 root 1 20 0 5484K 2632K pause 0 0:00 0.00% csh 675 cstdenis 1 44 0 8436K 3896K select 0 0:00 0.00% sshd A backtrace shows crash# gdb /usr/sbin/sshd 691 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"... Attaching to program: /usr/sbin/sshd, process 691 Reading symbols from /usr/lib/libssh.so.4...done. Loaded symbols for /usr/lib/libssh.so.4 Reading symbols from /lib/libutil.so.7...done. Loaded symbols for /lib/libutil.so.7 Reading symbols from /lib/libz.so.4...done. Loaded symbols for /lib/libz.so.4 Reading symbols from /usr/lib/libwrap.so.5...done. Loaded symbols for /usr/lib/libwrap.so.5 Reading symbols from /libexec/ld-elf.so.1...done. Loaded symbols for /libexec/ld-elf.so.1 0x28373225 in fgets (buf=0xbfbfe67b "", n=1, fp=0x283b8040) at /usr/src/lib/libc/stdio/fgets.c:56 56 { (gdb) bt #0 0x28373225 in fgets (buf=0xbfbfe67b "", n=1, fp=0x283b8040) at /usr/src/lib/libc/stdio/fgets.c:56 #1 0x281124ee in xgets (ptr=0xbfbfe67b "", len=1, fp=0x283b8040) at /usr/src/lib/libwrap/../../contrib/tcp_wrappers/misc.c:38 #2 0x28111410 in table_match (table=0x28112c5c "/etc/hosts.allow", request=0xbfbfeb14) at /usr/src/lib/libwrap/../../contrib/tcp_wrappers/hosts_access.c:162 #3 0x28111540 in hosts_access (request=0xbfbfeb14) at /usr/src/lib/libwrap/../../contrib/tcp_wrappers/hosts_access.c:132 #4 0x08052b39 in main (ac=2, av=0xbfbfeecc) at /usr/src/secure/usr.sbin/sshd/../../../crypto/openssh/sshd.c:1843 (gdb) bt #0 0x28373225 in fgets (buf=0xbfbfe67b "", n=1, fp=0x283b8040) at /usr/src/lib/libc/stdio/fgets.c:56 #1 0x281124ee in xgets (ptr=0xbfbfe67b "", len=1, fp=0x283b8040) at /usr/src/lib/libwrap/../../contrib/tcp_wrappers/misc.c:38 #2 0x28111410 in table_match (table=0x28112c5c "/etc/hosts.allow", request=0xbfbfeb14) at /usr/src/lib/libwrap/../../contrib/tcp_wrappers/hosts_access.c:162 #3 0x28111540 in hosts_access (request=0xbfbfeb14) at /usr/src/lib/libwrap/../../contrib/tcp_wrappers/hosts_access.c:132 #4 0x08052b39 in main (ac=2, av=0xbfbfeecc) at /usr/src/secure/usr.sbin/sshd/../../../crypto/openssh/sshd.c:1843 (gdb) q The program is running. Quit anyway (and detach it)? (y or n) y Detaching from program: /usr/sbin/sshd, process 691 A few questions 1. Is this a known issue of any sort? I've done some searching on it, but haven't found anything of interest. 2. Should this be reported to FreeBSD bug tracker, or to libwrap (or both)? Basically, is FreeBSD's libwrap (more or less) in sync with the main one, or is it completely separate? -- Chris St Denis Programmer SmarttNet (www.smartt.com) Ph: 604-473-9700 Ext. 200 ------------------------------------------- "Smart Internet Solutions For Businesses" From owner-freebsd-hackers@FreeBSD.ORG Fri Mar 13 18:18:48 2009 Return-Path: Delivered-To: freebsd-hackers@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id E74D91065674 for ; Fri, 13 Mar 2009 18:18:48 +0000 (UTC) (envelope-from bsd.quest@googlemail.com) Received: from nf-out-0910.google.com (nf-out-0910.google.com [64.233.182.186]) by mx1.freebsd.org (Postfix) with ESMTP id 72C148FC12 for ; Fri, 13 Mar 2009 18:18:48 +0000 (UTC) (envelope-from bsd.quest@googlemail.com) Received: by nf-out-0910.google.com with SMTP id d21so788535nfb.33 for ; Fri, 13 Mar 2009 11:18:47 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=googlemail.com; s=gamma; h=domainkey-signature:mime-version:received:in-reply-to:references :date:message-id:subject:from:to:cc:content-type; bh=MXKX7a3xFiwoLsLIi8qDnLl+iLTRQStuz6xfRoZ7XVg=; b=JemjrkQia7AN0jkMFMOpYmY/Ejs/FYQcJWtnUq4+Vxo58wzZRbPVgB1Kgv2rbsjH+8 BaYYCf4oZdvFu7TYl4oZjMnlI8m3ujy2u66kR9wyuP42hmY5uQHbIZqLzdPEUvsLndzF AR75G6XDEZx4S04vCuw8RTEs8wRnNa+akKtU0= DomainKey-Signature: a=rsa-sha1; c=nofws; d=googlemail.com; s=gamma; h=mime-version:in-reply-to:references:date:message-id:subject:from:to :cc:content-type; b=EiVXPCClYf/auKEZlpTMO6whw6l9oBkQJ0p/6Pe50LrLJM4Xya+5ZtnUswU0WNup0i Y7NEAppaWqx0UbeKjrXiCNeHPfpjdvJhpfg7mZbKWxgPPyDHiSwo10TCLXvpP35ebC9a 9FcvmJAFeEK2Q7ToHm/ZWSKvOnP9f5/g/PFbw= MIME-Version: 1.0 Received: by 10.210.125.13 with SMTP id x13mr1134977ebc.33.1236968327142; Fri, 13 Mar 2009 11:18:47 -0700 (PDT) In-Reply-To: <37364E21-701A-42F9-95B7-1B3386AEDE71@nomadiclab.com> References: <37364E21-701A-42F9-95B7-1B3386AEDE71@nomadiclab.com> Date: Fri, 13 Mar 2009 19:18:47 +0100 Message-ID: <671bb5fc0903131118u31b5b9b6l46b5d063aee78ff0@mail.gmail.com> From: Alexej Sokolov To: Pekka Nikander Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 7bit X-Content-Filtered-By: Mailman/MimeDel 2.1.5 Cc: freebsd-hackers@freebsd.org Subject: Re: Problems mapping an vm_object to a process memory space 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, 13 Mar 2009 18:18:49 -0000 hi , I had a problem with remapping too. Could I see your code? here is my code, that some times on AMD64 runs wrong : http://pastebin.com/m78da0b37 And now I solved the problem with remapping by using /dev/mem device. It has mmap syscal. And it seems to be working without problem. Alexej < 2009/3/13 Pekka Nikander > As a part of a research project, I'm trying to build publish/subscribe > shared memory semantics where the idea is to first map an vm_object as > read/write to a publisher's memory space, and then a COW shadow of that > later to the subscriber processes' memory space. > > I've got to the point where the code works most of the time, but at certain > scenarios (which are hard to classify and seem slightly random) the mapping > goes wrong, and either the subscriber process has no physical mapping at the > supposed address or there appears some random page. To me it appears as if > the vm_object, vm_map etc data structures are OK, but somehow the pmaps > don't get right. I'm currently using 7.1 RELEASE on amd64, but I'm planning > to try the same on -CURRENT as soon as I get it properly ported. I even > tried calling pmap_enter_object explicitly before returning to the user > space, but it doesn't seem to help. > > Another thing is that there may be some bugs related OBJ_ONEMAPPING. We > need to explicitly clear it at places, and sometimes artificially bump up > the vm_object reference count to avoid code related to ONEMAPPING from > trashing the object's mappings. Is this a known issue? > > Any advice? > > --Pekka Nikander > > _______________________________________________ > 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 Fri Mar 13 20:36:57 2009 Return-Path: Delivered-To: freebsd-hackers@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 8010F1065677 for ; Fri, 13 Mar 2009 20:36:57 +0000 (UTC) (envelope-from assaulter0x80@gmail.com) Received: from mail-fx0-f158.google.com (mail-fx0-f158.google.com [209.85.220.158]) by mx1.freebsd.org (Postfix) with ESMTP id 0F63E8FC15 for ; Fri, 13 Mar 2009 20:36:56 +0000 (UTC) (envelope-from assaulter0x80@gmail.com) Received: by fxm2 with SMTP id 2so2660208fxm.43 for ; Fri, 13 Mar 2009 13:36:56 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:mime-version:received:date:message-id:subject :from:to:content-type; bh=gerEjDyhnmUQ9R9OmrmR1tgcjF2VQtSvpD8zBZZS7LI=; b=blzdIxNRkRArfkQLyWpzcr6rY/u8hHjqsqgG4U3QBjR/Ce0AMfkjIQFJU2DepiuOi6 uDn4JPry60FNl6mtuxExDVtg7KY/xgtKHFyrX+YnENQiYgzuhH46UwazdDAWWSAQip6u Cf8grYl6dBtHSDf/amVckh3vD5T+ewrIuU7uE= DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=mime-version:date:message-id:subject:from:to:content-type; b=Ft65dYIcMdWrVBKHvJnzFnXZLQy6U8JdI3kgZ2VhArnuIbnhs8z0yw1esWh/t0xGHG YHhTIMySZt0aeqSJP2zn9VZYp2kMVuesQoXzm6DzQxo1HF+FSsMIDmtzPkweMn/HxzS9 SwUW9+AmHQMloqYgFsg2zw1Ds9t46T0ggd1gU= MIME-Version: 1.0 Received: by 10.103.102.17 with SMTP id e17mr850609mum.119.1236976611677; Fri, 13 Mar 2009 13:36:51 -0700 (PDT) Date: Fri, 13 Mar 2009 21:36:51 +0100 Message-ID: From: Jacky Oh To: freebsd-hackers@freebsd.org Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 7bit X-Content-Filtered-By: Mailman/MimeDel 2.1.5 Subject: sys/vimage.h and net/opt_inet6 not exist on 7.1 release? 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, 13 Mar 2009 20:36:57 -0000 Hi, Im trying to compile sys/netinet/ip_fw_pfil.c as example of KLD firewall module. This file include net/opt_inet6.h and sys/vimage.h but the compiler dont find it. This files seems that was deleted from the source tree. Anyone know something?. Thanks From owner-freebsd-hackers@FreeBSD.ORG Fri Mar 13 20:38:00 2009 Return-Path: Delivered-To: freebsd-hackers@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 2004710656D9 for ; Fri, 13 Mar 2009 20:38:00 +0000 (UTC) (envelope-from assaulter0x80@gmail.com) Received: from mail-bw0-f164.google.com (mail-bw0-f164.google.com [209.85.218.164]) by mx1.freebsd.org (Postfix) with ESMTP id 9D0BE8FC16 for ; Fri, 13 Mar 2009 20:37:59 +0000 (UTC) (envelope-from assaulter0x80@gmail.com) Received: by bwz8 with SMTP id 8so2696555bwz.43 for ; Fri, 13 Mar 2009 13:37:58 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:mime-version:received:in-reply-to:references :date:message-id:subject:from:to:content-type; bh=0+HLb7rv+J9sRBlq/ckRxiLZr+buqM3XapPu7Rz/w9o=; b=mUX8Yds/SVv4EfX18w+4+SsY3hb14cEj2VAnbgDkNOTkQ3ohrUBiOlIcF+Q9VDJSFJ zaf03C0H/5aMvTtxmO6TyQC7exXGlmbWNkRs3RT4vAaAGtJNQl5kPVK3ma5s5jwzwJP2 jzWGh69hZcwWvXiwKru+omQ269PAlm0oKkl+o= DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=mime-version:in-reply-to:references:date:message-id:subject:from:to :content-type; b=ee/lBr7VPLdmwfWc62uf/63In53EJu6E5sd5nP3tCdd3ygZv5Co58clrPSxBtV8KRg NFH8B4647CLTwFvNqhi85ozVs+sVYhzvgr+FK7YJ0c7QW8Y71wT9MMORz17WUJ34GcQz QmeR/cajJHpqnEUrIW5mAXRZ+O0E5Lw++vyEA= MIME-Version: 1.0 Received: by 10.103.241.5 with SMTP id t5mr835083mur.127.1236974862323; Fri, 13 Mar 2009 13:07:42 -0700 (PDT) In-Reply-To: References: Date: Fri, 13 Mar 2009 21:07:42 +0100 Message-ID: From: Jacky Oh To: freebsd-hackers@freebsd.org Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 7bit X-Content-Filtered-By: Mailman/MimeDel 2.1.5 Subject: Fwd: sys/vimage.h and net/opt_inet6 not exist on 7.1 release? 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, 13 Mar 2009 20:38:00 -0000 Hi, Im trying to compile sys/netinet/ip_fw_pfil.c as example of KLD firewall module. This file include net/opt_inet6.h and sys/vimage.h but the compiler dont find it. This files seems that was deleted from the source tree. Anyone know something?. Thanks From owner-freebsd-hackers@FreeBSD.ORG Fri Mar 13 21:19:59 2009 Return-Path: Delivered-To: freebsd-hackers@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id E020C106564A for ; Fri, 13 Mar 2009 21:19:59 +0000 (UTC) (envelope-from pekka.nikander@nomadiclab.com) Received: from smtp6.welho.com (smtp6.welho.com [213.243.153.40]) by mx1.freebsd.org (Postfix) with ESMTP id 9F8808FC13 for ; Fri, 13 Mar 2009 21:19:59 +0000 (UTC) (envelope-from pekka.nikander@nomadiclab.com) Received: from [192.168.1.169] (cs78165153.pp.htv.fi [62.78.165.153]) by smtp6.welho.com (Postfix) with ESMTP id D60015BC039; Fri, 13 Mar 2009 22:53:17 +0200 (EET) Message-Id: From: Pekka Nikander To: Alexej Sokolov In-Reply-To: <671bb5fc0903131118u31b5b9b6l46b5d063aee78ff0@mail.gmail.com> Content-Type: text/plain; charset=US-ASCII; format=flowed; delsp=yes Content-Transfer-Encoding: 7bit Mime-Version: 1.0 (Apple Message framework v930.3) Date: Fri, 13 Mar 2009 22:53:17 +0200 References: <37364E21-701A-42F9-95B7-1B3386AEDE71@nomadiclab.com> <671bb5fc0903131118u31b5b9b6l46b5d063aee78ff0@mail.gmail.com> X-Mailer: Apple Mail (2.930.3) Cc: freebsd-hackers@freebsd.org Subject: Re: Problems mapping an vm_object to a process memory space 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, 13 Mar 2009 21:20:00 -0000 Hi Alexej, The actual mapping code is now at http://pastebin.com/m56a949a5 The objects in question are allocated through vm_pager_allocate with OBJT_SWAP. Note that I'm not sure when OBJ_ONEMAPPING clearing actually helps and when not -- I've more sprinkled it around the code in the hope of circumventing what I suspect is a bug. (But I also have to confess that I don't understand the internals of vm_object_deallocate well enough to really say where the bug might be, if there is one.) The code around lines 110-117 is my latest attempt to fix. The earlier version simply wired the pages. --Pekka On 13 Mar 2009, at 20:18, Alexej Sokolov wrote: > hi , > I had a problem with remapping too. Could I see your code? > here is my code, that some times on AMD64 runs wrong : > http://pastebin.com/m78da0b37 > > And now I solved the problem with remapping by using /dev/mem > device. It has mmap syscal. And it seems to be working without > problem. > > Alexej > < > > 2009/3/13 Pekka Nikander > As a part of a research project, I'm trying to build publish/ > subscribe shared memory semantics where the idea is to first map an > vm_object as read/write to a publisher's memory space, and then a > COW shadow of that later to the subscriber processes' memory space. > > I've got to the point where the code works most of the time, but at > certain scenarios (which are hard to classify and seem slightly > random) the mapping goes wrong, and either the subscriber process > has no physical mapping at the supposed address or there appears > some random page. To me it appears as if the vm_object, vm_map etc > data structures are OK, but somehow the pmaps don't get right. I'm > currently using 7.1 RELEASE on amd64, but I'm planning to try the > same on -CURRENT as soon as I get it properly ported. I even tried > calling pmap_enter_object explicitly before returning to the user > space, but it doesn't seem to help. > > Another thing is that there may be some bugs related > OBJ_ONEMAPPING. We need to explicitly clear it at places, and > sometimes artificially bump up the vm_object reference count to > avoid code related to ONEMAPPING from trashing the object's > mappings. Is this a known issue? > > Any advice? > > --Pekka Nikander > > _______________________________________________ > 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 Sat Mar 14 16:15:03 2009 Return-Path: Delivered-To: freebsd-hackers@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 6A3021065673 for ; Sat, 14 Mar 2009 16:15:03 +0000 (UTC) (envelope-from rwatson@FreeBSD.org) Received: from cyrus.watson.org (cyrus.watson.org [65.122.17.42]) by mx1.freebsd.org (Postfix) with ESMTP id 4580E8FC1B for ; Sat, 14 Mar 2009 16:15:03 +0000 (UTC) (envelope-from rwatson@FreeBSD.org) Received: from fledge.watson.org (fledge.watson.org [65.122.17.41]) by cyrus.watson.org (Postfix) with ESMTPS id DCC0046B43; Sat, 14 Mar 2009 12:15:02 -0400 (EDT) Date: Sat, 14 Mar 2009 16:15:02 +0000 (GMT) From: Robert Watson X-X-Sender: robert@fledge.watson.org To: Jacky Oh In-Reply-To: Message-ID: References: User-Agent: Alpine 2.00 (BSF 1167 2008-08-23) MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII; format=flowed Cc: freebsd-hackers@freebsd.org Subject: Re: sys/vimage.h and net/opt_inet6 not exist on 7.1 release? 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, 14 Mar 2009 16:15:03 -0000 On Fri, 13 Mar 2009, Jacky Oh wrote: > Im trying to compile sys/netinet/ip_fw_pfil.c as example of KLD firewall > module. This file include net/opt_inet6.h and sys/vimage.h but the compiler > dont find it. This files seems that was deleted from the source tree. Hi Jacky-- vimage.h, at least, should exist only in 8.x -- could you check that you're checking out the right version of the file for use on 7.x? Robert N M Watson Computer Laboratory University of Cambridge