From owner-freebsd-hackers@FreeBSD.ORG Sun Aug 15 00:03:48 2010 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 91FB51065696 for ; Sun, 15 Aug 2010 00:03:48 +0000 (UTC) (envelope-from prt@prt.org) Received: from smtp5.uk.umis.net (smtp5.uk.umis.net [217.65.166.40]) by mx1.freebsd.org (Postfix) with ESMTP id 5B4DE8FC17 for ; Sun, 15 Aug 2010 00:03:48 +0000 (UTC) Received: from kate.prtsystems.ltd.uk ([217.65.165.35]) by smtp5.uk.umis.net with esmtpsa (TLSv1:AES256-SHA:256) (Exim 4.63 (FreeBSD)) (envelope-from ) id 1OkQhW-000Ngv-PN; Sun, 15 Aug 2010 00:03:46 +0000 Message-ID: <4C672EE1.60101@prt.org> Date: Sun, 15 Aug 2010 01:03:45 +0100 From: Paul Thornton User-Agent: Thunderbird 2.0.0.24 (Windows/20100228) MIME-Version: 1.0 To: Ed Schouten References: <4C66D2CF.9040408@prt.org> <20100814220929.GI2978@hoeg.nl> In-Reply-To: <20100814220929.GI2978@hoeg.nl> X-Enigmail-Version: 0.96.0 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 7bit Cc: freebsd-hackers@freebsd.org Subject: Re: Problem detecting and reacting to serial break 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, 15 Aug 2010 00:03:48 -0000 Ed Schouten wrote: > * Paul Thornton wrote: >> I'm using 8.0-RELEASE with uftdi and ucom driving the serial port. > > Somewhat unrelated question: have you ever tried running the this code > on 7.x? If so, did it work? I've just tried this on 7.2-RELEASE (that was the only 7.x CD I could find lurking about my desk). Something is clearly quite different between 7 and 8 here: On 7.2, it doesn't like my tcsetattr: [root@test1 /usr/local/src]# ./dmxrx2 Opened /dev/cuaU0 on file handle 3 before: c_iflag=2106 c_oflag=3 c_cflag=cf00 c_lflag=400 tcsetattr: Invalid argument No amount of fiddling with the options would make it work, so I used stty to set the paramaters of /dev/cuaU0.init to what I wanted: stty -f /dev/cuaU0.init speed 250000 -icanon -isig -echo cs8 clocal cstopb cread ignpar -ixany -ixon -ixoff -ignbrk brkint -imaxbel -icrnl ... and re-ran with some more debug ... [root@test1 /usr/local/src]# ./dmxrx2 Opened /dev/cuaU0 on file handle 3 before: c_iflag=6 c_oflag=3 c_cflag=cf00 c_lflag=400 tcsetattr: Invalid argument after: c_iflag=6 c_oflag=3 c_cflag=8f00 c_lflag=400 calling read with 513 bytes to go ^CCaught a signal: 2 So I now hang in a blocked read(). A quick and dirty test of "hd /dev/cuaU0" gives one line of zeros and then hangs. Under 8.0, this continually dumps the data coming in as you might expect it to. Were there any significant serial changes between 7.x and 8.0 which might explain this? I don't have enough understanding of how FreeBSD's serial internals should work to debug this on my own, but am more than happy to try all suggestions made. Paul. From owner-freebsd-hackers@FreeBSD.ORG Sun Aug 15 00:08:22 2010 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 A2A2F1065672 for ; Sun, 15 Aug 2010 00:08:22 +0000 (UTC) (envelope-from prt@prt.org) Received: from smtp5.uk.umis.net (smtp5.uk.umis.net [217.65.166.40]) by mx1.freebsd.org (Postfix) with ESMTP id 6C1A08FC1A for ; Sun, 15 Aug 2010 00:08:22 +0000 (UTC) Received: from kate.prtsystems.ltd.uk ([217.65.165.35]) by smtp5.uk.umis.net with esmtpsa (TLSv1:AES256-SHA:256) (Exim 4.63 (FreeBSD)) (envelope-from ) id 1OkQlx-000Nm2-1w; Sun, 15 Aug 2010 00:08:21 +0000 Message-ID: <4C672FF4.4080208@prt.org> Date: Sun, 15 Aug 2010 01:08:20 +0100 From: Paul Thornton User-Agent: Thunderbird 2.0.0.24 (Windows/20100228) MIME-Version: 1.0 To: Daniel O'Connor References: <4C66D2CF.9040408@prt.org> In-Reply-To: X-Enigmail-Version: 0.96.0 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 7bit Cc: freebsd-hackers@freebsd.org Subject: Re: Problem detecting and reacting to serial break 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, 15 Aug 2010 00:08:22 -0000 Daniel O'Connor wrote: > On 15/08/2010, at 3:00, Paul Thornton wrote: >> So according to the documentation, the effect of the break should be to >> flush the input and output buffers, and send a SIGINT to my process. The >> buffer doesn't seem to get flushed, and I don't get sent the SIGINT. > > It does sounds like it's ignoring your request :( > > However you won't get a SIGINT unless the serial port is the controlling terminal of your process (which it won't be if you just open()'d it) I realised that about 10 minutes after posting the original mail when re-reading the documentation on termios, thanks for the confirmation though. Part of the problem I'm having is that whenever you try and search for information/docs about this sort of thing, you're transported back in a time warp to the 1980s where people used serial terminals as the norm for access and everything seems to be written from that standpoint - not from a "I'd like to use the serial port for binary data that has nothing to do with interactive login please" perspective... Paul. From owner-freebsd-hackers@FreeBSD.ORG Sun Aug 15 00:09:51 2010 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 203BE1065679 for ; Sun, 15 Aug 2010 00:09:51 +0000 (UTC) (envelope-from yanegomi@gmail.com) Received: from mail-bw0-f54.google.com (mail-bw0-f54.google.com [209.85.214.54]) by mx1.freebsd.org (Postfix) with ESMTP id 9F5418FC08 for ; Sun, 15 Aug 2010 00:09:50 +0000 (UTC) Received: by bwz20 with SMTP id 20so1005330bwz.13 for ; Sat, 14 Aug 2010 17:09:49 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:mime-version:received:sender:received :in-reply-to:references:date:x-google-sender-auth:message-id:subject :from:to:cc:content-type:content-transfer-encoding; bh=RUR5eFWDfZ6b9H8GE7Nd8huZTusI3169fTDJNfsEvtU=; b=N0jlVfxCKL1TROH3sa9yO/aMRG3cYGsZr3Mna9bbBP5x7YLSIqNaFG5GUzar6qGbQn Se0L+GwAJxIYHvBPbskUUbZuEnMcgrEY4uff6U9js8G216t3QXo21BG2AdyB4DMrocg9 RuyykRYwVAydJaMduQZLf+BU4h6+CJz02BYGM= DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=mime-version:sender:in-reply-to:references:date :x-google-sender-auth:message-id:subject:from:to:cc:content-type :content-transfer-encoding; b=vhphtfZvfexrCR1bdo/oOYIgz6/5mNax4C589IX/+je8cwioQ8C8fiOY1k5ut7zSpd i3cAIptMem4bMWAUI89epwaZbsMRtf8IWoLa58hXIyh8LGDCGdMz6Q0koUzCBt6FDdOU wbIc/3wcdSbPiHuRuxXAeHsWnYvjTbA3Ir768= MIME-Version: 1.0 Received: by 10.204.47.193 with SMTP id o1mr2060603bkf.134.1281830989412; Sat, 14 Aug 2010 17:09:49 -0700 (PDT) Sender: yanegomi@gmail.com Received: by 10.204.82.6 with HTTP; Sat, 14 Aug 2010 17:09:49 -0700 (PDT) In-Reply-To: <4C672EE1.60101@prt.org> References: <4C66D2CF.9040408@prt.org> <20100814220929.GI2978@hoeg.nl> <4C672EE1.60101@prt.org> Date: Sat, 14 Aug 2010 17:09:49 -0700 X-Google-Sender-Auth: SSVEkEFP2TVnwCjdwWEFWVDj1wo Message-ID: From: Garrett Cooper To: Paul Thornton Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: quoted-printable Cc: Ed Schouten , freebsd-hackers@freebsd.org Subject: Re: Problem detecting and reacting to serial break 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, 15 Aug 2010 00:09:51 -0000 On Sat, Aug 14, 2010 at 5:03 PM, Paul Thornton wrote: > Ed Schouten wrote: >> * Paul Thornton wrote: >>> I'm using 8.0-RELEASE with uftdi and ucom driving the serial port. >> >> Somewhat unrelated question: have you ever tried running the this code >> on 7.x? If so, did it work? > > I've just tried this on 7.2-RELEASE (that was the only 7.x CD I could > find lurking about my desk). > > Something is clearly quite different between 7 and 8 here: > > On 7.2, it doesn't like my tcsetattr: > > [root@test1 /usr/local/src]# ./dmxrx2 > Opened /dev/cuaU0 on file handle 3 > before: c_iflag=3D2106 c_oflag=3D3 c_cflag=3Dcf00 c_lflag=3D400 > tcsetattr: Invalid argument > > No amount of fiddling with the options would make it work, so I used > stty to set the paramaters of /dev/cuaU0.init to what I wanted: > > stty -f /dev/cuaU0.init speed 250000 -icanon -isig -echo cs8 clocal > =A0cstopb cread ignpar -ixany -ixon -ixoff -ignbrk brkint -imaxbel -icrnl > > ... and re-ran with some more debug ... > > [root@test1 /usr/local/src]# ./dmxrx2 > Opened /dev/cuaU0 on file handle 3 > before: c_iflag=3D6 c_oflag=3D3 c_cflag=3Dcf00 c_lflag=3D400 > tcsetattr: Invalid argument > after: c_iflag=3D6 c_oflag=3D3 c_cflag=3D8f00 c_lflag=3D400 > calling read with 513 bytes to go > ^CCaught a signal: 2 > > So I now hang in a blocked read(). > > A quick and dirty test of "hd /dev/cuaU0" gives one line of zeros and > then hangs. =A0Under 8.0, this continually dumps the data coming in as yo= u > might expect it to. > > Were there any significant serial changes between 7.x and 8.0 which > might explain this? =A0I don't have enough understanding of how FreeBSD's > serial internals should work to debug this on my own, but am more than > happy to try all suggestions made. Bits of syscons were largely rewritten between 7.x and 8.x. That's the reason why Ed ask the question :) (he did the rewriting). -Garrett From owner-freebsd-hackers@FreeBSD.ORG Sun Aug 15 00:21:16 2010 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 AB4EC10656AB for ; Sun, 15 Aug 2010 00:21:16 +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 E3C408FC0A for ; Sun, 15 Aug 2010 00:21:15 +0000 (UTC) Received: from ur.dons.net.au (ppp121-45-156-6.lns6.adl6.internode.on.net [121.45.156.6]) (authenticated bits=0) by cain.gsoft.com.au (8.14.4/8.14.3) with ESMTP id o7F0L7U2095787 (version=TLSv1/SSLv3 cipher=AES128-SHA bits=128 verify=NO); Sun, 15 Aug 2010 09:51:13 +0930 (CST) (envelope-from doconnor@gsoft.com.au) Mime-Version: 1.0 (Apple Message framework v1081) Content-Type: multipart/signed; boundary=Apple-Mail-34-729272746; protocol="application/pkcs7-signature"; micalg=sha1 From: "Daniel O'Connor" In-Reply-To: <4C672FF4.4080208@prt.org> Date: Sun, 15 Aug 2010 09:51:06 +0930 Message-Id: References: <4C66D2CF.9040408@prt.org> <4C672FF4.4080208@prt.org> To: Paul Thornton X-Mailer: Apple Mail (2.1081) X-Spam-Score: 0.163 () BAYES_00,RDNS_DYNAMIC X-Scanned-By: MIMEDefang 2.67 on 203.31.81.10 X-Content-Filtered-By: Mailman/MimeDel 2.1.5 Cc: freebsd-hackers@freebsd.org Subject: Re: Problem detecting and reacting to serial break 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, 15 Aug 2010 00:21:16 -0000 --Apple-Mail-34-729272746 Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset=us-ascii On 15/08/2010, at 9:38, Paul Thornton wrote: > Part of the problem I'm having is that whenever you try and search for > information/docs about this sort of thing, you're transported back in = a > time warp to the 1980s where people used serial terminals as the norm > for access and everything seems to be written from that standpoint - = not > from a "I'd like to use the serial port for binary data that has = nothing > to do with interactive login please" perspective... Yep, definitely time to blow some dust off various old tomes :) Between 7.x and 8.x the default serial driver changed from sio to uart. You can recompile your kernel and get sio back and see if that has an = effect. Actually I see you used cuaU0 - that is a USB serial dongle so the = driver change would have no effect. That said the stack was rewritten between 7 & 8 too so perhaps that is = related. -- 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 --Apple-Mail-34-729272746-- From owner-freebsd-hackers@FreeBSD.ORG Sun Aug 15 05:33:39 2010 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 B6416106566B for ; Sun, 15 Aug 2010 05:33:39 +0000 (UTC) (envelope-from yanegomi@gmail.com) Received: from mail-bw0-f54.google.com (mail-bw0-f54.google.com [209.85.214.54]) by mx1.freebsd.org (Postfix) with ESMTP id 48CE98FC12 for ; Sun, 15 Aug 2010 05:33:39 +0000 (UTC) Received: by bwz20 with SMTP id 20so1131678bwz.13 for ; Sat, 14 Aug 2010 22:33:38 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:mime-version:received:received:date:message-id :subject:from:to:content-type; bh=+jnpkzf1sLmix92BWzNe322DS6FrwXVDSpUmsRbb4L8=; b=pV0oSaWD+xCGP8O+4PktluPqVfj2S9Cb868Yfg6PU75RVdWmGjEJumrkSoE87TSP7I yxUNnmU+TYPCcjbyy5vqCkznBEmNQGd7bKp4Esg7MZsoKAoXGf4p0vz7jh4JOCEcOfQj JUkFNwlq2BgSFl+2uDzma++xZr/jLgvIE5QaM= DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=mime-version:date:message-id:subject:from:to:content-type; b=BcDLpr/yZXSDajicykriB02BZJfhazafqeokKVqJ+4hJmZs316/lBw+rSLlatfAN8k IxfGysqlf0JQy2dUyyUvbvzUOIiyg3TmCix27WNER8lB+R8j0PcX8BDf6C7ug5gEroPT kgGdIXtul2bAL0+4q7rrmPNCSOlk/tuUA4vJI= MIME-Version: 1.0 Received: by 10.204.45.213 with SMTP id g21mr2258286bkf.11.1281850418203; Sat, 14 Aug 2010 22:33:38 -0700 (PDT) Received: by 10.204.82.6 with HTTP; Sat, 14 Aug 2010 22:33:38 -0700 (PDT) Date: Sat, 14 Aug 2010 22:33:38 -0700 Message-ID: From: Garrett Cooper To: hackers@freebsd.org Content-Type: text/plain; charset=ISO-8859-1 X-Mailman-Approved-At: Sun, 15 Aug 2010 11:02:19 +0000 Cc: Subject: Why doesn't ppc(4) check non-ENXIO failures during probe? 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, 15 Aug 2010 05:33:39 -0000 One thing that's puzzling me about the ppc(4) driver's ISA routines is that it only checks to see whether or not the device has an IO error: (from sys/dev/ppc/ppc_isa.c) @@ -121,8 +121,8 @@ parent = device_get_parent(dev); error = ISA_PNP_PROBE(parent, dev, lpc_ids); if (error == ENXIO) return (ENXIO); if (error != 0) /* XXX shall be set after detection */ device_set_desc(dev, "Parallel port"); But what about the case where ENOENT is returned :)? (from sys/isa/isa_common.c) static int isa_pnp_probe(device_t dev, device_t child, struct isa_pnp_id *ids) { struct isa_device* idev = DEVTOISA(child); if (!idev->id_vendorid) return (ENOENT); while (ids && ids->ip_id) { /* * Really ought to support >1 compat id per device. */ if (idev->id_logicalid == ids->ip_id || idev->id_compatid == ids->ip_id) { if (ids->ip_desc) device_set_desc(child, ids->ip_desc); return (0); } ids++; } return (ENXIO); } Does it make sense for this patch to be applied to ppc(4)? I think it solves some problems with bogus device.hints files and the ppc driver, but my eye is a bit untrained for this stuff and I don't have the experience to say with absolute authority whether or not it's the case. Thanks, -Garrett Index: sys/dev/ppc/ppc_isa.c =================================================================== --- sys/dev/ppc/ppc_isa.c (revision 211309) +++ sys/dev/ppc/ppc_isa.c (working copy) @@ -121,8 +121,8 @@ parent = device_get_parent(dev); error = ISA_PNP_PROBE(parent, dev, lpc_ids); - if (error == ENXIO) - return (ENXIO); + if (error) + return (error); if (error != 0) /* XXX shall be set after detection */ device_set_desc(dev, "Parallel port"); From owner-freebsd-hackers@FreeBSD.ORG Sun Aug 15 13:55:10 2010 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 C80B81065693 for ; Sun, 15 Aug 2010 13:55:10 +0000 (UTC) (envelope-from prt@prt.org) Received: from smtp5.uk.umis.net (smtp5.uk.umis.net [217.65.166.40]) by mx1.freebsd.org (Postfix) with ESMTP id 91ACB8FC1A for ; Sun, 15 Aug 2010 13:55:10 +0000 (UTC) Received: from kate.prtsystems.ltd.uk ([217.65.165.35]) by smtp5.uk.umis.net with esmtpsa (TLSv1:AES256-SHA:256) (Exim 4.63 (FreeBSD)) (envelope-from ) id 1Okdg5-0008dy-9m; Sun, 15 Aug 2010 13:55:09 +0000 Message-ID: <4C67F1BD.9000003@prt.org> Date: Sun, 15 Aug 2010 14:55:09 +0100 From: Paul Thornton User-Agent: Thunderbird 2.0.0.24 (Windows/20100228) MIME-Version: 1.0 To: Ed Schouten References: <4C66D2CF.9040408@prt.org> <20100814220929.GI2978@hoeg.nl> <4C672EE1.60101@prt.org> In-Reply-To: <4C672EE1.60101@prt.org> X-Enigmail-Version: 0.96.0 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 7bit Cc: freebsd-hackers@freebsd.org Subject: Re: Problem detecting and reacting to serial break 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, 15 Aug 2010 13:55:10 -0000 Paul Thornton wrote: > Ed Schouten wrote: >> * Paul Thornton wrote: >>> I'm using 8.0-RELEASE with uftdi and ucom driving the serial port. >> Somewhat unrelated question: have you ever tried running the this code >> on 7.x? If so, did it work? > > I've just tried this on 7.2-RELEASE (that was the only 7.x CD I could > find lurking about my desk). I've been looking into this a bit deeper, both with 7.2 and on a Linux box I had to hand. I'm using a baud rate of 250000 - which of course is non-standard; although the FTDI chip is more than capable of doing it. The tcsetattr does not like setting the baud rate to this - which works without complaint under 8 (I'm guessing this is one of the enhancements). This lack of tcsetattr success is, I suspect, causing my block on the read() call. When I set the rate to 9600, the tcsetattr succeeds, and I do get data coming back from the read - albeit baud barf. I made a quick hack to uftdireg.h and uftdi.c to add a rate of 250000 with a divisor of 12 - which results in my tcsetattr now succeeding, and the data read looking more correct. However I'm now back to the same problem as under 8.0 - the break has no effect and the position of data byte 1 wanders around the buffer. With Linux, it all works as expected - but the linux tcsetattr doesn't like the nonstandard baud rate either. However, in linux I used setserial to set a base baud rate of 24000000 and a divisor of 96 to get 250k baud rate. When I run, I have a stable buffer dump displayed which always starts with byte 1; so I'm happy that in theory my code is correct and the hardware is behaving as expected. So it seems that the answer is that I get the same behaviour with 7.2 as I did with 8.0. Paul. From owner-freebsd-hackers@FreeBSD.ORG Mon Aug 16 03:35:41 2010 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 232731065670 for ; Mon, 16 Aug 2010 03:35:41 +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 778818FC08 for ; Mon, 16 Aug 2010 03:35:39 +0000 (UTC) Received: from ur.gsoft.com.au (Ur.gsoft.com.au [203.31.81.44]) (authenticated bits=0) by cain.gsoft.com.au (8.14.4/8.14.3) with ESMTP id o7G3Z8vD031525 (version=TLSv1/SSLv3 cipher=AES128-SHA bits=128 verify=NO); Mon, 16 Aug 2010 13:05:14 +0930 (CST) (envelope-from doconnor@gsoft.com.au) Mime-Version: 1.0 (Apple Message framework v1081) Content-Type: multipart/signed; boundary=Apple-Mail-4-827314308; protocol="application/pkcs7-signature"; micalg=sha1 From: "Daniel O'Connor" In-Reply-To: <4C67F1BD.9000003@prt.org> Date: Mon, 16 Aug 2010 13:05:08 +0930 Message-Id: References: <4C66D2CF.9040408@prt.org> <20100814220929.GI2978@hoeg.nl> <4C672EE1.60101@prt.org> <4C67F1BD.9000003@prt.org> To: Paul Thornton X-Mailer: Apple Mail (2.1081) X-Spam-Score: -2.51 () ALL_TRUSTED,BAYES_00,T_RP_MATCHES_RCVD X-Scanned-By: MIMEDefang 2.67 on 203.31.81.10 X-Content-Filtered-By: Mailman/MimeDel 2.1.5 Cc: Ed Schouten , freebsd-hackers@freebsd.org Subject: Re: Problem detecting and reacting to serial break 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, 16 Aug 2010 03:35:41 -0000 --Apple-Mail-4-827314308 Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset=us-ascii On 15/08/2010, at 23:25, Paul Thornton wrote: > With Linux, it all works as expected - but the linux tcsetattr doesn't > like the nonstandard baud rate either. However, in linux I used > setserial to set a base baud rate of 24000000 and a divisor of 96 to = get > 250k baud rate. When I run, I have a stable buffer dump displayed = which > always starts with byte 1; so I'm happy that in theory my code is > correct and the hardware is behaving as expected. I had a quick look at the uftdi driver and while it has code for setting = break (uftdi_cfg_set_break), there doesn't seem to be any in the read = call back routine to handle break, hence the TTY layer will not see = them. The Linux driver does (obviously :) support it and it doesn't look too = tricky so you could probably fix it up. It would be nice if the man page mentioned the lack of break support ;( -- 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 --Apple-Mail-4-827314308-- From owner-freebsd-hackers@FreeBSD.ORG Mon Aug 16 05:41:29 2010 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 79A231065672 for ; Mon, 16 Aug 2010 05:41:29 +0000 (UTC) (envelope-from yanegomi@gmail.com) Received: from mail-bw0-f54.google.com (mail-bw0-f54.google.com [209.85.214.54]) by mx1.freebsd.org (Postfix) with ESMTP id 098F78FC19 for ; Mon, 16 Aug 2010 05:41:28 +0000 (UTC) Received: by bwz20 with SMTP id 20so1868544bwz.13 for ; Sun, 15 Aug 2010 22:41:27 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:mime-version:received:sender:received:date :x-google-sender-auth:message-id:subject:from:to:content-type; bh=LHDtBUdqyrjQ22gA3MOB2GRANz2KTPrZKDejSjoePYA=; b=oqc62wXpOZqIrx9qJSL+/q8p8PPqnOWL5hN7Ux4OnLYLDFoP7ibunFwelMgJeK7hlq w848on34KQSkuNIwbqjzFxwyEEsFa7O+Vg5kWzgHBeMv07smriLQj068vNsEzO6Qya+c fwhOQWC+YgRd8aP7DlAJF5++44shWFd4kta78= DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=mime-version:sender:date:x-google-sender-auth:message-id:subject :from:to:content-type; b=AdBGq00/hOVOAgAxkYOLijhOMC3GbF8nAgweB8p+KkQDw9koqWKLqksov8jonoE3dI NoBF89Ltz95HsYDhgAuTDByQU7D/B973NMlplWgDjHo8X1DXq0Z+lwSt31VZpyAObXaC pNticHcWAnfv7N6ZUX0dSPO+IXsgE5vaMgloc= MIME-Version: 1.0 Received: by 10.204.82.206 with SMTP id c14mr3003786bkl.145.1281937283067; Sun, 15 Aug 2010 22:41:23 -0700 (PDT) Sender: yanegomi@gmail.com Received: by 10.204.82.6 with HTTP; Sun, 15 Aug 2010 22:41:23 -0700 (PDT) Date: Sun, 15 Aug 2010 22:41:23 -0700 X-Google-Sender-Auth: wi30znSYCy-We1UtUd9bfSf3mBU Message-ID: From: Garrett Cooper To: hackers@freebsd.org Content-Type: text/plain; charset=ISO-8859-1 Cc: Subject: mount(2) not returning EINVAL with invalid filesystems 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, 16 Aug 2010 05:41:29 -0000 mount(2) says it should fail with EINVAL if the magic block is wrong: [EINVAL] The super block for the file system had a bad magic number or an out of range block size. This doesn't appear to be the case with a nmount layer though :/. I didn't find anything conclusive that noted where the issue was occurring, but I was wondering if anyone knew where it might be happening? $ sudo mount_msdosfs /dev/ada0s1b /mnt/ # ... madvise(0x800c09000,0x1000,0x5,0x8,0x3008,0x5039d0) = 0 (0x0) nmount(0x800c0d100,0x10,0x0,0x4,0xf0,0x5039d0) ERR#1 'Operation not permitted' write(2,"mount_msdosfs: ",15) ERR#9 'Bad file descriptor' write(2,": ",2) ERR#9 'Bad file descriptor' # ... mount_msdosfs: /dev/ada0s1b: Operation not permitted $ sudo mount /dev/ada0s1b /mnt/ # ... madvise(0x800c0b000,0x1000,0x5,0xa,0x2008,0x505dd8) = 0 (0x0) nmount(0x800c0d080,0x8,0x0,0x7fffffffdff0,0x70,0x505dd8) ERR#1 'Operation not permitted' write(2,"mount: ",7) ERR#9 'Bad file descriptor' write(2,": ",2) ERR#9 'Bad file descriptor' # ... mount: /dev/ada0s1b : Operation not permitted This is something small that I've noticed for a while now that doesn't make sense from a requirements perspective with the manpage. Thanks! -Garrett From owner-freebsd-hackers@FreeBSD.ORG Mon Aug 16 14:22:38 2010 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 215B7106567A; Mon, 16 Aug 2010 14:22:38 +0000 (UTC) (envelope-from kabaev@gmail.com) Received: from mail-qw0-f54.google.com (mail-qw0-f54.google.com [209.85.216.54]) by mx1.freebsd.org (Postfix) with ESMTP id 652698FC0C; Mon, 16 Aug 2010 14:22:37 +0000 (UTC) Received: by qwg5 with SMTP id 5so5751388qwg.13 for ; Mon, 16 Aug 2010 07:22:36 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:received:received:date:from:to:cc:subject :message-id:in-reply-to:references:x-mailer:mime-version :content-type; bh=1sYEx1iVL32KwZ0SCSz+TFGOsalpqrAlghQoK+e8ebE=; b=JpfI4l+QgGErPXbQWLlXooOQ+lUjbRp37RwkN2iNOTf4s0vp2t0O3wzYsxSqtGakBz 53Y0kAObEFTcR2XfgJJJXhzeTjveh2D68euFxTeFqxMJMI0LD6/xuqjqREfJChZzCVA6 TErAji0sKzxTodQzgmR1klni+eJ5cKiZwQ5kQ= DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=date:from:to:cc:subject:message-id:in-reply-to:references:x-mailer :mime-version:content-type; b=M0go6z0zzoiFRSElccQGJELiYPqHyo0xWsDt0PxVer06AOw4K2KYvbbDHtcsSWLcZN wwLQt+THk+mIZzNa2VJuAAM8C4Y355lEbHnbhoPy4wQ+ZC4TnmCG1VvM1B2ORSbqEDSZ uZ3gVdB5hKYNRIn/GfaEmiFstr0B+Kq37yDi4= Received: by 10.224.73.209 with SMTP id r17mr3377334qaj.2.1281968554606; Mon, 16 Aug 2010 07:22:34 -0700 (PDT) Received: from kan.dnsalias.net (c-24-63-226-98.hsd1.ma.comcast.net [24.63.226.98]) by mx.google.com with ESMTPS id q8sm7370073qcs.24.2010.08.16.07.22.31 (version=SSLv3 cipher=RC4-MD5); Mon, 16 Aug 2010 07:22:32 -0700 (PDT) Date: Mon, 16 Aug 2010 10:22:21 -0400 From: Alexander Kabaev To: Kostik Belousov Message-ID: <20100816102221.0f3b48f0@kan.dnsalias.net> In-Reply-To: <20100814143225.GA2396@deviant.kiev.zoral.com.ua> References: <20100806050633.GK14016@felucia.tataz.chchile.org> <20100806090404.GI22295@deviant.kiev.zoral.com.ua> <20100806110807.GA68489@alchemy.franken.de> <20100806111131.GN22295@deviant.kiev.zoral.com.ua> <20100807135939.GA875@alchemy.franken.de> <20100807180904.GZ22295@deviant.kiev.zoral.com.ua> <20100807193722.GB875@alchemy.franken.de> <20100814143225.GA2396@deviant.kiev.zoral.com.ua> X-Mailer: Claws Mail 3.7.6 (GTK+ 2.20.1; amd64-portbld-freebsd9.0) Mime-Version: 1.0 Content-Type: multipart/signed; micalg=PGP-SHA1; boundary="Sig_/JyNWM5YA/rxlgfSEl4LreCt"; protocol="application/pgp-signature" Cc: kan@freebsd.org, FreeBSD Hackers , Jeremie, nwhitehorn@freebsd.org, Marius Strobl , Hen Subject: Re: Avoiding sysctl at program startup using ELF aux vector (was: concurrent sysctl implementation) 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, 16 Aug 2010 14:22:38 -0000 --Sig_/JyNWM5YA/rxlgfSEl4LreCt Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: quoted-printable On Sat, 14 Aug 2010 17:32:25 +0300 Kostik Belousov wrote: > On Sat, Aug 07, 2010 at 09:37:22PM +0200, Marius Strobl wrote: > > On Sat, Aug 07, 2010 at 09:09:04PM +0300, Kostik Belousov wrote: > > > On Sat, Aug 07, 2010 at 03:59:39PM +0200, Marius Strobl wrote: > > > > On Fri, Aug 06, 2010 at 02:11:31PM +0300, Kostik Belousov wrote: > > > > > On Fri, Aug 06, 2010 at 01:08:08PM +0200, Marius Strobl wrote: > > > > > > On Fri, Aug 06, 2010 at 12:04:04PM +0300, Kostik Belousov > > > > > > wrote: > > > > > > > On Fri, Aug 06, 2010 at 07:06:33AM +0200, Jeremie Le Hen > > > > > > > wrote: > > > > > > > > Hi Kib, > > > > > > > >=20 > > > > > > > > In-Reply-To: > > > > > > > > <20100629083901.GG13238@deviant.kiev.zoral.com.ua> On > > > > > > > > Tue, Jun 29, 2010 at 11:39:01AM +0300, Kostik Belousov > > > > > > > > wrote: > > > > > > > > > On Tue, Jun 29, 2010 at 10:26:39AM +0200, Marius > > > > > > > > > Strobl wrote: > > > > > > > > > > On Mon, Jun 28, 2010 at 05:48:59PM +0300, Kostik > > > > > > > > > > Belousov wrote: > > > > > > > > > > > On Wed, Jun 23, 2010 at 11:09:59PM +0200, Jeremie > > > > > > > > > > > Le Hen wrote: > > > > > > > > > > > > Hi Kostik, > > > > > > > > > > > >=20 > > > > > > > > > > > > This patch seems to have faded out from > > > > > > > > > > > > memory. Is it possible to go forward and > > > > > > > > > > > > commit it? > > > > > > > > > > > I refreshed the patch. Hopefully, nobody will > > > > > > > > > > > object, and I commit it shortly. > > > > > > > > > > >=20 > > > > > > > > > > > >=20 > > > > > > > > > > > > Thanks, > > > > > > > > > > > > Regards. > > > > > > > > > > > >=20 > > > > > > > > > > > > On Sat, Jul 25, 2009 at 12:29:16AM +0300, > > > > > > > > > > > > Kostik Belousov wrote: > > > > > > > > > > > > > Below is the prototype that seems to work for > > > > > > > > > > > > > me both with patched and old rtld on i386. > > > > > > > > > > > > > Patch also contains bits for amd64 that I did > > > > > > > > > > > > > not tested yet. All other arches are not > > > > > > > > > > > > > buildable for now. > > > > > > > > > > > > >=20 > > > > > > > > > > > > > Patch completely eliminates sysctl syscalls > > > > > > > > > > > > > from the rtld and libc startup. Without the > > > > > > > > > > > > > patch, a single run of /bin/ls did 6 sysctls, > > > > > > > > > > > > > with the patch, no sysctls is queried at all. > > > > > > > > > > > > >=20 > > > > > > > > > > > Comparing with the originally posted patch, I > > > > > > > > > > > added support for all architectures, tested amd64 > > > > > > > > > > > and ia32 on amd64, and converted getpagesizes(3) > > > > > > > > > > > that added two more startup sysctls. > > > > > > > > > > >=20 > > > > > > > > > > > Would be nice to get a testing for at least > > > > > > > > > > > some !x86 architectures before the commit, I > > > > > > > > > > > added some people who helped me in past, to the > > > > > > > > > > > Cc:. > > > > > > > > > > >=20 > > > > > > > > > >=20 > > > > > > > > > > Doesn't look good on sparc64: > > > > > > > > > > <...> > > > > > > > > > > NFS ROOT: 192.168.1.40:/usr/data/nfsroot/sparc64 > > > > > > > > > > dc1: link state changed to UP > > > > > > > > > > pid 24 (ifconfig), uid 0: exited on signal 11 > > > > > > > > > > Segmentation fault > > > > > > > > > > Interface IP-Address Broadcast > > > > > > > > > > pid 29 (rcorder), uid 0: exited on signal 11 > > > > > > > > > > Segmentation fault > > > > > > > > > > pid 30 (grep), uid 0: exited on signal 11 > > > > > > > > > > Segmentation fault > > > > > > > > > > pid 31 (rcorder), uid 0: exited on signal 11 > > > > > > > > > > Segmentation fault > > > > > > > > > > =20 > > > > > > > > > > pid 32 (date), uid 0: exited on signal 11 > > > > > > > > > > Segmentation fault > > > > > > > > > > Jun 29 12:20:50 getty[36]: open /dev/ttyv3: No such > > > > > > > > > > file or directory <...> > > > > > > > > > >=20 > > > > > > > > > > Unfortunately, I currently lack the time to debug > > > > > > > > > > this. > > > > > > > > >=20 > > > > > > > > > Thank you. > > > > > > > >=20 > > > > > > > > Did yu have time to look at this problem? It would be > > > > > > > > nice to have this in the tree. > > > > > > >=20 > > > > > > > I cannot move forward without the help from somebody > > > > > > > having access to sparc64 system where the problem is > > > > > > > reproducable. > > > > > >=20 > > > > > > Do you have a debug version of the patch which outputs the > > > > > > necessary information? > > > > >=20 > > > > > I would suggest to build rtld and libc with debugging symbols > > > > > and get full backtrace from the faults. > > > >=20 > > > > v100# gdb /sbin/ifconfig ifconfig.core > > > > 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 > > > > "sparc64-marcel-freebsd"... Core was generated by `ifconfig'. > > > > Program terminated with signal 11, Segmentation fault. > > > > Reading symbols from /lib/libbsdxml.so.4...done. > > > > Loaded symbols for /lib/libbsdxml.so.4 > > > > Reading symbols from /lib/libjail.so.1...done. > > > > Loaded symbols for /lib/libjail.so.1 > > > > Reading symbols from /lib/libsbuf.so.5...done. > > > > Loaded symbols for /lib/libsbuf.so.5 > > > > Reading symbols from /lib/libipx.so.5...done. > > > > Loaded symbols for /lib/libipx.so.5 > > > > Reading symbols from /lib/libc.so.7...done. > > > > Loaded symbols for /lib/libc.so.7 > > > > Reading symbols from /libexec/ld-elf.so.1...done. > > > > Loaded symbols for /libexec/ld-elf.so.1 > > > > #0 0x000000004089ebdc in getpagesizes (pagesize=3D0x7fdffffe2f8, > > > > nelem=3D1) > > > > at /usr/home/marius/co/head/src/lib/libc/gen/getpagesizes.c:75 > > > > 75 while (nops > 0 && ps[nops - 1] =3D=3D 0) > > > > (gdb) bt #0 0x000000004089ebdc in getpagesizes > > > > (pagesize=3D0x7fdffffe2f8, nelem=3D1) > > > > at /usr/home/marius/co/head/src/lib/libc/gen/getpagesizes.c:75 > > > > #1 0x00000000407f4314 in malloc_init () > > > > at /usr/home/marius/co/head/src/lib/libc/stdlib/malloc.c:5418 > > > > #2 0x00000000407f67d8 in malloc (size=3D32) > > > > at /usr/home/marius/co/head/src/lib/libc/stdlib/malloc.c:5932 > > > > #3 0x00000000001069ac in clone_setdefcallback > > > > (ifprefix=3D0x11b8a8 "wlan", p=3D0x10a1a0 ) > > > > at /usr/home/marius/co/head/src/sbin/ifconfig/ifclone.c:106 #4 > > > > 0x0000000000119864 in __do_global_ctors_aux () #5 > > > > 0x000000000010243c in _init () #6 0x0000000000102508 in _start > > > > () #7 0x000000004022719c in .rtld_start () > > > > at /usr/home/marius/co/head/src/libexec/rtld-elf/sparc64/rtld_s= tart.S:59 > > > > #8 0x000000004022719c in .rtld_start () > > > > at /usr/home/marius/co/head/src/libexec/rtld-elf/sparc64/rtld_s= tart.S:59 > > > > Previous frame identical to this frame (corrupt stack?) > > > >=20 > > > > All faults I've looked at died the same why. > > > Thank you. I think I found the reason, which was an unitialized > > > variable. I also fixed a sillyness with osrelver. > > >=20 > > > In the patched tree, there is tools/test/auxinfo that could be > > > used to quick-check the system. > > >=20 > > > Updated patch is available at > > > http://people.freebsd.org/~kib/misc/rtld_auxinfo.1.patch > >=20 > > I can confirm that this versions works on sparc64. > After the discussion with Alexander, I made the change to allow libc > to access aux vectors, instead of providing rtld interface to fetch > values. >=20 > I decided to keep the single function that fetch the values, because > it is convenient place to do digesting of the vector. >=20 > http://people.freebsd.org/~kib/misc/rtld_auxinfo.2.patch No objections here. --=20 Alexander Kabaev --Sig_/JyNWM5YA/rxlgfSEl4LreCt Content-Type: application/pgp-signature; name=signature.asc Content-Disposition: attachment; filename=signature.asc -----BEGIN PGP SIGNATURE----- Version: GnuPG v2.0.16 (FreeBSD) iD8DBQFMaUmlQ6z1jMm+XZYRAjNPAJ9nAnXrSOZCNLup/R4ak5yGbnGi8QCgztgI aVibb0fja+mVl/rZULfWCQ4= =eF6S -----END PGP SIGNATURE----- --Sig_/JyNWM5YA/rxlgfSEl4LreCt-- From owner-freebsd-hackers@FreeBSD.ORG Mon Aug 16 16:46:03 2010 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 7AB401065695; Mon, 16 Aug 2010 16:46:03 +0000 (UTC) (envelope-from osharoiko@gmail.com) Received: from mail-iw0-f182.google.com (mail-iw0-f182.google.com [209.85.214.182]) by mx1.freebsd.org (Postfix) with ESMTP id 30EDA8FC1A; Mon, 16 Aug 2010 16:46:02 +0000 (UTC) Received: by iwn10 with SMTP id 10so2078405iwn.13 for ; Mon, 16 Aug 2010 09:46:02 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:mime-version:received:received:in-reply-to :references:date:message-id:subject:from:to:cc:content-type; bh=CkJQs94YuGoAjYWSp3CMTYTbLg/Dg5qfKxODJ/LzxOE=; b=E6IK8P2eZVtVI5cT6PiFjsqxDnMKeIutADZw2VHRLqe8o/nLjAuyOEBpHOyt/J0Z+n c8t9w65cc/X8cnaej0GsP2+XCR6rwnyNftt4xhrgLLozp4P4KkA6ZErthxKhuX+tKrAI ubPHUh10oj19AAcrd8OdJxxZpltflCIcadbOY= 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; b=TwCB4hgamtExBtByzRE6So188YZuzQypkmAuO8JveLAY7CMTd1cE8c5QUBTmgmt76q FrD9VeQZHGS7HJY8VSDAUojGrMPusbH029xZ7EpsaGheTrloXUcB2iDAJdPtxt5kRG2B UBtpnA3YtVmt7akzpmlyji6RMoiA5ovTZp6cs= MIME-Version: 1.0 Received: by 10.231.33.73 with SMTP id g9mr5554325ibd.117.1281977162259; Mon, 16 Aug 2010 09:46:02 -0700 (PDT) Received: by 10.231.185.7 with HTTP; Mon, 16 Aug 2010 09:46:02 -0700 (PDT) In-Reply-To: References: <201008041112.28704.jhb@freebsd.org> <201008051145.53737.jhb@freebsd.org> <20100805200022.GB3610@panther.nvidia.com> Date: Mon, 16 Aug 2010 20:46:02 +0400 Message-ID: From: Oleg Sharoyko To: Christian Zander Content-Type: text/plain; charset=UTF-8 Cc: "freebsd-hackers@freebsd.org" Subject: Re: PCI config space is not restored upon resume (macbook pro) 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, 16 Aug 2010 16:46:03 -0000 On 6 August 2010 08:15, Oleg Sharoyko wrote: >> When using the NVIDIA driver, you will need to make sure that >> you're using 256.44, you'll need to be running X at the time of >> entry to S3/S4, and you'll need to make sure you've switched >> away from X's VT (this didn't happen automatically on FreeBSD >> last time I checked). > I'll give 256.44 a try, but at first I'll try to fix bios emulation issues. Sorry for a long delay - it has been a really busy week here. It does indeed works with 256.44 just the way you describe. Though I had a couple of strange lockups of ACPI subsystem, but I haven't had enough time to debug them. I guess other drivers could also work if only this wasn't a MacBook. FreeBSD can call BIOS reset, but it looks like this doesn't work with MacBook as it has no BIOS, and would require to copy video card BIOS into memory and execute it in emulation mode. I've seen such a code for linux loader (to boot linux in non-emulation mode), but I don't think it worth doing this on resume. -- Oleg Sharoyko From owner-freebsd-hackers@FreeBSD.ORG Mon Aug 16 17:18:18 2010 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 0EFB8106576E; Mon, 16 Aug 2010 17:18:15 +0000 (UTC) (envelope-from marius@alchemy.franken.de) Received: from alchemy.franken.de (alchemy.franken.de [194.94.249.214]) by mx1.freebsd.org (Postfix) with ESMTP id 7DC898FC18; Mon, 16 Aug 2010 17:18:14 +0000 (UTC) Received: from alchemy.franken.de (localhost [127.0.0.1]) by alchemy.franken.de (8.14.3/8.14.3/ALCHEMY.FRANKEN.DE) with ESMTP id o7GHICBF022457; Mon, 16 Aug 2010 19:18:12 +0200 (CEST) (envelope-from marius@alchemy.franken.de) Received: (from marius@localhost) by alchemy.franken.de (8.14.3/8.14.3/Submit) id o7GHIBJm022456; Mon, 16 Aug 2010 19:18:11 +0200 (CEST) (envelope-from marius) Date: Mon, 16 Aug 2010 19:18:11 +0200 From: Marius Strobl To: Kostik Belousov Message-ID: <20100816171811.GC904@alchemy.franken.de> References: <20100806050633.GK14016@felucia.tataz.chchile.org> <20100806090404.GI22295@deviant.kiev.zoral.com.ua> <20100806110807.GA68489@alchemy.franken.de> <20100806111131.GN22295@deviant.kiev.zoral.com.ua> <20100807135939.GA875@alchemy.franken.de> <20100807180904.GZ22295@deviant.kiev.zoral.com.ua> <20100807193722.GB875@alchemy.franken.de> <20100814143225.GA2396@deviant.kiev.zoral.com.ua> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20100814143225.GA2396@deviant.kiev.zoral.com.ua> User-Agent: Mutt/1.4.2.3i Cc: kan@freebsd.org, FreeBSD Hackers , Jeremie Le Hen , nwhitehorn@freebsd.org Subject: Re: Avoiding sysctl at program startup using ELF aux vector (was: concurrent sysctl implementation) 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, 16 Aug 2010 17:18:18 -0000 On Sat, Aug 14, 2010 at 05:32:25PM +0300, Kostik Belousov wrote: > On Sat, Aug 07, 2010 at 09:37:22PM +0200, Marius Strobl wrote: > > On Sat, Aug 07, 2010 at 09:09:04PM +0300, Kostik Belousov wrote: > > > On Sat, Aug 07, 2010 at 03:59:39PM +0200, Marius Strobl wrote: > > > > On Fri, Aug 06, 2010 at 02:11:31PM +0300, Kostik Belousov wrote: > > > > > On Fri, Aug 06, 2010 at 01:08:08PM +0200, Marius Strobl wrote: > > > > > > On Fri, Aug 06, 2010 at 12:04:04PM +0300, Kostik Belousov wrote: > > > > > > > On Fri, Aug 06, 2010 at 07:06:33AM +0200, Jeremie Le Hen wrote: > > > > > > > > Hi Kib, > > > > > > > > > > > > > > > > In-Reply-To: <20100629083901.GG13238@deviant.kiev.zoral.com.ua> > > > > > > > > On Tue, Jun 29, 2010 at 11:39:01AM +0300, Kostik Belousov wrote: > > > > > > > > > On Tue, Jun 29, 2010 at 10:26:39AM +0200, Marius Strobl wrote: > > > > > > > > > > On Mon, Jun 28, 2010 at 05:48:59PM +0300, Kostik Belousov wrote: > > > > > > > > > > > On Wed, Jun 23, 2010 at 11:09:59PM +0200, Jeremie Le Hen wrote: > > > > > > > > > > > > Hi Kostik, > > > > > > > > > > > > > > > > > > > > > > > > This patch seems to have faded out from memory. Is it possible to go > > > > > > > > > > > > forward and commit it? > > > > > > > > > > > I refreshed the patch. Hopefully, nobody will object, and I commit it > > > > > > > > > > > shortly. > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > Thanks, > > > > > > > > > > > > Regards. > > > > > > > > > > > > > > > > > > > > > > > > On Sat, Jul 25, 2009 at 12:29:16AM +0300, Kostik Belousov wrote: > > > > > > > > > > > > > Below is the prototype that seems to work for me both with patched and > > > > > > > > > > > > > old rtld on i386. Patch also contains bits for amd64 that I did not > > > > > > > > > > > > > tested yet. All other arches are not buildable for now. > > > > > > > > > > > > > > > > > > > > > > > > > > Patch completely eliminates sysctl syscalls from the rtld and libc > > > > > > > > > > > > > startup. Without the patch, a single run of /bin/ls did 6 sysctls, > > > > > > > > > > > > > with the patch, no sysctls is queried at all. > > > > > > > > > > > > > > > > > > > > > > > > Comparing with the originally posted patch, I added support for all > > > > > > > > > > > architectures, tested amd64 and ia32 on amd64, and converted getpagesizes(3) > > > > > > > > > > > that added two more startup sysctls. > > > > > > > > > > > > > > > > > > > > > > Would be nice to get a testing for at least some !x86 architectures > > > > > > > > > > > before the commit, I added some people who helped me in past, to the Cc:. > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > Doesn't look good on sparc64: > > > > > > > > > > <...> > > > > > > > > > > NFS ROOT: 192.168.1.40:/usr/data/nfsroot/sparc64 > > > > > > > > > > dc1: link state changed to UP > > > > > > > > > > pid 24 (ifconfig), uid 0: exited on signal 11 > > > > > > > > > > Segmentation fault > > > > > > > > > > Interface IP-Address Broadcast > > > > > > > > > > pid 29 (rcorder), uid 0: exited on signal 11 > > > > > > > > > > Segmentation fault > > > > > > > > > > pid 30 (grep), uid 0: exited on signal 11 > > > > > > > > > > Segmentation fault > > > > > > > > > > pid 31 (rcorder), uid 0: exited on signal 11 > > > > > > > > > > Segmentation fault > > > > > > > > > > > > > > > > > > > > pid 32 (date), uid 0: exited on signal 11 > > > > > > > > > > Segmentation fault > > > > > > > > > > Jun 29 12:20:50 getty[36]: open /dev/ttyv3: No such file or directory > > > > > > > > > > <...> > > > > > > > > > > > > > > > > > > > > Unfortunately, I currently lack the time to debug this. > > > > > > > > > > > > > > > > > > Thank you. > > > > > > > > > > > > > > > > Did yu have time to look at this problem? It would be nice to have this > > > > > > > > in the tree. > > > > > > > > > > > > > > I cannot move forward without the help from somebody having access to > > > > > > > sparc64 system where the problem is reproducable. > > > > > > > > > > > > Do you have a debug version of the patch which outputs the necessary > > > > > > information? > > > > > > > > > > I would suggest to build rtld and libc with debugging symbols and > > > > > get full backtrace from the faults. > > > > > > > > v100# gdb /sbin/ifconfig ifconfig.core > > > > 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 "sparc64-marcel-freebsd"... > > > > Core was generated by `ifconfig'. > > > > Program terminated with signal 11, Segmentation fault. > > > > Reading symbols from /lib/libbsdxml.so.4...done. > > > > Loaded symbols for /lib/libbsdxml.so.4 > > > > Reading symbols from /lib/libjail.so.1...done. > > > > Loaded symbols for /lib/libjail.so.1 > > > > Reading symbols from /lib/libsbuf.so.5...done. > > > > Loaded symbols for /lib/libsbuf.so.5 > > > > Reading symbols from /lib/libipx.so.5...done. > > > > Loaded symbols for /lib/libipx.so.5 > > > > Reading symbols from /lib/libc.so.7...done. > > > > Loaded symbols for /lib/libc.so.7 > > > > Reading symbols from /libexec/ld-elf.so.1...done. > > > > Loaded symbols for /libexec/ld-elf.so.1 > > > > #0 0x000000004089ebdc in getpagesizes (pagesize=0x7fdffffe2f8, nelem=1) > > > > at /usr/home/marius/co/head/src/lib/libc/gen/getpagesizes.c:75 > > > > 75 while (nops > 0 && ps[nops - 1] == 0) > > > > (gdb) bt > > > > #0 0x000000004089ebdc in getpagesizes (pagesize=0x7fdffffe2f8, nelem=1) > > > > at /usr/home/marius/co/head/src/lib/libc/gen/getpagesizes.c:75 > > > > #1 0x00000000407f4314 in malloc_init () > > > > at /usr/home/marius/co/head/src/lib/libc/stdlib/malloc.c:5418 > > > > #2 0x00000000407f67d8 in malloc (size=32) > > > > at /usr/home/marius/co/head/src/lib/libc/stdlib/malloc.c:5932 > > > > #3 0x00000000001069ac in clone_setdefcallback (ifprefix=0x11b8a8 "wlan", > > > > p=0x10a1a0 ) > > > > at /usr/home/marius/co/head/src/sbin/ifconfig/ifclone.c:106 > > > > #4 0x0000000000119864 in __do_global_ctors_aux () > > > > #5 0x000000000010243c in _init () > > > > #6 0x0000000000102508 in _start () > > > > #7 0x000000004022719c in .rtld_start () > > > > at /usr/home/marius/co/head/src/libexec/rtld-elf/sparc64/rtld_start.S:59 > > > > #8 0x000000004022719c in .rtld_start () > > > > at /usr/home/marius/co/head/src/libexec/rtld-elf/sparc64/rtld_start.S:59 > > > > Previous frame identical to this frame (corrupt stack?) > > > > > > > > All faults I've looked at died the same why. > > > Thank you. I think I found the reason, which was an unitialized > > > variable. I also fixed a sillyness with osrelver. > > > > > > In the patched tree, there is tools/test/auxinfo that could be used to > > > quick-check the system. > > > > > > Updated patch is available at > > > http://people.freebsd.org/~kib/misc/rtld_auxinfo.1.patch > > > > I can confirm that this versions works on sparc64. > After the discussion with Alexander, I made the change to allow libc to > access aux vectors, instead of providing rtld interface to fetch values. > > I decided to keep the single function that fetch the values, because it > is convenient place to do digesting of the vector. > > http://people.freebsd.org/~kib/misc/rtld_auxinfo.2.patch This version also works on sparc64 (I've verified that no sysctls are invoked during startup). Marius From owner-freebsd-hackers@FreeBSD.ORG Mon Aug 16 18:22:17 2010 Return-Path: Delivered-To: freebsd-hackers@freebsd.org Received: from [127.0.0.1] (freefall.freebsd.org [IPv6:2001:4f8:fff6::28]) by hub.freebsd.org (Postfix) with ESMTP id D29F0106566B; Mon, 16 Aug 2010 18:22:16 +0000 (UTC) (envelope-from jkim@FreeBSD.org) From: Jung-uk Kim To: freebsd-hackers@freebsd.org Date: Mon, 16 Aug 2010 14:21:52 -0400 User-Agent: KMail/1.6.2 References: In-Reply-To: MIME-Version: 1.0 Content-Disposition: inline Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: 7bit Message-Id: <201008161422.01541.jkim@FreeBSD.org> Cc: Christian Zander , Oleg Sharoyko Subject: Re: PCI config space is not restored upon resume (macbook pro) 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, 16 Aug 2010 18:22:17 -0000 On Monday 16 August 2010 12:46 pm, Oleg Sharoyko wrote: > On 6 August 2010 08:15, Oleg Sharoyko wrote: > >> When using the NVIDIA driver, you will need to make sure that > >> you're using 256.44, you'll need to be running X at the time of > >> entry to S3/S4, and you'll need to make sure you've switched > >> away from X's VT (this didn't happen automatically on FreeBSD > >> last time I checked). > > > > I'll give 256.44 a try, but at first I'll try to fix bios > > emulation issues. > > Sorry for a long delay - it has been a really busy week here. It > does indeed works with 256.44 just the way you describe. Though I > had a couple of strange lockups of ACPI subsystem, but I haven't > had enough time to debug them. I guess other drivers could also > work if only this wasn't a MacBook. FreeBSD can call BIOS reset, > but it looks like this doesn't work with MacBook as it has no BIOS, > and would require to copy video card BIOS into memory and execute > it in emulation mode. I've seen such a code for linux loader (to > boot linux in non-emulation mode), but I don't think it worth doing > this on resume. I am glad to hear it helped. :-) In theory, we can shadow video ROM and execute it in emulation *iff* it actually contains x86 real mode code. It won't be too hard but I am not sure whether it is worth trying. Are you sure the option ROM is actually real mode code but not shadowed again after resume? FYI, you can add a printf() in sys/dev/fb/vesa.c like this to verify, I think: if (x86bios_get_orm(0xc0000) == NULL) { printf("No option ROM found\n"); return (1); } Jung-uk Kim From owner-freebsd-hackers@FreeBSD.ORG Mon Aug 16 18:30:58 2010 Return-Path: Delivered-To: freebsd-hackers@freebsd.org Received: from [127.0.0.1] (freefall.freebsd.org [IPv6:2001:4f8:fff6::28]) by hub.freebsd.org (Postfix) with ESMTP id 1A5A810656A5; Mon, 16 Aug 2010 18:30:58 +0000 (UTC) (envelope-from jkim@FreeBSD.org) From: Jung-uk Kim To: freebsd-hackers@freebsd.org Date: Mon, 16 Aug 2010 14:30:32 -0400 User-Agent: KMail/1.6.2 References: <201008161422.01541.jkim@FreeBSD.org> In-Reply-To: <201008161422.01541.jkim@FreeBSD.org> MIME-Version: 1.0 Content-Disposition: inline Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: 7bit Message-Id: <201008161430.44974.jkim@FreeBSD.org> Cc: Christian Zander , Oleg Sharoyko Subject: Re: PCI config space is not restored upon resume (macbook pro) 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, 16 Aug 2010 18:30:58 -0000 On Monday 16 August 2010 02:21 pm, Jung-uk Kim wrote: > On Monday 16 August 2010 12:46 pm, Oleg Sharoyko wrote: > > On 6 August 2010 08:15, Oleg Sharoyko wrote: > > >> When using the NVIDIA driver, you will need to make sure that > > >> you're using 256.44, you'll need to be running X at the time > > >> of entry to S3/S4, and you'll need to make sure you've > > >> switched away from X's VT (this didn't happen automatically on > > >> FreeBSD last time I checked). > > > > > > I'll give 256.44 a try, but at first I'll try to fix bios > > > emulation issues. > > > > Sorry for a long delay - it has been a really busy week here. It > > does indeed works with 256.44 just the way you describe. Though I > > had a couple of strange lockups of ACPI subsystem, but I haven't > > had enough time to debug them. I guess other drivers could also > > work if only this wasn't a MacBook. FreeBSD can call BIOS reset, > > but it looks like this doesn't work with MacBook as it has no > > BIOS, and would require to copy video card BIOS into memory and > > execute it in emulation mode. I've seen such a code for linux > > loader (to boot linux in non-emulation mode), but I don't think > > it worth doing this on resume. > > I am glad to hear it helped. :-) > > In theory, we can shadow video ROM and execute it in emulation > *iff* it actually contains x86 real mode code. It won't be too > hard but I am not sure whether it is worth trying. Are you sure > the option ROM is actually real mode code but not shadowed again > after resume? FYI, you can add a printf() in sys/dev/fb/vesa.c > like this to verify, I think: > > if (x86bios_get_orm(0xc0000) == NULL) { > printf("No option ROM found\n"); > return (1); > } I forgot "where" to add it. It's in vesa_bios_post(). You need to replace: if (x86bios_get_orm(0xc0000) == NULL) return (1); with the above three lines. Just in case. :-) Jung-uk Kim From owner-freebsd-hackers@FreeBSD.ORG Mon Aug 16 21:16:01 2010 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 89DBD10656A7; Mon, 16 Aug 2010 21:16:01 +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 5A7DC8FC24; Mon, 16 Aug 2010 21:16:01 +0000 (UTC) Received: from bigwig.baldwin.cx (66.111.2.69.static.nyinternet.net [66.111.2.69]) by cyrus.watson.org (Postfix) with ESMTPSA id 0977A46B06; Mon, 16 Aug 2010 17:16:01 -0400 (EDT) Received: from jhbbsd.localnet (smtp.hudson-trading.com [209.249.190.9]) by bigwig.baldwin.cx (Postfix) with ESMTPSA id C61428A04E; Mon, 16 Aug 2010 17:15:58 -0400 (EDT) From: John Baldwin To: freebsd-hackers@freebsd.org Date: Mon, 16 Aug 2010 16:11:11 -0400 User-Agent: KMail/1.13.5 (FreeBSD/7.3-CBSD-20100217; KDE/4.4.5; amd64; ; ) References: <201008091213.o79CD3I6061232@fire.js.berklix.net> In-Reply-To: <201008091213.o79CD3I6061232@fire.js.berklix.net> MIME-Version: 1.0 Content-Type: Text/Plain; charset="iso-8859-15" Content-Transfer-Encoding: 7bit Message-Id: <201008161611.11974.jhb@freebsd.org> X-Greylist: Sender succeeded SMTP AUTH, not delayed by milter-greylist-4.0.1 (bigwig.baldwin.cx); Mon, 16 Aug 2010 17:15:58 -0400 (EDT) X-Virus-Scanned: clamav-milter 0.95.1 at bigwig.baldwin.cx X-Virus-Status: Clean X-Spam-Status: No, score=-2.6 required=4.2 tests=AWL,BAYES_00 autolearn=ham version=3.2.5 X-Spam-Checker-Version: SpamAssassin 3.2.5 (2008-06-10) on bigwig.baldwin.cx Cc: "Julian H. Stacey" , hackers@freebsd.org Subject: Re: real memory falsely reports 8G, BIOS & avail memory reports 1G 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, 16 Aug 2010 21:16:01 -0000 On Monday, August 09, 2010 8:13:03 am Julian H. Stacey wrote: > Hi hackers@freebsd.org > A laptop here emits a puzzlingly dmesg to both 8.1-RC2 & 8.1-RELEASE: > real memory = 8572108800 (8175 MB) > avail memory = 1018789888 (971 MB) > BIOS reckons it has 1G. No panel to unscrew to inspect memory. > I don't beleive 8G. > > If this is a bug in FreeBSD detect code ? > I am ready to run test kernel patches againt 8.1-RELEASE > & report back if anyone has code. > (I have room to install a current too if necessary) > > Full dmesg here: > http://www.berklix.com/~jhs/hardware/laptops/novatech-8355/dmesg/ > > Cheers, > Julian Hmm, do you have dmidecode output? -- John Baldwin From owner-freebsd-hackers@FreeBSD.ORG Mon Aug 16 21:16:01 2010 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 89DBD10656A7; Mon, 16 Aug 2010 21:16:01 +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 5A7DC8FC24; Mon, 16 Aug 2010 21:16:01 +0000 (UTC) Received: from bigwig.baldwin.cx (66.111.2.69.static.nyinternet.net [66.111.2.69]) by cyrus.watson.org (Postfix) with ESMTPSA id 0977A46B06; Mon, 16 Aug 2010 17:16:01 -0400 (EDT) Received: from jhbbsd.localnet (smtp.hudson-trading.com [209.249.190.9]) by bigwig.baldwin.cx (Postfix) with ESMTPSA id C61428A04E; Mon, 16 Aug 2010 17:15:58 -0400 (EDT) From: John Baldwin To: freebsd-hackers@freebsd.org Date: Mon, 16 Aug 2010 16:11:11 -0400 User-Agent: KMail/1.13.5 (FreeBSD/7.3-CBSD-20100217; KDE/4.4.5; amd64; ; ) References: <201008091213.o79CD3I6061232@fire.js.berklix.net> In-Reply-To: <201008091213.o79CD3I6061232@fire.js.berklix.net> MIME-Version: 1.0 Content-Type: Text/Plain; charset="iso-8859-15" Content-Transfer-Encoding: 7bit Message-Id: <201008161611.11974.jhb@freebsd.org> X-Greylist: Sender succeeded SMTP AUTH, not delayed by milter-greylist-4.0.1 (bigwig.baldwin.cx); Mon, 16 Aug 2010 17:15:58 -0400 (EDT) X-Virus-Scanned: clamav-milter 0.95.1 at bigwig.baldwin.cx X-Virus-Status: Clean X-Spam-Status: No, score=-2.6 required=4.2 tests=AWL,BAYES_00 autolearn=ham version=3.2.5 X-Spam-Checker-Version: SpamAssassin 3.2.5 (2008-06-10) on bigwig.baldwin.cx Cc: "Julian H. Stacey" , hackers@freebsd.org Subject: Re: real memory falsely reports 8G, BIOS & avail memory reports 1G 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, 16 Aug 2010 21:16:01 -0000 On Monday, August 09, 2010 8:13:03 am Julian H. Stacey wrote: > Hi hackers@freebsd.org > A laptop here emits a puzzlingly dmesg to both 8.1-RC2 & 8.1-RELEASE: > real memory = 8572108800 (8175 MB) > avail memory = 1018789888 (971 MB) > BIOS reckons it has 1G. No panel to unscrew to inspect memory. > I don't beleive 8G. > > If this is a bug in FreeBSD detect code ? > I am ready to run test kernel patches againt 8.1-RELEASE > & report back if anyone has code. > (I have room to install a current too if necessary) > > Full dmesg here: > http://www.berklix.com/~jhs/hardware/laptops/novatech-8355/dmesg/ > > Cheers, > Julian Hmm, do you have dmidecode output? -- John Baldwin From owner-freebsd-hackers@FreeBSD.ORG Mon Aug 16 21:16:02 2010 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 F20671065696 for ; Mon, 16 Aug 2010 21:16:02 +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 C29648FC27 for ; Mon, 16 Aug 2010 21:16:02 +0000 (UTC) Received: from bigwig.baldwin.cx (66.111.2.69.static.nyinternet.net [66.111.2.69]) by cyrus.watson.org (Postfix) with ESMTPSA id 7208846B35; Mon, 16 Aug 2010 17:16:02 -0400 (EDT) Received: from jhbbsd.localnet (smtp.hudson-trading.com [209.249.190.9]) by bigwig.baldwin.cx (Postfix) with ESMTPSA id 72C438A04F; Mon, 16 Aug 2010 17:16:01 -0400 (EDT) From: John Baldwin To: freebsd-hackers@freebsd.org Date: Mon, 16 Aug 2010 16:19:35 -0400 User-Agent: KMail/1.13.5 (FreeBSD/7.3-CBSD-20100217; KDE/4.4.5; amd64; ; ) References: In-Reply-To: MIME-Version: 1.0 Content-Type: Text/Plain; charset="iso-8859-1" Content-Transfer-Encoding: 7bit Message-Id: <201008161619.35740.jhb@freebsd.org> X-Greylist: Sender succeeded SMTP AUTH, not delayed by milter-greylist-4.0.1 (bigwig.baldwin.cx); Mon, 16 Aug 2010 17:16:01 -0400 (EDT) X-Virus-Scanned: clamav-milter 0.95.1 at bigwig.baldwin.cx X-Virus-Status: Clean X-Spam-Status: No, score=-2.6 required=4.2 tests=AWL,BAYES_00 autolearn=ham version=3.2.5 X-Spam-Checker-Version: SpamAssassin 3.2.5 (2008-06-10) on bigwig.baldwin.cx Cc: Garrett Cooper Subject: Re: Why doesn't ppc(4) check non-ENXIO failures during probe? 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, 16 Aug 2010 21:16:03 -0000 On Sunday, August 15, 2010 1:33:38 am Garrett Cooper wrote: > One thing that's puzzling me about the ppc(4) driver's ISA > routines is that it only checks to see whether or not the device has > an IO error: Your patch would break hinted ppc devices. ENXIO means that the device_t being probed has an ISA PNP ID, but it does not match any of the IDs in the list. ENONET means that the device_t does not have an ISA ID at all. For the isa bus that means it was explicitly created via a set of ppc.X hints. -- John Baldwin From owner-freebsd-hackers@FreeBSD.ORG Mon Aug 16 23:23:56 2010 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 BE9BF1065694; Mon, 16 Aug 2010 23:23:56 +0000 (UTC) (envelope-from yanegomi@gmail.com) Received: from mail-bw0-f54.google.com (mail-bw0-f54.google.com [209.85.214.54]) by mx1.freebsd.org (Postfix) with ESMTP id 1D5A88FC0C; Mon, 16 Aug 2010 23:23:55 +0000 (UTC) Received: by bwz20 with SMTP id 20so2751142bwz.13 for ; Mon, 16 Aug 2010 16:23:55 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:mime-version:received:received:in-reply-to :references:date:message-id:subject:from:to:cc:content-type :content-transfer-encoding; bh=13HAM+h+O3KoS1M7ItSdvU1lpJozebzEVfbRqLDundw=; b=A3hGk/chiefpO71YkLDnzwQv9lSDrop+doHHM5tZOfYE3LfyEcwWehbdB8/yFCkcON UDvB2HhDukYih6+7dnACg+LCHlZmIxOioc+utDX4Wm71pyrcRg6CgP4ykohbzLmkTBn9 agZUPWfHbmuCmjjLPD+4PEvpi3tkKqwSDjHQE= 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=bHbUAtlmCkspISUFh54kW8S1dSuqZ4kpiBFuJPjOZ3KKqD3n8ULE78dfD3iLxdIAk3 ajYnmo9+18oAKVRg1IHOtZqYAm5mAe9VXZ3urhdDv9CDTps9+XkTFcyYYnpZIV+EEB9b 4VYaQsPbhF3yowaW/0nJKhL/kYvm3OCvPg1IQ= MIME-Version: 1.0 Received: by 10.204.23.81 with SMTP id q17mr3883285bkb.58.1282001034714; Mon, 16 Aug 2010 16:23:54 -0700 (PDT) Received: by 10.204.82.6 with HTTP; Mon, 16 Aug 2010 16:23:54 -0700 (PDT) In-Reply-To: <201008161619.35740.jhb@freebsd.org> References: <201008161619.35740.jhb@freebsd.org> Date: Mon, 16 Aug 2010 16:23:54 -0700 Message-ID: From: Garrett Cooper To: John Baldwin Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: quoted-printable X-Mailman-Approved-At: Tue, 17 Aug 2010 02:42:56 +0000 Cc: freebsd-hackers@freebsd.org Subject: Re: Why doesn't ppc(4) check non-ENXIO failures during probe? 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, 16 Aug 2010 23:23:56 -0000 On Mon, Aug 16, 2010 at 1:19 PM, John Baldwin wrote: > On Sunday, August 15, 2010 1:33:38 am Garrett Cooper wrote: >> =A0 =A0 One thing that's puzzling me about the ppc(4) driver's ISA >> routines is that it only checks to see whether or not the device has >> an IO error: > > Your patch would break hinted ppc devices. =A0ENXIO means that the device= _t > being probed has an ISA PNP ID, but it does not match any of the IDs in t= he > list. =A0ENONET means that the device_t does not have an ISA ID at all. = =A0For the > isa bus that means it was explicitly created via a set of ppc.X hints. Just clarifying some things because I don't know all of the details. If a ISA based parallel port fails to probe with ENOENT, then it's assumed that the configuration details are incorrect, and it should reprobe the device with different configuration settings (irq, isa port, etc) a max of BIOS_MAX_PPC times before it finally bails failing to configure a device (ppc_probe in ppc.c)? What if all of the ISA details in the device.hints file are bogus and the only detail that's correct is in the puc driver, etc? Would it fail to connect the card if it reached the BIOS_MAX_PPC ISA-related failure limit (see ppc_probe again)? Thanks, -Garrett From owner-freebsd-hackers@FreeBSD.ORG Tue Aug 17 11:49:50 2010 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 3685F10656A4 for ; Tue, 17 Aug 2010 11:49:50 +0000 (UTC) (envelope-from jhs@berklix.com) Received: from tower.berklix.org (tower.berklix.org [83.236.223.114]) by mx1.freebsd.org (Postfix) with ESMTP id B28EE8FC0C for ; Tue, 17 Aug 2010 11:49:49 +0000 (UTC) Received: from park.js.berklix.net (p549A57CF.dip.t-dialin.net [84.154.87.207]) (authenticated bits=0) by tower.berklix.org (8.14.2/8.14.2) with ESMTP id o7HBngjW049402; Tue, 17 Aug 2010 11:49:43 GMT (envelope-from jhs@berklix.com) Received: from fire.js.berklix.net (fire.js.berklix.net [192.168.91.41]) by park.js.berklix.net (8.13.8/8.13.8) with ESMTP id o7HBnWo4033817; Tue, 17 Aug 2010 13:49:32 +0200 (CEST) (envelope-from jhs@berklix.com) Received: from fire.js.berklix.net (localhost [127.0.0.1]) by fire.js.berklix.net (8.14.3/8.14.3) with ESMTP id o7HBnMtp065687; Tue, 17 Aug 2010 13:49:27 +0200 (CEST) (envelope-from jhs@fire.js.berklix.net) Message-Id: <201008171149.o7HBnMtp065687@fire.js.berklix.net> to: freebsd-hackers@freebsd.org From: "Julian H. Stacey" Organization: http://www.berklix.com BSD Unix Linux Consultancy, Munich Germany User-agent: EXMH on FreeBSD http://www.berklix.com/free/ X-URL: http://www.berklix.com In-reply-to: Your message "Mon, 16 Aug 2010 16:11:11 EDT." <201008161611.11974.jhb@freebsd.org> Date: Tue, 17 Aug 2010 13:49:22 +0200 Sender: jhs@berklix.com Cc: Paul Wootton Subject: Re: real memory falsely reports 8G, BIOS & avail memory reports 1G 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, 17 Aug 2010 11:49:50 -0000 John Baldwin wrote: > On Monday, August 09, 2010 8:13:03 am Julian H. Stacey wrote: > > Hi hackers@freebsd.org > > A laptop here emits a puzzlingly dmesg to both 8.1-RC2 & 8.1-RELEASE: > > real memory = 8572108800 (8175 MB) > > avail memory = 1018789888 (971 MB) > > BIOS reckons it has 1G. No panel to unscrew to inspect memory. > > I don't beleive 8G. > > > > If this is a bug in FreeBSD detect code ? > > I am ready to run test kernel patches againt 8.1-RELEASE > > & report back if anyone has code. > > (I have room to install a current too if necessary) > > > > Full dmesg here: > > http://www.berklix.com/~jhs/hardware/laptops/novatech-8355/dmesg/ > > > > Cheers, > > Julian > > Hmm, do you have dmidecode output? Hi, Thanks for interest, Yes here http://www.berklix.com/~jhs/hardware/laptops/novatech-8355/dmidecode/ PS Paul Wootton just mailed me how to physically get to look at the RAM; I will do that & reports back. http://www.overclockers.com/tips1192/index02.asp Cheers, Julian -- Julian Stacey: BSD Unix Linux C Sys Eng Consultants Munich http://berklix.com Mail plain text, Not HTML, quoted-printable & base 64 dumped with spam. Avoid top posting, It cripples itemised cumulative responses. From owner-freebsd-hackers@FreeBSD.ORG Tue Aug 17 13:17:02 2010 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 93B241065693 for ; Tue, 17 Aug 2010 13:17:02 +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 E6BCA8FC27 for ; Tue, 17 Aug 2010 13:17:01 +0000 (UTC) Received: from bigwig.baldwin.cx (66.111.2.69.static.nyinternet.net [66.111.2.69]) by cyrus.watson.org (Postfix) with ESMTPSA id 7E17F46B9E; Tue, 17 Aug 2010 09:17:01 -0400 (EDT) Received: from jhbbsd.localnet (smtp.hudson-trading.com [209.249.190.9]) by bigwig.baldwin.cx (Postfix) with ESMTPSA id 85A348A04E; Tue, 17 Aug 2010 09:17:00 -0400 (EDT) From: John Baldwin To: Garrett Cooper Date: Tue, 17 Aug 2010 09:07:20 -0400 User-Agent: KMail/1.13.5 (FreeBSD/7.3-CBSD-20100217; KDE/4.4.5; amd64; ; ) References: <201008161619.35740.jhb@freebsd.org> In-Reply-To: MIME-Version: 1.0 Content-Type: Text/Plain; charset="iso-8859-1" Content-Transfer-Encoding: 7bit Message-Id: <201008170907.20593.jhb@freebsd.org> X-Greylist: Sender succeeded SMTP AUTH, not delayed by milter-greylist-4.0.1 (bigwig.baldwin.cx); Tue, 17 Aug 2010 09:17:00 -0400 (EDT) X-Virus-Scanned: clamav-milter 0.95.1 at bigwig.baldwin.cx X-Virus-Status: Clean X-Spam-Status: No, score=-2.6 required=4.2 tests=AWL,BAYES_00 autolearn=ham version=3.2.5 X-Spam-Checker-Version: SpamAssassin 3.2.5 (2008-06-10) on bigwig.baldwin.cx Cc: freebsd-hackers@freebsd.org Subject: Re: Why doesn't ppc(4) check non-ENXIO failures during probe? 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, 17 Aug 2010 13:17:02 -0000 On Monday, August 16, 2010 7:23:54 pm Garrett Cooper wrote: > On Mon, Aug 16, 2010 at 1:19 PM, John Baldwin wrote: > > On Sunday, August 15, 2010 1:33:38 am Garrett Cooper wrote: > >> One thing that's puzzling me about the ppc(4) driver's ISA > >> routines is that it only checks to see whether or not the device has > >> an IO error: > > > > Your patch would break hinted ppc devices. ENXIO means that the device_t > > being probed has an ISA PNP ID, but it does not match any of the IDs in the > > list. ENONET means that the device_t does not have an ISA ID at all. For the > > isa bus that means it was explicitly created via a set of ppc.X hints. > > Just clarifying some things because I don't know all of the details. > > If a ISA based parallel port fails to probe with ENOENT, then it's > assumed that the configuration details are incorrect, and it should > reprobe the device with different configuration settings (irq, isa > port, etc) a max of BIOS_MAX_PPC times before it finally bails failing > to configure a device (ppc_probe in ppc.c)? What if all of the ISA > details in the device.hints file are bogus and the only detail that's > correct is in the puc driver, etc? Would it fail to connect the card > if it reached the BIOS_MAX_PPC ISA-related failure limit (see > ppc_probe again)? ISA_PNP_PROBE() does not talk to the hardware, it just compares device IDs. You have to realize that device_t objects on an ISA device come from three sources: 1) "Builtin" devices are auto-enumerated via ACPI or PnP BIOS. Any modern BIOS will do this for things like built in serial ports, ISA timers, PS/2 keyboard, etc. 2) ISA PnP adapters in an ISA slot are enumerated via ISA PnP. 3) Users indicate that specific ISA devices are present via hints. Devices from 1) and 2) have an assigned device ID (HID) and zero-or-more compatibility IDs (CID). ISA_PNP_PROBE() accepts a list of HID IDs and returns true (0) if the HID or any of the CIDs match any of the ids in the list that is passed in. If none of the IDs match it returns ENXIO. Thus for devices from 1) and 2) ISA_PNP_PROBE() returns either 0 or ENXIO. For devices from 3), ISA_PNP_PROBE() will always return ENOENT. Your change would break 3) since those devices would then never probe. ppc_probe() is called to verify that the hardware truly exists at the resources that are claimed. In practice the loop you refer to never runs now as the default hints for ppc always specify a port and ppc adapters from 1) always include the port resource. That loop should probably belong in an identify routine instead of in the probe routine anyway. It probably predates new-bus. The waters are slightly muddied further by the fact that if the resources specified in a hint match the resources from one of the devices found via 1) or 2), the device from 1) or 2) will actually subsume the hinted device so you will not get a separate type 3) device. For example, in the default hints uart0 specifies an I/O port of 0x3f8. If ACPI tells the OS about a COM1 serial port with the default I/O port (0x3f8), then the hints cause that device to be "named" uart0 and to use the flags from uart0 to enable the serial console, etc. -- John Baldwin From owner-freebsd-hackers@FreeBSD.ORG Tue Aug 17 13:17:03 2010 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 3379C10656AA for ; Tue, 17 Aug 2010 13:17:03 +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 045B28FC1C for ; Tue, 17 Aug 2010 13:17:03 +0000 (UTC) Received: from bigwig.baldwin.cx (66.111.2.69.static.nyinternet.net [66.111.2.69]) by cyrus.watson.org (Postfix) with ESMTPSA id A873046B91; Tue, 17 Aug 2010 09:17:02 -0400 (EDT) Received: from jhbbsd.localnet (smtp.hudson-trading.com [209.249.190.9]) by bigwig.baldwin.cx (Postfix) with ESMTPSA id A0DD58A04F; Tue, 17 Aug 2010 09:17:01 -0400 (EDT) From: John Baldwin To: "Julian H. Stacey" Date: Tue, 17 Aug 2010 09:09:09 -0400 User-Agent: KMail/1.13.5 (FreeBSD/7.3-CBSD-20100217; KDE/4.4.5; amd64; ; ) References: <201008171149.o7HBnMtp065687@fire.js.berklix.net> In-Reply-To: <201008171149.o7HBnMtp065687@fire.js.berklix.net> MIME-Version: 1.0 Content-Type: Text/Plain; charset="iso-8859-15" Content-Transfer-Encoding: 7bit Message-Id: <201008170909.09979.jhb@freebsd.org> X-Greylist: Sender succeeded SMTP AUTH, not delayed by milter-greylist-4.0.1 (bigwig.baldwin.cx); Tue, 17 Aug 2010 09:17:01 -0400 (EDT) X-Virus-Scanned: clamav-milter 0.95.1 at bigwig.baldwin.cx X-Virus-Status: Clean X-Spam-Status: No, score=-2.6 required=4.2 tests=AWL,BAYES_00 autolearn=ham version=3.2.5 X-Spam-Checker-Version: SpamAssassin 3.2.5 (2008-06-10) on bigwig.baldwin.cx Cc: freebsd-hackers@freebsd.org, Paul Wootton Subject: Re: real memory falsely reports 8G, BIOS & avail memory reports 1G 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, 17 Aug 2010 13:17:03 -0000 On Tuesday, August 17, 2010 7:49:22 am Julian H. Stacey wrote: > John Baldwin wrote: > > On Monday, August 09, 2010 8:13:03 am Julian H. Stacey wrote: > > > Hi hackers@freebsd.org > > > A laptop here emits a puzzlingly dmesg to both 8.1-RC2 & 8.1-RELEASE: > > > real memory = 8572108800 (8175 MB) > > > avail memory = 1018789888 (971 MB) > > > BIOS reckons it has 1G. No panel to unscrew to inspect memory. > > > I don't beleive 8G. > > > > > > If this is a bug in FreeBSD detect code ? > > > I am ready to run test kernel patches againt 8.1-RELEASE > > > & report back if anyone has code. > > > (I have room to install a current too if necessary) > > > > > > Full dmesg here: > > > http://www.berklix.com/~jhs/hardware/laptops/novatech-8355/dmesg/ > > > > > > Cheers, > > > Julian > > > > Hmm, do you have dmidecode output? > > Hi, Thanks for interest, Yes here Yeah, I saw you post the details later in the thread and had forgotten to delete my reply. At one point the code to print out "real memory" was changed to use the DMI/SMBios information as when it is correct it gives a more accurate looking number (an even 8GB for example vs some number that is slightly smaller than 8GB). It looks like your DMI info is just very wrong resulting in a bogus number in the printf. However, it is only a cosmetic failure, it doesn't affect how the kernel runs or uses memory. -- John Baldwin From owner-freebsd-hackers@FreeBSD.ORG Tue Aug 17 15:36:08 2010 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 3894C1065672 for ; Tue, 17 Aug 2010 15:36:08 +0000 (UTC) (envelope-from anish.mailing.list@gmail.com) Received: from mail-pz0-f54.google.com (mail-pz0-f54.google.com [209.85.210.54]) by mx1.freebsd.org (Postfix) with ESMTP id 0B9E08FC1F for ; Tue, 17 Aug 2010 15:36:07 +0000 (UTC) Received: by pzk7 with SMTP id 7so2960073pzk.13 for ; Tue, 17 Aug 2010 08:36:07 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:received:received:message-id:date:from :user-agent:mime-version:to:subject:content-type :content-transfer-encoding; bh=Gc/UJFsUOEBT7XgfXMsY2onoRVWYwM906hzampPTFjA=; b=pZc4dY6yE2sCrCLE7SJFPmWgkPqtZI++Rb3K2DYV6d34DCQ5qEaoE3N6GN7KDINSdv +3Bp6nh6FjcfeB4BqaTDWxr0dvHe4ci7ZWMiOZIrHiW0lB56LEC6Q0bncvBOvPi7NbBS lwMU5xKkjHTOB2ZhcaX7IQzzg4KixlKxD2rlw= DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=message-id:date:from:user-agent:mime-version:to:subject :content-type:content-transfer-encoding; b=qzhAz4XlO7VaeJSm4+TUCDI+vAqR0BK+UGwTJyGtmV109+faBo0mh1SSb5bBUI1Nva fh+z6beKoQ9iqDJ0S5Ezi4x+PJoGuGNhHq99SJJAPpM0W2Qswk+P9Qjxp3rWqep9hMpy AZ+Cd8c2M3TqGBeu4FRhDGeEd86akcOhaoeEY= Received: by 10.115.107.7 with SMTP id j7mr7990286wam.107.1282057904306; Tue, 17 Aug 2010 08:11:44 -0700 (PDT) Received: from [192.168.1.100] (mail.win-ent.com [67.152.15.146]) by mx.google.com with ESMTPS id m6sm2195991vcx.24.2010.08.17.08.11.43 (version=TLSv1/SSLv3 cipher=RC4-MD5); Tue, 17 Aug 2010 08:11:43 -0700 (PDT) Message-ID: <4C6AA6AE.6060100@gmail.com> Date: Tue, 17 Aug 2010 11:11:42 -0400 From: Anish Patel User-Agent: Mozilla/5.0 (X11; U; Linux x86_64; en-US; rv:1.9.2.7) Gecko/20100722 Lightning/1.0b2pre Thunderbird/3.1.1 MIME-Version: 1.0 To: freebsd-hackers@FreeBSD.org Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 7bit Cc: Subject: i386_set_ioperm equiv for x86_64 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, 17 Aug 2010 15:36:08 -0000 Hi all, sorry if i sent this to the wrong list, but i am trying to find the equivalent call for i386_set_ioperm() for a x86_64 system. Thanks Anish From owner-freebsd-hackers@FreeBSD.ORG Tue Aug 17 15:47:51 2010 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 D28561065675 for ; Tue, 17 Aug 2010 15:47:51 +0000 (UTC) (envelope-from kostikbel@gmail.com) Received: from mail.zoral.com.ua (mx0.zoral.com.ua [91.193.166.200]) by mx1.freebsd.org (Postfix) with ESMTP id 4E9C68FC26 for ; Tue, 17 Aug 2010 15:47:50 +0000 (UTC) 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 o7HFlcgO034011 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=NO); Tue, 17 Aug 2010 18:47:38 +0300 (EEST) (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.4/8.14.4) with ESMTP id o7HFlcgm006168; Tue, 17 Aug 2010 18:47:38 +0300 (EEST) (envelope-from kostikbel@gmail.com) Received: (from kostik@localhost) by deviant.kiev.zoral.com.ua (8.14.4/8.14.4/Submit) id o7HFlcsv006167; Tue, 17 Aug 2010 18:47:38 +0300 (EEST) (envelope-from kostikbel@gmail.com) X-Authentication-Warning: deviant.kiev.zoral.com.ua: kostik set sender to kostikbel@gmail.com using -f Date: Tue, 17 Aug 2010 18:47:38 +0300 From: Kostik Belousov To: Anish Patel Message-ID: <20100817154738.GN2396@deviant.kiev.zoral.com.ua> References: <4C6AA6AE.6060100@gmail.com> Mime-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha1; protocol="application/pgp-signature"; boundary="tgGkmR2uZxfBDBxQ" Content-Disposition: inline In-Reply-To: <4C6AA6AE.6060100@gmail.com> User-Agent: Mutt/1.4.2.3i X-Virus-Scanned: clamav-milter 0.95.2 at skuns.kiev.zoral.com.ua X-Virus-Status: Clean X-Spam-Status: No, score=-3.5 required=5.0 tests=ALL_TRUSTED,AWL,BAYES_00, DNS_FROM_OPENWHOIS autolearn=no version=3.2.5 X-Spam-Checker-Version: SpamAssassin 3.2.5 (2008-06-10) on skuns.kiev.zoral.com.ua Cc: freebsd-hackers@freebsd.org Subject: Re: i386_set_ioperm equiv for x86_64 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, 17 Aug 2010 15:47:51 -0000 --tgGkmR2uZxfBDBxQ Content-Type: text/plain; charset=us-ascii Content-Disposition: inline On Tue, Aug 17, 2010 at 11:11:42AM -0400, Anish Patel wrote: > Hi all, > sorry if i sent this to the wrong list, but i am trying to find the > equivalent call for i386_set_ioperm() for a x86_64 system. i386_set_ioperm() is the convenience wrapper around sysarch(I386_SET_IOPERM). The same request, but without a wrapper, is available on amd64, starting from FreeBSD 8.0. --tgGkmR2uZxfBDBxQ Content-Type: application/pgp-signature Content-Disposition: inline -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.4.10 (FreeBSD) iEYEARECAAYFAkxqrxoACgkQC3+MBN1Mb4gd7gCg5HXO+8xiCaaAxSP/x9fFoU28 /n0An1S0YWhPsZbmukj0RqrFHtfh1OXA =4ckF -----END PGP SIGNATURE----- --tgGkmR2uZxfBDBxQ-- From owner-freebsd-hackers@FreeBSD.ORG Tue Aug 17 19:56:22 2010 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 DA6AF106564A; Tue, 17 Aug 2010 19:56:22 +0000 (UTC) (envelope-from yanegomi@gmail.com) Received: from mail-bw0-f54.google.com (mail-bw0-f54.google.com [209.85.214.54]) by mx1.freebsd.org (Postfix) with ESMTP id 39BDC8FC14; Tue, 17 Aug 2010 19:56:21 +0000 (UTC) Received: by bwz20 with SMTP id 20so3780278bwz.13 for ; Tue, 17 Aug 2010 12:56:21 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:mime-version:received:received:in-reply-to :references:date:message-id:subject:from:to:cc:content-type :content-transfer-encoding; bh=zWn2trO2eZE+Fke/bOqFSMyco8gooIEd+iPv9aTUlyo=; b=Nmyf7wO76BNJBfX+bDoIva2E0aKbOqjTv2DGAWrZwJX9arjIjTqMllmRBoMEkYE8IM 98e+H6XcTigqwG4pLjXA/hXCjYBuF8uzGYNrG5SciTaqz6MugjnTDA3oLD4RjZdUzI7i t9TQwVKZyIxi7wQ7IHAAGhMbo/R6ZDpT1j9wI= 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=pmWhrmQ2pHPLLr7SJ1icdWaheDVm1SxAyp/LTOb5Kfkofws672GXEZ2hiO58sFZ+Dy SgPLbF7YJ4v6yVkzAGz951jbZgVDeTleoNHCVXvfpt0RKDnwPG5htIUoWYO7p2vmIMtp SW8IqKSwhMSMyB1JP3Mb7QSJPIj6sZcy66zts= MIME-Version: 1.0 Received: by 10.204.21.135 with SMTP id j7mr4712233bkb.198.1282074981001; Tue, 17 Aug 2010 12:56:21 -0700 (PDT) Received: by 10.204.82.6 with HTTP; Tue, 17 Aug 2010 12:56:20 -0700 (PDT) In-Reply-To: <201008170907.20593.jhb@freebsd.org> References: <201008161619.35740.jhb@freebsd.org> <201008170907.20593.jhb@freebsd.org> Date: Tue, 17 Aug 2010 12:56:20 -0700 Message-ID: From: Garrett Cooper To: John Baldwin Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: quoted-printable X-Mailman-Approved-At: Tue, 17 Aug 2010 20:05:02 +0000 Cc: freebsd-hackers@freebsd.org Subject: Re: Why doesn't ppc(4) check non-ENXIO failures during probe? 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, 17 Aug 2010 19:56:22 -0000 On Tue, Aug 17, 2010 at 6:07 AM, John Baldwin wrote: > On Monday, August 16, 2010 7:23:54 pm Garrett Cooper wrote: >> On Mon, Aug 16, 2010 at 1:19 PM, John Baldwin wrote: >> > On Sunday, August 15, 2010 1:33:38 am Garrett Cooper wrote: >> >> =A0 =A0 One thing that's puzzling me about the ppc(4) driver's ISA >> >> routines is that it only checks to see whether or not the device has >> >> an IO error: >> > >> > Your patch would break hinted ppc devices. =A0ENXIO means that the dev= ice_t >> > being probed has an ISA PNP ID, but it does not match any of the IDs i= n the >> > list. =A0ENONET means that the device_t does not have an ISA ID at all= . =A0For the >> > isa bus that means it was explicitly created via a set of ppc.X hints. >> >> Just clarifying some things because I don't know all of the details. >> >> If a ISA based parallel port fails to probe with ENOENT, then it's >> assumed that the configuration details are incorrect, and it should >> reprobe the device with different configuration settings (irq, isa >> port, etc) a max of BIOS_MAX_PPC times before it finally bails failing >> to configure a device (ppc_probe in ppc.c)? What if all of the ISA >> details in the device.hints file are bogus and the only detail that's >> correct is in the puc driver, etc? Would it fail to connect the card >> if it reached the BIOS_MAX_PPC ISA-related failure limit (see >> ppc_probe again)? > > ISA_PNP_PROBE() does not talk to the hardware, it just compares device ID= s. > You have to realize that device_t objects on an ISA device come from thre= e > sources: > > =A01) "Builtin" devices are auto-enumerated via ACPI or PnP BIOS. =A0Any > =A0modern BIOS will do this for things like built in serial ports, ISA > =A0timers, PS/2 keyboard, etc. > > =A02) ISA PnP adapters in an ISA slot are enumerated via ISA PnP. > > =A03) Users indicate that specific ISA devices are present via hints. > > Devices from 1) and 2) have an assigned device ID (HID) and zero-or-more > compatibility IDs (CID). =A0ISA_PNP_PROBE() accepts a list of HID IDs and > returns true (0) if the HID or any of the CIDs match any of the ids in > the list that is passed in. =A0If none of the IDs match it returns ENXIO. > Thus for devices from 1) and 2) ISA_PNP_PROBE() returns either 0 or > ENXIO. =A0For devices from 3), ISA_PNP_PROBE() will always return ENOENT. > > Your change would break 3) since those devices would then never probe. > > ppc_probe() is called to verify that the hardware truly exists at the > resources that are claimed. =A0In practice the loop you refer to never ru= ns > now as the default hints for ppc always specify a port and ppc adapters > from 1) always include the port resource. =A0That loop should probably > belong in an identify routine instead of in the probe routine anyway. > It probably predates new-bus. > > The waters are slightly muddied further by the fact that if the resources > specified in a hint match the resources from one of the devices found via > 1) or 2), the device from 1) or 2) will actually subsume the hinted devic= e > so you will not get a separate type 3) device. =A0For example, in the def= ault > hints uart0 specifies an I/O port of 0x3f8. =A0If ACPI tells the OS about= a > COM1 serial port with the default I/O port (0x3f8), then the hints cause > that device to be "named" uart0 and to use the flags from uart0 to enable > the serial console, etc. So more or less it's for BIOSes with ISA that doesn't feature plug and play (286s, 386s, some 486s?)? Just trying to fill in the gap :). Thanks! -Garrett From owner-freebsd-hackers@FreeBSD.ORG Tue Aug 17 21:04:29 2010 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 9A19710656A9 for ; Tue, 17 Aug 2010 21:04:29 +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 55B598FC17 for ; Tue, 17 Aug 2010 21:04:29 +0000 (UTC) Received: from bigwig.baldwin.cx (66.111.2.69.static.nyinternet.net [66.111.2.69]) by cyrus.watson.org (Postfix) with ESMTPSA id 0296C46B09; Tue, 17 Aug 2010 17:04:27 -0400 (EDT) Received: from jhbbsd.localnet (smtp.hudson-trading.com [209.249.190.9]) by bigwig.baldwin.cx (Postfix) with ESMTPSA id E0B668A03C; Tue, 17 Aug 2010 17:04:25 -0400 (EDT) From: John Baldwin To: Garrett Cooper Date: Tue, 17 Aug 2010 16:15:21 -0400 User-Agent: KMail/1.13.5 (FreeBSD/7.3-CBSD-20100217; KDE/4.4.5; amd64; ; ) References: <201008170907.20593.jhb@freebsd.org> In-Reply-To: MIME-Version: 1.0 Content-Type: Text/Plain; charset="iso-8859-1" Content-Transfer-Encoding: 7bit Message-Id: <201008171615.21103.jhb@freebsd.org> X-Greylist: Sender succeeded SMTP AUTH, not delayed by milter-greylist-4.0.1 (bigwig.baldwin.cx); Tue, 17 Aug 2010 17:04:25 -0400 (EDT) X-Virus-Scanned: clamav-milter 0.95.1 at bigwig.baldwin.cx X-Virus-Status: Clean X-Spam-Status: No, score=-2.6 required=4.2 tests=AWL,BAYES_00 autolearn=ham version=3.2.5 X-Spam-Checker-Version: SpamAssassin 3.2.5 (2008-06-10) on bigwig.baldwin.cx Cc: freebsd-hackers@freebsd.org Subject: Re: Why doesn't ppc(4) check non-ENXIO failures during probe? 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, 17 Aug 2010 21:04:29 -0000 On Tuesday, August 17, 2010 3:56:20 pm Garrett Cooper wrote: > On Tue, Aug 17, 2010 at 6:07 AM, John Baldwin wrote: > > On Monday, August 16, 2010 7:23:54 pm Garrett Cooper wrote: > >> On Mon, Aug 16, 2010 at 1:19 PM, John Baldwin wrote: > >> > On Sunday, August 15, 2010 1:33:38 am Garrett Cooper wrote: > >> >> One thing that's puzzling me about the ppc(4) driver's ISA > >> >> routines is that it only checks to see whether or not the device has > >> >> an IO error: > >> > > >> > Your patch would break hinted ppc devices. ENXIO means that the device_t > >> > being probed has an ISA PNP ID, but it does not match any of the IDs in the > >> > list. ENONET means that the device_t does not have an ISA ID at all. For the > >> > isa bus that means it was explicitly created via a set of ppc.X hints. > >> > >> Just clarifying some things because I don't know all of the details. > >> > >> If a ISA based parallel port fails to probe with ENOENT, then it's > >> assumed that the configuration details are incorrect, and it should > >> reprobe the device with different configuration settings (irq, isa > >> port, etc) a max of BIOS_MAX_PPC times before it finally bails failing > >> to configure a device (ppc_probe in ppc.c)? What if all of the ISA > >> details in the device.hints file are bogus and the only detail that's > >> correct is in the puc driver, etc? Would it fail to connect the card > >> if it reached the BIOS_MAX_PPC ISA-related failure limit (see > >> ppc_probe again)? > > > > ISA_PNP_PROBE() does not talk to the hardware, it just compares device IDs. > > You have to realize that device_t objects on an ISA device come from three > > sources: > > > > 1) "Builtin" devices are auto-enumerated via ACPI or PnP BIOS. Any > > modern BIOS will do this for things like built in serial ports, ISA > > timers, PS/2 keyboard, etc. > > > > 2) ISA PnP adapters in an ISA slot are enumerated via ISA PnP. > > > > 3) Users indicate that specific ISA devices are present via hints. > > > > Devices from 1) and 2) have an assigned device ID (HID) and zero-or-more > > compatibility IDs (CID). ISA_PNP_PROBE() accepts a list of HID IDs and > > returns true (0) if the HID or any of the CIDs match any of the ids in > > the list that is passed in. If none of the IDs match it returns ENXIO. > > Thus for devices from 1) and 2) ISA_PNP_PROBE() returns either 0 or > > ENXIO. For devices from 3), ISA_PNP_PROBE() will always return ENOENT. > > > > Your change would break 3) since those devices would then never probe. > > > > ppc_probe() is called to verify that the hardware truly exists at the > > resources that are claimed. In practice the loop you refer to never runs > > now as the default hints for ppc always specify a port and ppc adapters > > from 1) always include the port resource. That loop should probably > > belong in an identify routine instead of in the probe routine anyway. > > It probably predates new-bus. > > > > The waters are slightly muddied further by the fact that if the resources > > specified in a hint match the resources from one of the devices found via > > 1) or 2), the device from 1) or 2) will actually subsume the hinted device > > so you will not get a separate type 3) device. For example, in the default > > hints uart0 specifies an I/O port of 0x3f8. If ACPI tells the OS about a > > COM1 serial port with the default I/O port (0x3f8), then the hints cause > > that device to be "named" uart0 and to use the flags from uart0 to enable > > the serial console, etc. > > So more or less it's for BIOSes with ISA that doesn't feature plug > and play (286s, 386s, some 486s?)? Just trying to fill in the gap :). Yes, it may perhaps still be useful for some x86 embedded systems, though it is doubtful that those would use a ppc(4) device perhaps. -- John Baldwin From owner-freebsd-hackers@FreeBSD.ORG Wed Aug 18 08:30:42 2010 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 A3EAE10656A3 for ; Wed, 18 Aug 2010 08:30:42 +0000 (UTC) (envelope-from wdef200@yahoo.co.uk) Received: from web26403.mail.ukl.yahoo.com (web26403.mail.ukl.yahoo.com [217.146.176.27]) by mx1.freebsd.org (Postfix) with SMTP id 00BAA8FC0A for ; Wed, 18 Aug 2010 08:30:41 +0000 (UTC) Received: (qmail 63091 invoked by uid 60001); 18 Aug 2010 08:30:41 -0000 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=yahoo.co.uk; s=s1024; t=1282120241; bh=YFy+oss9x4n+1fpViPUFaWpLw3p34xBKH5qPmL6UBO8=; h=Message-ID:X-YMail-OSG:Received:X-Mailer:Date:From:Subject:To:MIME-Version:Content-Type:Content-Transfer-Encoding; b=FW8JkfVA3H2kmETV7tAxuFv9+3RsweW8xlbJDMWFD0dKAn9e6b4QitHUAz8pAxcPIG70b2WA9jt2oMOVfuNmi1IzxYX6g+jdSheaedZ/xLQGJHjbNGutLknN3BEMq+ok0NJHT7vbIOocOhpBKA9ZVs87xZKqljJ3SeHIBrsfb9s= DomainKey-Signature: a=rsa-sha1; q=dns; c=nofws; s=s1024; d=yahoo.co.uk; h=Message-ID:X-YMail-OSG:Received:X-Mailer:Date:From:Subject:To:MIME-Version:Content-Type:Content-Transfer-Encoding; b=uIHB7UTrK+aLveCyGlPty06ogIMRH1TcuOm2IZazTLwp/kHqNQECQBklIGX80rUVkYKw5l0PPMDj7+/O1LriVdJpfixIUJrejG0itUhi1GY5Lz1iL6vpYj10x6euxWO+saubLeeQCHCrcMI2pFp7Wxs0vTri1K6CuwdjlJnJChc=; Message-ID: <100395.62822.qm@web26403.mail.ukl.yahoo.com> X-YMail-OSG: gSJvxE0VM1nxj65EFewzIlry5t0H085AiV8kDA2OUM1QpZp cD2jhqhD3r0u7Y2KnNU0sXvoxZ42pjfHh2c8Z4tQdfqAykRJPSgiyBx8vuV. 0qWNJp39ausNZuiWU_DaDEC9C09_I0fGXnGUoUQN_CLtm8WewH7ozFxTFfw4 3N7REj1FPNo_HxeG2UeoR7STJTtA6fMje.ECMicx.aLXsJrZ0v9TiFmTHMKh g3xEpdYJ.HQ..iz7iL8sfbLQAJjAfCikL0w-- Received: from [109.123.86.204] by web26403.mail.ukl.yahoo.com via HTTP; Wed, 18 Aug 2010 08:30:41 GMT X-Mailer: YahooMailRC/470 YahooMailWebService/0.8.105.279950 Date: Wed, 18 Aug 2010 08:30:41 +0000 (GMT) From: Phil Grundig To: freebsd-hackers@freebsd.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable X-Mailman-Approved-At: Wed, 18 Aug 2010 11:25:46 +0000 Subject: Re: How to read cmos clock - what is gettimeofday reading? 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, 18 Aug 2010 08:30:42 -0000 "This is incorrect: see msg03414 on freebsd-hardware@freebsd.org."=0A=0AMea= ning:=0A=0Ahttp://www.mail-archive.com/freebsd-hardware@freebsd.org/msg0341= 4.html=0A=0A=0A From owner-freebsd-hackers@FreeBSD.ORG Wed Aug 18 08:41:18 2010 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 EB1881065674 for ; Wed, 18 Aug 2010 08:41:17 +0000 (UTC) (envelope-from wdef200@yahoo.co.uk) Received: from web26406.mail.ukl.yahoo.com (web26406.mail.ukl.yahoo.com [217.146.176.30]) by mx1.freebsd.org (Postfix) with SMTP id 4D88D8FC23 for ; Wed, 18 Aug 2010 08:41:17 +0000 (UTC) Received: (qmail 47875 invoked by uid 60001); 18 Aug 2010 08:14:36 -0000 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=yahoo.co.uk; s=s1024; t=1282119276; bh=3lz95lXmghfmtGle2AwUVIWKMSn5wuJOJKtsEfzB3dE=; h=Message-ID:X-YMail-OSG:Received:X-Mailer:Date:From:Subject:To:MIME-Version:Content-Type; b=Z09jljtkN5SaQY0FGAWiY2RbN/O26wIV11eOkPDN/oL91H5U0jcGjg1AkEFSpR3XbgqwVUHtSlOxTq0zDMjDeiYxx7fXQaOjqzIML86CjeoZr2q8pMlssnLY5MF8uEkuoEz7B4+9unREB9vyHvSepTI0T0ZoitRcSNWzD+lViTg= DomainKey-Signature: a=rsa-sha1; q=dns; c=nofws; s=s1024; d=yahoo.co.uk; h=Message-ID:X-YMail-OSG:Received:X-Mailer:Date:From:Subject:To:MIME-Version:Content-Type; b=RVe0ZXN3ZWE29Giu8hIW8z7ZoQyLtNfIaqmIvtcrLhvaL7yEt3AYYyNtJH9b+qqMfm+YnJwPCw1bairIyWhVdBNPDM+Y+sJxapxNgAIUUKc3eT0fnU3jRbHwW3/PJ/gdVahmEKVRZ17he+Oisn3tgA8N3kqF85ICcGmCmqoyXCw=; Message-ID: <111186.47487.qm@web26406.mail.ukl.yahoo.com> X-YMail-OSG: rAatE64VM1nDXAmnlOFBfXdUX0T49VBc6paXa62uE__tHNS OUzhYystwA2dZ_qIRtKcEdAyhg3iCf4.BdDlQJOEvhuEesbZqbkIK2XrYx01 fSzu8V8VtqVHH76CK0oAIFcZ318HFSnn.C0z1.U9AD0YNLUF2_wzm3aNklqD cVWYQybL1GLunxUS6e2UNl4q.4ND1IwnICi2gqiyRSN4pN.vjGAod9U6wWl3 kZP9AXyG_lDhRU6iL0wjQDckm734QkZWYT.MODrTssmjLgqE- Received: from [109.123.86.204] by web26406.mail.ukl.yahoo.com via HTTP; Wed, 18 Aug 2010 01:14:35 PDT X-Mailer: YahooMailRC/470 YahooMailWebService/0.8.105.279950 Date: Wed, 18 Aug 2010 01:14:35 -0700 (PDT) From: Phil Grundig To: freebsd-hackers@freebsd.org MIME-Version: 1.0 X-Mailman-Approved-At: Wed, 18 Aug 2010 11:26:22 +0000 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable X-Content-Filtered-By: Mailman/MimeDel 2.1.5 Subject: How to read cmos clock - what is gettimeofday reading? 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, 18 Aug 2010 08:41:18 -0000 I have C code for Linux that, among other things, caches the difference bet= ween =0Athe rtc and system time. I want to port this code to FreeBSD/Mac. L= inux has the =0Autility hwclock which reads /dev/rtc and anyway getting the= cmos clock time =0Adirectly from this interface can be done in a few lines= of code.=0A=0AI've been looking around for how to read the cmos/rtc on Fre= eBSD. There is no =0Ahwclock utility in FreeBSD that I can read sources for= to see how it is done.=0Ahttp://www.wraith.sf.ca.us/ntp/not-hwclock.c.txt = is supposed to be C code to =0Aread the software time and then set the cmos= clock to match. This code implies =0Athat, on FreeBSD, gettimeofday reads = the software time and settimeofday sets the =0Acmos clock. On Linux gettime= ofday does indeed read the software time.=0A=0ABUT the source to adjkerntz.= c for FreeBSD says that gettimeofday reads the CMOS =0Aclock not the system= time:=0A=0A/* get local CMOS clock and possible kernel offset */=0Aif (get= timeofday(&tv, &tz)) {=0A syslog(LOG_ERR, "gettimeofday: %m");=0A ret= urn 1;=0A}=0A=0AWhich is it? Does gettimeofday read the cmos clock/rtc on F= reeBSD? If not, how =0Ado I read the battery-backed clock on FreeBSD?=0A=0A= To further confuse matters there appears to be a common misconception on th= e web =0Athat the cmos time is automatically synced to system time on FreeB= SD. This is =0Aincorrect: see msg03414 on freebsd-hardware@freebsd.org.=0A= =0AThanks=0A=0A=0A=0A From owner-freebsd-hackers@FreeBSD.ORG Wed Aug 18 16:10:16 2010 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 973FC1065672 for ; Wed, 18 Aug 2010 16:10:16 +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 D5E628FC21 for ; Wed, 18 Aug 2010 16:10:15 +0000 (UTC) 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 TAA21138; Wed, 18 Aug 2010 19:10:13 +0300 (EEST) (envelope-from avg@icyb.net.ua) Message-ID: <4C6C05E4.1000908@icyb.net.ua> Date: Wed, 18 Aug 2010 19:10:12 +0300 From: Andriy Gapon User-Agent: Thunderbird 2.0.0.24 (X11/20100517) MIME-Version: 1.0 To: freebsd-hackers@freebsd.org References: <4C2B07F5.6030801@delphij.net> <4C2B4D35.8060903@feral.com> <86lj9wmbrz.fsf@ds4.des.no> <4C2BBF3C.4070503@delphij.net> <86hbkkmad1.fsf@ds4.des.no> <4C2BD498.3090704@delphij.net> <86d3v7n093.fsf@ds4.des.no> <4C5D4BFD.9080803@delphij.net> <20100807173222.W48418@maildrop.int.zabbadoz.net> In-Reply-To: <20100807173222.W48418@maildrop.int.zabbadoz.net> X-Enigmail-Version: 0.95.7 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 7bit Cc: Matthew Jacob , "Bjoern A. Zeeb" , d@delphij.net, =?ISO-8859-1?Q?Dag-Erling_Sm=F8rgrav?= Subject: Re: Winbond Watchdog [Was Re: Supermicro BIOS's watchdog feature?] 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, 18 Aug 2010 16:10:16 -0000 on 07/08/2010 20:39 Bjoern A. Zeeb said the following: > There are not many assertions put in place and it only checks one of > the two base ports as I had only done it for me so far. Unfortunately > there is no ACPI WDRT entry here (either?). devinfo -r was to some use > though. ACPI WDRT seems to be a very very rare beast. > In case it'll help you or someone else I just put it online: > http://people.freebsd.org/~bz/20100807-02-wd-fintek-f71882fg.diff Just in case, here is a my very hairy driver for watchdog logic and power led control in Winbond W83977 family of Super I/O chips. http://people.freebsd.org/~avg/w83977.diff There are quite a few possibilities about how this chip could be wired and programmed (e.g. watchdog output may go to any of three multifunctional pins), but I really implemented only one configuration (the one that I actually had). -- Andriy Gapon From owner-freebsd-hackers@FreeBSD.ORG Thu Aug 19 04:48:05 2010 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 A350B1065694; Thu, 19 Aug 2010 04:48:05 +0000 (UTC) (envelope-from osharoiko@gmail.com) Received: from mail-iw0-f182.google.com (mail-iw0-f182.google.com [209.85.214.182]) by mx1.freebsd.org (Postfix) with ESMTP id 5A34C8FC1C; Thu, 19 Aug 2010 04:48:05 +0000 (UTC) Received: by iwn36 with SMTP id 36so1635508iwn.13 for ; Wed, 18 Aug 2010 21:48:04 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:mime-version:received:received:in-reply-to :references:date:message-id:subject:from:to:cc:content-type :content-transfer-encoding; bh=m4p8wBHGITzyD1LHb6QdAPMqIh3ChJE0c4hs/FCm8CY=; b=I57TydMml7Tmi8cxAKquChL/PL9IqcMtFaQyI4T7wQiqa+w5QRm5/0IaGjAnpHqaTz NRQnKXKg96qjMdqm80vVYt1X69slRzB2kMaD4yt5kZ4PX80LNE2i2/uwzDtENva3tKPH riPmXKpQpYDYx7/0+6Y6POojaBv6yQQdX19cs= 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=osQA0X1L/HZb3l4IxtFraEaJqMMljiTixaZr7HpEGzJDrRhUBI668w9hoEF24gXDro w0R6C8j6pCMrhAxrCunFhtQNU/B8y++JsNAIPAUyHpODjwe6O34QT/ZwBxEevtpMhv41 cPGbcwxmlO9Q2BnqtICNykDr/fz0rF/srfwAY= MIME-Version: 1.0 Received: by 10.231.30.75 with SMTP id t11mr7673053ibc.27.1282193284649; Wed, 18 Aug 2010 21:48:04 -0700 (PDT) Received: by 10.231.185.7 with HTTP; Wed, 18 Aug 2010 21:48:04 -0700 (PDT) In-Reply-To: <201008161422.01541.jkim@FreeBSD.org> References: <201008161422.01541.jkim@FreeBSD.org> Date: Thu, 19 Aug 2010 08:48:04 +0400 Message-ID: From: Oleg Sharoyko To: Jung-uk Kim Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: quoted-printable Cc: freebsd-hackers@freebsd.org, Christian Zander Subject: Re: PCI config space is not restored upon resume (macbook pro) 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, 19 Aug 2010 04:48:05 -0000 On 16 August 2010 22:21, Jung-uk Kim wrote: > In theory, we can shadow video ROM and execute it in emulation *iff* > it actually contains x86 real mode code. =C2=A0It won't be too hard but I > am not sure whether it is worth trying. =C2=A0Are you sure the option ROM > is actually real mode code but not shadowed again after resume? Sorry, I guess I wasn't clear enough. There is no VGA ROM at 0xc0000 after resume. In patches for linux loader (which I've mentioned in previous message) they search for ROM, then copy it into memory, execute and install at proper address. This is possible during boot, but I don't think this can be done after resume. And, moreover, I tend to agree that this isn't worth trying as this is very specific to macboocs only (AFAIK). By the way, do you think it could be possible to dump option ROM contents into a file before suspending the system and then load it back on resume from userland? I've seen a userland tool in ports (sysutils/vbetool) which can execute VESA BIOS functions. So, I guess, it could be possible to try to call POST using saved ROM dump, but I don't know if it's possible to stick this ROM image into memory "forever" and for all processes. --=20 Oleg Sharoyko From owner-freebsd-hackers@FreeBSD.ORG Thu Aug 19 10:40:02 2010 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 15C94106567A for ; Thu, 19 Aug 2010 10:40:02 +0000 (UTC) (envelope-from wdef200@gmail.com) Received: from mail-bw0-f54.google.com (mail-bw0-f54.google.com [209.85.214.54]) by mx1.freebsd.org (Postfix) with ESMTP id 94DAE8FC15 for ; Thu, 19 Aug 2010 10:40:01 +0000 (UTC) Received: by bwz20 with SMTP id 20so1819848bwz.13 for ; Thu, 19 Aug 2010 03:39:44 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:mime-version:received:received:date:message-id :subject:from:to:content-type; bh=vw1ShQ5Dw4j9rXNLR/ZNaLJ4z5ZgMJ3vyslVsgCdyvQ=; b=PH42hotmGH+aNlP+b1nq/8oKk4Vm9gfGrgs5eXQW0TiSXORoQpozdjPRzdhb35r5aO 8YLZdjO82PCYWBBxHwj7RRd0gborA2MScsFsmS+sh00q0/varp7Tpwf8JyxYzoKivQGS s06i7aSRmMBNIUx4Gu5IQU00dpFArI6XUfjI4= DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=mime-version:date:message-id:subject:from:to:content-type; b=QXx2SxcS+G3gfUx7dSgWBz6hEDPusmB3TamaLGeHjrv7i9lb3LjtVwO8am3fEZ/v7w XP50vs4JHlUjB8AcZB7cKZq9siIvt+jny9r/IZRuE1asKhgODtqJUDDEkqM1yhnOKyXp BtKPLIN75HkjXiuGnqw6IbXYkgz5UetD0QSX8= MIME-Version: 1.0 Received: by 10.204.59.134 with SMTP id l6mr6426815bkh.103.1282212586963; Thu, 19 Aug 2010 03:09:46 -0700 (PDT) Received: by 10.204.67.3 with HTTP; Thu, 19 Aug 2010 03:09:46 -0700 (PDT) Date: Thu, 19 Aug 2010 13:09:46 +0300 Message-ID: From: phil hefferan To: freebsd-hackers@freebsd.org Content-Type: text/plain; charset=ISO-8859-1 X-Content-Filtered-By: Mailman/MimeDel 2.1.5 Subject: Reading rtc on FreeBSD X-BeenThere: freebsd-hackers@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: Technical Discussions relating to FreeBSD List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 19 Aug 2010 10:40:02 -0000 I have C code for Linux that, among other things, caches the difference between the rtc and system time, so that the program can detect if the system time has changed more than a threshold between runs. I want to port this code to FreeBSD/Mac. I'm trying to clarify the relationship between rtc and system time on FreeBSD and how the rtc is read. Linux has the utility hwclock which reads /dev/rtc and anyway getting the cmos clock time directly from this interface can be done in a few lines of code. I've been looking around for how to read the cmos/rtc on FreeBSD. There is no hwclock utility in FreeBSD that I can read sources for to see how it is done. http://www.wraith.sf.ca.us/ntp/not-hwclock.c.txt is supposed to be C code to read the software time and then set the cmos clock to match. This code implies that, on FreeBSD, gettimeofday reads the software time and settimeofday sets the cmos clock. I read here http://www.mail-archive.com/freebsd-hardware@freebsd.org/msg03414.html that settimeofday in fact sets both rtc and system time together. On Linux both gettimeofday and settimeofday apply to the software time only. BUT the source to adjkerntz.c for FreeBSD seems to say that gettimeofday reads the CMOS clock not the system time: /* get local CMOS clock and possible kernel offset */ if (gettimeofday(&tv, &tz)) { syslog(LOG_ERR, "gettimeofday: %m"); return 1; } Which is it? Does gettimeofday read the cmos clock/rtc on FreeBSD? If not, how do I read the battery-backed clock on FreeBSD? From owner-freebsd-hackers@FreeBSD.ORG Thu Aug 19 11:14:56 2010 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 47AE41065674 for ; Thu, 19 Aug 2010 11:14:56 +0000 (UTC) (envelope-from wdef200@gmail.com) Received: from mail-bw0-f54.google.com (mail-bw0-f54.google.com [209.85.214.54]) by mx1.freebsd.org (Postfix) with ESMTP id CA6E48FC19 for ; Thu, 19 Aug 2010 11:14:55 +0000 (UTC) Received: by bwz20 with SMTP id 20so1847202bwz.13 for ; Thu, 19 Aug 2010 04:14:54 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:mime-version:received:received:in-reply-to :references:date:message-id:subject:from:to:content-type; bh=/2XKlkA6M/Gvo17E1f10DFdpurt7DSQBueOFMSBZvjw=; b=sZdsc8Sux7MQ9+zGpfJo2fJmWM4FoSX1bguBvlcWtK1VS2PXqqaECVnCQT3JH/oA95 tZxQRNNnafqJfywnxAIVvpfh82Rs5snmUGGa35Qj44OPa9y4lMKa/x7Qak76cQcG0XlP kahZ39Q5rgvDAXh+jvWs6kFFD9+oxUkfXpa/s= 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=bVk6gy90p6tupwK8GmZqUbYT21jVXlquMUjO0tr808Upuuhr4x/k+6x956RqtIwslf u9PmD4y6xeMPX18TnhogVggBhYe+MmomPlRNo6s7XrHxmfftYIvKIU+alGDYs4yDSi3P y5WGOnK3DA3W17yaRJxbieXIbgnrUyasiDSXc= MIME-Version: 1.0 Received: by 10.204.23.77 with SMTP id q13mr3053330bkb.191.1282216494603; Thu, 19 Aug 2010 04:14:54 -0700 (PDT) Received: by 10.204.67.3 with HTTP; Thu, 19 Aug 2010 04:14:54 -0700 (PDT) In-Reply-To: References: Date: Thu, 19 Aug 2010 14:14:54 +0300 Message-ID: From: phil hefferan To: freebsd-hackers@freebsd.org Content-Type: text/plain; charset=ISO-8859-1 X-Content-Filtered-By: Mailman/MimeDel 2.1.5 Subject: Re: Reading rtc on FreeBSD X-BeenThere: freebsd-hackers@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: Technical Discussions relating to FreeBSD List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 19 Aug 2010 11:14:56 -0000 My apologies for the multiple posts on this - please ignore the earlier similar post by my alter ego from a yahoo account. What happened: I tried to subscribe from a yahoo account and nothing happened. Meanwhile I posted to the list from the yahoo account. Got a 'waiting moderator approval message' but nothing happened. Got impatient and tried to subscribe from a gmail account - that worked so I posted from there Meanwhile moderator had approved the yahoo message. Oops. Won't happen again. From owner-freebsd-hackers@FreeBSD.ORG Thu Aug 19 11:38:37 2010 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 BE6701065696 for ; Thu, 19 Aug 2010 11:38:37 +0000 (UTC) (envelope-from peterjeremy@acm.org) Received: from mail14.syd.optusnet.com.au (mail14.syd.optusnet.com.au [211.29.132.195]) by mx1.freebsd.org (Postfix) with ESMTP id 4C60E8FC12 for ; Thu, 19 Aug 2010 11:38:36 +0000 (UTC) Received: from server.vk2pj.dyndns.org (c220-239-116-103.belrs4.nsw.optusnet.com.au [220.239.116.103]) by mail14.syd.optusnet.com.au (8.13.1/8.13.1) with ESMTP id o7JBcYWu030911 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=NO); Thu, 19 Aug 2010 21:38:35 +1000 X-Bogosity: Ham, spamicity=0.000000 Received: from server.vk2pj.dyndns.org (localhost.vk2pj.dyndns.org [127.0.0.1]) by server.vk2pj.dyndns.org (8.14.4/8.14.4) with ESMTP id o7JBcY1t060813; Thu, 19 Aug 2010 21:38:34 +1000 (EST) (envelope-from peter@server.vk2pj.dyndns.org) Received: (from peter@localhost) by server.vk2pj.dyndns.org (8.14.4/8.14.4/Submit) id o7JBcX7I060812; Thu, 19 Aug 2010 21:38:33 +1000 (EST) (envelope-from peter) Date: Thu, 19 Aug 2010 21:38:33 +1000 From: Peter Jeremy To: phil hefferan Message-ID: <20100819113833.GA59397@server.vk2pj.dyndns.org> References: MIME-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha1; protocol="application/pgp-signature"; boundary="cNdxnHkX5QqsyA0e" Content-Disposition: inline In-Reply-To: X-PGP-Key: http://members.optusnet.com.au/peterjeremy/pubkey.asc User-Agent: Mutt/1.5.20 (2009-06-14) Cc: freebsd-hackers@freebsd.org Subject: Re: Reading rtc on FreeBSD X-BeenThere: freebsd-hackers@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: Technical Discussions relating to FreeBSD List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 19 Aug 2010 11:38:37 -0000 --cNdxnHkX5QqsyA0e Content-Type: text/plain; charset=us-ascii Content-Disposition: inline Content-Transfer-Encoding: quoted-printable Repeating your question will not encourage an answer. On 2010-Aug-19 13:09:46 +0300, phil hefferan wrote: >I've been looking around for how to read the cmos/rtc on FreeBSD. There is >no hwclock utility in FreeBSD that I can read sources for to see how it is >done. The RTC is only accessed within the kernel (/sys/isa/atrtc.c for i386 and amd64) and read in /sys/kern/subr_rtc.c::inittodr() >implies that, on FreeBSD, gettimeofday reads the software time and >settimeofday sets the cmos clock. I read here >http://www.mail-archive.com/freebsd-hardware@freebsd.org/msg03414.html that >settimeofday in fact sets both rtc and system time together. gettimeofday(2) reads the software clock only. settimeofday(2) writes both the software clock and RTC. >BUT the source to adjkerntz.c for FreeBSD seems to say that gettimeofday >reads the CMOS clock not the system time: > >/* get local CMOS clock and possible kernel offset */ >if (gettimeofday(&tv, &tz)) { > syslog(LOG_ERR, "gettimeofday: %m"); > return 1; >} That comment is incorrect. >Which is it? Does gettimeofday read the cmos clock/rtc on FreeBSD? If not, >how do I read the battery-backed clock on FreeBSD? There is no managed access to the RTC in FreeBSD. Your only option to read the RTC is to directly access its IO port registers via io(4) or i386_set_ioperm(2) --=20 Peter Jeremy --cNdxnHkX5QqsyA0e Content-Type: application/pgp-signature Content-Disposition: inline -----BEGIN PGP SIGNATURE----- Version: GnuPG v2.0.15 (FreeBSD) iEYEARECAAYFAkxtF7kACgkQ/opHv/APuId4UwCeIX0Oqg38buhFxD/QoQvEq5D5 DI0An1ZUAuMvI2SglELi62p9jO4858Gl =Vkpr -----END PGP SIGNATURE----- --cNdxnHkX5QqsyA0e-- From owner-freebsd-hackers@FreeBSD.ORG Thu Aug 19 12:50:25 2010 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 E1B081065697 for ; Thu, 19 Aug 2010 12:50:25 +0000 (UTC) (envelope-from wdef200@gmail.com) Received: from mail-bw0-f54.google.com (mail-bw0-f54.google.com [209.85.214.54]) by mx1.freebsd.org (Postfix) with ESMTP id D49F38FC1D for ; Thu, 19 Aug 2010 12:50:15 +0000 (UTC) Received: by bwz20 with SMTP id 20so1932015bwz.13 for ; Thu, 19 Aug 2010 05:50:14 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:mime-version:received:received:in-reply-to :references:date:message-id:subject:from:to:cc:content-type; bh=x4xTeIvXt3WQ/9Rvxx2yKibYeSfGVzdjgDg74MUgRaI=; b=F0nLZ9fSYAXHF3dXfObwBkrmyaM4rI01e3cHqbrlZAXFiq8Z0aCr9GRPIG09R8KMzj tvSxCUzq1QTcodlNIwbDuRNOYLElNGA0GmCxXOwe4rQKhzz/lIMZnJJUOBScHSGW2cbf XD0jziZZ8FcUwKqlCdJa9yqvxIQmlAvgodgT4= 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; b=oskoxGSM4ucV69qR32yXKaIvqirx1u31NuK+3TekPRL3N+Qe47Bnz12kEWLevFHHi1 dQ29EZT/k/gu5OoKlU9ZYrCqyvw1HZNVkh9mA3TIDWyppFPmpndTwD8GplAz0a0JXBZf HZ0xkRsO9JoRXZNyXyjP1hkS44fcK8lIY+wl0= MIME-Version: 1.0 Received: by 10.204.7.88 with SMTP id c24mr6516554bkc.172.1282222211914; Thu, 19 Aug 2010 05:50:11 -0700 (PDT) Received: by 10.204.67.3 with HTTP; Thu, 19 Aug 2010 05:50:11 -0700 (PDT) In-Reply-To: <20100819113833.GA59397@server.vk2pj.dyndns.org> References: <20100819113833.GA59397@server.vk2pj.dyndns.org> Date: Thu, 19 Aug 2010 15:50:11 +0300 Message-ID: From: phil hefferan To: Peter Jeremy Content-Type: text/plain; charset=ISO-8859-1 X-Content-Filtered-By: Mailman/MimeDel 2.1.5 Cc: freebsd-hackers@freebsd.org Subject: Re: Reading rtc on FreeBSD X-BeenThere: freebsd-hackers@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: Technical Discussions relating to FreeBSD List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 19 Aug 2010 12:50:26 -0000 On Thu, Aug 19, 2010 at 2:38 PM, Peter Jeremy wrote: > Repeating your question will not encourage an answer. > I realize that - it was inadvertent and sloppy. I assumed the yahoo post hadn't gone through when I posted from gmail. Again I apologize for the bad netiquette. > > On 2010-Aug-19 13:09:46 +0300, phil hefferan wrote: > >I've been looking around for how to read the cmos/rtc on FreeBSD. There is > >no hwclock utility in FreeBSD that I can read sources for to see how it is > >done. > > The RTC is only accessed within the kernel (/sys/isa/atrtc.c for > i386 and amd64) and read in /sys/kern/subr_rtc.c::inittodr() > > Thanks. No equivalent to an ioctl on /dev/rtc/ > > >implies that, on FreeBSD, gettimeofday reads the software time and > >settimeofday sets the cmos clock. I read here > >http://www.mail-archive.com/freebsd-hardware@freebsd.org/msg03414.htmlthat > >settimeofday in fact sets both rtc and system time together. > > gettimeofday(2) reads the software clock only. > settimeofday(2) writes both the software clock and RTC. > > This might explain why some people assume the RTC is automatically synced to software time. If they change the software time, presumably this is most likely done through settimeofday()? This suggests also that comparing software time and RTC won't be useful for what I want to do (detect if software time has been changed) since settimeofday will have synced these if it has been changed. Is there any other clock that can be read in userspace which does not change immediately if software time is changed? > >BUT the source to adjkerntz.c for FreeBSD seems to say that gettimeofday > >reads the CMOS clock not the system time: > > > >/* get local CMOS clock and possible kernel offset */ > >if (gettimeofday(&tv, &tz)) { > > syslog(LOG_ERR, "gettimeofday: %m"); > > return 1; > >} > > That comment is incorrect. > > Maybe worth a bug report? Also - wondering then if adjkerntz is actually working as advertised. > >Which is it? Does gettimeofday read the cmos clock/rtc on FreeBSD? If not, > >how do I read the battery-backed clock on FreeBSD? > > There is no managed access to the RTC in FreeBSD. Your only option to > read the RTC is to directly access its IO port registers via io(4) or > i386_set_ioperm(2) > > Thanks Peter. -phil From owner-freebsd-hackers@FreeBSD.ORG Thu Aug 19 13:04:57 2010 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 3B4B41065696 for ; Thu, 19 Aug 2010 13:04:57 +0000 (UTC) (envelope-from ray@dlink.ua) Received: from dlink.ua (smtp.dlink.ua [193.138.187.146]) by mx1.freebsd.org (Postfix) with ESMTP id ED2A18FC14 for ; Thu, 19 Aug 2010 13:04:56 +0000 (UTC) Received: from gw ([192.168.10.10] helo=terran) by dlink.ua with esmtpsa (TLS-1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.63) (envelope-from ) id 1Om4NZ-0000cR-3Z for freebsd-hackers@freebsd.org; Thu, 19 Aug 2010 15:37:57 +0300 Date: Thu, 19 Aug 2010 15:38:05 +0300 From: Alexandr Rybalko To: freebsd-hackers@freebsd.org Message-Id: <20100819153805.7d60302e.ray@dlink.ua> Organization: D-Link X-Mailer: Sylpheed 2.7.1 (GTK+ 2.20.1; i386-portbld-freebsd8.0) Mime-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit Subject: Modules and Buses 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, 19 Aug 2010 13:04:57 -0000 Hi all, Can someone say, how `make` in sys/modules dir can obtain available buses. I try to make clean version of bfe, that can be for PCI bus or can be part of SoC (like BCM5354) on SSB bus. So for proper module building I need to know what bus interface I must build if_bfe_pci.c, or if_bfe_siba.c, or both? -- Alexandr Rybalko aka Alex RAY From owner-freebsd-hackers@FreeBSD.ORG Thu Aug 19 13:35:25 2010 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 801D910656AB for ; Thu, 19 Aug 2010 13:35:25 +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 505F78FC1D for ; Thu, 19 Aug 2010 13:35:25 +0000 (UTC) Received: from bigwig.baldwin.cx (66.111.2.69.static.nyinternet.net [66.111.2.69]) by cyrus.watson.org (Postfix) with ESMTPSA id EC8DA46B37; Thu, 19 Aug 2010 09:35:24 -0400 (EDT) Received: from jhbbsd.localnet (smtp.hudson-trading.com [209.249.190.9]) by bigwig.baldwin.cx (Postfix) with ESMTPSA id 27DF38A04E; Thu, 19 Aug 2010 09:35:24 -0400 (EDT) From: John Baldwin To: freebsd-hackers@freebsd.org Date: Thu, 19 Aug 2010 09:18:46 -0400 User-Agent: KMail/1.13.5 (FreeBSD/7.3-CBSD-20100217; KDE/4.4.5; amd64; ; ) References: <20100819153805.7d60302e.ray@dlink.ua> In-Reply-To: <20100819153805.7d60302e.ray@dlink.ua> MIME-Version: 1.0 Content-Type: Text/Plain; charset="iso-8859-1" Content-Transfer-Encoding: 7bit Message-Id: <201008190918.46947.jhb@freebsd.org> X-Greylist: Sender succeeded SMTP AUTH, not delayed by milter-greylist-4.0.1 (bigwig.baldwin.cx); Thu, 19 Aug 2010 09:35:24 -0400 (EDT) X-Virus-Scanned: clamav-milter 0.95.1 at bigwig.baldwin.cx X-Virus-Status: Clean X-Spam-Status: No, score=-2.6 required=4.2 tests=AWL,BAYES_00 autolearn=ham version=3.2.5 X-Spam-Checker-Version: SpamAssassin 3.2.5 (2008-06-10) on bigwig.baldwin.cx Cc: Alexandr Rybalko Subject: Re: Modules and Buses 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, 19 Aug 2010 13:35:25 -0000 On Thursday, August 19, 2010 8:38:05 am Alexandr Rybalko wrote: > Hi all, > > Can someone say, how `make` in sys/modules dir can obtain available buses. > I try to make clean version of bfe, that can be for PCI bus or can be part of SoC (like BCM5354) on SSB bus. > So for proper module building I need to know what bus interface I must build if_bfe_pci.c, or if_bfe_siba.c, or both? You can always include both buses. If a bus driver isn't present in the kernel the attachment will just never be invoked. -- John Baldwin From owner-freebsd-hackers@FreeBSD.ORG Thu Aug 19 14:05:07 2010 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 C344E1065693 for ; Thu, 19 Aug 2010 14:05:07 +0000 (UTC) (envelope-from freebsd-hackers@m.gmane.org) Received: from lo.gmane.org (lo.gmane.org [80.91.229.12]) by mx1.freebsd.org (Postfix) with ESMTP id 7B7368FC24 for ; Thu, 19 Aug 2010 14:05:07 +0000 (UTC) Received: from list by lo.gmane.org with local (Exim 4.69) (envelope-from ) id 1Om5js-0003l3-2h for freebsd-hackers@freebsd.org; Thu, 19 Aug 2010 16:05:04 +0200 Received: from p5b2030f3.dip.t-dialin.net ([91.32.48.243]) by main.gmane.org with esmtp (Gmexim 0.1 (Debian)) id 1AlnuQ-0007hv-00 for ; Thu, 19 Aug 2010 16:05:04 +0200 Received: from sperber by p5b2030f3.dip.t-dialin.net with local (Gmexim 0.1 (Debian)) id 1AlnuQ-0007hv-00 for ; Thu, 19 Aug 2010 16:05:04 +0200 X-Injected-Via-Gmane: http://gmane.org/ To: freebsd-hackers@freebsd.org From: Michael Sperber Date: Thu, 19 Aug 2010 15:08:59 +0200 Lines: 28 Message-ID: Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii X-Complaints-To: usenet@dough.gmane.org X-Gmane-NNTP-Posting-Host: p5b2030f3.dip.t-dialin.net User-Agent: Gnus/5.110011 (No Gnus v0.11) XEmacs/21.5-b29 (darwin) Cancel-Lock: sha1:eshrD3pvb2wf8yD9yHggHh26eE4= Subject: Data truncation on ptys 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, 19 Aug 2010 14:05:07 -0000 I'm one of the maintainers of XEmacs, and I've been running into a persistent problem with subprocesses / ptys since at least 5.x. (If this is not the right list, I'd appreciate a pointer to a more appropriate forum.) Here's the basic issue: Whenever XEmacs tries to send a larger chunk of data to a subprocess over a pty, only part of the data arrives at the other end of the pty. XEmacs tries very hard to chop up the data into (245-byte) pieces, terminating the pieces with NL or EOF as appropriate. Still, when around 7.5 kilobyte is sent rapidly, I see this pattern: master truss: write(7," 1692 1693 1694 1695 1696 1697 1"...,245) = 245 (0xf5) write(7,"\^D",1) = 1 (0x1) slave/subprocess truss ("cat" in this case): read(0," 1692 1693 1694 1695 1696 1697 1"...,4096) = 144 (0x90) Subsequent writes from the master do not get seen *at all* on the slave, i.e. the next read blocks. If anybody could shed some light on this issue, help would be much appreciated! -- Regards, Mike From owner-freebsd-hackers@FreeBSD.ORG Thu Aug 19 14:06:36 2010 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 10D13106566B for ; Thu, 19 Aug 2010 14:06:36 +0000 (UTC) (envelope-from ray@dlink.ua) Received: from dlink.ua (smtp.dlink.ua [193.138.187.146]) by mx1.freebsd.org (Postfix) with ESMTP id C5DE28FC15 for ; Thu, 19 Aug 2010 14:06:35 +0000 (UTC) Received: from gw ([192.168.10.10] helo=terran) by dlink.ua with esmtpsa (TLS-1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.63) (envelope-from ) id 1Om5lK-0001LY-Ck; Thu, 19 Aug 2010 17:06:34 +0300 Date: Thu, 19 Aug 2010 17:06:43 +0300 From: Alexandr Rybalko To: John Baldwin Message-Id: <20100819170643.38362078.ray@dlink.ua> In-Reply-To: <201008190918.46947.jhb@freebsd.org> References: <20100819153805.7d60302e.ray@dlink.ua> <201008190918.46947.jhb@freebsd.org> Organization: D-Link X-Mailer: Sylpheed 2.7.1 (GTK+ 2.20.1; i386-portbld-freebsd8.0) Mime-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit Cc: freebsd-hackers@freebsd.org Subject: Re: Modules and Buses 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, 19 Aug 2010 14:06:36 -0000 On Thu, 19 Aug 2010 09:18:46 -0400 John Baldwin wrote: >> On Thursday, August 19, 2010 8:38:05 am Alexandr Rybalko wrote: >> > Hi all, >> > >> > Can someone say, how `make` in sys/modules dir can obtain available buses. >> > I try to make clean version of bfe, that can be for PCI bus or can be part >> of SoC (like BCM5354) on SSB bus. >> > So for proper module building I need to know what bus interface I must build >> if_bfe_pci.c, or if_bfe_siba.c, or both? >> >> You can always include both buses. If a bus driver isn't present in the >> kernel the attachment will just never be invoked. I was afraid of such response. Now I have to rewrite siba implementation to newbus :) Thanks you for answer! >> >> -- >> John Baldwin -- Alexandr Rybalko aka Alex RAY From owner-freebsd-hackers@FreeBSD.ORG Thu Aug 19 14:58:39 2010 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 899141065705 for ; Thu, 19 Aug 2010 14:58:39 +0000 (UTC) (envelope-from ed@hoeg.nl) Received: from mx0.hoeg.nl (unknown [IPv6:2a01:4f8:101:5343::aa]) by mx1.freebsd.org (Postfix) with ESMTP id 281A28FC13 for ; Thu, 19 Aug 2010 14:58:39 +0000 (UTC) Received: by mx0.hoeg.nl (Postfix, from userid 1000) id 669252A28CF5; Thu, 19 Aug 2010 16:58:37 +0200 (CEST) Date: Thu, 19 Aug 2010 16:58:37 +0200 From: Ed Schouten To: Michael Sperber Message-ID: <20100819145837.GJ2978@hoeg.nl> References: MIME-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha1; protocol="application/pgp-signature"; boundary="WTEzZvM72OaERIi0" Content-Disposition: inline In-Reply-To: User-Agent: Mutt/1.5.20 (2009-06-14) Cc: freebsd-hackers@freebsd.org Subject: Re: Data truncation on ptys 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, 19 Aug 2010 14:58:39 -0000 --WTEzZvM72OaERIi0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline Content-Transfer-Encoding: quoted-printable Hello Michael, * Michael Sperber wrote: > I'm one of the maintainers of XEmacs, and I've been running into a > persistent problem with subprocesses / ptys since at least 5.x. (If this > is not the right list, I'd appreciate a pointer to a more appropriate > forum.) Very quick question. Does this problem still occur on FreeBSD 8.x? FreeBSD 8.x has an entirely new TTY layer, which includes a new pseudo-terminal driver. Greetings, --=20 Ed Schouten WWW: http://80386.nl/ --WTEzZvM72OaERIi0 Content-Type: application/pgp-signature Content-Disposition: inline -----BEGIN PGP SIGNATURE----- Version: GnuPG v2.0.16 (FreeBSD) iEYEARECAAYFAkxtRp0ACgkQ52SDGA2eCwXa9ACffpJZ5bt7AywNfA6shlPq+vXi ISwAnR0is7eNFAsB0kEnLeVfzewW+utt =aYeK -----END PGP SIGNATURE----- --WTEzZvM72OaERIi0-- From owner-freebsd-hackers@FreeBSD.ORG Fri Aug 20 02:17:10 2010 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 6690310656A5 for ; Fri, 20 Aug 2010 02:17:10 +0000 (UTC) (envelope-from bf1783@googlemail.com) Received: from mail-wy0-f182.google.com (mail-wy0-f182.google.com [74.125.82.182]) by mx1.freebsd.org (Postfix) with ESMTP id F24E18FC13 for ; Fri, 20 Aug 2010 02:17:09 +0000 (UTC) Received: by wyj26 with SMTP id 26so3461362wyj.13 for ; Thu, 19 Aug 2010 19:17:09 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=googlemail.com; s=gamma; h=domainkey-signature:mime-version:received:received:reply-to:date :message-id:subject:from:to:cc:content-type; bh=jSznsicUKsbq+ys9BLZ19TN0TvjXVf0oGHBeC5KX/iI=; b=H34xkaHJUF49EPFtU9otAdm98CMna1joObvTVRr/rQ2Awe6E450tqHemSxYcllwU3S yiApxRpvXKT0CcmE4qgfpqG9LU+RIswsSapcJcQVJL8NaTnxQ32KNJ01o/2N2i3uAd73 oKExFv972f2DyAtrlGa40Hw++Lxx5vOCJcfyg= DomainKey-Signature: a=rsa-sha1; c=nofws; d=googlemail.com; s=gamma; h=mime-version:reply-to:date:message-id:subject:from:to:cc :content-type; b=Di0G2qyoAH7tYDY3aj+7KzAQovqPIDIeBoIai1+EufEAtpRr0wYFqTVr/uwRLiS/eE iZoe6xFklyIuew38DeihYdqMKxgjrf8SnukFQaykBwTTTp+Ks681BtNl8EpA7bUDQoN2 mRlxXLopzw+wB3VGBJNhgrj8IEksPa7MPPh8g= MIME-Version: 1.0 Received: by 10.216.188.209 with SMTP id a59mr1327529wen.87.1282270628453; Thu, 19 Aug 2010 19:17:08 -0700 (PDT) Received: by 10.216.183.212 with HTTP; Thu, 19 Aug 2010 19:17:08 -0700 (PDT) Date: Fri, 20 Aug 2010 02:17:08 +0000 Message-ID: From: "b. f." To: freebsd-hackers@FreeBSD.org Content-Type: text/plain; charset=ISO-8859-1 Cc: phil hefferan , Phil Grundig Subject: Re: How to read cmos clock - what is gettimeofday reading? X-BeenThere: freebsd-hackers@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list Reply-To: bf1783@gmail.com List-Id: Technical Discussions relating to FreeBSD List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 20 Aug 2010 02:17:10 -0000 >To further confuse matters there appears to be a common misconception on the web >that the cmos time is automatically synced to system time on FreeBSD. This is >incorrect: see msg03414 on freebsd-hardware at freebsd.org. The situation has changed in 8-STABLE and 9-CURRENT since the above message was written. The timekeeping code was changed (by the person who wrote the message that you cited) to periodically (every machdep.rtc_save_period seconds) adjust the value of the rtc if ntp is used to update the system time, machdep.disable_rtc_set=0, and the rtc driver hasn't been disabled: http://svnweb.freebsd.org/viewvc/base?view=revision&revision=207360 http://svnweb.freebsd.org/viewvc/base?view=revision&revision=208297 atrtc_{get,set}time, now in /usr/src/sys/x86/isa/atrtc.c, could serve as a basis for your own code: http://svn.freebsd.org/viewvc/base/head/sys/x86/isa/atrtc.c?view=markup There are of course *_rtc_{get,set}time variants for other architectures as well. b. From owner-freebsd-hackers@FreeBSD.ORG Fri Aug 20 07:55:44 2010 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 DF9A610656A4 for ; Fri, 20 Aug 2010 07:55:44 +0000 (UTC) (envelope-from wdef200@gmail.com) Received: from mail-bw0-f54.google.com (mail-bw0-f54.google.com [209.85.214.54]) by mx1.freebsd.org (Postfix) with ESMTP id 6A4FD8FC1E for ; Fri, 20 Aug 2010 07:55:44 +0000 (UTC) Received: by bwz20 with SMTP id 20so2847003bwz.13 for ; Fri, 20 Aug 2010 00:55:43 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:mime-version:received:received:in-reply-to :references:date:message-id:subject:from:to:cc:content-type; bh=MJYAKBpf0739d5MQz/sSnHRhUrrxQR3rLXgiDZ60cR4=; b=XVZ+jTrvGnToMaSrnYRT50IRPle4LaXaNPhNRy5az+NxIT4z7aadA4uImpHrXkT7Kz MGl/Cos7+Kjj9skBZARXRU0E6uRuuL17b/a90YfDxhgGWDuF9KavBw1FGnkg7ihQjwdQ dv+97vFKJaIwKPlC0qcZwLcuisuZYmgmvIQKk= 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; b=RhxPxFMLwlZ/BC5LsWTfHQPea5WHgMhMmk1VV8fSL+FLCE0Ki3w7RBlLsecNRln7RW 9UppdIcrc9/HmqL05IKgQLQ7GhBAcuh93FDnA7hgzCmEJHMngsNKuzVrHECunHQ1PiSd akXwNQahG70XczGK6aMf+MrUexGG4e4nDPino= MIME-Version: 1.0 Received: by 10.204.140.27 with SMTP id g27mr615083bku.168.1282290936004; Fri, 20 Aug 2010 00:55:36 -0700 (PDT) Received: by 10.204.67.3 with HTTP; Fri, 20 Aug 2010 00:55:35 -0700 (PDT) In-Reply-To: References: Date: Fri, 20 Aug 2010 10:55:35 +0300 Message-ID: From: phil hefferan To: bf1783@gmail.com Content-Type: text/plain; charset=ISO-8859-1 X-Content-Filtered-By: Mailman/MimeDel 2.1.5 Cc: freebsd-hackers@freebsd.org Subject: Re: How to read cmos clock - what is gettimeofday reading? 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, 20 Aug 2010 07:55:45 -0000 On Fri, Aug 20, 2010 at 5:17 AM, b. f. wrote: > >To further confuse matters there appears to be a common misconception on > the web > >that the cmos time is automatically synced to system time on FreeBSD. This > is > >incorrect: see msg03414 on freebsd-hardware at freebsd.org. > > The situation has changed in 8-STABLE and 9-CURRENT since the above > message was written. The timekeeping code was changed (by the person > who wrote the message that you cited) to periodically (every > machdep.rtc_save_period seconds) adjust the value of the rtc if ntp is > used to update the system time, machdep.disable_rtc_set=0, and the rtc > driver hasn't been disabled: > > http://svnweb.freebsd.org/viewvc/base?view=revision&revision=207360 > http://svnweb.freebsd.org/viewvc/base?view=revision&revision=208297 > > atrtc_{get,set}time, now in /usr/src/sys/x86/isa/atrtc.c, could serve > as a basis for your own code: > > http://svn.freebsd.org/viewvc/base/head/sys/x86/isa/atrtc.c?view=markup > > There are of course *_rtc_{get,set}time variants for other > architectures as well. > > Thanks for that. I'll look at atrtc_gettime. From owner-freebsd-hackers@FreeBSD.ORG Fri Aug 20 08:33:31 2010 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 669D010656AB for ; Fri, 20 Aug 2010 08:33:31 +0000 (UTC) (envelope-from sperber@deinprogramm.de) Received: from h615406.serverkompetenz.net (h615406.serverkompetenz.net [81.169.143.132]) by mx1.freebsd.org (Postfix) with ESMTP id 248E98FC24 for ; Fri, 20 Aug 2010 08:33:30 +0000 (UTC) Received: from h615406.serverkompetenz.net (localhost [127.0.0.1]) by h615406.serverkompetenz.net (Postfix) with ESMTP id DFC8417072; Fri, 20 Aug 2010 08:16:26 +0000 (UTC) Received: from eta.local (p5B203E92.dip.t-dialin.net [91.32.62.146]) (using TLSv1 with cipher ADH-AES256-SHA (256/256 bits)) (No client certificate requested) by h615406.serverkompetenz.net (Postfix) with ESMTPSA id A186B17070; Fri, 20 Aug 2010 08:16:26 +0000 (UTC) Received: by eta.local (Postfix, from userid 2246) id 0191F804379; Fri, 20 Aug 2010 10:16:25 +0200 (CEST) From: Michael Sperber To: Ed Schouten References: <20100819145837.GJ2978@hoeg.nl> Date: Fri, 20 Aug 2010 10:16:24 +0200 In-Reply-To: <20100819145837.GJ2978@hoeg.nl> (Ed Schouten's message of "Thu, 19 Aug 2010 16:58:37 +0200") Message-ID: User-Agent: Gnus/5.110011 (No Gnus v0.11) XEmacs/21.5-b29 (darwin) MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii X-Virus-Scanned: ClamAV using ClamSMTP Cc: freebsd-hackers@freebsd.org Subject: Re: Data truncation on ptys 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, 20 Aug 2010 08:33:31 -0000 Ed Schouten writes: > Hello Michael, > > * Michael Sperber wrote: >> I'm one of the maintainers of XEmacs, and I've been running into a >> persistent problem with subprocesses / ptys since at least 5.x. (If this >> is not the right list, I'd appreciate a pointer to a more appropriate >> forum.) > > Very quick question. Does this problem still occur on FreeBSD 8.x? > FreeBSD 8.x has an entirely new TTY layer, which includes a new > pseudo-terminal driver. Huh - no! So I guess this means I can put it down to an OS bug rather than a bug in XEmacs. (Let me know if it's still worth filing a PR.) Thanks! -- Regards, Mike From owner-freebsd-hackers@FreeBSD.ORG Fri Aug 20 13:28:41 2010 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 9A2681065674 for ; Fri, 20 Aug 2010 13:28:41 +0000 (UTC) (envelope-from jessefrgsmith@yahoo.ca) Received: from n18.bullet.mail.mud.yahoo.com (n18.bullet.mail.mud.yahoo.com [68.142.206.145]) by mx1.freebsd.org (Postfix) with SMTP id 4E05B8FC18 for ; Fri, 20 Aug 2010 13:28:41 +0000 (UTC) Received: from [68.142.200.221] by n18.bullet.mail.mud.yahoo.com with NNFMP; 20 Aug 2010 13:15:48 -0000 Received: from [68.142.201.249] by t9.bullet.mud.yahoo.com with NNFMP; 20 Aug 2010 13:15:48 -0000 Received: from [127.0.0.1] by omp410.mail.mud.yahoo.com with NNFMP; 20 Aug 2010 13:14:32 -0000 X-Yahoo-Newman-Id: 219642.23300.bm@omp410.mail.mud.yahoo.com Received: (qmail 85682 invoked from network); 20 Aug 2010 13:14:31 -0000 DomainKey-Signature: a=rsa-sha1; q=dns; c=nofws; s=s1024; d=yahoo.ca; h=DKIM-Signature:Received:X-Yahoo-SMTP:X-YMail-OSG:X-Yahoo-Newman-Property:Subject:From:To:Content-Type:Date:Message-ID:Mime-Version:X-Mailer:Content-Transfer-Encoding; b=VZGlIWjvdNPu3ZAlb+9YRuC0uTxsgWyWBMju47UNVfsIrnL5UwgcXpmwDTXXHFAvKesVF7s6d6PncDfjti6vBvMo6xXwjZp8rOTAH0HJWDQj/XSMdO6JEsih/zI0ktBGKgBxbCrfBVrELrRxLL5TQ6+6sie3g3ResRDCxnZxyhE= ; DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=yahoo.ca; s=s1024; t=1282310071; bh=3zWM+lhz5N/uqHQYBq1s22rx1Ye7sHY1DUZ5e6qPOFM=; h=Received:X-Yahoo-SMTP:X-YMail-OSG:X-Yahoo-Newman-Property:Subject:From:To:Content-Type:Date:Message-ID:Mime-Version:X-Mailer:Content-Transfer-Encoding; b=KyCTbjC0Jnwl9fEbQyorz1P1t5v++yEDCTZCGJ3RiuIK5quuHcgWxenhBu3ZIGC+gweTwQ1o/fFumdvNJU1z37oXbModu0BVZEtgPO7chc1XTkd+b9k5D4JTTMZ3qtPVCDpIPdwYf7ul4JraJ20Du02ZGx2nChC7H8xPovvfRzk= Received: from [192.168.0.104] (jessefrgsmith@71.7.176.238 with plain) by smtp143.mail.mud.yahoo.com with SMTP; 20 Aug 2010 06:14:31 -0700 PDT X-Yahoo-SMTP: NPm1JouswBClX_uJxHJINmnKUpROdMKvLL0- X-YMail-OSG: SgBPXqYVM1ne_z0Gmdw4owAURGukv0DaTfc0vrNVJdbslPr hjykkBbRsDhNZ2pXl4xK8aUg3Iq.L59kQ0EJlsrXWHOIKfH4LoTODY6B6OPY 9OxDL2CRmzyZMyWlaJOEbJAwlMKvD4CBp.2YSuwV3aIHONxGwPxwKRIF6PRy cnIBra.SFtDhyrVDy.tEX.eD.Eri0RmWiuoXmI7E5qvcZHxKw9k46lU.7.Sb phHe8QWL_8oAC6Ph5Q_52BCwz6J5vw9t16VZgsqcwPrRQAO2a1a1QN6Vz0iU QDZIiSSFzyH5DrrzEO3vL.HI- X-Yahoo-Newman-Property: ymail-3 From: Jesse Smith To: freebsd-hackers@freebsd.org Content-Type: text/plain; charset="UTF-8" Date: Fri, 20 Aug 2010 10:14:23 -0300 Message-ID: <1282310063.2601.9.camel@hp-laptop> Mime-Version: 1.0 X-Mailer: Evolution 2.28.1 Content-Transfer-Encoding: 7bit Subject: Converting from jiffies to ticks 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, 20 Aug 2010 13:28:41 -0000 I am currently trying to port a program from Linux to FreeBSD which detects how much processor time a process is using. The native Linux code does this (in part) by reading the number of "jiffies" a given process uses. This info is pulled from the /proc/PID/stat file. One function is failing on FreeBSD and it's obviously because FreeBSD does not have all the same files/data in the /proc directory. I've looked around and, as I understand it, FreeBSD uses "ticks" instead of "jiffies" to measure process usage. However, how to gather that data is a bit lost on me. This raises a question for me: Where can I find the equivalent information on FreeBSD? I assume there's a function call. Maybe in the kvm_* family? I need to be able to get the number of ticks a given PID is using, both in the kernel and userspace. The rest of the program measures everything in "jiffies", so it would be ideal for me to get the ticks used on FreeBSD (based on PID), convert it to "jiffies" and pass it back to the main program. Thanks for any advice, Jesse From owner-freebsd-hackers@FreeBSD.ORG Fri Aug 20 13:46:24 2010 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 1270610656A4 for ; Fri, 20 Aug 2010 13:46:24 +0000 (UTC) (envelope-from spawk@acm.poly.edu) Received: from acm.poly.edu (acm.poly.edu [128.238.9.200]) by mx1.freebsd.org (Postfix) with ESMTP id A788F8FC15 for ; Fri, 20 Aug 2010 13:46:21 +0000 (UTC) Received: (qmail 77993 invoked from network); 20 Aug 2010 13:46:21 -0000 Received: from unknown (HELO ?192.168.1.216?) (spawk@66.206.120.2) by acm.poly.edu with AES256-SHA encrypted SMTP; 20 Aug 2010 13:46:21 -0000 Message-ID: <4C6E8732.8090304@acm.poly.edu> Date: Fri, 20 Aug 2010 09:46:26 -0400 From: Boris Kochergin User-Agent: Thunderbird 2.0.0.24 (X11/20100530) MIME-Version: 1.0 To: Jesse Smith References: <1282310063.2601.9.camel@hp-laptop> In-Reply-To: <1282310063.2601.9.camel@hp-laptop> Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit Cc: freebsd-hackers@freebsd.org Subject: Re: Converting from jiffies to ticks 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, 20 Aug 2010 13:46:24 -0000 Jesse Smith wrote: > I am currently trying to port a program from Linux to FreeBSD which > detects how much processor time a process is using. The native Linux > code does this (in part) by reading the number of "jiffies" a given > process uses. This info is pulled from the /proc/PID/stat file. > > One function is failing on FreeBSD and it's obviously because FreeBSD > does not have all the same files/data in the /proc directory. > > I've looked around and, as I understand it, FreeBSD uses "ticks" instead > of "jiffies" to measure process usage. However, how to gather that data > is a bit lost on me. > > This raises a question for me: > Where can I find the equivalent information on FreeBSD? I assume > there's a function call. Maybe in the kvm_* family? I need to be able to > get the number of ticks a given PID is using, both in the kernel and > userspace. > > > The rest of the program measures everything in "jiffies", so it would be > ideal for me to get the ticks used on FreeBSD (based on PID), convert it > to "jiffies" and pass it back to the main program. > > Thanks for any advice, > Jesse > > As someone pointed out on -hackers, the jiffies situation in Linux is messy because it depends on the architecture, what version of the kernel is in use, etc. If, in the end, you're just interested in things like the real and CPU time used, however, check out kvm_getprocs(3). The information available with that call is documented in the kinfo_proc structure in /usr/include/sys/user.h. -Boris From owner-freebsd-hackers@FreeBSD.ORG Fri Aug 20 14:14:48 2010 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 2A5E31065673 for ; Fri, 20 Aug 2010 14:14:48 +0000 (UTC) (envelope-from yanegomi@gmail.com) Received: from mail-bw0-f54.google.com (mail-bw0-f54.google.com [209.85.214.54]) by mx1.freebsd.org (Postfix) with ESMTP id B01238FC1D for ; Fri, 20 Aug 2010 14:14:47 +0000 (UTC) Received: by bwz20 with SMTP id 20so3116929bwz.13 for ; Fri, 20 Aug 2010 07:14:46 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:mime-version:received:sender:received:date :x-google-sender-auth:message-id:subject:from:to:content-type; bh=DmGsCb0B0pTrw8XSHmoC/3zvTjZ1MdtMz00l+8Nf7R0=; b=Fdt5fcagUYSoa8/9M1sHGKWOJn5zVklK94m2GyKmiyJkCC3SvcrUrosaVJNth+gfUE s6XwlAWe/YnegHQLbkm/Ae0XMtwwY80sPq1sYpb6Zfu2t4ujITWftfG4b1TqmmNnuzOV kYJMoFeLgwHDorsSXN6GEr6BaACFp+F3S4ieQ= DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=mime-version:sender:date:x-google-sender-auth:message-id:subject :from:to:content-type; b=betYouiPwAv8S9xGYrjk+zPtXehbfPdBqnFPNHbrYv7EE0cyCY4DYRzUEJvuNHdWEI eH2Vzvuo3zEtBmlMJpBx6sqMfGz0MsZoP6/zwYNJqmziMXbx0qWpk6OrYiUH1Ds7Gk1X TNn9RAQd2/EV2WsQ8h4YdRnxiQZO98MWMRT1U= MIME-Version: 1.0 Received: by 10.204.68.10 with SMTP id t10mr1038132bki.77.1282313686521; Fri, 20 Aug 2010 07:14:46 -0700 (PDT) Sender: yanegomi@gmail.com Received: by 10.204.82.6 with HTTP; Fri, 20 Aug 2010 07:14:46 -0700 (PDT) Date: Fri, 20 Aug 2010 07:14:46 -0700 X-Google-Sender-Auth: 6MvaYIqhCtMJo1bbqEcJQ6xUqNQ Message-ID: From: Garrett Cooper To: hackers@freebsd.org Content-Type: text/plain; charset=ISO-8859-1 Cc: Subject: Question about printcpuinfo in sys/amd64/amd64/indentcpu.c 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, 20 Aug 2010 14:14:48 -0000 Hi, Currently the code in identcpu.c does a check for a specific cpu value extension. This is set to 0x80000004 (even though the corresponding code below iterates through 0x80000002:0x80000005): /* Check for extended CPUID information and a processor name. */ if (cpu_exthigh >= 0x80000004) { brand = cpu_brand; for (i = 0x80000002; i < 0x80000005; i++) { do_cpuid(i, regs); memcpy(brand, regs, sizeof(regs)); brand += sizeof(regs); } } Why was this done? Because some processors lie and state that they're newer than the processor version that they actually are? This was committed in CVS revision 1.80.2.14 with the following message: MFC: Precursors to simple hyperthreading support and sync with current: - Axe earlysetcpuclass() as it was OBE a long time ago. - Add cpu_exthigh to hold the highest supported extended cpuid. - Don't initialize cpu_class, the initial value isn't used anywhere. - Make the support for processor names in the extended cpuid information shared between the AMD and Transmeta sections and also perform it for Intel CPUs. - Support brand-indexed names for Intel CPUs. - Sync AMD 486 cpu_model's with current. - Remove duplicate and bogus docs for bits 28 and 29 of cpuid features. - Document bits 30 and 31 of cpuid features. - Display the number of logical cores on CPUs that support hyperthreading. - Make hw_instruction_sse static. - Move enable_sse()'s prototype to machine/md_var.h. - Add cpu_procinfo to hold information about this processor from cpuid 1 including count of HTT cores, brand index, local APIC ID, etc. Thanks, -Garrett From owner-freebsd-hackers@FreeBSD.ORG Fri Aug 20 14:48:31 2010 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 97DF61065672 for ; Fri, 20 Aug 2010 14:48: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 687278FC1A for ; Fri, 20 Aug 2010 14:48:31 +0000 (UTC) Received: from bigwig.baldwin.cx (66.111.2.69.static.nyinternet.net [66.111.2.69]) by cyrus.watson.org (Postfix) with ESMTPSA id EF72A46B17; Fri, 20 Aug 2010 10:48:30 -0400 (EDT) Received: from jhbbsd.localnet (smtp.hudson-trading.com [209.249.190.9]) by bigwig.baldwin.cx (Postfix) with ESMTPSA id C10468A04E; Fri, 20 Aug 2010 10:48:29 -0400 (EDT) From: John Baldwin To: freebsd-hackers@freebsd.org Date: Fri, 20 Aug 2010 09:38:45 -0400 User-Agent: KMail/1.13.5 (FreeBSD/7.3-CBSD-20100217; KDE/4.4.5; amd64; ; ) References: <1282310063.2601.9.camel@hp-laptop> In-Reply-To: <1282310063.2601.9.camel@hp-laptop> MIME-Version: 1.0 Content-Type: Text/Plain; charset="utf-8" Content-Transfer-Encoding: 7bit Message-Id: <201008200938.45590.jhb@freebsd.org> X-Greylist: Sender succeeded SMTP AUTH, not delayed by milter-greylist-4.0.1 (bigwig.baldwin.cx); Fri, 20 Aug 2010 10:48:29 -0400 (EDT) X-Virus-Scanned: clamav-milter 0.95.1 at bigwig.baldwin.cx X-Virus-Status: Clean X-Spam-Status: No, score=-2.6 required=4.2 tests=AWL,BAYES_00 autolearn=ham version=3.2.5 X-Spam-Checker-Version: SpamAssassin 3.2.5 (2008-06-10) on bigwig.baldwin.cx Cc: Jesse Smith Subject: Re: Converting from jiffies to ticks 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, 20 Aug 2010 14:48:31 -0000 On Friday, August 20, 2010 9:14:23 am Jesse Smith wrote: > I am currently trying to port a program from Linux to FreeBSD which > detects how much processor time a process is using. The native Linux > code does this (in part) by reading the number of "jiffies" a given > process uses. This info is pulled from the /proc/PID/stat file. > > One function is failing on FreeBSD and it's obviously because FreeBSD > does not have all the same files/data in the /proc directory. > > I've looked around and, as I understand it, FreeBSD uses "ticks" instead > of "jiffies" to measure process usage. However, how to gather that data > is a bit lost on me. > > This raises a question for me: > Where can I find the equivalent information on FreeBSD? I assume > there's a function call. Maybe in the kvm_* family? I need to be able to > get the number of ticks a given PID is using, both in the kernel and > userspace. > > > The rest of the program measures everything in "jiffies", so it would be > ideal for me to get the ticks used on FreeBSD (based on PID), convert it > to "jiffies" and pass it back to the main program. FreeBSD saves the total runtime in an architecture-dependent "ticker" count that is separate from "ticks". ("ticks" tends to run at hz, so by default 1000 times per second, where as the 'ticker' on x86 is the TSC which runs at the clock speed of the CPU (throttling and turbo boost aside)). You can look at the calcru() function to see how the kernel converts the runtime "ticker" count (saved in rux_runtime) into microseconds. -- John Baldwin From owner-freebsd-hackers@FreeBSD.ORG Fri Aug 20 17:38:00 2010 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 6F30B1065674 for ; Fri, 20 Aug 2010 17:38:00 +0000 (UTC) (envelope-from rysto32@gmail.com) Received: from mail-ew0-f54.google.com (mail-ew0-f54.google.com [209.85.215.54]) by mx1.freebsd.org (Postfix) with ESMTP id DA0948FC0A for ; Fri, 20 Aug 2010 17:37:59 +0000 (UTC) Received: by ewy26 with SMTP id 26so2652285ewy.13 for ; Fri, 20 Aug 2010 10: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:received:date:message-id :subject:from:to:content-type; bh=J9NqztsmOROd5jv+ttneTx4Ie2Kjx+UiK4oNy4Kpzhc=; b=eddzBX2RodxtkEBkc8qLDzzmzahhS13iCdtFM/4QbdkrEJ41LxBa+hGFBkEcTAD3+i shiMZoKBRRDnRtof/AjPVYpCCk6B7Gnj+Y0RmsbPivJZVdmSeg0dxwGlb1Z5OQhQcnEc DnC1mHYfpuULOR/dB9O5co71JkNfVpO8CaCmE= DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=mime-version:date:message-id:subject:from:to:content-type; b=Q36dvmQX6qybOnymweOIp888PdxdA7oTEjzGBSABGmY15c5y8bVm04Fbfb5587jlro vKzzNj3lg+tuv6r/AjXsEs/tLK/xLJG/I6pC+SkXVfjpUW8h013XyRwlWLzbPXiyR+C8 We1DrnJ7nBbNZggOEpFks5XHK/phMPi8ki0sM= MIME-Version: 1.0 Received: by 10.213.32.206 with SMTP id e14mr1557722ebd.97.1282324433326; Fri, 20 Aug 2010 10:13:53 -0700 (PDT) Received: by 10.213.17.66 with HTTP; Fri, 20 Aug 2010 10:13:53 -0700 (PDT) Date: Fri, 20 Aug 2010 13:13:53 -0400 Message-ID: From: Ryan Stone To: freebsd-hackers@freebsd.org Content-Type: text/plain; charset=ISO-8859-1 Subject: kld modules remain loaded if MOD_LOAD handler returns an error 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, 20 Aug 2010 17:38:00 -0000 Consider the following modules: /* first.c */ static int *test; int test_function(void) { return *test; } static int first_modevent(struct module *m, int what, void *arg) { int err = 0; switch (what) { case MOD_LOAD: /* kldload */ test = malloc(sizeof(int), M_TEMP, M_NOWAIT | M_ZERO); if (!test) err = ENOMEM; break; case MOD_UNLOAD: /* kldunload */ break; default: err = EINVAL; break; } return(err); } static moduledata_t first_mod = { "first", first_modevent, NULL }; DECLARE_MODULE(first, first_mod, SI_SUB_KLD, SI_ORDER_ANY); MODULE_VERSION(first, 1); /* second.c */ static int second_modevent(struct module *m, int what, void *arg) { int err = 0; switch (what) { case MOD_LOAD: /* kldload */ test_function(); break; case MOD_UNLOAD: /* kldunload */ break; default: err = EINVAL; break; } return(err); } static moduledata_t second_mod = { "second", second_modevent, NULL }; DECLARE_MODULE(second, second_mod, SI_SUB_KLD, SI_ORDER_ANY); MODULE_DEPEND(second, first, 1, 1, 1); Consider the case where malloc fails in first_modevent. first_modevent will return ENOMEM, but the module will remain loaded. Now when the second module goes and loads, it calls into the first module, which is not initialized properly, and promptly crashes when test_function() dereferences a null pointer. It seems to me that a module should be unloaded if it returns an error from its MOD_LOAD handler. However, that's easier said than done. The MOD_LOAD handler is called from a SYSINIT, and there's no immediately obvious way to pass information about the failure from the SYSINIT to the kernel linker. Anybody have any thoughts on this? From owner-freebsd-hackers@FreeBSD.ORG Fri Aug 20 21:26:28 2010 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 C53411065693 for ; Fri, 20 Aug 2010 21:26:28 +0000 (UTC) (envelope-from yanegomi@gmail.com) Received: from mail-bw0-f54.google.com (mail-bw0-f54.google.com [209.85.214.54]) by mx1.freebsd.org (Postfix) with ESMTP id C59498FC18 for ; Fri, 20 Aug 2010 21:26:19 +0000 (UTC) Received: by mail-bw0-f54.google.com with SMTP id 20so25091bwz.13 for ; Fri, 20 Aug 2010 14:26:19 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:mime-version:received:sender:received :in-reply-to:references:date:x-google-sender-auth:message-id:subject :from:to:cc:content-type:content-transfer-encoding; bh=20iIZvEe/U2lriN7wCE+/dEmnOWU3H4tte3ThnM97Ik=; b=DvXbcnjeqF8315KG/Fkii4+wMviW5gw4IKwUDm5SpH/jP5w+v+gax/LGtGXFnMAbvW SMXYY6k1x1pIeUBF+RL2opb48OnROId9s6ZGtbQt5zcLMMM3Xwm6Vhy4exbxgL6QoBpG 5hP7DwZ7u/inbUb/IBrl3+5APoAC3qUj+VSZg= DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=mime-version:sender:in-reply-to:references:date :x-google-sender-auth:message-id:subject:from:to:cc:content-type :content-transfer-encoding; b=kPvZfsgi2l7DU5CQdKoYOBZrCdIdCxjJnjyekj+e7TuOH+NAgP33ftu0Mi07isc3ct NWlc358tEJpAMcv2IAW8OOOIJNZDFqW64yF5BJcxXdMsfzBz26Xs/CB1om9FJgu0a9al 9IwTJXM6GVhp6zGYkV2yQfjN7jR+/Z/d5q4hg= MIME-Version: 1.0 Received: by 10.204.68.136 with SMTP id v8mr1372248bki.88.1282339579405; Fri, 20 Aug 2010 14:26:19 -0700 (PDT) Sender: yanegomi@gmail.com Received: by 10.204.82.6 with HTTP; Fri, 20 Aug 2010 14:26:19 -0700 (PDT) In-Reply-To: References: Date: Fri, 20 Aug 2010 14:26:19 -0700 X-Google-Sender-Auth: YndQrd0bWcj9s5XgccCG1NYZNiI Message-ID: From: Garrett Cooper To: Ryan Stone Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: quoted-printable Cc: freebsd-hackers@freebsd.org Subject: Re: kld modules remain loaded if MOD_LOAD handler returns an error 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, 20 Aug 2010 21:26:28 -0000 On Fri, Aug 20, 2010 at 10:13 AM, Ryan Stone wrote: > Consider the following modules: > > /* first.c */ > static int *test; > > int > test_function(void) > { > =A0 =A0return *test; > } > > static int > first_modevent(struct module *m, int what, void *arg) > { > =A0 =A0 =A0 =A0int err =3D 0; > > =A0 =A0 =A0 =A0switch (what) { > =A0 =A0 =A0 =A0case MOD_LOAD: =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0/* kldload *= / > =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0test =3D malloc(sizeof(int), M_TEMP, M_NOW= AIT | M_ZERO); > =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0if (!test) > =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0err =3D ENOMEM; > =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0break; > =A0 =A0 =A0 =A0case MOD_UNLOAD: =A0 =A0 =A0 =A0 =A0 =A0 =A0/* kldunload *= / > =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0break; > =A0 =A0 =A0 =A0default: > =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0err =3D EINVAL; > =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0break; > =A0 =A0 =A0 =A0} > =A0 =A0 =A0 =A0return(err); > } > > static moduledata_t first_mod =3D { > =A0 =A0 =A0 =A0"first", > =A0 =A0 =A0 =A0first_modevent, > =A0 =A0 =A0 =A0NULL > }; > > DECLARE_MODULE(first, first_mod, SI_SUB_KLD, SI_ORDER_ANY); > MODULE_VERSION(first, 1); > > > /* second.c */ > static int > second_modevent(struct module *m, int what, void *arg) > { > =A0 =A0 =A0 =A0int err =3D 0; > > =A0 =A0 =A0 =A0switch (what) { > =A0 =A0 =A0 =A0case MOD_LOAD: =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0/* kldload *= / > =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0test_function(); > =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0break; > =A0 =A0 =A0 =A0case MOD_UNLOAD: =A0 =A0 =A0 =A0 =A0 =A0 =A0/* kldunload *= / > =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0break; > =A0 =A0 =A0 =A0default: > =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0err =3D EINVAL; > =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0break; > =A0 =A0 =A0 =A0} > =A0 =A0 =A0 =A0return(err); > } > > static moduledata_t second_mod =3D { > =A0 =A0 =A0 =A0"second", > =A0 =A0 =A0 =A0second_modevent, > =A0 =A0 =A0 =A0NULL > }; > > DECLARE_MODULE(second, second_mod, SI_SUB_KLD, SI_ORDER_ANY); > MODULE_DEPEND(second, first, 1, 1, 1); > > > Consider the case where malloc fails in first_modevent. > first_modevent will return ENOMEM, but the module will remain loaded. > Now when the second module goes and loads, it calls into the first > module, which is not initialized properly, and promptly crashes when > test_function() dereferences a null pointer. > > It seems to me that a module should be unloaded if it returns an error > from its MOD_LOAD handler. =A0However, that's easier said than done. > The MOD_LOAD handler is called from a SYSINIT, and there's no > immediately obvious way to pass information about the failure from the > SYSINIT to the kernel linker. =A0Anybody have any thoughts on this? I saw similar issues as well with another driver on 6.3 and 7.1. Looking over kern_kldload and kldload in sys/kern/kern_linker.c, it doesn't appear that there's an issue with error catching, but I didn't attempt to trace down the call stack further than that. -Garrett From owner-freebsd-hackers@FreeBSD.ORG Fri Aug 20 21:45:23 2010 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 099DB106564A for ; Fri, 20 Aug 2010 21:45:23 +0000 (UTC) (envelope-from john.giacomoni@lineratesystems.com) Received: from mail-yw0-f54.google.com (mail-yw0-f54.google.com [209.85.213.54]) by mx1.freebsd.org (Postfix) with ESMTP id C36408FC12 for ; Fri, 20 Aug 2010 21:45:22 +0000 (UTC) Received: by ywk9 with SMTP id 9so1734179ywk.13 for ; Fri, 20 Aug 2010 14:45:21 -0700 (PDT) Received: by 10.151.83.11 with SMTP id k11mr2687456ybl.116.1282338962070; Fri, 20 Aug 2010 14:16:02 -0700 (PDT) Received: from [10.126.1.124] (174-29-36-52.hlrn.qwest.net [174.29.36.52]) by mx.google.com with ESMTPS id v32sm693876yba.18.2010.08.20.14.16.00 (version=TLSv1/SSLv3 cipher=RC4-MD5); Fri, 20 Aug 2010 14:16:01 -0700 (PDT) From: John Giacomoni Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: quoted-printable Date: Fri, 20 Aug 2010 15:15:59 -0600 Message-Id: <5F142BAD-E8F5-46C4-9AF3-D5E7AEAD93A0@lineratesystems.com> To: freebsd-hackers@freebsd.org Mime-Version: 1.0 (Apple Message framework v1081) X-Mailer: Apple Mail (2.1081) X-Mailman-Approved-At: Fri, 20 Aug 2010 21:55:20 +0000 Subject: use of rwlocks safe in network stack? 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, 20 Aug 2010 21:45:23 -0000 Can someone help me understand how it is safe to process network packets = from within a driver's interrupt context? It looks to me like the network drivers (bce in particular) violate the = rules laid out in locking (9). In FreeBSD 7.3 the bce driver's RX interrupt can call up into the = network stack (bce_intr -> bce_rx_intr -> if_input) which will grab = INP_INFO_WLOCK (rw_wlock) when it hits the TCP layer. pfslowtimo also acquires INP_INFO_LOCK. Is this safe? locking (9) says that acquiring a rw_wlock is not allowed = in interrupt context and rw_wlock can "sleep" via mi_switch in the = turnstile code. Is this a locking order type rule? and if so, is the rule being ignored = because network stack is guaranteed to return in a finite amount of = time? Or is the bce interrupt a different type of interrupt than = referred to in locking (9) ? Thanks, John Giacomoni From owner-freebsd-hackers@FreeBSD.ORG Fri Aug 20 22:14:39 2010 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 589611065698 for ; Fri, 20 Aug 2010 22:14:39 +0000 (UTC) (envelope-from rysto32@gmail.com) Received: from mail-ew0-f54.google.com (mail-ew0-f54.google.com [209.85.215.54]) by mx1.freebsd.org (Postfix) with ESMTP id A7DD38FC0C for ; Fri, 20 Aug 2010 22:14:38 +0000 (UTC) Received: by ewy26 with SMTP id 26so2861313ewy.13 for ; Fri, 20 Aug 2010 15:14:37 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:mime-version:received:received:in-reply-to :references:date:message-id:subject:from:to:cc:content-type; bh=OIJq8wuNT9clZV8iFu00Ig6uaNOUiE2nS/z/JcZOPnU=; b=Wu0Wx9C/ab7m/FaBdPH2mDCtWTyFauKjtbFqBG3fGDrnfqCoJ6kxBsPQkHGnWKXtuK MZ8a0Yy3MlyTPDYmAErCNioGnG4L8CyeP1IBPdMDVpW0klDojAAXEd0fSEy4wPm0aF9X wPcnkMkxwfnsjEN8Or1eFPw1FuUEiS0i8nbRg= 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; b=DTe6RLNrZPNj6fmPuXkN8Wocn1Qgc+Oi8hrhDN2HTBOvAkSZ0ITOBfhbMu0i6Awn2B KIMwmpZZX4n47KuykqHWIl3vBaO0ptKprQfkeTGuhu4xSoMBMXM3J99BvwbseRFIMjhD HUAy/DmmCkR2yukpodVGqkb6/RtTjPBDJy68o= MIME-Version: 1.0 Received: by 10.213.16.211 with SMTP id p19mr1819635eba.88.1282342477436; Fri, 20 Aug 2010 15:14:37 -0700 (PDT) Received: by 10.213.17.66 with HTTP; Fri, 20 Aug 2010 15:14:37 -0700 (PDT) In-Reply-To: <5F142BAD-E8F5-46C4-9AF3-D5E7AEAD93A0@lineratesystems.com> References: <5F142BAD-E8F5-46C4-9AF3-D5E7AEAD93A0@lineratesystems.com> Date: Fri, 20 Aug 2010 18:14:37 -0400 Message-ID: From: Ryan Stone To: John Giacomoni Content-Type: text/plain; charset=ISO-8859-1 Cc: freebsd-hackers@freebsd.org Subject: Re: use of rwlocks safe in network stack? 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, 20 Aug 2010 22:14:39 -0000 I don't know the details of the bce driver, but presumably the interrupt handling is happening in the context of a software interrupt thread, where it is safe to take mutexes and rwlocks. You are only in interrupt context in a "fast" interrupt handler. From owner-freebsd-hackers@FreeBSD.ORG Sat Aug 21 00:30:15 2010 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 5317510656AE for ; Sat, 21 Aug 2010 00:30:15 +0000 (UTC) (envelope-from julian@elischer.org) Received: from out-0.mx.aerioconnect.net (out-0-37.mx.aerioconnect.net [216.240.47.97]) by mx1.freebsd.org (Postfix) with ESMTP id 351A08FC15 for ; Sat, 21 Aug 2010 00:30:14 +0000 (UTC) Received: from idiom.com (postfix@mx0.idiom.com [216.240.32.160]) by out-0.mx.aerioconnect.net (8.13.8/8.13.8) with ESMTP id o7L06e53020065; Fri, 20 Aug 2010 17:06:40 -0700 X-Client-Authorized: MaGic Cook1e X-Client-Authorized: MaGic Cook1e Received: from julian-mac.elischer.org (h-67-100-89-137.snfccasy.static.covad.net [67.100.89.137]) by idiom.com (Postfix) with ESMTP id A57742D6011; Fri, 20 Aug 2010 17:06:39 -0700 (PDT) Message-ID: <4C6F18A1.7090705@elischer.org> Date: Fri, 20 Aug 2010 17:06:57 -0700 From: Julian Elischer User-Agent: Mozilla/5.0 (Macintosh; U; PPC Mac OS X 10.4; en-US; rv:1.9.1.11) Gecko/20100711 Thunderbird/3.0.6 MIME-Version: 1.0 To: John Giacomoni References: <5F142BAD-E8F5-46C4-9AF3-D5E7AEAD93A0@lineratesystems.com> In-Reply-To: <5F142BAD-E8F5-46C4-9AF3-D5E7AEAD93A0@lineratesystems.com> Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit X-Scanned-By: MIMEDefang 2.67 on 216.240.47.51 Cc: freebsd-hackers@freebsd.org Subject: Re: use of rwlocks safe in network stack? 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, 21 Aug 2010 00:30:15 -0000 On 8/20/10 2:15 PM, John Giacomoni wrote: > Can someone help me understand how it is safe to process network packets from within a driver's interrupt context? > It looks to me like the network drivers (bce in particular) violate the rules laid out in locking (9). The trick is that most of the 'interrupt' handlers in the system are not really interrupt handlers directly, but rather threads that are kicked into life when a 'stub' interrupt handler kicks them. The stub is system supplied unless the driver specifically supplies one (called a "FAST" interrupt handler) in which case THAT is a real interrupt handler and must only use spinlocks. I hope that helps.. I'm sure there is a man page for it in chapter 9 somewhere. (looks) ah yes man ithread should be a good start. > > In FreeBSD 7.3 the bce driver's RX interrupt can call up into the network stack (bce_intr -> bce_rx_intr -> if_input) which will grab INP_INFO_WLOCK (rw_wlock) when it hits the TCP layer. > > pfslowtimo also acquires INP_INFO_LOCK. > > Is this safe? locking (9) says that acquiring a rw_wlock is not allowed in interrupt context and rw_wlock can "sleep" via mi_switch in the turnstile code. > > Is this a locking order type rule? and if so, is the rule being ignored because network stack is guaranteed to return in a finite amount of time? Or is the bce interrupt a different type of interrupt than referred to in locking (9) ? > > Thanks, > > John Giacomoni > > > > _______________________________________________ > 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 Aug 21 00:46:07 2010 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 DE5B81065670 for ; Sat, 21 Aug 2010 00:46:07 +0000 (UTC) (envelope-from atom@smasher.org) Received: from atom.smasher.org (atom.smasher.org [69.55.237.145]) by mx1.freebsd.org (Postfix) with SMTP id AA0FD8FC14 for ; Sat, 21 Aug 2010 00:46:07 +0000 (UTC) Received: (qmail 68364 invoked by uid 1000); 21 Aug 2010 00:19:26 -0000 Content-Type: TEXT/PLAIN; format=flowed; charset=US-ASCII Date: Sat, 21 Aug 2010 12:19:24 +1200 (NZST) From: Atom Smasher Message-ID: <1008211213030.2000@smasher> MIME-Version: 1.0 OpenPGP: id=0xB88D52E4D9F57808; algo=1 (RSA); size=4096; url=http://atom.smasher.org/pgp.txt To: freebsd-hackers@freebsd.org X-POM: The Moon is Waxing Gibbous (88% of Full) X-Hashcash: 1:20:1008210019:freebsd-hackers@freebsd.org::f8obly087RsX/5Oa:000000 0000000000000000000000001Zj1 Subject: intel i5 - core? or core2? 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, 21 Aug 2010 00:46:07 -0000 hardware: MACH: x86_64 (LENOVO, 4313CTO, ThinkPad T510) CPU: x86_64 (Intel(R) Core(TM) i5 CPU M 540 @ 2.53GHz) FreeBSD 8.1-RELEASE #0 (amd64) in "/etc/make.conf" i tried setting "CPUTYPE=core" but as soon as i start building things, lang/perl5.10 fails, complaining about "core" not being right. when i change the setting to "CPUTYPE=core2" it builds fine. is something wrong? i thought the i5 was "core", not "core2"...? -- ...atom ________________________ http://atom.smasher.org/ 762A 3B98 A3C3 96C9 C6B7 582A B88D 52E4 D9F5 7808 ------------------------------------------------- "The nationalist not only does not disapprove of atrocities committed by his own side, but he has a remarkable capacity for not even hearing about them." -- George Orwell From owner-freebsd-hackers@FreeBSD.ORG Sat Aug 21 01:03:17 2010 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 F0F8B1065673 for ; Sat, 21 Aug 2010 01:03:17 +0000 (UTC) (envelope-from yanegomi@gmail.com) Received: from mail-bw0-f54.google.com (mail-bw0-f54.google.com [209.85.214.54]) by mx1.freebsd.org (Postfix) with ESMTP id 7E4B48FC13 for ; Sat, 21 Aug 2010 01:03:17 +0000 (UTC) Received: by bwz20 with SMTP id 20so170354bwz.13 for ; Fri, 20 Aug 2010 18:03:16 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:mime-version:received:sender:received :in-reply-to:references:date:x-google-sender-auth:message-id:subject :from:to:cc:content-type:content-transfer-encoding; bh=EK6kidJr4hZipM9r7BFKNQ0nm7xixki6Nu6FJdgaE5M=; b=EchIOkyn4qG9nFEJugJQWnh8KXKPOI8pRv2u7Yxeot4Csn9iGbudzRo1g7QBJ2B60J qQMcngQ5ZI7wFsaNPGVOgx6Ys0TuxKYXhIPKT2SrcFN6Kg9fPvC5YT9WEtjN377m1qyO ajKRLq4e+vnNy4I3ChYVrW9Iqd3sBiUd0FwHM= DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=mime-version:sender:in-reply-to:references:date :x-google-sender-auth:message-id:subject:from:to:cc:content-type :content-transfer-encoding; b=OrtC3hP0FPRN/GKspMY4PH/KcDm62Lp+wKqRyBNRBj1R30p6RuugBsE4ZJUlGvOAtB 51hCvQa/9UsQoJ2y6qpiRyf8fUSUhoJMqOkPQr7w2aU+upPbYL37+wtqz9Thv+scMrhb xtSVf8Bv1TfYx1H0jYtWkhegAsJWXFDXVvvUc= MIME-Version: 1.0 Received: by 10.204.138.145 with SMTP id a17mr1460065bku.82.1282352596258; Fri, 20 Aug 2010 18:03:16 -0700 (PDT) Sender: yanegomi@gmail.com Received: by 10.204.82.6 with HTTP; Fri, 20 Aug 2010 18:03:16 -0700 (PDT) In-Reply-To: <1008211213030.2000@smasher> References: <1008211213030.2000@smasher> Date: Fri, 20 Aug 2010 18:03:16 -0700 X-Google-Sender-Auth: xQrEtwGlCmw6JLIYJvOOsFPoi3U Message-ID: From: Garrett Cooper To: Atom Smasher Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: quoted-printable Cc: freebsd-hackers@freebsd.org Subject: Re: intel i5 - core? or core2? 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, 21 Aug 2010 01:03:18 -0000 On Fri, Aug 20, 2010 at 5:19 PM, Atom Smasher wrote: > hardware: > =A0MACH: =A0x86_64 (LENOVO, 4313CTO, ThinkPad T510) > =A0CPU: =A0 x86_64 (Intel(R) Core(TM) i5 CPU M 540 @ 2.53GHz) > > FreeBSD 8.1-RELEASE #0 (amd64) > > in "/etc/make.conf" i tried setting "CPUTYPE=3Dcore" but as soon as i sta= rt > building things, lang/perl5.10 fails, complaining about "core" not being > right. > > when i change the setting to "CPUTYPE=3Dcore2" it builds fine. > > is something wrong? i thought the i5 was "core", not "core2"...? I thought our base gcc didn't support core/core2 (IIRC gcc 4.4+ supports core/core2). Maybe this is a documentation bug with .../share/examples/etc/make.conf ? Thanks, -Garrett From owner-freebsd-hackers@FreeBSD.ORG Sat Aug 21 01:04:59 2010 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 4E5DA1065694 for ; Sat, 21 Aug 2010 01:04:59 +0000 (UTC) (envelope-from swell.k@gmail.com) Received: from mail-wy0-f182.google.com (mail-wy0-f182.google.com [74.125.82.182]) by mx1.freebsd.org (Postfix) with ESMTP id D5E8C8FC16 for ; Sat, 21 Aug 2010 01:04:58 +0000 (UTC) Received: by wyj26 with SMTP id 26so5002495wyj.13 for ; Fri, 20 Aug 2010 18:04:57 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:received:received:from:to:cc:subject:references :date:in-reply-to:message-id:user-agent:mime-version:content-type; bh=LAw3+fhk9hALPLjWFdUdPrdNr6uTQ61VqxI2cG90rw0=; b=evEl+D6HTz1qgNHrKpDcZJY2A0ywOhgKqdM5uSG1dr52Uzf2NWd6eFpuw2XbHSWERa VtG/lTn0PLJ3n4fhvCWJ0yXgb5HPKtcwFnB14kW2owAFUieT5E2PsMAKq5eJ4P4fEsNh WNH5rBJEfMY/g9rW5CsfTyEA+j7EXRa7evSj4= DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=from:to:cc:subject:references:date:in-reply-to:message-id :user-agent:mime-version:content-type; b=BjqA9Kc/1xiI2MzHfEUsvC4uRkNYTCVHj6zWI97GQKYMD3f/Onwbs7RvRyEoysdqve 6k+Ogx0EcTJDmSrXi/t0LsmL4BIwJtRMugbuWNJm1gmlduoO7UTfaRwpPvAbC4wcM4Dq EW7fwShUXw63iwD+G3G2Nl61C/JBi5HyRZvvs= Received: by 10.227.138.146 with SMTP id a18mr1914184wbu.151.1282352697738; Fri, 20 Aug 2010 18:04:57 -0700 (PDT) Received: from localhost (spftor1.privacyfoundation.de [87.118.104.203]) by mx.google.com with ESMTPS id m25sm3001607wbc.7.2010.08.20.18.04.53 (version=SSLv3 cipher=RC4-MD5); Fri, 20 Aug 2010 18:04:57 -0700 (PDT) From: Anonymous To: Atom Smasher References: <1008211213030.2000@smasher> Date: Sat, 21 Aug 2010 05:04:42 +0400 In-Reply-To: <1008211213030.2000@smasher> (Atom Smasher's message of "Sat, 21 Aug 2010 12:19:24 +1200 (NZST)") Message-ID: <8639u822tx.fsf@gmail.com> User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/24.0.50 (berkeley-unix) MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Cc: freebsd-hackers@freebsd.org Subject: Re: intel i5 - core? or core2? 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, 21 Aug 2010 01:04:59 -0000 Atom Smasher writes: > hardware: > MACH: x86_64 (LENOVO, 4313CTO, ThinkPad T510) > CPU: x86_64 (Intel(R) Core(TM) i5 CPU M 540 @ 2.53GHz) > > FreeBSD 8.1-RELEASE #0 (amd64) > > in "/etc/make.conf" i tried setting "CPUTYPE=core" but as soon as i > start building things, lang/perl5.10 fails, complaining about "core" > not being right. > > when i change the setting to "CPUTYPE=core2" it builds fine. I'd suggest using CPUTYPE?=native and let the compiler decide what's best. Our pretty old gcc in base supports neither `core' nor `core2'. The `core2' is just an alias for `nocona'/`prescott' for amd64/i386. And `core' alias is available only for i386, cf. bsd.cpu.mk. > > is something wrong? i thought the i5 was "core", not "core2"...? From owner-freebsd-hackers@FreeBSD.ORG Sat Aug 21 11:41:40 2010 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 10F8810656A6 for ; Sat, 21 Aug 2010 11:41:40 +0000 (UTC) (envelope-from rank1seeker@gmail.com) Received: from mail-ww0-f50.google.com (mail-ww0-f50.google.com [74.125.82.50]) by mx1.freebsd.org (Postfix) with ESMTP id 9EC7E8FC0C for ; Sat, 21 Aug 2010 11:41:39 +0000 (UTC) Received: by wwi18 with SMTP id 18so1295868wwi.31 for ; Sat, 21 Aug 2010 04:41:38 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:mime-version:received:received:in-reply-to :references:date:message-id:subject:from:to:content-type; bh=WkDxrqa0dwUV2zsRAKUAI54UIYj1zf2CJ7E97fNkd3o=; b=ZSrslhXwqg0PLMo5tYDX6UN25NUkDaLZJw9aG4MNkHq8uZ02gGl3XYd/DH4pNrk0Sd xkHQ9G8OE4Z49zdJ3uR+U36ER3uSILQ8PDGcDQsfz0H9CIP+qG3hI/bNEcw8LsIb93CZ XSvvRIXNuCbYibM8by8mRbfCEk/0fCbAgaJFc= 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=A/lcQU0kM2zRfuWViHJAtd+pEmST1belyvI6FRPSHkswrv2FtQ362aTZtk6QMennL7 fNZWNpl6BB4IuQ4yODgm8OY1F+LmHdkZAHLADfm/DunYoaNWlJRPvh4eQCFzLxdpq4hH CqW0QXfDGJf5G6Pyto/4PD2+1/FTutdE6eNFA= MIME-Version: 1.0 Received: by 10.216.131.161 with SMTP id m33mr2461304wei.13.1282390898502; Sat, 21 Aug 2010 04:41:38 -0700 (PDT) Received: by 10.216.58.144 with HTTP; Sat, 21 Aug 2010 04:41:38 -0700 (PDT) In-Reply-To: <8639u822tx.fsf@gmail.com> References: <1008211213030.2000@smasher> <8639u822tx.fsf@gmail.com> Date: Sat, 21 Aug 2010 13:41:38 +0200 Message-ID: From: "Domagoj S." To: freebsd-hackers@freebsd.org Content-Type: text/plain; charset=ISO-8859-1 Subject: Re: intel i5 - core? or core2? 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, 21 Aug 2010 11:41:40 -0000 8.1 RELEASE 32bit # gcc --version gcc (GCC) 4.2.1 20070719 [FreeBSD] As per: http://gcc.gnu.org/gcc-4.2/changes.html core2 is supported Setting CPUTYPE(for i386) to: "nocona", "core" or "core2", will at the end, ALWAYS set CPUTYPE to: "prescott", which again results in set: MACHINE_CPU = sse3 sse2 sse i686 mmx i586 i486 i386 CPUTYPE?=native is nowhere mentioned "in FreeBSD" From owner-freebsd-hackers@FreeBSD.ORG Sat Aug 21 13:07:16 2010 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 A9DEF10656A8; Sat, 21 Aug 2010 13:07:16 +0000 (UTC) (envelope-from olivier@gid0.org) Received: from mail-iw0-f182.google.com (mail-iw0-f182.google.com [209.85.214.182]) by mx1.freebsd.org (Postfix) with ESMTP id 723508FC14; Sat, 21 Aug 2010 13:07:16 +0000 (UTC) Received: by iwn36 with SMTP id 36so4549468iwn.13 for ; Sat, 21 Aug 2010 06:07:15 -0700 (PDT) MIME-Version: 1.0 Received: by 10.231.161.16 with SMTP id p16mr3474273ibx.61.1282394516047; Sat, 21 Aug 2010 05:41:56 -0700 (PDT) Received: by 10.231.176.140 with HTTP; Sat, 21 Aug 2010 05:41:55 -0700 (PDT) In-Reply-To: References: <1008211213030.2000@smasher> Date: Sat, 21 Aug 2010 14:41:56 +0200 Message-ID: From: Olivier Smedts To: Garrett Cooper Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: quoted-printable Cc: freebsd-hackers@freebsd.org, Atom Smasher Subject: Re: intel i5 - core? or core2? 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, 21 Aug 2010 13:07:16 -0000 2010/8/21 Garrett Cooper : > On Fri, Aug 20, 2010 at 5:19 PM, Atom Smasher wrote: >> hardware: >> =A0MACH: =A0x86_64 (LENOVO, 4313CTO, ThinkPad T510) >> =A0CPU: =A0 x86_64 (Intel(R) Core(TM) i5 CPU M 540 @ 2.53GHz) >> >> FreeBSD 8.1-RELEASE #0 (amd64) >> >> in "/etc/make.conf" i tried setting "CPUTYPE=3Dcore" but as soon as i st= art >> building things, lang/perl5.10 fails, complaining about "core" not being >> right. >> >> when i change the setting to "CPUTYPE=3Dcore2" it builds fine. >> >> is something wrong? i thought the i5 was "core", not "core2"...? > > =A0 =A0I thought our base gcc didn't support core/core2 (IIRC gcc 4.4+ > supports core/core2). Maybe this is a documentation bug with > .../share/examples/etc/make.conf ? CPYTYPE is make.conf and -march in gcc are different things. After a lot of reading (/usr/share/examples/etc/make.conf and man gcc) and testing, here is what I use for my core2 : CPUTYPE=3Dcore2 CFLAGS=3D-O2 -pipe -march=3Dnative NO_CPU_CFLAGS=3Dyes COPTFLAGS=3D-O2 -pipe -march=3Dnative NO_CPU_COPTFLAGS=3Dyes I think you can use the same for your i5. > Thanks, > -Garrett > _______________________________________________ > 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= " > --=20 Olivier Smedts=A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 = =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0=A0 _ =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0= =A0 ASCII ribbon campaign ( ) e-mail: olivier@gid0.org=A0 =A0 =A0 =A0 - against HTML email & vCards=A0 X www: http://www.gid0.org=A0 =A0 - against proprietary attachments / \ =A0 "Il y a seulement 10 sortes de gens dans le monde : =A0 ceux qui comprennent le binaire, =A0 et ceux qui ne le comprennent pas." From owner-freebsd-hackers@FreeBSD.ORG Sat Aug 21 16:25:45 2010 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 B82B81065670 for ; Sat, 21 Aug 2010 16:25:45 +0000 (UTC) (envelope-from swell.k@gmail.com) Received: from mail-ww0-f50.google.com (mail-ww0-f50.google.com [74.125.82.50]) by mx1.freebsd.org (Postfix) with ESMTP id 4B80C8FC14 for ; Sat, 21 Aug 2010 16:25:44 +0000 (UTC) Received: by wwi18 with SMTP id 18so1564985wwi.31 for ; Sat, 21 Aug 2010 09:25:44 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:received:received:from:to:cc:subject:references :date:in-reply-to:message-id:user-agent:mime-version:content-type; bh=rZ/yqyenJrkdG6QPQUVOS26mqRktJSDcDZglAhJcwWw=; b=jbpIrwU9NnTxhYiNftVtM3EZl1rTRShI4ckgMI4GhStp20aGP2q9oyAgw56gxPXA4R CeE6faBvMdEw8RErseizcaacB/3MQCY1j6va16750be1GrTuevUHDAa4AVRAB6TpGjWF IgS1BtrjXZ/0WDxtAP++N1DkJK1TyaZygSHfw= DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=from:to:cc:subject:references:date:in-reply-to:message-id :user-agent:mime-version:content-type; b=EzA+KaTLJPNfsbyMLrTQhIEADCQ8YKZHODruRp4G4w7RXma1r/O7C6Kgvh9nOT5HPL P78vRBNyoxcx9Rjb0wRuAUgR0Je3WLUxmeNIC0gSlU59ge0O1XQNfbwdkng7/MReQ7rR Qo2LJQswBZtglApr0S4pIfiyM/VPoJnR7tcuA= Received: by 10.227.143.12 with SMTP id s12mr2653474wbu.125.1282407944083; Sat, 21 Aug 2010 09:25:44 -0700 (PDT) Received: from localhost (server51262.uk2net.com [83.170.92.9]) by mx.google.com with ESMTPS id e31sm3607633wbe.5.2010.08.21.09.25.41 (version=SSLv3 cipher=RC4-MD5); Sat, 21 Aug 2010 09:25:42 -0700 (PDT) From: Anonymous To: "Domagoj S." References: <1008211213030.2000@smasher> <8639u822tx.fsf@gmail.com> Date: Sat, 21 Aug 2010 20:25:35 +0400 In-Reply-To: (Domagoj S.'s message of "Sat, 21 Aug 2010 13:41:38 +0200") Message-ID: <861v9sue4g.fsf@gmail.com> User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/24.0.50 (berkeley-unix) MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Cc: freebsd-hackers@freebsd.org Subject: Re: intel i5 - core? or core2? 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, 21 Aug 2010 16:25:45 -0000 "Domagoj S." writes: > 8.1 RELEASE 32bit > > # gcc --version > gcc (GCC) 4.2.1 20070719 [FreeBSD] > > As per: http://gcc.gnu.org/gcc-4.2/changes.html > core2 is supported It's not! `core' and `core2' for -mtune/-march introduced since gcc43. $ echo 'int main(){}' | gcc -xc - -o/dev/null -march=core :1: error: bad value (core) for -march= switch :1: error: bad value (core) for -mtune= switch $ echo 'int main(){}' | gcc -xc - -o/dev/null -march=core2 :1: error: bad value (core2) for -march= switch :1: error: bad value (core2) for -mtune= switch Setting CPUTYPE to `core2' on amd64 will only add `sse3' to MACHINE_CPU, even when the underlying compiler/assembler actually supports more features, e.g. ssse3, sse4.1, etc., cf. conf/112997. BTW, while clang in base (on /head) supports -march=core2 it's still better to stick to -march=native, e.g. on my box CPU: Intel(R) Core(TM)2 Duo CPU E8400 @ 3.00GHz (3177.07-MHz K8-class CPU) `native' on clang implies `penryn', not a `core2'. While `native' on gcc45 implies `core2' + extra cflags[1]. [1] -mcx16 -msahf -msse4.1 --param l1-cache-size=32 --param l1-cache-line-size=64 --param l2-cache-size=6144 > > Setting CPUTYPE(for i386) to: "nocona", "core" or "core2", will at > the end, ALWAYS set CPUTYPE to: "prescott", which again results in > set: > MACHINE_CPU = sse3 sse2 sse i686 mmx i586 i486 i386 You can populate MACHINE_CPU directly, e.g. CPUTYPE ?= native MACHINE_CPU != echo ${MACHINE_ARCH}; ${CC} -E -dM -v -march=${CPUTYPE} - &1 \ | awk '/SSE|MMX/ && !/MATH/ { FS="__"; gsub("_",".",$$2); print tolower($$2) }' MACHINE_CPU += i486 i586 i686 Note sure how well it'll work for cross-arch compilation, though. > > CPUTYPE?=native is nowhere mentioned "in FreeBSD" That cruft in bsd.cpu.mk was written in pre-gcc4 days, i.e. when it didn't support -march=native. Besides, if not maintained to accommodate for newer gcc's from ports those aliases are more harmful than useful. And not much code uses MACHINE_CPU in base anyway, only libcrypto and libz.