From owner-svn-src-head@FreeBSD.ORG Sun Oct 7 00:20:10 2012 Return-Path: Delivered-To: svn-src-head@FreeBSD.org Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id D3B0F1065677; Sun, 7 Oct 2012 00:20:09 +0000 (UTC) (envelope-from marcel@xcllnt.net) Received: from mail.xcllnt.net (mail.xcllnt.net [70.36.220.4]) by mx1.freebsd.org (Postfix) with ESMTP id 904558FC1B; Sun, 7 Oct 2012 00:20:07 +0000 (UTC) Received: from sa-nc-cs-116.static.jnpr.net (natint3.juniper.net [66.129.224.36]) (authenticated bits=0) by mail.xcllnt.net (8.14.5/8.14.5) with ESMTP id q970JwEl048542 (version=TLSv1/SSLv3 cipher=AES128-SHA bits=128 verify=NO); Sat, 6 Oct 2012 17:20:00 -0700 (PDT) (envelope-from marcel@xcllnt.net) Content-Type: text/plain; charset=us-ascii Mime-Version: 1.0 (Mac OS X Mail 6.2 \(1499\)) From: Marcel Moolenaar In-Reply-To: <5070A4FC.4080802@FreeBSD.org> Date: Sat, 6 Oct 2012 17:19:52 -0700 Content-Transfer-Encoding: quoted-printable Message-Id: <31A2ABA0-49C8-458B-A055-152C3266D9B0@xcllnt.net> References: <201210062001.q96K16Or030755@svn.freebsd.org> <5070A4FC.4080802@FreeBSD.org> To: Dimitry Andric X-Mailer: Apple Mail (2.1499) Cc: svn-src-head@FreeBSD.org, svn-src-all@FreeBSD.org, src-committers@FreeBSD.org Subject: Re: svn commit: r241298 - in head: . gnu/usr.bin/cc/cc_int gnu/usr.bin/cc/include kerberos5 kerberos5/tools/asn1_compile kerberos5/tools/slc lib/clang/include share/mk tools/build/make_check usr.sbin/c... X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 07 Oct 2012 00:20:10 -0000 On Oct 6, 2012, at 2:39 PM, Dimitry Andric wrote: > On 2012-10-06 22:01, Marcel Moolenaar wrote: >> 2. Remove the use of -E. It's not needed in our build because we = use ?=3D for >> the respective variables, which means that we'll take the = environment >> value (if any) anyway. >=20 > No, this will break builds of 32-bit libraries on amd64, at least when > CC/CXX etc are set in make.conf. I put this in specifically in = r227120. >=20 > Please revert this particular change, unless you have tested that it > works correctly, with e.g. CC=3Dclang in make.conf. I'll double-check to make sure all is fine. I'll revert if I hit a problem and don't have an immediate fix for it. FYI, --=20 Marcel Moolenaar marcel@xcllnt.net From owner-svn-src-head@FreeBSD.ORG Sun Oct 7 01:58:33 2012 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id 6FF671065686; Sun, 7 Oct 2012 01:58:33 +0000 (UTC) (envelope-from imp@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 5A2488FC19; Sun, 7 Oct 2012 01:58:33 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id q971wXiZ089976; Sun, 7 Oct 2012 01:58:33 GMT (envelope-from imp@svn.freebsd.org) Received: (from imp@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q971wXQk089972; Sun, 7 Oct 2012 01:58:33 GMT (envelope-from imp@svn.freebsd.org) Message-Id: <201210070158.q971wXQk089972@svn.freebsd.org> From: Warner Losh Date: Sun, 7 Oct 2012 01:58:33 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r241307 - head/sys/arm/at91 X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 07 Oct 2012 01:58:33 -0000 Author: imp Date: Sun Oct 7 01:58:32 2012 New Revision: 241307 URL: http://svn.freebsd.org/changeset/base/241307 Log: Use the RTC unit to get the time. This works on all known AT91SAM9* processors, either on reboot or after power down with battery backup. However, the AT91RM9200 RTC always resets on reboot making it just about useless at the moment (if we support a low-power mode or an extended sleep mode, it might become useful). Submitted by: Ian Lepore Modified: head/sys/arm/at91/at91_rtc.c head/sys/arm/at91/at91_rtcreg.h Modified: head/sys/arm/at91/at91_rtc.c ============================================================================== --- head/sys/arm/at91/at91_rtc.c Sat Oct 6 22:14:19 2012 (r241306) +++ head/sys/arm/at91/at91_rtc.c Sun Oct 7 01:58:32 2012 (r241307) @@ -1,5 +1,6 @@ /*- * Copyright (c) 2006 M. Warner Losh. All rights reserved. + * Copyright (c) 2012 Ian Lepore. All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions @@ -23,6 +24,18 @@ * SUCH DAMAGE. */ +/* + * Driver for the at91 on-chip realtime clock. + * + * This driver does not currently support alarms, just date and time. + * + * Note that on an rm9200 the RTC is not your typical battery-driven clock that + * keeps time while the system is powered down. In fact, it doesn't even + * survive a chip reset to keep time across a reboot. About the only thing it + * might be good for is keeping time while the cpu clock is turned off for power + * savings. On later chips, a battery backup feature is available. + */ + #include __FBSDID("$FreeBSD$"); @@ -39,11 +52,20 @@ __FBSDID("$FreeBSD$"); #include #include #include +#include #include #include "clock_if.h" +/* + * The driver has all the infrastructure to use interrupts but doesn't actually + * have any need to do so right now. There's a non-zero cost for installing the + * handler because the RTC shares the system interrupt (IRQ 1), and thus will + * get called a lot for no reason at all. + */ +#define AT91_RTC_USE_INTERRUPTS_NOT + struct at91_rtc_softc { device_t dev; /* Myself */ @@ -81,12 +103,32 @@ static devclass_t at91_rtc_devclass; static int at91_rtc_probe(device_t dev); static int at91_rtc_attach(device_t dev); static int at91_rtc_detach(device_t dev); -static int at91_rtc_intr(void *); /* helper routines */ static int at91_rtc_activate(device_t dev); static void at91_rtc_deactivate(device_t dev); +#ifdef AT91_RTC_USE_INTERRUPTS +static int +at91_rtc_intr(void *xsc) +{ + struct at91_rtc_softc *sc; + uint32_t status; + + sc = xsc; + /* Must clear the status bits after reading them to re-arm. */ + status = RD4(sc, RTC_SR); + WR4(sc, RTC_SCCR, status); + if (status == 0) + return; + AT91_RTC_LOCK(sc); + /* Do something here */ + AT91_RTC_UNLOCK(sc); + wakeup(sc); + return (FILTER_HANDLED); +} +#endif + static int at91_rtc_probe(device_t dev) { @@ -108,15 +150,35 @@ at91_rtc_attach(device_t dev) AT91_RTC_LOCK_INIT(sc); /* - * Activate the interrupt, but disable all interrupts in the hardware + * Disable all interrupts in the hardware. + * Clear all bits in the status register. + * Set 24-hour-clock mode. */ WR4(sc, RTC_IDR, 0xffffffff); + WR4(sc, RTC_SCCR, 0x1f); + WR4(sc, RTC_MR, 0); + +#ifdef AT91_RTC_USE_INTERRUPTS err = bus_setup_intr(dev, sc->irq_res, INTR_TYPE_MISC, at91_rtc_intr, NULL, sc, &sc->intrhand); if (err) { AT91_RTC_LOCK_DESTROY(sc); goto out; } +#endif + + /* + * Read the calendar register. If the century is 19 then the clock has + * never been set. Try to store an invalid value into the register, + * which will turn on the error bit in RTC_VER, and our getclock code + * knows to return EINVAL if any error bits are on. + */ + if (RTC_CALR_CEN(RD4(sc, RTC_CALR)) == 19) + WR4(sc, RTC_CALR, 0); + + /* + * Register as a time of day clock with 1-second resolution. + */ clock_register(dev, 1000000); out: if (err) @@ -142,11 +204,13 @@ at91_rtc_activate(device_t dev) RF_ACTIVE); if (sc->mem_res == NULL) goto errout; +#ifdef AT91_RTC_USE_INTERRUPTS rid = 0; sc->irq_res = bus_alloc_resource_any(dev, SYS_RES_IRQ, &rid, RF_ACTIVE | RF_SHAREABLE); if (sc->irq_res == NULL) goto errout; +#endif return (0); errout: at91_rtc_deactivate(dev); @@ -159,39 +223,26 @@ at91_rtc_deactivate(device_t dev) struct at91_rtc_softc *sc; sc = device_get_softc(dev); +#ifdef AT91_RTC_USE_INTERRUPTS + WR4(sc, RTC_IDR, 0xffffffff); if (sc->intrhand) bus_teardown_intr(dev, sc->irq_res, sc->intrhand); sc->intrhand = 0; +#endif bus_generic_detach(sc->dev); if (sc->mem_res) - bus_release_resource(dev, SYS_RES_IOPORT, + bus_release_resource(dev, SYS_RES_MEMORY, rman_get_rid(sc->mem_res), sc->mem_res); sc->mem_res = 0; +#ifdef AT91_RTC_USE_INTERRUPTS if (sc->irq_res) bus_release_resource(dev, SYS_RES_IRQ, rman_get_rid(sc->irq_res), sc->irq_res); sc->irq_res = 0; +#endif return; } -static int -at91_rtc_intr(void *xsc) -{ - struct at91_rtc_softc *sc = xsc; -#if 0 - uint32_t status; - - /* Reading the status also clears the interrupt */ - status = RD4(sc, RTC_SR); - if (status == 0) - return; - AT91_RTC_LOCK(sc); - AT91_RTC_UNLOCK(sc); -#endif - wakeup(sc); - return (FILTER_HANDLED); -} - /* * Get the time of day clock and return it in ts. * Return 0 on success, an error number otherwise. @@ -204,6 +255,12 @@ at91_rtc_gettime(device_t dev, struct ti struct at91_rtc_softc *sc; sc = device_get_softc(dev); + + /* If the error bits are set we can't return useful values. */ + + if (RD4(sc, RTC_VER) & (RTC_VER_NVTIM | RTC_VER_NVCAL)) + return EINVAL; + timr = RD4(sc, RTC_TIMR); calr = RD4(sc, RTC_CALR); ct.nsec = 0; @@ -226,11 +283,46 @@ at91_rtc_settime(device_t dev, struct ti { struct at91_rtc_softc *sc; struct clocktime ct; + int rv; sc = device_get_softc(dev); clock_ts_to_ct(ts, &ct); + + /* + * Can't set the clock unless a second has elapsed since we last did so. + */ + while ((RD4(sc, RTC_SR) & RTC_SR_SECEV) == 0) + cpu_spinwait(); + + /* + * Stop the clocks for an update; wait until hardware is ready. + * Clear the update-ready status after it gets asserted (the manual says + * to do this before updating the value registers). + */ + WR4(sc, RTC_CR, RTC_CR_UPDCAL | RTC_CR_UPDTIM); + while ((RD4(sc, RTC_SR) & RTC_SR_ACKUPD) == 0) + cpu_spinwait(); + WR4(sc, RTC_SCCR, RTC_SR_ACKUPD); + + /* + * Set the values in the hardware, then check whether the hardware was + * happy with them so we can return the correct status. + */ WR4(sc, RTC_TIMR, RTC_TIMR_MK(ct.hour, ct.min, ct.sec)); - WR4(sc, RTC_CALR, RTC_CALR_MK(ct.year, ct.mon, ct.day, ct.dow)); + WR4(sc, RTC_CALR, RTC_CALR_MK(ct.year, ct.mon, ct.day, ct.dow+1)); + + if (RD4(sc, RTC_VER) & (RTC_VER_NVTIM | RTC_VER_NVCAL)) + rv = EINVAL; + else + rv = 0; + + /* + * Restart the clocks (turn off the update bits). + * Clear the second-event bit (because the manual says to). + */ + WR4(sc, RTC_CR, RD4(sc, RTC_CR) & ~(RTC_CR_UPDCAL | RTC_CR_UPDTIM)); + WR4(sc, RTC_SCCR, RTC_SR_SECEV); + return (0); } @@ -244,7 +336,7 @@ static device_method_t at91_rtc_methods[ DEVMETHOD(clock_gettime, at91_rtc_gettime), DEVMETHOD(clock_settime, at91_rtc_settime), - { 0, 0 } + DEVMETHOD_END }; static driver_t at91_rtc_driver = { Modified: head/sys/arm/at91/at91_rtcreg.h ============================================================================== --- head/sys/arm/at91/at91_rtcreg.h Sat Oct 6 22:14:19 2012 (r241306) +++ head/sys/arm/at91/at91_rtcreg.h Sun Oct 7 01:58:32 2012 (r241307) @@ -42,6 +42,10 @@ #define RTC_IMR 0x28 /* RTC Interrupt Mask Register */ #define RTC_VER 0x2c /* RTC Valid Entry Register */ +/* CR */ +#define RTC_CR_UPDTIM (0x1u << 0) /* Request update of time register */ +#define RTC_CR_UPDCAL (0x1u << 1) /* Request update of calendar reg. */ + /* TIMR */ #define RTC_TIMR_SEC_M 0x7fUL #define RTC_TIMR_SEC_S 0 @@ -71,14 +75,29 @@ #define RTC_CALR_DOW_M 0x00d0000UL #define RTC_CALR_DOW_S 21 #define RTC_CALR_DOW(x) FROMBCD(((x) & RTC_CALR_DOW_M) >> RTC_CALR_DOW_S) -#define RTC_CALR_DAY_M 0x3f00000UL +#define RTC_CALR_DAY_M 0x3f000000UL #define RTC_CALR_DAY_S 24 #define RTC_CALR_DAY(x) FROMBCD(((x) & RTC_CALR_DAY_M) >> RTC_CALR_DAY_S) #define RTC_CALR_MK(yr, mon, day, dow) \ - ((TOBCD((yr) / 100 + 19) << RTC_CALR_CEN_S) | \ + ((TOBCD((yr) / 100) << RTC_CALR_CEN_S) | \ (TOBCD((yr) % 100) << RTC_CALR_YEAR_S) | \ (TOBCD(mon) << RTC_CALR_MON_S) | \ (TOBCD(dow) << RTC_CALR_DOW_S) | \ (TOBCD(day) << RTC_CALR_DAY_S)) +/* SR */ + +#define RTC_SR_ACKUPD (0x1u << 0) /* Acknowledge for Update */ +#define RTC_SR_ALARM (0x1u << 1) /* Alarm Flag */ +#define RTC_SR_SECEV (0x1u << 2) /* Second Event */ +#define RTC_SR_TIMEV (0x1u << 3) /* Time Event */ +#define RTC_SR_CALEV (0x1u << 4) /* Calendar event */ + +/* VER */ + +#define RTC_VER_NVTIM (0x1 << 0) /* Non-valid time */ +#define RTC_VER_NVCAL (0x1 << 1) /* Non-valid calendar */ +#define RTC_VER_NVTIMALR (0x1 << 2) /* Non-valid time alarm */ +#define RTC_VER_NVCALALR (0x1 << 3) /* Non-valid calendar alarm */ + #endif /* ARM_AT91_AT91_RTCREG_H */ From owner-svn-src-head@FreeBSD.ORG Sun Oct 7 02:08:19 2012 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id BE66D1065670; Sun, 7 Oct 2012 02:08:19 +0000 (UTC) (envelope-from imp@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id A8A5A8FC08; Sun, 7 Oct 2012 02:08:19 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id q9728JH9091702; Sun, 7 Oct 2012 02:08:19 GMT (envelope-from imp@svn.freebsd.org) Received: (from imp@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q9728JT7091700; Sun, 7 Oct 2012 02:08:19 GMT (envelope-from imp@svn.freebsd.org) Message-Id: <201210070208.q9728JT7091700@svn.freebsd.org> From: Warner Losh Date: Sun, 7 Oct 2012 02:08:19 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r241308 - head/sys/arm/at91 X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 07 Oct 2012 02:08:19 -0000 Author: imp Date: Sun Oct 7 02:08:19 2012 New Revision: 241308 URL: http://svn.freebsd.org/changeset/base/241308 Log: Improve a few comments. Modified: head/sys/arm/at91/at91_rtc.c Modified: head/sys/arm/at91/at91_rtc.c ============================================================================== --- head/sys/arm/at91/at91_rtc.c Sun Oct 7 01:58:32 2012 (r241307) +++ head/sys/arm/at91/at91_rtc.c Sun Oct 7 02:08:19 2012 (r241308) @@ -29,11 +29,13 @@ * * This driver does not currently support alarms, just date and time. * - * Note that on an rm9200 the RTC is not your typical battery-driven clock that - * keeps time while the system is powered down. In fact, it doesn't even - * survive a chip reset to keep time across a reboot. About the only thing it - * might be good for is keeping time while the cpu clock is turned off for power - * savings. On later chips, a battery backup feature is available. + * The RTC on the AT91RM9200 resets when the core rests, so it is useless as a + * source of time (except when the CPU clock is powered down to save power, + * which we don't currently do). On AT91SAM9 chips, the RTC survives chip + * reset, and there's provisions for it to keep time via battery backup if the + * system loses power. On those systems, we use it as a RTC. We tell the two + * apart because the century field is 19 on AT91RM9200 on reset, or on AT91SAM9 + * chips that haven't had their time properly set. */ #include @@ -186,10 +188,13 @@ out: return (err); } +/* + * Cannot support detach, since there's no clock_unregister function. + */ static int at91_rtc_detach(device_t dev) { - return (EBUSY); /* XXX */ + return (EBUSY); } static int From owner-svn-src-head@FreeBSD.ORG Sun Oct 7 05:31:43 2012 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id A35A4106564A; Sun, 7 Oct 2012 05:31:43 +0000 (UTC) (envelope-from brde@optusnet.com.au) Received: from mail02.syd.optusnet.com.au (mail02.syd.optusnet.com.au [211.29.132.183]) by mx1.freebsd.org (Postfix) with ESMTP id 1E2208FC08; Sun, 7 Oct 2012 05:31:42 +0000 (UTC) Received: from c122-106-175-26.carlnfd1.nsw.optusnet.com.au (c122-106-175-26.carlnfd1.nsw.optusnet.com.au [122.106.175.26]) by mail02.syd.optusnet.com.au (8.13.1/8.13.1) with ESMTP id q975VXU4021151 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=NO); Sun, 7 Oct 2012 16:31:34 +1100 Date: Sun, 7 Oct 2012 16:31:33 +1100 (EST) From: Bruce Evans X-X-Sender: bde@besplex.bde.org To: Marcel Moolenaar In-Reply-To: <201210062001.q96K16Or030755@svn.freebsd.org> Message-ID: <20121007161440.C7605@besplex.bde.org> References: <201210062001.q96K16Or030755@svn.freebsd.org> MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII; format=flowed Cc: svn-src-head@freebsd.org, svn-src-all@freebsd.org, src-committers@freebsd.org Subject: Re: svn commit: r241298 - in head: . gnu/usr.bin/cc/cc_int gnu/usr.bin/cc/include kerberos5 kerberos5/tools/asn1_compile kerberos5/tools/slc lib/clang/include share/mk tools/build/make_check usr.sbin/c... X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 07 Oct 2012 05:31:43 -0000 On Sat, 6 Oct 2012, Marcel Moolenaar wrote: > Log: > Add support for bmake. This includes: > .... > Modified: head/share/mk/bsd.dep.mk > ============================================================================== > --- head/share/mk/bsd.dep.mk Sat Oct 6 19:57:27 2012 (r241297) > +++ head/share/mk/bsd.dep.mk Sat Oct 6 20:01:05 2012 (r241298) > @@ -102,8 +102,8 @@ ${_YC} y.tab.h: ${_YSRC} > CLEANFILES+= y.tab.c y.tab.h > .elif !empty(YFLAGS:M-d) > .for _YH in ${_YC:R}.h > -.ORDER: ${_YC} ${_YH} > -${_YC} ${_YH}: ${_YSRC} > +${_YH}: ${_YC} > +${_YC}: ${_YSRC} > ${YACC} ${YFLAGS} -o ${_YC} ${.ALLSRC} > SRCS+= ${_YH} > CLEANFILES+= ${_YH} This is broken. Yacc headers don't depend on generated yacc .c files. Now there is only a null rule to create the headers. One broken case is when the header somehow gets deleted. It bcomes out of date, but running make to update it only runs the null rule, so it remains nonexistent. Bruce From owner-svn-src-head@FreeBSD.ORG Sun Oct 7 13:27:08 2012 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id 3A4AB106564A; Sun, 7 Oct 2012 13:27:08 +0000 (UTC) (envelope-from simon@FreeBSD.org) Received: from emx.nitro.dk (leto.nitro.dk [178.63.52.6]) by mx1.freebsd.org (Postfix) with ESMTP id E43E98FC23; Sun, 7 Oct 2012 13:27:07 +0000 (UTC) Received: from mailscan.leto.nitro.dk (mailscan.leto.nitro.dk [127.0.1.4]) by emx.nitro.dk (Postfix) with ESMTP id C0A5F30F10C; Sun, 7 Oct 2012 13:27:00 +0000 (UTC) Received: from emx.nitro.dk ([127.0.1.2]) by mailscan.leto.nitro.dk (mailscan.leto.nitro.dk [127.0.1.4]) (amavisd-new, port 10024) with LMTP id Xz8OiCQsfejt; Sun, 7 Oct 2012 13:26:58 +0000 (UTC) Received: from [192.168.4.24] (unknown [89.100.2.68]) (using TLSv1 with cipher AES128-SHA (128/128 bits)) (No client certificate requested) by emx.nitro.dk (Postfix) with ESMTPSA id 4824530F102; Sun, 7 Oct 2012 13:26:58 +0000 (UTC) Content-Type: text/plain; charset=us-ascii Mime-Version: 1.0 (Mac OS X Mail 6.2 \(1499\)) From: "Simon L. B. Nielsen" In-Reply-To: <201210021744.q92Hi8dt077996@svn.freebsd.org> Date: Sun, 7 Oct 2012 14:26:57 +0100 Content-Transfer-Encoding: quoted-printable Message-Id: References: <201210021744.q92Hi8dt077996@svn.freebsd.org> To: Andrey A. Chernov X-Mailer: Apple Mail (2.1499) Cc: svn-src-head@freebsd.org, svn-src-all@freebsd.org, src-committers@freebsd.org Subject: Re: svn commit: r241137 - head/lib/libc/stdlib X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 07 Oct 2012 13:27:08 -0000 On 2 Oct 2012, at 18:44, Andrey A. Chernov wrote: > Author: ache > Date: Tue Oct 2 17:44:08 2012 > New Revision: 241137 > URL: http://svn.freebsd.org/changeset/base/241137 >=20 > Log: > Using putenv() and later direct pointer contents modification it is = possibe > to craft environment variables with similar names like that: > a=3D1 > a=3D2 > ... > unsetenv("a") should remove them all to make later getenv("a") = impossible. > Fix it to do so (this is GNU autoconf test #3 failure too). >=20 > PR: 172273 > MFC after: 1 week >=20 > Modified: > head/lib/libc/stdlib/getenv.c Reviewed by ? This needs to be reviewed by someone with clue about the pittfals if = environment manipulation before any MFC. PS. env functions are mentioned in MAINTAINERS. --=20 Simon L. B. Nielsen FreeBSD Security Officer From owner-svn-src-head@FreeBSD.ORG Sun Oct 7 15:37:31 2012 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id A134D1065672; Sun, 7 Oct 2012 15:37:31 +0000 (UTC) (envelope-from dteske@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 8BDAA8FC14; Sun, 7 Oct 2012 15:37:31 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id q97FbV6P024731; Sun, 7 Oct 2012 15:37:31 GMT (envelope-from dteske@svn.freebsd.org) Received: (from dteske@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q97FbVGx024728; Sun, 7 Oct 2012 15:37:31 GMT (envelope-from dteske@svn.freebsd.org) Message-Id: <201210071537.q97FbVGx024728@svn.freebsd.org> From: Devin Teske Date: Sun, 7 Oct 2012 15:37:31 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r241310 - head/sys/boot/forth X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 07 Oct 2012 15:37:31 -0000 Author: dteske Date: Sun Oct 7 15:37:30 2012 New Revision: 241310 URL: http://svn.freebsd.org/changeset/base/241310 Log: Comment and Copyright fixes/updates. Reviewed by: adrian (co-mentor) Approved by: adrian (co-mentor) Modified: head/sys/boot/forth/menu-commands.4th head/sys/boot/forth/menu.4th Modified: head/sys/boot/forth/menu-commands.4th ============================================================================== --- head/sys/boot/forth/menu-commands.4th Sun Oct 7 05:11:29 2012 (r241309) +++ head/sys/boot/forth/menu-commands.4th Sun Oct 7 15:37:30 2012 (r241310) @@ -1,4 +1,4 @@ -\ Copyright (c) 2006-2011 Devin Teske +\ Copyright (c) 2006-2012 Devin Teske \ All rights reserved. \ \ Redistribution and use in source and binary forms, with or without @@ -144,10 +144,6 @@ marker task-menu-commands.4th @ \ dereference address into value 48 + \ convert to ASCII numeral - \ Since we are [in this file] going to override the standard `boot' - \ routine with a custom one, you should know that we use $kernel - \ when referencing the desired kernel. Set $kernel below. - s" set kernel=${kernel_prefix}${kernel[N]}${kernel_suffix}" \ command to assemble full kernel-path -rot tuck 36 + c! swap \ replace 'N' with array index value @@ -168,10 +164,6 @@ marker task-menu-commands.4th @ \ dereference address into value 48 + \ convert to ASCII numeral - \ Since we are [in this file] going to override the standard `boot' - \ routine with a custom one, you should know that we use $root when - \ booting. Set $root below. - s" set root=${root_prefix}${root[N]}${root_prefix}" \ command to assemble full kernel-path -rot tuck 30 + c! swap \ replace 'N' with array index value Modified: head/sys/boot/forth/menu.4th ============================================================================== --- head/sys/boot/forth/menu.4th Sun Oct 7 05:11:29 2012 (r241309) +++ head/sys/boot/forth/menu.4th Sun Oct 7 15:37:30 2012 (r241310) @@ -1,6 +1,6 @@ \ Copyright (c) 2003 Scott Long \ Copyright (c) 2003 Aleksander Fafula -\ Copyright (c) 2006-2011 Devin Teske +\ Copyright (c) 2006-2012 Devin Teske \ All rights reserved. \ \ Redistribution and use in source and binary forms, with or without @@ -384,7 +384,7 @@ create init_text8 255 allot \ ACPI option is to be presented to the user, otherwise returns -1. Used \ internally by menu-create, you need not (nor should you) call this directly. \ -: acpimenuitem ( -- C-Addr | -1 ) +: acpimenuitem ( -- C-Addr/U | -1 ) arch-i386? if acpipresent? if @@ -493,7 +493,7 @@ create init_text8 255 allot \ If this is the ACPI menu option, act accordingly. dup menuacpi @ = if - acpimenuitem ( -- C-Addr | -1 ) + acpimenuitem ( -- C-Addr/U | -1 ) else loader_color? if s" ansi_caption[x]" @@ -502,14 +502,14 @@ create init_text8 255 allot then then - ( C-Addr | -1 ) + ( C-Addr/U | -1 ) dup -1 <> if \ replace 'x' with current iteration -rot 2dup 13 + c! rot \ test for environment variable getenv dup -1 <> if - printmenuitem ( C-Addr -- N ) + printmenuitem ( C-Addr/U -- N ) s" menukeyN !" \ generate cmd to store result -rot 2dup 7 + c! rot From owner-svn-src-head@FreeBSD.ORG Sun Oct 7 16:45:39 2012 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id 494501065672; Sun, 7 Oct 2012 16:45:39 +0000 (UTC) (envelope-from marcel@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 1A81C8FC12; Sun, 7 Oct 2012 16:45:39 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id q97GjcYN033919; Sun, 7 Oct 2012 16:45:38 GMT (envelope-from marcel@svn.freebsd.org) Received: (from marcel@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q97Gjcj4033917; Sun, 7 Oct 2012 16:45:38 GMT (envelope-from marcel@svn.freebsd.org) Message-Id: <201210071645.q97Gjcj4033917@svn.freebsd.org> From: Marcel Moolenaar Date: Sun, 7 Oct 2012 16:45:38 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r241311 - head X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 07 Oct 2012 16:45:39 -0000 Author: marcel Date: Sun Oct 7 16:45:38 2012 New Revision: 241311 URL: http://svn.freebsd.org/changeset/base/241311 Log: Fix 32-bit library builds after the removal of adding -E to make for AS, CC, CXX and LD. This fix implements the intended as it should have been implemented all along: by passing AS, CC, CXX and LD on the commandline of the sub-make instead of in the environment of the sub-make. Breakage pointed-out by: dim@ Modified: head/Makefile.inc1 Modified: head/Makefile.inc1 ============================================================================== --- head/Makefile.inc1 Sun Oct 7 15:37:30 2012 (r241310) +++ head/Makefile.inc1 Sun Oct 7 16:45:38 2012 (r241311) @@ -295,9 +295,10 @@ LIB32CPUFLAGS= -march=i686 -mmmx -msse - LIB32CPUFLAGS= -march=${TARGET_CPUTYPE} .endif LIB32WMAKEENV= MACHINE=i386 MACHINE_ARCH=i386 \ - MACHINE_CPU="i686 mmx sse sse2" \ - LD="${LD} -m elf_i386_fbsd -Y P,${LIB32TMP}/usr/lib32" \ - AS="${AS} --32" + MACHINE_CPU="i686 mmx sse sse2" +LIB32WMAKEFLAGS= \ + AS="${AS} --32" \ + LD="${LD} -m elf_i386_fbsd -Y P,${LIB32TMP}/usr/lib32" .elif ${TARGET_ARCH} == "powerpc64" .if empty(TARGET_CPUTYPE) @@ -305,7 +306,8 @@ LIB32CPUFLAGS= -mcpu=powerpc .else LIB32CPUFLAGS= -mcpu=${TARGET_CPUTYPE} .endif -LIB32WMAKEENV= MACHINE=powerpc MACHINE_ARCH=powerpc \ +LIB32WMAKEENV= MACHINE=powerpc MACHINE_ARCH=powerpc +LIB32WMAKEFLAGS= \ LD="${LD} -m elf32ppc_fbsd" .endif @@ -322,16 +324,20 @@ LIB32WMAKEENV+= MAKEOBJDIRPREFIX=${OBJTR VERSION="${VERSION}" \ INSTALL="sh ${.CURDIR}/tools/install.sh" \ PATH=${TMPPATH} \ - CC="${CC} ${LIB32FLAGS}" \ - CXX="${CXX} ${LIB32FLAGS}" \ LIBDIR=/usr/lib32 \ SHLIBDIR=/usr/lib32 \ COMPILER_TYPE=${WMAKE_COMPILER_TYPE} +LIB32WMAKEFLAGS+= \ + CC="${CC} ${LIB32FLAGS}" \ + CXX="${CXX} ${LIB32FLAGS}" \ + DESTDIR=${LIB32TMP} \ + -DCOMPAT_32BIT \ + -DNO_CPU_CFLAGS \ + -DNO_CTF \ + -DNO_LINT -LIB32WMAKE= ${LIB32WMAKEENV} ${MAKE} -DNO_CPU_CFLAGS -DCOMPAT_32BIT \ - -DWITHOUT_BIND -DWITHOUT_MAN -DWITHOUT_INFO \ - -DWITHOUT_HTML -DNO_CTF -DNO_LINT \ - DESTDIR=${LIB32TMP} +LIB32WMAKE= ${LIB32WMAKEENV} ${MAKE} ${LIB32WMAKEFLAGS} \ + -DWITHOUT_BIND -DWITHOUT_MAN -DWITHOUT_INFO -DWITHOUT_HTML LIB32IMAKE= ${LIB32WMAKE:NINSTALL=*:NDESTDIR=*:N_LDSCRIPTROOT=*} -DNO_INCS .endif From owner-svn-src-head@FreeBSD.ORG Sun Oct 7 17:48:39 2012 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id 1FC87106566C; Sun, 7 Oct 2012 17:48:39 +0000 (UTC) (envelope-from marcel@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id F28AB8FC0A; Sun, 7 Oct 2012 17:48:38 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id q97HmcVA042310; Sun, 7 Oct 2012 17:48:38 GMT (envelope-from marcel@svn.freebsd.org) Received: (from marcel@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q97HmcDM042308; Sun, 7 Oct 2012 17:48:38 GMT (envelope-from marcel@svn.freebsd.org) Message-Id: <201210071748.q97HmcDM042308@svn.freebsd.org> From: Marcel Moolenaar Date: Sun, 7 Oct 2012 17:48:38 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r241312 - head X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 07 Oct 2012 17:48:39 -0000 Author: marcel Date: Sun Oct 7 17:48:38 2012 New Revision: 241312 URL: http://svn.freebsd.org/changeset/base/241312 Log: Fix the showconfig target. bmake sends debug output to stderr. Submitted by: Simon Garrety Modified: head/Makefile.inc1 Modified: head/Makefile.inc1 ============================================================================== --- head/Makefile.inc1 Sun Oct 7 16:45:38 2012 (r241311) +++ head/Makefile.inc1 Sun Oct 7 17:48:38 2012 (r241312) @@ -1569,7 +1569,7 @@ check-old: check-old-files check-old-lib # showconfig - show build configuration. # showconfig: - @${MAKE} -n -f bsd.own.mk -V dummy -dg1 | grep ^MK_ | sort + @${MAKE} -n -f bsd.own.mk -V dummy -dg1 2>&1 | grep ^MK_ | sort .if !empty(KRNLOBJDIR) && !empty(KERNCONF) DTBOUTPUTPATH= ${KRNLOBJDIR}/${KERNCONF}/ From owner-svn-src-head@FreeBSD.ORG Sun Oct 7 18:07:46 2012 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id 4C041106564A; Sun, 7 Oct 2012 18:07:46 +0000 (UTC) (envelope-from alc@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 1D84B8FC08; Sun, 7 Oct 2012 18:07:46 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id q97I7jMo044929; Sun, 7 Oct 2012 18:07:45 GMT (envelope-from alc@svn.freebsd.org) Received: (from alc@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q97I7jCM044927; Sun, 7 Oct 2012 18:07:45 GMT (envelope-from alc@svn.freebsd.org) Message-Id: <201210071807.q97I7jCM044927@svn.freebsd.org> From: Alan Cox Date: Sun, 7 Oct 2012 18:07:45 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r241313 - head/sys/mips/mips X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 07 Oct 2012 18:07:46 -0000 Author: alc Date: Sun Oct 7 18:07:45 2012 New Revision: 241313 URL: http://svn.freebsd.org/changeset/base/241313 Log: Optimize the TLB invalidations performed by pmap_protect(). Use the new range-based invalidation function instead of performing per-page invalidations. Don't bother invalidating mappings that don't have PTE_D set, since they don't allow write access. Modified: head/sys/mips/mips/pmap.c Modified: head/sys/mips/mips/pmap.c ============================================================================== --- head/sys/mips/mips/pmap.c Sun Oct 7 17:48:38 2012 (r241312) +++ head/sys/mips/mips/pmap.c Sun Oct 7 18:07:45 2012 (r241313) @@ -1913,9 +1913,11 @@ pmap_remove_all(vm_page_t m) void pmap_protect(pmap_t pmap, vm_offset_t sva, vm_offset_t eva, vm_prot_t prot) { - pt_entry_t *pte; + pt_entry_t pbits, *pte; pd_entry_t *pde, *pdpe; - vm_offset_t va_next; + vm_offset_t va, va_next; + vm_paddr_t pa; + vm_page_t m; if ((prot & VM_PROT_READ) == VM_PROT_NONE) { pmap_remove(pmap, sva, eva); @@ -1927,10 +1929,6 @@ pmap_protect(pmap_t pmap, vm_offset_t sv rw_wlock(&pvh_global_lock); PMAP_LOCK(pmap); for (; sva < eva; sva = va_next) { - pt_entry_t pbits; - vm_page_t m; - vm_paddr_t pa; - pdpe = pmap_segmap(pmap, sva); #ifdef __mips_n64 if (*pdpe == 0) { @@ -1947,29 +1945,52 @@ pmap_protect(pmap_t pmap, vm_offset_t sv pde = pmap_pdpe_to_pde(pdpe, sva); if (*pde == NULL) continue; + + /* + * Limit our scan to either the end of the va represented + * by the current page table page, or to the end of the + * range being write protected. + */ if (va_next > eva) va_next = eva; + va = va_next; for (pte = pmap_pde_to_pte(pde, sva); sva != va_next; pte++, - sva += PAGE_SIZE) { - - /* Skip invalid PTEs */ - if (!pte_test(pte, PTE_V)) - continue; + sva += PAGE_SIZE) { pbits = *pte; - if (pte_test(&pbits, PTE_MANAGED | PTE_D)) { - pa = TLBLO_PTE_TO_PA(pbits); - m = PHYS_TO_VM_PAGE(pa); - vm_page_dirty(m); + if (!pte_test(&pbits, PTE_V) || pte_test(&pbits, + PTE_RO)) { + if (va != va_next) { + pmap_invalidate_range(pmap, va, sva); + va = va_next; + } + continue; } - pte_clear(&pbits, PTE_D); pte_set(&pbits, PTE_RO); - - if (pbits != *pte) { - *pte = pbits; - pmap_update_page(pmap, sva, pbits); + if (pte_test(&pbits, PTE_D)) { + pte_clear(&pbits, PTE_D); + if (pte_test(&pbits, PTE_MANAGED)) { + pa = TLBLO_PTE_TO_PA(pbits); + m = PHYS_TO_VM_PAGE(pa); + vm_page_dirty(m); + } + if (va == va_next) + va = sva; + } else { + /* + * Unless PTE_D is set, any TLB entries + * mapping "sva" don't allow write access, so + * they needn't be invalidated. + */ + if (va != va_next) { + pmap_invalidate_range(pmap, va, sva); + va = va_next; + } } + *pte = pbits; } + if (va != va_next) + pmap_invalidate_range(pmap, va, sva); } rw_wunlock(&pvh_global_lock); PMAP_UNLOCK(pmap); From owner-svn-src-head@FreeBSD.ORG Sun Oct 7 19:30:17 2012 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id 666141065670; Sun, 7 Oct 2012 19:30:17 +0000 (UTC) (envelope-from mav@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 4FDE88FC08; Sun, 7 Oct 2012 19:30:17 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id q97JUHKx056957; Sun, 7 Oct 2012 19:30:17 GMT (envelope-from mav@svn.freebsd.org) Received: (from mav@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q97JUHCZ056952; Sun, 7 Oct 2012 19:30:17 GMT (envelope-from mav@svn.freebsd.org) Message-Id: <201210071930.q97JUHCZ056952@svn.freebsd.org> From: Alexander Motin Date: Sun, 7 Oct 2012 19:30:17 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r241329 - head/sys/geom/raid X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 07 Oct 2012 19:30:17 -0000 Author: mav Date: Sun Oct 7 19:30:16 2012 New Revision: 241329 URL: http://svn.freebsd.org/changeset/base/241329 Log: Make graid command line a bit more friendly by allowing volume name or provider name to be specified instead of geom name (first argument in all subcommands except label). In most cases there is only one array used any way, so it is not really useful to make user type ugly geom names like Intel-f0bdf223 or SiI-732c2b9448cf. Though they can be used in some cases. Sponsored by: iXsystems, Inc. MFC after: 1 month Modified: head/sys/geom/raid/g_raid_ctl.c head/sys/geom/raid/md_ddf.c head/sys/geom/raid/md_intel.c head/sys/geom/raid/md_promise.c Modified: head/sys/geom/raid/g_raid_ctl.c ============================================================================== --- head/sys/geom/raid/g_raid_ctl.c Sun Oct 7 18:57:52 2012 (r241328) +++ head/sys/geom/raid/g_raid_ctl.c Sun Oct 7 19:30:16 2012 (r241329) @@ -51,7 +51,10 @@ g_raid_find_node(struct g_class *mp, con { struct g_raid_softc *sc; struct g_geom *gp; + struct g_provider *pp; + struct g_raid_volume *vol; + /* Look for geom with specified name. */ LIST_FOREACH(gp, &mp->geom, geom) { sc = gp->softc; if (sc == NULL) @@ -61,6 +64,35 @@ g_raid_find_node(struct g_class *mp, con if (strcasecmp(sc->sc_name, name) == 0) return (sc); } + + /* Look for provider with specified name. */ + LIST_FOREACH(gp, &mp->geom, geom) { + sc = gp->softc; + if (sc == NULL) + continue; + if (sc->sc_stopping != 0) + continue; + LIST_FOREACH(pp, &gp->provider, provider) { + if (strcmp(pp->name, name) == 0) + return (sc); + if (strncmp(pp->name, "raid/", 5) == 0 && + strcmp(pp->name + 5, name) == 0) + return (sc); + } + } + + /* Look for volume with specified name. */ + LIST_FOREACH(gp, &mp->geom, geom) { + sc = gp->softc; + if (sc == NULL) + continue; + if (sc->sc_stopping != 0) + continue; + TAILQ_FOREACH(vol, &sc->sc_volumes, v_next) { + if (strcmp(vol->v_name, name) == 0) + return (sc); + } + } return (NULL); } Modified: head/sys/geom/raid/md_ddf.c ============================================================================== --- head/sys/geom/raid/md_ddf.c Sun Oct 7 18:57:52 2012 (r241328) +++ head/sys/geom/raid/md_ddf.c Sun Oct 7 19:30:16 2012 (r241329) @@ -2231,7 +2231,7 @@ g_raid_md_ctl_ddf(struct g_raid_md_objec struct g_consumer *cp; struct g_provider *pp; char arg[16]; - const char *verb, *volname, *levelname, *diskname; + const char *nodename, *verb, *volname, *levelname, *diskname; char *tmp; int *nargs, *force; off_t size, sectorsize, strip, offs[DDF_MAX_DISKS_HARD], esize; @@ -2502,8 +2502,12 @@ g_raid_md_ctl_ddf(struct g_raid_md_objec } if (strcmp(verb, "delete") == 0) { + nodename = gctl_get_asciiparam(req, "arg0"); + if (nodename != NULL && strcasecmp(sc->sc_name, nodename) != 0) + nodename = NULL; + /* Full node destruction. */ - if (*nargs == 1) { + if (*nargs == 1 && nodename != NULL) { /* Check if some volume is still open. */ force = gctl_get_paraml(req, "force", sizeof(*force)); if (force != NULL && *force == 0 && @@ -2521,11 +2525,12 @@ g_raid_md_ctl_ddf(struct g_raid_md_objec } /* Destroy specified volume. If it was last - all node. */ - if (*nargs != 2) { + if (*nargs > 2) { gctl_error(req, "Invalid number of arguments."); return (-1); } - volname = gctl_get_asciiparam(req, "arg1"); + volname = gctl_get_asciiparam(req, + nodename != NULL ? "arg1" : "arg0"); if (volname == NULL) { gctl_error(req, "No volume name."); return (-2); @@ -2535,6 +2540,14 @@ g_raid_md_ctl_ddf(struct g_raid_md_objec TAILQ_FOREACH(vol, &sc->sc_volumes, v_next) { if (strcmp(vol->v_name, volname) == 0) break; + pp = vol->v_provider; + if (pp == NULL) + continue; + if (strcmp(pp->name, volname) == 0) + break; + if (strncmp(pp->name, "raid/", 5) == 0 && + strcmp(pp->name + 5, volname) == 0) + break; } if (vol == NULL) { i = strtol(volname, &tmp, 10); Modified: head/sys/geom/raid/md_intel.c ============================================================================== --- head/sys/geom/raid/md_intel.c Sun Oct 7 18:57:52 2012 (r241328) +++ head/sys/geom/raid/md_intel.c Sun Oct 7 19:30:16 2012 (r241329) @@ -1461,7 +1461,7 @@ g_raid_md_ctl_intel(struct g_raid_md_obj struct g_consumer *cp; struct g_provider *pp; char arg[16], serial[INTEL_SERIAL_LEN]; - const char *verb, *volname, *levelname, *diskname; + const char *nodename, *verb, *volname, *levelname, *diskname; char *tmp; int *nargs, *force; off_t off, size, sectorsize, strip, disk_sectors; @@ -1876,8 +1876,12 @@ g_raid_md_ctl_intel(struct g_raid_md_obj } if (strcmp(verb, "delete") == 0) { + nodename = gctl_get_asciiparam(req, "arg0"); + if (nodename != NULL && strcasecmp(sc->sc_name, nodename) != 0) + nodename = NULL; + /* Full node destruction. */ - if (*nargs == 1) { + if (*nargs == 1 && nodename != NULL) { /* Check if some volume is still open. */ force = gctl_get_paraml(req, "force", sizeof(*force)); if (force != NULL && *force == 0 && @@ -1895,11 +1899,12 @@ g_raid_md_ctl_intel(struct g_raid_md_obj } /* Destroy specified volume. If it was last - all node. */ - if (*nargs != 2) { + if (*nargs > 2) { gctl_error(req, "Invalid number of arguments."); return (-1); } - volname = gctl_get_asciiparam(req, "arg1"); + volname = gctl_get_asciiparam(req, + nodename != NULL ? "arg1" : "arg0"); if (volname == NULL) { gctl_error(req, "No volume name."); return (-2); @@ -1909,6 +1914,14 @@ g_raid_md_ctl_intel(struct g_raid_md_obj TAILQ_FOREACH(vol, &sc->sc_volumes, v_next) { if (strcmp(vol->v_name, volname) == 0) break; + pp = vol->v_provider; + if (pp == NULL) + continue; + if (strcmp(pp->name, volname) == 0) + break; + if (strncmp(pp->name, "raid/", 5) == 0 && + strcmp(pp->name + 5, volname) == 0) + break; } if (vol == NULL) { i = strtol(volname, &tmp, 10); Modified: head/sys/geom/raid/md_promise.c ============================================================================== --- head/sys/geom/raid/md_promise.c Sun Oct 7 18:57:52 2012 (r241328) +++ head/sys/geom/raid/md_promise.c Sun Oct 7 19:30:16 2012 (r241329) @@ -1217,7 +1217,7 @@ g_raid_md_ctl_promise(struct g_raid_md_o struct g_consumer *cp; struct g_provider *pp; char arg[16]; - const char *verb, *volname, *levelname, *diskname; + const char *nodename, *verb, *volname, *levelname, *diskname; char *tmp; int *nargs, *force; off_t size, sectorsize, strip; @@ -1478,8 +1478,12 @@ g_raid_md_ctl_promise(struct g_raid_md_o } if (strcmp(verb, "delete") == 0) { + nodename = gctl_get_asciiparam(req, "arg0"); + if (nodename != NULL && strcasecmp(sc->sc_name, nodename) != 0) + nodename = NULL; + /* Full node destruction. */ - if (*nargs == 1) { + if (*nargs == 1 && nodename != NULL) { /* Check if some volume is still open. */ force = gctl_get_paraml(req, "force", sizeof(*force)); if (force != NULL && *force == 0 && @@ -1497,11 +1501,12 @@ g_raid_md_ctl_promise(struct g_raid_md_o } /* Destroy specified volume. If it was last - all node. */ - if (*nargs != 2) { + if (*nargs > 2) { gctl_error(req, "Invalid number of arguments."); return (-1); } - volname = gctl_get_asciiparam(req, "arg1"); + volname = gctl_get_asciiparam(req, + nodename != NULL ? "arg1" : "arg0"); if (volname == NULL) { gctl_error(req, "No volume name."); return (-2); @@ -1511,6 +1516,14 @@ g_raid_md_ctl_promise(struct g_raid_md_o TAILQ_FOREACH(vol, &sc->sc_volumes, v_next) { if (strcmp(vol->v_name, volname) == 0) break; + pp = vol->v_provider; + if (pp == NULL) + continue; + if (strcmp(pp->name, volname) == 0) + break; + if (strncmp(pp->name, "raid/", 5) == 0 && + strcmp(pp->name + 5, volname) == 0) + break; } if (vol == NULL) { i = strtol(volname, &tmp, 10); From owner-svn-src-head@FreeBSD.ORG Sun Oct 7 19:51:28 2012 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id 5826D106568A; Sun, 7 Oct 2012 19:51:28 +0000 (UTC) (envelope-from dim@FreeBSD.org) Received: from tensor.andric.com (tensor.andric.com [87.251.56.140]) by mx1.freebsd.org (Postfix) with ESMTP id 0F3CB8FC21; Sun, 7 Oct 2012 19:51:28 +0000 (UTC) Received: from [192.168.0.6] (spaceball.home.andric.com [192.168.0.6]) (using TLSv1 with cipher DHE-RSA-CAMELLIA256-SHA (256/256 bits)) (No client certificate requested) by tensor.andric.com (Postfix) with ESMTPSA id BBEF65C59; Sun, 7 Oct 2012 21:51:26 +0200 (CEST) Message-ID: <5071DD3B.4020301@FreeBSD.org> Date: Sun, 07 Oct 2012 21:51:23 +0200 From: Dimitry Andric Organization: The FreeBSD Project User-Agent: Mozilla/5.0 (Windows NT 6.1; WOW64; rv:16.0) Gecko/20121002 Thunderbird/16.0 MIME-Version: 1.0 To: Marcel Moolenaar References: <201210071645.q97Gjcj4033917@svn.freebsd.org> In-Reply-To: <201210071645.q97Gjcj4033917@svn.freebsd.org> Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit Cc: svn-src-head@freebsd.org, svn-src-all@freebsd.org, src-committers@freebsd.org Subject: Re: svn commit: r241311 - head X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 07 Oct 2012 19:51:28 -0000 On 2012-10-07 18:45, Marcel Moolenaar wrote: > Author: marcel > Date: Sun Oct 7 16:45:38 2012 > New Revision: 241311 > URL: http://svn.freebsd.org/changeset/base/241311 > > Log: > Fix 32-bit library builds after the removal of adding -E to make for AS, > CC, CXX and LD. This fix implements the intended as it should have been > implemented all along: by passing AS, CC, CXX and LD on the commandline > of the sub-make instead of in the environment of the sub-make. Thanks! This works very nicely. From owner-svn-src-head@FreeBSD.ORG Sun Oct 7 19:53:10 2012 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id D4B7A106566B; Sun, 7 Oct 2012 19:53:05 +0000 (UTC) (envelope-from joel@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 86BCE8FC22; Sun, 7 Oct 2012 19:53:05 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id q97Jr5lJ059994; Sun, 7 Oct 2012 19:53:05 GMT (envelope-from joel@svn.freebsd.org) Received: (from joel@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q97Jr5u0059990; Sun, 7 Oct 2012 19:53:05 GMT (envelope-from joel@svn.freebsd.org) Message-Id: <201210071953.q97Jr5u0059990@svn.freebsd.org> From: Joel Dahl Date: Sun, 7 Oct 2012 19:53:05 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r241330 - in head/usr.sbin: bsdconfig chroot mountd X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 07 Oct 2012 19:53:10 -0000 Author: joel (doc committer) Date: Sun Oct 7 19:53:04 2012 New Revision: 241330 URL: http://svn.freebsd.org/changeset/base/241330 Log: Minor mdoc fixes. Modified: head/usr.sbin/bsdconfig/bsdconfig.8 head/usr.sbin/chroot/chroot.8 head/usr.sbin/mountd/exports.5 Modified: head/usr.sbin/bsdconfig/bsdconfig.8 ============================================================================== --- head/usr.sbin/bsdconfig/bsdconfig.8 Sun Oct 7 19:30:16 2012 (r241329) +++ head/usr.sbin/bsdconfig/bsdconfig.8 Sun Oct 7 19:53:04 2012 (r241330) @@ -129,7 +129,7 @@ Generate a graphviz language file .Pq printed on stdout visualizing the -.Xr bsdconfig 8 +.Nm menu, include, and shortcut structure and relationships. See .Dq bsdconfig dot -h for more details. Modified: head/usr.sbin/chroot/chroot.8 ============================================================================== --- head/usr.sbin/chroot/chroot.8 Sun Oct 7 19:30:16 2012 (r241329) +++ head/usr.sbin/chroot/chroot.8 Sun Oct 7 19:53:04 2012 (r241330) @@ -60,7 +60,7 @@ options are given, the user, group and group list of the process are set to these values after the -.Xr chroot 8 +.Nm has taken place. .Sh ENVIRONMENT The following environment variable is referenced by Modified: head/usr.sbin/mountd/exports.5 ============================================================================== --- head/usr.sbin/mountd/exports.5 Sun Oct 7 19:30:16 2012 (r241329) +++ head/usr.sbin/mountd/exports.5 Sun Oct 7 19:53:04 2012 (r241330) @@ -101,7 +101,7 @@ This line does not export any file syste of the server's directory tree is for NFSv4 clients. The exported file systems for NFSv4 are specified via the other lines in the -.Xr exports 5 +.Nm file in the same way as for NFSv2 and NFSv3. The pathnames must not have any symbolic links in them and should not have any From owner-svn-src-head@FreeBSD.ORG Sun Oct 7 20:01:42 2012 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id 0ADD9106572A; Sun, 7 Oct 2012 20:01:42 +0000 (UTC) (envelope-from joel@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id E7CBC8FC16; Sun, 7 Oct 2012 20:01:41 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id q97K1f3S061129; Sun, 7 Oct 2012 20:01:41 GMT (envelope-from joel@svn.freebsd.org) Received: (from joel@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q97K1foA061122; Sun, 7 Oct 2012 20:01:41 GMT (envelope-from joel@svn.freebsd.org) Message-Id: <201210072001.q97K1foA061122@svn.freebsd.org> From: Joel Dahl Date: Sun, 7 Oct 2012 20:01:41 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r241331 - in head/usr.bin: calendar m4 m4/lib script unzip who X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 07 Oct 2012 20:01:42 -0000 Author: joel (doc committer) Date: Sun Oct 7 20:01:41 2012 New Revision: 241331 URL: http://svn.freebsd.org/changeset/base/241331 Log: Remove contractions. Modified: head/usr.bin/calendar/calendar.1 head/usr.bin/m4/lib/ohash_init.3 head/usr.bin/m4/m4.1 head/usr.bin/script/script.1 head/usr.bin/unzip/unzip.1 head/usr.bin/who/who.1 Modified: head/usr.bin/calendar/calendar.1 ============================================================================== --- head/usr.bin/calendar/calendar.1 Sun Oct 7 19:53:04 2012 (r241330) +++ head/usr.bin/calendar/calendar.1 Sun Oct 7 20:01:41 2012 (r241331) @@ -313,7 +313,7 @@ the time-difference towards Greenwich. The new and full moons are happening on the day indicated: They might happen in the time period in the early night or in the late evening. -It doesn't indicate that they are starting in the night on that date. +It does not indicate that they are starting in the night on that date. .Pp Because of minor differences between the output of the formulas used and other sources on the Internet, Druids and Werewolves should Modified: head/usr.bin/m4/lib/ohash_init.3 ============================================================================== --- head/usr.bin/m4/lib/ohash_init.3 Sun Oct 7 19:53:04 2012 (r241330) +++ head/usr.bin/m4/lib/ohash_init.3 Sun Oct 7 20:01:41 2012 (r241331) @@ -166,7 +166,7 @@ for (n = ohash_first(h, &i); n != NULL; points to an auxiliary unsigned integer used to record the current position in the ohash table. Those functions are safe to use even while entries are added to/removed -from the table, but in such a case they don't guarantee that new entries +from the table, but in such a case they do not guarantee that new entries will be returned. As a special case, they can safely be used to free elements in the table. .Pp Modified: head/usr.bin/m4/m4.1 ============================================================================== --- head/usr.bin/m4/m4.1 Sun Oct 7 19:53:04 2012 (r241330) +++ head/usr.bin/m4/m4.1 Sun Oct 7 20:01:41 2012 (r241331) @@ -97,7 +97,7 @@ You can change the quote characters with .Ic changequote built-in macro. .Pp -Most built-ins don't make any sense without arguments, and hence are not +Most built-ins do not make any sense without arguments, and hence are not recognized as special when not followed by an open parenthesis. .Pp The options are as follows: Modified: head/usr.bin/script/script.1 ============================================================================== --- head/usr.bin/script/script.1 Sun Oct 7 19:53:04 2012 (r241330) +++ head/usr.bin/script/script.1 Sun Oct 7 20:01:41 2012 (r241331) @@ -75,7 +75,7 @@ retaining the prior contents. .It Fl d When playing back a session with the .Fl p -flag, don't sleep between records when playing back a timestamped session. +flag, do not sleep between records when playing back a timestamped session. .It Fl k Log keys sent to the program as well as output. .It Fl p Modified: head/usr.bin/unzip/unzip.1 ============================================================================== --- head/usr.bin/unzip/unzip.1 Sun Oct 7 19:53:04 2012 (r241330) +++ head/usr.bin/unzip/unzip.1 Sun Oct 7 20:01:41 2012 (r241331) @@ -50,7 +50,7 @@ Extract to stdout/screen. When extracting files from the zipfile, they are written to stdout. This is similar to .Fl p , -but doesn't suppress normal output. +but does not suppress normal output. .It Fl d Ar dir Extract files into the specified directory rather than the current directory. Modified: head/usr.bin/who/who.1 ============================================================================== --- head/usr.bin/who/who.1 Sun Oct 7 19:53:04 2012 (r241330) +++ head/usr.bin/who/who.1 Sun Oct 7 20:01:41 2012 (r241331) @@ -51,7 +51,7 @@ The options are as follows: .It Fl a Equivalent to .Fl bTu , -with the exception that output isn't restricted to the time and date of +with the exception that output is not restricted to the time and date of the last system reboot. .It Fl b Write the time and date of the last system reboot. From owner-svn-src-head@FreeBSD.ORG Sun Oct 7 20:36:47 2012 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id 642911065708; Sun, 7 Oct 2012 20:36:47 +0000 (UTC) (envelope-from imp@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 4F0468FC23; Sun, 7 Oct 2012 20:36:47 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id q97Kal7O066722; Sun, 7 Oct 2012 20:36:47 GMT (envelope-from imp@svn.freebsd.org) Received: (from imp@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q97KalP6066720; Sun, 7 Oct 2012 20:36:47 GMT (envelope-from imp@svn.freebsd.org) Message-Id: <201210072036.q97KalP6066720@svn.freebsd.org> From: Warner Losh Date: Sun, 7 Oct 2012 20:36:47 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r241333 - head/sys/arm/at91 X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 07 Oct 2012 20:36:47 -0000 Author: imp Date: Sun Oct 7 20:36:46 2012 New Revision: 241333 URL: http://svn.freebsd.org/changeset/base/241333 Log: Loop reading the RTC registers until the same values are obtained twice, as advised in the atmel docs. Submitted by: Ian Lapore Modified: head/sys/arm/at91/at91_rtc.c Modified: head/sys/arm/at91/at91_rtc.c ============================================================================== --- head/sys/arm/at91/at91_rtc.c Sun Oct 7 20:17:24 2012 (r241332) +++ head/sys/arm/at91/at91_rtc.c Sun Oct 7 20:36:46 2012 (r241333) @@ -256,7 +256,7 @@ static int at91_rtc_gettime(device_t dev, struct timespec *ts) { struct clocktime ct; - uint32_t timr, calr; + uint32_t calr, calr2, timr, timr2; struct at91_rtc_softc *sc; sc = device_get_softc(dev); @@ -266,8 +266,19 @@ at91_rtc_gettime(device_t dev, struct ti if (RD4(sc, RTC_VER) & (RTC_VER_NVTIM | RTC_VER_NVCAL)) return EINVAL; - timr = RD4(sc, RTC_TIMR); - calr = RD4(sc, RTC_CALR); + /* + * The RTC hardware can update registers while the CPU is reading them. + * The manual advises reading until you obtain the same values twice. + * Interleaving the reads (rather than timr, timr2, calr, calr2 order) + * also ensures we don't miss a midnight rollover/carry between reads. + */ + do { + timr = RD4(sc, RTC_TIMR); + calr = RD4(sc, RTC_CALR); + timr2 = RD4(sc, RTC_TIMR); + calr2 = RD4(sc, RTC_CALR); + } while (timr != timr2 || calr != calr2); + ct.nsec = 0; ct.sec = RTC_TIMR_SEC(timr); ct.min = RTC_TIMR_MIN(timr); From owner-svn-src-head@FreeBSD.ORG Sun Oct 7 23:45:20 2012 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id 39930106566B; Sun, 7 Oct 2012 23:45:20 +0000 (UTC) (envelope-from adrian@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 2227B8FC08; Sun, 7 Oct 2012 23:45:20 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id q97NjJhn091566; Sun, 7 Oct 2012 23:45:19 GMT (envelope-from adrian@svn.freebsd.org) Received: (from adrian@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q97NjJ0i091562; Sun, 7 Oct 2012 23:45:19 GMT (envelope-from adrian@svn.freebsd.org) Message-Id: <201210072345.q97NjJ0i091562@svn.freebsd.org> From: Adrian Chadd Date: Sun, 7 Oct 2012 23:45:19 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r241336 - head/sys/dev/ath X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 07 Oct 2012 23:45:20 -0000 Author: adrian Date: Sun Oct 7 23:45:19 2012 New Revision: 241336 URL: http://svn.freebsd.org/changeset/base/241336 Log: Migrate the TID TXQ accesses to a new set of macros, rather than reusing the ATH_TXQ_* macros. * Introduce the new macros; * rename the TID queue and TID filtered frame queue so the compiler tells me I'm using the wrong macro. These should correspond 1:1 to the existing code. Modified: head/sys/dev/ath/if_ath_tx.c head/sys/dev/ath/if_ath_tx_ht.c head/sys/dev/ath/if_athvar.h Modified: head/sys/dev/ath/if_ath_tx.c ============================================================================== --- head/sys/dev/ath/if_ath_tx.c Sun Oct 7 21:33:04 2012 (r241335) +++ head/sys/dev/ath/if_ath_tx.c Sun Oct 7 23:45:19 2012 (r241336) @@ -2669,7 +2669,7 @@ ath_tx_xmit_aggr(struct ath_softc *sc, s /* paused? queue */ if (tid->paused) { - ATH_TXQ_INSERT_HEAD(tid, bf, bf_list); + ATH_TID_INSERT_HEAD(tid, bf, bf_list); /* XXX don't sched - we're paused! */ return; } @@ -2678,7 +2678,7 @@ ath_tx_xmit_aggr(struct ath_softc *sc, s if (bf->bf_state.bfs_dobaw && (! BAW_WITHIN(tap->txa_start, tap->txa_wnd, SEQNO(bf->bf_state.bfs_seqno)))) { - ATH_TXQ_INSERT_HEAD(tid, bf, bf_list); + ATH_TID_INSERT_HEAD(tid, bf, bf_list); ath_tx_tid_sched(sc, tid); return; } @@ -2777,11 +2777,11 @@ ath_tx_swq(struct ath_softc *sc, struct if (atid->paused) { /* TID is paused, queue */ DPRINTF(sc, ATH_DEBUG_SW_TX, "%s: paused\n", __func__); - ATH_TXQ_INSERT_TAIL(atid, bf, bf_list); + ATH_TID_INSERT_TAIL(atid, bf, bf_list); } else if (ath_tx_ampdu_pending(sc, an, tid)) { /* AMPDU pending; queue */ DPRINTF(sc, ATH_DEBUG_SW_TX, "%s: pending\n", __func__); - ATH_TXQ_INSERT_TAIL(atid, bf, bf_list); + ATH_TID_INSERT_TAIL(atid, bf, bf_list); /* XXX sched? */ } else if (ath_tx_ampdu_running(sc, an, tid)) { /* AMPDU running, attempt direct dispatch if possible */ @@ -2789,7 +2789,7 @@ ath_tx_swq(struct ath_softc *sc, struct /* * Always queue the frame to the tail of the list. */ - ATH_TXQ_INSERT_TAIL(atid, bf, bf_list); + ATH_TID_INSERT_TAIL(atid, bf, bf_list); /* * If the hardware queue isn't busy, direct dispatch @@ -2799,8 +2799,8 @@ ath_tx_swq(struct ath_softc *sc, struct * Otherwise, schedule the TID. */ if (txq->axq_depth < sc->sc_hwq_limit) { - bf = TAILQ_FIRST(&atid->axq_q); - ATH_TXQ_REMOVE(atid, bf, bf_list); + bf = ATH_TID_FIRST(atid); + ATH_TID_REMOVE(atid, bf, bf_list); /* * Ensure it's definitely treated as a non-AMPDU @@ -2831,7 +2831,7 @@ ath_tx_swq(struct ath_softc *sc, struct } else { /* Busy; queue */ DPRINTF(sc, ATH_DEBUG_SW_TX, "%s: swq'ing\n", __func__); - ATH_TXQ_INSERT_TAIL(atid, bf, bf_list); + ATH_TID_INSERT_TAIL(atid, bf, bf_list); ath_tx_tid_sched(sc, atid); } } @@ -2856,8 +2856,8 @@ ath_tx_tid_init(struct ath_softc *sc, st /* XXX now with this bzer(), is the field 0'ing needed? */ bzero(atid, sizeof(*atid)); - TAILQ_INIT(&atid->axq_q); - TAILQ_INIT(&atid->filtq.axq_q); + TAILQ_INIT(&atid->tid_q); + TAILQ_INIT(&atid->filtq.tid_q); atid->tid = i; atid->an = an; for (j = 0; j < ATH_TID_MAX_BUFS; j++) @@ -2948,7 +2948,7 @@ ath_tx_tid_filt_addbuf(struct ath_softc ath_tx_set_retry(sc, bf); sc->sc_stats.ast_tx_swfiltered++; - ATH_TXQ_INSERT_TAIL(&tid->filtq, bf, bf_list); + ATH_TID_INSERT_TAIL(&tid->filtq, bf, bf_list); } /* @@ -2997,9 +2997,9 @@ ath_tx_tid_filt_comp_complete(struct ath tid->clrdmask = 1; /* XXX this is really quite inefficient */ - while ((bf = TAILQ_LAST(&tid->filtq.axq_q, ath_bufhead_s)) != NULL) { - ATH_TXQ_REMOVE(&tid->filtq, bf, bf_list); - ATH_TXQ_INSERT_HEAD(tid, bf, bf_list); + while ((bf = ATH_TID_LAST(&tid->filtq, ath_bufhead_s)) != NULL) { + ATH_TID_REMOVE(&tid->filtq, bf, bf_list); + ATH_TID_INSERT_HEAD(tid, bf, bf_list); } ath_tx_tid_resume(sc, tid); @@ -3392,7 +3392,7 @@ ath_tx_tid_drain(struct ath_softc *sc, s /* Walk the queue, free frames */ t = 0; for (;;) { - bf = TAILQ_FIRST(&tid->axq_q); + bf = ATH_TID_FIRST(tid); if (bf == NULL) { break; } @@ -3402,14 +3402,14 @@ ath_tx_tid_drain(struct ath_softc *sc, s t = 1; } - ATH_TXQ_REMOVE(tid, bf, bf_list); + ATH_TID_REMOVE(tid, bf, bf_list); ath_tx_tid_drain_pkt(sc, an, tid, bf_cq, bf); } /* And now, drain the filtered frame queue */ t = 0; for (;;) { - bf = TAILQ_FIRST(&tid->filtq.axq_q); + bf = ATH_TID_FIRST(&tid->filtq); if (bf == NULL) break; @@ -3418,7 +3418,7 @@ ath_tx_tid_drain(struct ath_softc *sc, s t = 1; } - ATH_TXQ_REMOVE(&tid->filtq, bf, bf_list); + ATH_TID_REMOVE(&tid->filtq, bf, bf_list); ath_tx_tid_drain_pkt(sc, an, tid, bf_cq, bf); } @@ -3668,9 +3668,9 @@ ath_tx_tid_cleanup(struct ath_softc *sc, * we run off and discard/process things. */ /* XXX this is really quite inefficient */ - while ((bf = TAILQ_LAST(&atid->filtq.axq_q, ath_bufhead_s)) != NULL) { - ATH_TXQ_REMOVE(&atid->filtq, bf, bf_list); - ATH_TXQ_INSERT_HEAD(atid, bf, bf_list); + while ((bf = ATH_TID_LAST(&atid->filtq, ath_bufhead_s)) != NULL) { + ATH_TID_REMOVE(&atid->filtq, bf, bf_list); + ATH_TID_INSERT_HEAD(atid, bf, bf_list); } /* @@ -3679,11 +3679,11 @@ ath_tx_tid_cleanup(struct ath_softc *sc, * + Discard retry frames in the queue * + Fix the completion function to be non-aggregate */ - bf = TAILQ_FIRST(&atid->axq_q); + bf = ATH_TID_FIRST(atid); while (bf) { if (bf->bf_state.bfs_isretried) { bf_next = TAILQ_NEXT(bf, bf_list); - TAILQ_REMOVE(&atid->axq_q, bf, bf_list); + ATH_TID_REMOVE(atid, bf, bf_list); atid->axq_depth--; if (bf->bf_state.bfs_dobaw) { ath_tx_update_baw(sc, an, atid, bf); @@ -3888,7 +3888,7 @@ ath_tx_aggr_retry_unaggr(struct ath_soft * Insert this at the head of the queue, so it's * retried before any current/subsequent frames. */ - ATH_TXQ_INSERT_HEAD(atid, bf, bf_list); + ATH_TID_INSERT_HEAD(atid, bf, bf_list); ath_tx_tid_sched(sc, atid); /* Send the BAR if there are no other frames waiting */ if (ath_tx_tid_bar_tx_ready(sc, atid)) @@ -4017,7 +4017,7 @@ ath_tx_comp_aggr_error(struct ath_softc /* Prepend all frames to the beginning of the queue */ while ((bf = TAILQ_LAST(&bf_q, ath_bufhead_s)) != NULL) { TAILQ_REMOVE(&bf_q, bf, bf_list); - ATH_TXQ_INSERT_HEAD(tid, bf, bf_list); + ATH_TID_INSERT_HEAD(tid, bf, bf_list); } /* @@ -4387,7 +4387,7 @@ ath_tx_aggr_comp_aggr(struct ath_softc * /* Prepend all frames to the beginning of the queue */ while ((bf = TAILQ_LAST(&bf_q, ath_bufhead_s)) != NULL) { TAILQ_REMOVE(&bf_q, bf, bf_list); - ATH_TXQ_INSERT_HEAD(atid, bf, bf_list); + ATH_TID_INSERT_HEAD(atid, bf, bf_list); } /* @@ -4665,7 +4665,7 @@ ath_tx_tid_hw_queue_aggr(struct ath_soft if (tid->paused) break; - bf = TAILQ_FIRST(&tid->axq_q); + bf = ATH_TID_FIRST(tid); if (bf == NULL) { break; } @@ -4678,7 +4678,7 @@ ath_tx_tid_hw_queue_aggr(struct ath_soft DPRINTF(sc, ATH_DEBUG_SW_TX_AGGR, "%s: non-baw packet\n", __func__); - ATH_TXQ_REMOVE(tid, bf, bf_list); + ATH_TID_REMOVE(tid, bf, bf_list); if (bf->bf_state.bfs_nframes > 1) device_printf(sc->sc_dev, @@ -4868,12 +4868,12 @@ ath_tx_tid_hw_queue_norm(struct ath_soft if (tid->paused) break; - bf = TAILQ_FIRST(&tid->axq_q); + bf = ATH_TID_FIRST(tid); if (bf == NULL) { break; } - ATH_TXQ_REMOVE(tid, bf, bf_list); + ATH_TID_REMOVE(tid, bf, bf_list); KASSERT(txq == bf->bf_state.bfs_txq, ("txqs not equal!\n")); Modified: head/sys/dev/ath/if_ath_tx_ht.c ============================================================================== --- head/sys/dev/ath/if_ath_tx_ht.c Sun Oct 7 21:33:04 2012 (r241335) +++ head/sys/dev/ath/if_ath_tx_ht.c Sun Oct 7 23:45:19 2012 (r241336) @@ -661,7 +661,7 @@ ath_tx_form_aggr(struct ath_softc *sc, s h_baw = tap->txa_wnd / 2; for (;;) { - bf = TAILQ_FIRST(&tid->axq_q); + bf = ATH_TID_FIRST(tid); if (bf_first == NULL) bf_first = bf; if (bf == NULL) { @@ -760,7 +760,7 @@ ath_tx_form_aggr(struct ath_softc *sc, s /* * this packet is part of an aggregate. */ - ATH_TXQ_REMOVE(tid, bf, bf_list); + ATH_TID_REMOVE(tid, bf, bf_list); /* The TID lock is required for the BAW update */ ath_tx_addto_baw(sc, an, tid, bf); Modified: head/sys/dev/ath/if_athvar.h ============================================================================== --- head/sys/dev/ath/if_athvar.h Sun Oct 7 21:33:04 2012 (r241335) +++ head/sys/dev/ath/if_athvar.h Sun Oct 7 23:45:19 2012 (r241336) @@ -99,7 +99,7 @@ struct ath_buf; * Note that TID 16 (WME_NUM_TID+1) is for handling non-QoS frames. */ struct ath_tid { - TAILQ_HEAD(,ath_buf) axq_q; /* pending buffers */ + TAILQ_HEAD(,ath_buf) tid_q; /* pending buffers */ u_int axq_depth; /* SW queue depth */ char axq_name[48]; /* lock name */ struct ath_node *an; /* pointer to parent */ @@ -108,7 +108,7 @@ struct ath_tid { int hwq_depth; /* how many buffers are on HW */ struct { - TAILQ_HEAD(,ath_buf) axq_q; /* filtered queue */ + TAILQ_HEAD(,ath_buf) tid_q; /* filtered queue */ u_int axq_depth; /* SW queue depth */ char axq_name[48]; /* lock name */ } filtq; @@ -355,6 +355,9 @@ struct ath_txq { #define ATH_TID_UNLOCK_ASSERT(_sc, _tid) \ ATH_TXQ_UNLOCK_ASSERT((_sc)->sc_ac2q[(_tid)->ac]) +/* + * These are for the hardware queue. + */ #define ATH_TXQ_INSERT_HEAD(_tq, _elm, _field) do { \ TAILQ_INSERT_HEAD(&(_tq)->axq_q, (_elm), _field); \ (_tq)->axq_depth++; \ @@ -370,6 +373,24 @@ struct ath_txq { #define ATH_TXQ_FIRST(_tq) TAILQ_FIRST(&(_tq)->axq_q) #define ATH_TXQ_LAST(_tq, _field) TAILQ_LAST(&(_tq)->axq_q, _field) +/* + * These are for the TID software queue and filtered frames queues. + */ +#define ATH_TID_INSERT_HEAD(_tq, _elm, _field) do { \ + TAILQ_INSERT_HEAD(&(_tq)->tid_q, (_elm), _field); \ + (_tq)->axq_depth++; \ +} while (0) +#define ATH_TID_INSERT_TAIL(_tq, _elm, _field) do { \ + TAILQ_INSERT_TAIL(&(_tq)->tid_q, (_elm), _field); \ + (_tq)->axq_depth++; \ +} while (0) +#define ATH_TID_REMOVE(_tq, _elm, _field) do { \ + TAILQ_REMOVE(&(_tq)->tid_q, _elm, _field); \ + (_tq)->axq_depth--; \ +} while (0) +#define ATH_TID_FIRST(_tq) TAILQ_FIRST(&(_tq)->tid_q) +#define ATH_TID_LAST(_tq, _field) TAILQ_LAST(&(_tq)->tid_q, _field) + struct ath_vap { struct ieee80211vap av_vap; /* base class */ int av_bslot; /* beacon slot index */ From owner-svn-src-head@FreeBSD.ORG Mon Oct 8 01:49:52 2012 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id C2524106564A; Mon, 8 Oct 2012 01:49:52 +0000 (UTC) (envelope-from adrian.chadd@gmail.com) Received: from mail-pa0-f54.google.com (mail-pa0-f54.google.com [209.85.220.54]) by mx1.freebsd.org (Postfix) with ESMTP id 366BF8FC0A; Mon, 8 Oct 2012 01:49:52 +0000 (UTC) Received: by mail-pa0-f54.google.com with SMTP id bi1so3880293pad.13 for ; Sun, 07 Oct 2012 18:49:51 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:sender:in-reply-to:references:date :x-google-sender-auth:message-id:subject:from:to:cc:content-type; bh=hvB0t057ve8Zpj5lebf9GxEvCAItRxw0vWhg8kGOylI=; b=K112Fpl9ODsdshXa1uIa4HvzxBMKexz3k1zuFODttrvS5JerWZbI6rckwDbuDa7ZCa /mlhdgXmNedsgleiROGxvHeLlecnsOtvwhMy6nqgm0EHSZqkCkJbQUOu0tCBELqaDi6e 8gJCq5hIKDkREy8jPJlOmipi8Hf09j84HJRXtYSpz+hvIUWiiPE9JMOGhY+5FfQMUIap Yb9HvvSg/yBPSer+Rw/0A/iO89N8y0sTWBOQ5q1Ma8B+G48Zzf/wo0hOK/1fRZrrOKO6 Ue89Ass00azTP1Xi/a0KFMLfFtzivDsPjyDoi5TeXMc0CR41ID8A9MurpQPVF9o2UyQK lBgA== MIME-Version: 1.0 Received: by 10.68.202.6 with SMTP id ke6mr48811633pbc.82.1349660991740; Sun, 07 Oct 2012 18:49:51 -0700 (PDT) Sender: adrian.chadd@gmail.com Received: by 10.68.223.136 with HTTP; Sun, 7 Oct 2012 18:49:51 -0700 (PDT) In-Reply-To: <201210061002.q96A2BFf039772@svn.freebsd.org> References: <201210061002.q96A2BFf039772@svn.freebsd.org> Date: Sun, 7 Oct 2012 18:49:51 -0700 X-Google-Sender-Auth: cKyJ-P70C3x8vV0ApnymQTSXxE8 Message-ID: From: Adrian Chadd To: Gleb Smirnoff , FreeBSD Net Content-Type: text/plain; charset=ISO-8859-1 Cc: svn-src-head@freebsd.org, svn-src-all@freebsd.org, src-committers@freebsd.org Subject: Re: svn commit: r241245 - in head: . share/man/man9 sys/contrib/ipfilter/netinet sys/net sys/netinet sys/netpfil/ipfw sys/netpfil/pf sys/sys X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 08 Oct 2012 01:49:52 -0000 Hi, People have been reporting this: Oct 7 18:35:19 alix kernel: in_cksum_skip: out of data by 53295 Oct 7 18:35:19 alix kernel: in_cksum_skip: out of data by 55335 Would you please investigate this, or back the patch out? Also, if this is actually due to this patch - why is it that you didn't pick it up in testing? Thanks, Adrian On 6 October 2012 03:02, Gleb Smirnoff wrote: > Author: glebius > Date: Sat Oct 6 10:02:11 2012 > New Revision: 241245 > URL: http://svn.freebsd.org/changeset/base/241245 > > Log: > A step in resolving mess with byte ordering for AF_INET. After this change: > > - All packets in NETISR_IP queue are in net byte order. > - ip_input() is entered in net byte order and converts packet > to host byte order right _after_ processing pfil(9) hooks. > - ip_output() is entered in host byte order and converts packet > to net byte order right _before_ processing pfil(9) hooks. > - ip_fragment() accepts and emits packet in net byte order. > - ip_forward(), ip_mloopback() use host byte order (untouched actually). > - ip_fastforward() no longer modifies packet at all (except ip_ttl). > - Swapping of byte order there and back removed from the following modules: > pf(4), ipfw(4), enc(4), if_bridge(4). > - Swapping of byte order added to ipfilter(4), based on __FreeBSD_version > - __FreeBSD_version bumped. > - pfil(9) manual page updated. > > Reviewed by: ray, luigi, eri, melifaro > Tested by: glebius (LE), ray (BE) > > Modified: > head/UPDATING > head/share/man/man9/pfil.9 > head/sys/contrib/ipfilter/netinet/fil.c > head/sys/net/if_bridge.c > head/sys/net/if_enc.c > head/sys/netinet/ip_fastfwd.c > head/sys/netinet/ip_input.c > head/sys/netinet/ip_output.c > head/sys/netpfil/ipfw/ip_fw_pfil.c > head/sys/netpfil/pf/pf_ioctl.c > head/sys/sys/param.h > > Modified: head/UPDATING > ============================================================================== > --- head/UPDATING Sat Oct 6 07:06:57 2012 (r241244) > +++ head/UPDATING Sat Oct 6 10:02:11 2012 (r241245) > @@ -24,6 +24,11 @@ NOTE TO PEOPLE WHO THINK THAT FreeBSD 10 > disable the most expensive debugging functionality run > "ln -s 'abort:false,junk:false' /etc/malloc.conf".) > > +20121006: > + The pfil(9) API/ABI for AF_INET family has been changed. Packet > + filtering modules: pf(4), ipfw(4), ipfilter(4) need to be recompiled > + with new kernel. > + > 20121001: > The net80211(4) ABI has been changed to allow for improved driver > PS-POLL and power-save support. All wireless drivers need to be > > Modified: head/share/man/man9/pfil.9 > ============================================================================== > --- head/share/man/man9/pfil.9 Sat Oct 6 07:06:57 2012 (r241244) > +++ head/share/man/man9/pfil.9 Sat Oct 6 10:02:11 2012 (r241245) > @@ -28,7 +28,7 @@ > .\" > .\" $FreeBSD$ > .\" > -.Dd September 16, 2012 > +.Dd October 6, 2012 > .Dt PFIL 9 > .Os > .Sh NAME > @@ -127,10 +127,9 @@ Currently, filtering points are implemen > .Pp > .Bl -tag -width "AF_INET6" -offset XXX -compact > .It AF_INET > +IPv4 packets. > .It AF_INET6 > -IPv4 and IPv6 packets. Note that packet header is already > -.Cm converted to host format. > -Host format has to be preserved in case of header modifications. > +IPv6 packets. > .It AF_LINK > Link-layer packets. > .El > > Modified: head/sys/contrib/ipfilter/netinet/fil.c > ============================================================================== > --- head/sys/contrib/ipfilter/netinet/fil.c Sat Oct 6 07:06:57 2012 (r241244) > +++ head/sys/contrib/ipfilter/netinet/fil.c Sat Oct 6 10:02:11 2012 (r241245) > @@ -2513,7 +2513,7 @@ int out; > } else > #endif > { > -#if (defined(OpenBSD) && (OpenBSD >= 200311)) && defined(_KERNEL) > +#if ((defined(OpenBSD) && (OpenBSD >= 200311)) || (defined(FreeBSD) && (__FreeBSD_version >= 1000019))) && defined(_KERNEL) > ip->ip_len = ntohs(ip->ip_len); > ip->ip_off = ntohs(ip->ip_off); > #endif > @@ -2777,7 +2777,7 @@ finished: > RWLOCK_EXIT(&ipf_global); > > #ifdef _KERNEL > -# if (defined(OpenBSD) && (OpenBSD >= 200311)) > +# if (defined(OpenBSD) && (OpenBSD >= 200311)) || (defined(FreeBSD) && (__FreeBSD_version >= 1000019)) > if (FR_ISPASS(pass) && (v == 4)) { > ip = fin->fin_ip; > ip->ip_len = ntohs(ip->ip_len); > > Modified: head/sys/net/if_bridge.c > ============================================================================== > --- head/sys/net/if_bridge.c Sat Oct 6 07:06:57 2012 (r241244) > +++ head/sys/net/if_bridge.c Sat Oct 6 10:02:11 2012 (r241245) > @@ -3093,15 +3093,6 @@ bridge_pfil(struct mbuf **mp, struct ifn > switch (ether_type) { > case ETHERTYPE_IP: > /* > - * before calling the firewall, swap fields the same as > - * IP does. here we assume the header is contiguous > - */ > - ip = mtod(*mp, struct ip *); > - > - ip->ip_len = ntohs(ip->ip_len); > - ip->ip_off = ntohs(ip->ip_off); > - > - /* > * Run pfil on the member interface and the bridge, both can > * be skipped by clearing pfil_member or pfil_bridge. > * > @@ -3139,7 +3130,7 @@ bridge_pfil(struct mbuf **mp, struct ifn > } > } > > - /* Recalculate the ip checksum and restore byte ordering */ > + /* Recalculate the ip checksum. */ > ip = mtod(*mp, struct ip *); > hlen = ip->ip_hl << 2; > if (hlen < sizeof(struct ip)) > @@ -3151,8 +3142,6 @@ bridge_pfil(struct mbuf **mp, struct ifn > if (ip == NULL) > goto bad; > } > - ip->ip_len = htons(ip->ip_len); > - ip->ip_off = htons(ip->ip_off); > ip->ip_sum = 0; > if (hlen == sizeof(struct ip)) > ip->ip_sum = in_cksum_hdr(ip); > > Modified: head/sys/net/if_enc.c > ============================================================================== > --- head/sys/net/if_enc.c Sat Oct 6 07:06:57 2012 (r241244) > +++ head/sys/net/if_enc.c Sat Oct 6 10:02:11 2012 (r241245) > @@ -270,23 +270,8 @@ ipsec_filter(struct mbuf **mp, int dir, > switch (ip->ip_v) { > #ifdef INET > case 4: > - /* > - * before calling the firewall, swap fields the same as > - * IP does. here we assume the header is contiguous > - */ > - ip->ip_len = ntohs(ip->ip_len); > - ip->ip_off = ntohs(ip->ip_off); > - > error = pfil_run_hooks(&V_inet_pfil_hook, mp, > encif, dir, NULL); > - > - if (*mp == NULL || error != 0) > - break; > - > - /* restore byte ordering */ > - ip = mtod(*mp, struct ip *); > - ip->ip_len = htons(ip->ip_len); > - ip->ip_off = htons(ip->ip_off); > break; > #endif > #ifdef INET6 > > Modified: head/sys/netinet/ip_fastfwd.c > ============================================================================== > --- head/sys/netinet/ip_fastfwd.c Sat Oct 6 07:06:57 2012 (r241244) > +++ head/sys/netinet/ip_fastfwd.c Sat Oct 6 10:02:11 2012 (r241245) > @@ -164,7 +164,7 @@ ip_fastforward(struct mbuf *m) > struct sockaddr_in *dst = NULL; > struct ifnet *ifp; > struct in_addr odest, dest; > - u_short sum, ip_len; > + uint16_t sum, ip_len, ip_off; > int error = 0; > int hlen, mtu; > #ifdef IPFIREWALL_FORWARD > @@ -340,12 +340,6 @@ ip_fastforward(struct mbuf *m) > * Step 3: incoming packet firewall processing > */ > > - /* > - * Convert to host representation > - */ > - ip->ip_len = ntohs(ip->ip_len); > - ip->ip_off = ntohs(ip->ip_off); > - > odest.s_addr = dest.s_addr = ip->ip_dst.s_addr; > > /* > @@ -472,8 +466,6 @@ passin: > forwardlocal: > /* > * Return packet for processing by ip_input(). > - * Keep host byte order as expected at ip_input's > - * "ours"-label. > */ > m->m_flags |= M_FASTFWD_OURS; > if (ro.ro_rt) > @@ -500,6 +492,8 @@ passout: > /* > * Step 6: send off the packet > */ > + ip_len = ntohs(ip->ip_len); > + ip_off = ntohs(ip->ip_off); > > /* > * Check if route is dampned (when ARP is unable to resolve) > @@ -515,7 +509,7 @@ passout: > /* > * Check if there is enough space in the interface queue > */ > - if ((ifp->if_snd.ifq_len + ip->ip_len / ifp->if_mtu + 1) >= > + if ((ifp->if_snd.ifq_len + ip_len / ifp->if_mtu + 1) >= > ifp->if_snd.ifq_maxlen) { > IPSTAT_INC(ips_odropped); > /* would send source quench here but that is depreciated */ > @@ -539,13 +533,8 @@ passout: > else > mtu = ifp->if_mtu; > > - if (ip->ip_len <= mtu || > - (ifp->if_hwassist & CSUM_FRAGMENT && (ip->ip_off & IP_DF) == 0)) { > - /* > - * Restore packet header fields to original values > - */ > - ip->ip_len = htons(ip->ip_len); > - ip->ip_off = htons(ip->ip_off); > + if (ip_len <= mtu || > + (ifp->if_hwassist & CSUM_FRAGMENT && (ip_off & IP_DF) == 0)) { > /* > * Send off the packet via outgoing interface > */ > @@ -555,7 +544,7 @@ passout: > /* > * Handle EMSGSIZE with icmp reply needfrag for TCP MTU discovery > */ > - if (ip->ip_off & IP_DF) { > + if (ip_off & IP_DF) { > IPSTAT_INC(ips_cantfrag); > icmp_error(m, ICMP_UNREACH, ICMP_UNREACH_NEEDFRAG, > 0, mtu); > @@ -565,10 +554,6 @@ passout: > * We have to fragment the packet > */ > m->m_pkthdr.csum_flags |= CSUM_IP; > - /* > - * ip_fragment expects ip_len and ip_off in host byte > - * order but returns all packets in network byte order > - */ > if (ip_fragment(ip, &m, mtu, ifp->if_hwassist, > (~ifp->if_hwassist & CSUM_DELAY_IP))) { > goto drop; > > Modified: head/sys/netinet/ip_input.c > ============================================================================== > --- head/sys/netinet/ip_input.c Sat Oct 6 07:06:57 2012 (r241244) > +++ head/sys/netinet/ip_input.c Sat Oct 6 10:02:11 2012 (r241245) > @@ -380,20 +380,18 @@ ip_input(struct mbuf *m) > struct ifaddr *ifa; > struct ifnet *ifp; > int checkif, hlen = 0; > - u_short sum; > + uint16_t sum, ip_len; > int dchg = 0; /* dest changed after fw */ > struct in_addr odst; /* original dst address */ > > M_ASSERTPKTHDR(m); > > if (m->m_flags & M_FASTFWD_OURS) { > - /* > - * Firewall or NAT changed destination to local. > - * We expect ip_len and ip_off to be in host byte order. > - */ > m->m_flags &= ~M_FASTFWD_OURS; > /* Set up some basics that will be used later. */ > ip = mtod(m, struct ip *); > + ip->ip_len = ntohs(ip->ip_len); > + ip->ip_off = ntohs(ip->ip_off); > hlen = ip->ip_hl << 2; > goto ours; > } > @@ -458,15 +456,11 @@ ip_input(struct mbuf *m) > return; > #endif > > - /* > - * Convert fields to host representation. > - */ > - ip->ip_len = ntohs(ip->ip_len); > - if (ip->ip_len < hlen) { > + ip_len = ntohs(ip->ip_len); > + if (ip_len < hlen) { > IPSTAT_INC(ips_badlen); > goto bad; > } > - ip->ip_off = ntohs(ip->ip_off); > > /* > * Check that the amount of data in the buffers > @@ -474,17 +468,17 @@ ip_input(struct mbuf *m) > * Trim mbufs if longer than we expect. > * Drop packet if shorter than we expect. > */ > - if (m->m_pkthdr.len < ip->ip_len) { > + if (m->m_pkthdr.len < ip_len) { > tooshort: > IPSTAT_INC(ips_tooshort); > goto bad; > } > - if (m->m_pkthdr.len > ip->ip_len) { > + if (m->m_pkthdr.len > ip_len) { > if (m->m_len == m->m_pkthdr.len) { > - m->m_len = ip->ip_len; > - m->m_pkthdr.len = ip->ip_len; > + m->m_len = ip_len; > + m->m_pkthdr.len = ip_len; > } else > - m_adj(m, ip->ip_len - m->m_pkthdr.len); > + m_adj(m, ip_len - m->m_pkthdr.len); > } > #ifdef IPSEC > /* > @@ -519,6 +513,8 @@ tooshort: > #ifdef IPFIREWALL_FORWARD > if (m->m_flags & M_FASTFWD_OURS) { > m->m_flags &= ~M_FASTFWD_OURS; > + ip->ip_len = ntohs(ip->ip_len); > + ip->ip_off = ntohs(ip->ip_off); > goto ours; > } > if ((dchg = (m_tag_find(m, PACKET_TAG_IPFORWARD, NULL) != NULL)) != 0) { > @@ -527,6 +523,8 @@ tooshort: > * packets originally destined to us to some other directly > * connected host. > */ > + ip->ip_len = ntohs(ip->ip_len); > + ip->ip_off = ntohs(ip->ip_off); > ip_forward(m, dchg); > return; > } > @@ -534,6 +532,13 @@ tooshort: > > passin: > /* > + * From now and up to output pfil(9) processing in ip_output() > + * the header is in host byte order. > + */ > + ip->ip_len = ntohs(ip->ip_len); > + ip->ip_off = ntohs(ip->ip_off); > + > + /* > * Process options and, if not destined for us, > * ship it on. ip_dooptions returns 1 when an > * error was detected (causing an icmp message > @@ -1360,6 +1365,8 @@ u_char inetctlerrmap[PRC_NCMDS] = { > * > * The srcrt parameter indicates whether the packet is being forwarded > * via a source route. > + * > + * IP header in host byte order. > */ > void > ip_forward(struct mbuf *m, int srcrt) > > Modified: head/sys/netinet/ip_output.c > ============================================================================== > --- head/sys/netinet/ip_output.c Sat Oct 6 07:06:57 2012 (r241244) > +++ head/sys/netinet/ip_output.c Sat Oct 6 10:02:11 2012 (r241245) > @@ -125,7 +125,8 @@ ip_output(struct mbuf *m, struct mbuf *o > int error = 0; > struct sockaddr_in *dst; > struct in_ifaddr *ia; > - int isbroadcast, sw_csum; > + int isbroadcast; > + uint16_t ip_len, ip_off, sw_csum; > struct route iproute; > struct rtentry *rte; /* cache for ro->ro_rt */ > struct in_addr odst; > @@ -501,6 +502,12 @@ sendit: > hlen = ip->ip_hl << 2; > #endif /* IPSEC */ > > + /* > + * To network byte order. pfil(9) hooks and ip_fragment() expect this. > + */ > + ip->ip_len = htons(ip->ip_len); > + ip->ip_off = htons(ip->ip_off); > + > /* Jump over all PFIL processing if hooks are not active. */ > if (!PFIL_HOOKED(&V_inet_pfil_hook)) > goto passout; > @@ -537,6 +544,8 @@ sendit: > } else { > if (ia != NULL) > ifa_free(&ia->ia_ifa); > + ip->ip_len = ntohs(ip->ip_len); > + ip->ip_off = ntohs(ip->ip_off); > goto again; /* Redo the routing table lookup. */ > } > } > @@ -570,11 +579,16 @@ sendit: > m_tag_delete(m, fwd_tag); > if (ia != NULL) > ifa_free(&ia->ia_ifa); > + ip->ip_len = ntohs(ip->ip_len); > + ip->ip_off = ntohs(ip->ip_off); > goto again; > } > #endif /* IPFIREWALL_FORWARD */ > > passout: > + ip_len = ntohs(ip->ip_len); > + ip_off = ntohs(ip->ip_off); > + > /* 127/8 must not appear on wire - RFC1122. */ > if ((ntohl(ip->ip_dst.s_addr) >> IN_CLASSA_NSHIFT) == IN_LOOPBACKNET || > (ntohl(ip->ip_src.s_addr) >> IN_CLASSA_NSHIFT) == IN_LOOPBACKNET) { > @@ -603,11 +617,9 @@ passout: > * If small enough for interface, or the interface will take > * care of the fragmentation for us, we can just send directly. > */ > - if (ip->ip_len <= mtu || > + if (ip_len <= mtu || > (m->m_pkthdr.csum_flags & ifp->if_hwassist & CSUM_TSO) != 0 || > - ((ip->ip_off & IP_DF) == 0 && (ifp->if_hwassist & CSUM_FRAGMENT))) { > - ip->ip_len = htons(ip->ip_len); > - ip->ip_off = htons(ip->ip_off); > + ((ip_off & IP_DF) == 0 && (ifp->if_hwassist & CSUM_FRAGMENT))) { > ip->ip_sum = 0; > if (sw_csum & CSUM_DELAY_IP) > ip->ip_sum = in_cksum(m, hlen); > @@ -641,7 +653,7 @@ passout: > } > > /* Balk when DF bit is set or the interface didn't support TSO. */ > - if ((ip->ip_off & IP_DF) || (m->m_pkthdr.csum_flags & CSUM_TSO)) { > + if ((ip_off & IP_DF) || (m->m_pkthdr.csum_flags & CSUM_TSO)) { > error = EMSGSIZE; > IPSTAT_INC(ips_cantfrag); > goto bad; > @@ -710,8 +722,12 @@ ip_fragment(struct ip *ip, struct mbuf * > int firstlen; > struct mbuf **mnext; > int nfrags; > + uint16_t ip_len, ip_off; > + > + ip_len = ntohs(ip->ip_len); > + ip_off = ntohs(ip->ip_off); > > - if (ip->ip_off & IP_DF) { /* Fragmentation not allowed */ > + if (ip_off & IP_DF) { /* Fragmentation not allowed */ > IPSTAT_INC(ips_cantfrag); > return EMSGSIZE; > } > @@ -785,7 +801,7 @@ smart_frag_failure: > * The fragments are linked off the m_nextpkt of the original > * packet, which after processing serves as the first fragment. > */ > - for (nfrags = 1; off < ip->ip_len; off += len, nfrags++) { > + for (nfrags = 1; off < ip_len; off += len, nfrags++) { > struct ip *mhip; /* ip header on the fragment */ > struct mbuf *m; > int mhlen = sizeof (struct ip); > @@ -811,10 +827,10 @@ smart_frag_failure: > mhip->ip_hl = mhlen >> 2; > } > m->m_len = mhlen; > - /* XXX do we need to add ip->ip_off below ? */ > - mhip->ip_off = ((off - hlen) >> 3) + ip->ip_off; > - if (off + len >= ip->ip_len) { /* last fragment */ > - len = ip->ip_len - off; > + /* XXX do we need to add ip_off below ? */ > + mhip->ip_off = ((off - hlen) >> 3) + ip_off; > + if (off + len >= ip_len) { /* last fragment */ > + len = ip_len - off; > m->m_flags |= M_LASTFRAG; > } else > mhip->ip_off |= IP_MF; > @@ -849,11 +865,10 @@ smart_frag_failure: > * Update first fragment by trimming what's been copied out > * and updating header. > */ > - m_adj(m0, hlen + firstlen - ip->ip_len); > + m_adj(m0, hlen + firstlen - ip_len); > m0->m_pkthdr.len = hlen + firstlen; > ip->ip_len = htons((u_short)m0->m_pkthdr.len); > - ip->ip_off |= IP_MF; > - ip->ip_off = htons(ip->ip_off); > + ip->ip_off = htons(ip_off | IP_MF); > ip->ip_sum = 0; > if (sw_csum & CSUM_DELAY_IP) > ip->ip_sum = in_cksum(m0, hlen); > @@ -1279,6 +1294,8 @@ ip_ctloutput(struct socket *so, struct s > * calls the output routine of the loopback "driver", but with an interface > * pointer that might NOT be a loopback interface -- evil, but easier than > * replicating that code here. > + * > + * IP header in host byte order. > */ > static void > ip_mloopback(struct ifnet *ifp, struct mbuf *m, struct sockaddr_in *dst, > > Modified: head/sys/netpfil/ipfw/ip_fw_pfil.c > ============================================================================== > --- head/sys/netpfil/ipfw/ip_fw_pfil.c Sat Oct 6 07:06:57 2012 (r241244) > +++ head/sys/netpfil/ipfw/ip_fw_pfil.c Sat Oct 6 10:02:11 2012 (r241245) > @@ -125,10 +125,6 @@ ipfw_check_packet(void *arg, struct mbuf > int ipfw; > int ret; > > - /* all the processing now uses ip_len in net format */ > - if (mtod(*m0, struct ip *)->ip_v == 4) > - SET_NET_IPLEN(mtod(*m0, struct ip *)); > - > /* convert dir to IPFW values */ > dir = (dir == PFIL_IN) ? DIR_IN : DIR_OUT; > bzero(&args, sizeof(args)); > @@ -288,8 +284,7 @@ again: > FREE_PKT(*m0); > *m0 = NULL; > } > - if (*m0 && mtod(*m0, struct ip *)->ip_v == 4) > - SET_HOST_IPLEN(mtod(*m0, struct ip *)); > + > return ret; > } > > > Modified: head/sys/netpfil/pf/pf_ioctl.c > ============================================================================== > --- head/sys/netpfil/pf/pf_ioctl.c Sat Oct 6 07:06:57 2012 (r241244) > +++ head/sys/netpfil/pf/pf_ioctl.c Sat Oct 6 10:02:11 2012 (r241245) > @@ -3473,23 +3473,8 @@ static int > pf_check_in(void *arg, struct mbuf **m, struct ifnet *ifp, int dir, > struct inpcb *inp) > { > - /* > - * XXX Wed Jul 9 22:03:16 2003 UTC > - * OpenBSD has changed its byte ordering convention on ip_len/ip_off > - * in network stack. OpenBSD's network stack have converted > - * ip_len/ip_off to host byte order frist as FreeBSD. > - * Now this is not true anymore , so we should convert back to network > - * byte order. > - */ > - struct ip *h = NULL; > int chk; > > - if ((*m)->m_pkthdr.len >= (int)sizeof(struct ip)) { > - /* if m_pkthdr.len is less than ip header, pf will handle. */ > - h = mtod(*m, struct ip *); > - HTONS(h->ip_len); > - HTONS(h->ip_off); > - } > CURVNET_SET(ifp->if_vnet); > chk = pf_test(PF_IN, ifp, m, inp); > CURVNET_RESTORE(); > @@ -3497,28 +3482,14 @@ pf_check_in(void *arg, struct mbuf **m, > m_freem(*m); > *m = NULL; > } > - if (*m != NULL) { > - /* pf_test can change ip header location */ > - h = mtod(*m, struct ip *); > - NTOHS(h->ip_len); > - NTOHS(h->ip_off); > - } > - return chk; > + > + return (chk); > } > > static int > pf_check_out(void *arg, struct mbuf **m, struct ifnet *ifp, int dir, > struct inpcb *inp) > { > - /* > - * XXX Wed Jul 9 22:03:16 2003 UTC > - * OpenBSD has changed its byte ordering convention on ip_len/ip_off > - * in network stack. OpenBSD's network stack have converted > - * ip_len/ip_off to host byte order frist as FreeBSD. > - * Now this is not true anymore , so we should convert back to network > - * byte order. > - */ > - struct ip *h = NULL; > int chk; > > /* We need a proper CSUM befor we start (s. OpenBSD ip_output) */ > @@ -3526,12 +3497,7 @@ pf_check_out(void *arg, struct mbuf **m, > in_delayed_cksum(*m); > (*m)->m_pkthdr.csum_flags &= ~CSUM_DELAY_DATA; > } > - if ((*m)->m_pkthdr.len >= (int)sizeof(*h)) { > - /* if m_pkthdr.len is less than ip header, pf will handle. */ > - h = mtod(*m, struct ip *); > - HTONS(h->ip_len); > - HTONS(h->ip_off); > - } > + > CURVNET_SET(ifp->if_vnet); > chk = pf_test(PF_OUT, ifp, m, inp); > CURVNET_RESTORE(); > @@ -3539,13 +3505,8 @@ pf_check_out(void *arg, struct mbuf **m, > m_freem(*m); > *m = NULL; > } > - if (*m != NULL) { > - /* pf_test can change ip header location */ > - h = mtod(*m, struct ip *); > - NTOHS(h->ip_len); > - NTOHS(h->ip_off); > - } > - return chk; > + > + return (chk); > } > #endif > > @@ -3554,10 +3515,6 @@ static int > pf_check6_in(void *arg, struct mbuf **m, struct ifnet *ifp, int dir, > struct inpcb *inp) > { > - > - /* > - * IPv6 is not affected by ip_len/ip_off byte order changes. > - */ > int chk; > > /* > @@ -3579,9 +3536,6 @@ static int > pf_check6_out(void *arg, struct mbuf **m, struct ifnet *ifp, int dir, > struct inpcb *inp) > { > - /* > - * IPv6 does not affected ip_len/ip_off byte order changes. > - */ > int chk; > > /* We need a proper CSUM before we start (s. OpenBSD ip_output) */ > > Modified: head/sys/sys/param.h > ============================================================================== > --- head/sys/sys/param.h Sat Oct 6 07:06:57 2012 (r241244) > +++ head/sys/sys/param.h Sat Oct 6 10:02:11 2012 (r241245) > @@ -58,7 +58,7 @@ > * in the range 5 to 9. > */ > #undef __FreeBSD_version > -#define __FreeBSD_version 1000018 /* Master, propagated to newvers */ > +#define __FreeBSD_version 1000019 /* Master, propagated to newvers */ > > /* > * __FreeBSD_kernel__ indicates that this system uses the kernel of FreeBSD, From owner-svn-src-head@FreeBSD.ORG Mon Oct 8 04:11:46 2012 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id 6E5771065670; Mon, 8 Oct 2012 04:11:46 +0000 (UTC) (envelope-from marcel@xcllnt.net) Received: from mail.xcllnt.net (mail.xcllnt.net [70.36.220.4]) by mx1.freebsd.org (Postfix) with ESMTP id 3B4568FC0C; Mon, 8 Oct 2012 04:11:46 +0000 (UTC) Received: from dhcp-192-168-2-58.wifi.xcllnt.net (wifi.xcllnt.net [70.36.220.6] (may be forged)) (authenticated bits=0) by mail.xcllnt.net (8.14.5/8.14.5) with ESMTP id q984BcNN072532 (version=TLSv1/SSLv3 cipher=AES128-SHA bits=128 verify=NO); Sun, 7 Oct 2012 21:11:39 -0700 (PDT) (envelope-from marcel@xcllnt.net) Content-Type: text/plain; charset=us-ascii Mime-Version: 1.0 (Mac OS X Mail 6.2 \(1499\)) From: Marcel Moolenaar In-Reply-To: <20121007161440.C7605@besplex.bde.org> Date: Sun, 7 Oct 2012 21:11:38 -0700 Content-Transfer-Encoding: quoted-printable Message-Id: <81CB9A3A-4BFF-41B2-A1F9-3721A40F6260@xcllnt.net> References: <201210062001.q96K16Or030755@svn.freebsd.org> <20121007161440.C7605@besplex.bde.org> To: Bruce Evans X-Mailer: Apple Mail (2.1499) Cc: "svn-src-head@FreeBSD.org" , "svn-src-all@FreeBSD.org" , "src-committers@FreeBSD.org" , Simon Gerraty Subject: Re: svn commit: r241298 - in head: . gnu/usr.bin/cc/cc_int gnu/usr.bin/cc/include kerberos5 kerberos5/tools/asn1_compile kerberos5/tools/slc lib/clang/include share/mk tools/build/make_check usr.sbin/c... X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 08 Oct 2012 04:11:46 -0000 On Oct 6, 2012, at 10:31 PM, Bruce Evans wrote: > On Sat, 6 Oct 2012, Marcel Moolenaar wrote: >=20 >> Log: >> Add support for bmake. This includes: >> .... >> Modified: head/share/mk/bsd.dep.mk >> = =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D >> --- head/share/mk/bsd.dep.mk Sat Oct 6 19:57:27 2012 = (r241297) >> +++ head/share/mk/bsd.dep.mk Sat Oct 6 20:01:05 2012 = (r241298) >> @@ -102,8 +102,8 @@ ${_YC} y.tab.h: ${_YSRC} >> CLEANFILES+=3D y.tab.c y.tab.h >> .elif !empty(YFLAGS:M-d) >> .for _YH in ${_YC:R}.h >> -.ORDER: ${_YC} ${_YH} >> -${_YC} ${_YH}: ${_YSRC} >> +${_YH}: ${_YC} >> +${_YC}: ${_YSRC} >> ${YACC} ${YFLAGS} -o ${_YC} ${.ALLSRC} >> SRCS+=3D ${_YH} >> CLEANFILES+=3D ${_YH} >=20 > This is broken. Yacc headers don't depend on generated yacc .c files. > Now there is only a null rule to create the headers. One broken case > is when the header somehow gets deleted. It bcomes out of date, but > running make to update it only runs the null rule, so it remains > nonexistent. The problem with the old rule is that it's broken as well. The change attempts to fix a real parallel build problem. Your comment is valid though. What about the following (possibly white-space corrupted) patch from Simon: Index: share/mk/bsd.dep.mk =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D --- share/mk/bsd.dep.mk (revision 241871) +++ share/mk/bsd.dep.mk (working copy) @@ -95,16 +95,17 @@ CLEANFILES+=3D ${_LC} SRCS:=3D ${SRCS:S/${_YSRC}/${_YC}/} CLEANFILES+=3D ${_YC} .if !empty(YFLAGS:M-d) && !empty(SRCS:My.tab.h) -.ORDER: ${_YC} y.tab.h -${_YC} y.tab.h: ${_YSRC} +y.tab.h: ${_YSRC} ${YACC} ${YFLAGS} ${.ALLSRC} +${_YC}: y.tab.h cp y.tab.c ${_YC} CLEANFILES+=3D y.tab.c y.tab.h .elif !empty(YFLAGS:M-d) .for _YH in ${_YC:R}.h -${_YH}: ${_YC} -${_YC}: ${_YSRC} +${_YH}: ${_YSRC} ${YACC} ${YFLAGS} -o ${_YC} ${.ALLSRC} +${_YC}: ${_YH} + @touch ${.TARGET} SRCS+=3D ${_YH} CLEANFILES+=3D ${_YH} .endfor This makes sure the C file is always more recent than the H file and important to keep make happy in all situations. It doesn't fix the the problem of removing the C file entirely. At least the C file is recreated, but not with the right contents. Thoughts? --=20 Marcel Moolenaar marcel@xcllnt.net From owner-svn-src-head@FreeBSD.ORG Mon Oct 8 05:04:22 2012 Return-Path: Delivered-To: svn-src-head@FreeBSD.org Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id 33973106575A; Mon, 8 Oct 2012 05:04:22 +0000 (UTC) (envelope-from glebius@FreeBSD.org) Received: from cell.glebius.int.ru (glebius.int.ru [81.19.64.117]) by mx1.freebsd.org (Postfix) with ESMTP id 9E6F58FC14; Mon, 8 Oct 2012 05:04:21 +0000 (UTC) Received: from cell.glebius.int.ru (localhost [127.0.0.1]) by cell.glebius.int.ru (8.14.5/8.14.5) with ESMTP id q9854K6I066739; Mon, 8 Oct 2012 09:04:20 +0400 (MSK) (envelope-from glebius@FreeBSD.org) Received: (from glebius@localhost) by cell.glebius.int.ru (8.14.5/8.14.5/Submit) id q9854Kv6066738; Mon, 8 Oct 2012 09:04:20 +0400 (MSK) (envelope-from glebius@FreeBSD.org) X-Authentication-Warning: cell.glebius.int.ru: glebius set sender to glebius@FreeBSD.org using -f Date: Mon, 8 Oct 2012 09:04:20 +0400 From: Gleb Smirnoff To: Adrian Chadd Message-ID: <20121008050420.GO34622@FreeBSD.org> References: <201210061002.q96A2BFf039772@svn.freebsd.org> MIME-Version: 1.0 Content-Type: text/plain; charset=koi8-r Content-Disposition: inline In-Reply-To: User-Agent: Mutt/1.5.21 (2010-09-15) Cc: svn-src-head@FreeBSD.org, FreeBSD Net , svn-src-all@FreeBSD.org, src-committers@FreeBSD.org Subject: Re: svn commit: r241245 - in head: . share/man/man9 sys/contrib/ipfilter/netinet sys/net sys/netinet sys/netpfil/ipfw sys/netpfil/pf sys/sys X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 08 Oct 2012 05:04:22 -0000 On Sun, Oct 07, 2012 at 06:49:51PM -0700, Adrian Chadd wrote: A> Hi, A> A> People have been reporting this: A> A> A> Oct 7 18:35:19 alix kernel: in_cksum_skip: out of data by 53295 A> Oct 7 18:35:19 alix kernel: in_cksum_skip: out of data by 55335 A> A> Would you please investigate this, or back the patch out? I'm working on it. A> Also, if this is actually due to this patch - why is it that you A> didn't pick it up in testing? Because this debugging printf is only on i386, not on amd64. -- Totus tuus, Glebius. From owner-svn-src-head@FreeBSD.ORG Mon Oct 8 07:01:08 2012 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id 24D3A1065672; Mon, 8 Oct 2012 07:01:08 +0000 (UTC) (envelope-from yongari@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 0EB7A8FC0A; Mon, 8 Oct 2012 07:01:08 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id q987176X050347; Mon, 8 Oct 2012 07:01:07 GMT (envelope-from yongari@svn.freebsd.org) Received: (from yongari@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q98717js050345; Mon, 8 Oct 2012 07:01:07 GMT (envelope-from yongari@svn.freebsd.org) Message-Id: <201210080701.q98717js050345@svn.freebsd.org> From: Pyun YongHyeon Date: Mon, 8 Oct 2012 07:01:07 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r241340 - head/sys/dev/ale X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 08 Oct 2012 07:01:08 -0000 Author: yongari Date: Mon Oct 8 07:01:07 2012 New Revision: 241340 URL: http://svn.freebsd.org/changeset/base/241340 Log: Fix typo. Check against number of allocated MSI-X vectors. There is no ale(4) controller that supports MSI-X so this is not real issue. PR: kern/171825 Modified: head/sys/dev/ale/if_ale.c Modified: head/sys/dev/ale/if_ale.c ============================================================================== --- head/sys/dev/ale/if_ale.c Mon Oct 8 05:51:47 2012 (r241339) +++ head/sys/dev/ale/if_ale.c Mon Oct 8 07:01:07 2012 (r241340) @@ -551,7 +551,7 @@ ale_attach(device_t dev) if (msix_disable == 0 || msi_disable == 0) { if (msix_disable == 0 && msixc == ALE_MSIX_MESSAGES && pci_alloc_msix(dev, &msixc) == 0) { - if (msic == ALE_MSIX_MESSAGES) { + if (msixc == ALE_MSIX_MESSAGES) { device_printf(dev, "Using %d MSIX messages.\n", msixc); sc->ale_flags |= ALE_FLAG_MSIX; From owner-svn-src-head@FreeBSD.ORG Mon Oct 8 07:13:46 2012 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id 466C41065672; Mon, 8 Oct 2012 07:13:46 +0000 (UTC) (envelope-from yongari@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 3070F8FC08; Mon, 8 Oct 2012 07:13:46 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id q987DktO052254; Mon, 8 Oct 2012 07:13:46 GMT (envelope-from yongari@svn.freebsd.org) Received: (from yongari@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q987DjEC052252; Mon, 8 Oct 2012 07:13:45 GMT (envelope-from yongari@svn.freebsd.org) Message-Id: <201210080713.q987DjEC052252@svn.freebsd.org> From: Pyun YongHyeon Date: Mon, 8 Oct 2012 07:13:45 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r241341 - head/sys/dev/bge X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 08 Oct 2012 07:13:46 -0000 Author: yongari Date: Mon Oct 8 07:13:45 2012 New Revision: 241341 URL: http://svn.freebsd.org/changeset/base/241341 Log: Limit applying TX data corruption and FIFO workaround to BCM5719 A0. It's believed BCM5720 does not have the issue. Modified: head/sys/dev/bge/if_bge.c Modified: head/sys/dev/bge/if_bge.c ============================================================================== --- head/sys/dev/bge/if_bge.c Mon Oct 8 07:01:07 2012 (r241340) +++ head/sys/dev/bge/if_bge.c Mon Oct 8 07:13:45 2012 (r241341) @@ -2121,8 +2121,8 @@ bge_blockinit(struct bge_softc *sc) * Adjust tx margin to prevent TX data corruption and * fix internal FIFO overflow. */ - if (sc->bge_asicrev == BGE_ASICREV_BCM5719 || - sc->bge_asicrev == BGE_ASICREV_BCM5720) { + if (sc->bge_asicrev == BGE_ASICREV_BCM5719 && + sc->bge_chipid == BGE_CHIPID_BCM5719_A0) { dmactl &= ~(BGE_RDMA_RSRVCTRL_FIFO_LWM_MASK | BGE_RDMA_RSRVCTRL_FIFO_HWM_MASK | BGE_RDMA_RSRVCTRL_TXMRGN_MASK); From owner-svn-src-head@FreeBSD.ORG Mon Oct 8 07:21:33 2012 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id 96D0A1065670; Mon, 8 Oct 2012 07:21:33 +0000 (UTC) (envelope-from glebius@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 81B1E8FC0A; Mon, 8 Oct 2012 07:21:33 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id q987LX7s053397; Mon, 8 Oct 2012 07:21:33 GMT (envelope-from glebius@svn.freebsd.org) Received: (from glebius@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q987LXZ0053394; Mon, 8 Oct 2012 07:21:33 GMT (envelope-from glebius@svn.freebsd.org) Message-Id: <201210080721.q987LXZ0053394@svn.freebsd.org> From: Gleb Smirnoff Date: Mon, 8 Oct 2012 07:21:33 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r241342 - head/sys/netinet X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 08 Oct 2012 07:21:33 -0000 Author: glebius Date: Mon Oct 8 07:21:32 2012 New Revision: 241342 URL: http://svn.freebsd.org/changeset/base/241342 Log: No reason to play with IP header before calling sctp_delayed_cksum() with offset beyond the IP header. Modified: head/sys/netinet/ip_divert.c Modified: head/sys/netinet/ip_divert.c ============================================================================== --- head/sys/netinet/ip_divert.c Mon Oct 8 07:13:45 2012 (r241341) +++ head/sys/netinet/ip_divert.c Mon Oct 8 07:21:32 2012 (r241342) @@ -215,10 +215,8 @@ divert_packet(struct mbuf *m, int incomi } #ifdef SCTP if (m->m_pkthdr.csum_flags & CSUM_SCTP) { - ip->ip_len = ntohs(ip->ip_len); sctp_delayed_cksum(m, (uint32_t)(ip->ip_hl << 2)); m->m_pkthdr.csum_flags &= ~CSUM_SCTP; - ip->ip_len = htons(ip->ip_len); } #endif bzero(&divsrc, sizeof(divsrc)); From owner-svn-src-head@FreeBSD.ORG Mon Oct 8 07:33:44 2012 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id 5D82F106564A; Mon, 8 Oct 2012 07:33:44 +0000 (UTC) (envelope-from yongari@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id E71238FC14; Mon, 8 Oct 2012 07:33:43 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id q987XhIm055178; Mon, 8 Oct 2012 07:33:43 GMT (envelope-from yongari@svn.freebsd.org) Received: (from yongari@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q987XhK8055176; Mon, 8 Oct 2012 07:33:43 GMT (envelope-from yongari@svn.freebsd.org) Message-Id: <201210080733.q987XhK8055176@svn.freebsd.org> From: Pyun YongHyeon Date: Mon, 8 Oct 2012 07:33:43 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r241343 - head/sys/dev/bge X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 08 Oct 2012 07:33:44 -0000 Author: yongari Date: Mon Oct 8 07:33:43 2012 New Revision: 241343 URL: http://svn.freebsd.org/changeset/base/241343 Log: Rework device detach. While here, move driver lock/callout initialization to the beginning of device attach for readability. Modified: head/sys/dev/bge/if_bge.c Modified: head/sys/dev/bge/if_bge.c ============================================================================== --- head/sys/dev/bge/if_bge.c Mon Oct 8 07:21:32 2012 (r241342) +++ head/sys/dev/bge/if_bge.c Mon Oct 8 07:33:43 2012 (r241343) @@ -2875,7 +2875,9 @@ bge_attach(device_t dev) sc = device_get_softc(dev); sc->bge_dev = dev; + BGE_LOCK_INIT(sc, device_get_nameunit(dev)); TASK_INIT(&sc->bge_intr_task, 0, bge_intr_task, sc); + callout_init_mtx(&sc->bge_stat_ch, &sc->bge_mtx, 0); /* * Map control/status registers. @@ -3234,8 +3236,6 @@ bge_attach(device_t dev) bge_devinfo(sc); - BGE_LOCK_INIT(sc, device_get_nameunit(dev)); - /* Try to reset the chip. */ if (bge_reset(sc)) { device_printf(sc->bge_dev, "chip reset failed\n"); @@ -3439,7 +3439,6 @@ again: * Call MI attach routine. */ ether_ifattach(ifp, eaddr); - callout_init_mtx(&sc->bge_stat_ch, &sc->bge_mtx, 0); /* Tell upper layer we support long frames. */ ifp->if_data.ifi_hdrlen = sizeof(struct ether_vlan_header); @@ -3456,7 +3455,7 @@ again: if (sc->bge_tq == NULL) { device_printf(dev, "could not create taskqueue.\n"); ether_ifdetach(ifp); - error = ENXIO; + error = ENOMEM; goto fail; } taskqueue_start_threads(&sc->bge_tq, 1, PI_NET, "%s taskq", @@ -3464,23 +3463,19 @@ again: error = bus_setup_intr(dev, sc->bge_irq, INTR_TYPE_NET | INTR_MPSAFE, bge_msi_intr, NULL, sc, &sc->bge_intrhand); - if (error) - ether_ifdetach(ifp); } else error = bus_setup_intr(dev, sc->bge_irq, INTR_TYPE_NET | INTR_MPSAFE, NULL, bge_intr, sc, &sc->bge_intrhand); if (error) { - bge_detach(dev); + ether_ifdetach(ifp); device_printf(sc->bge_dev, "couldn't set up irq\n"); } - return (0); - fail: - bge_release_resources(sc); - + if (error) + bge_detach(dev); return (error); } @@ -3498,16 +3493,16 @@ bge_detach(device_t dev) ether_poll_deregister(ifp); #endif - BGE_LOCK(sc); - bge_stop(sc); - bge_reset(sc); - BGE_UNLOCK(sc); - - callout_drain(&sc->bge_stat_ch); + if (device_is_attached(dev)) { + ether_ifdetach(ifp); + BGE_LOCK(sc); + bge_stop(sc); + BGE_UNLOCK(sc); + callout_drain(&sc->bge_stat_ch); + } if (sc->bge_tq) taskqueue_drain(sc->bge_tq, &sc->bge_intr_task); - ether_ifdetach(ifp); if (sc->bge_flags & BGE_FLAG_TBI) { ifmedia_removeall(&sc->bge_ifmedia); From owner-svn-src-head@FreeBSD.ORG Mon Oct 8 08:03:59 2012 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id AB1F21065672; Mon, 8 Oct 2012 08:03:59 +0000 (UTC) (envelope-from glebius@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 943B08FC16; Mon, 8 Oct 2012 08:03:59 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id q9883xoo059515; Mon, 8 Oct 2012 08:03:59 GMT (envelope-from glebius@svn.freebsd.org) Received: (from glebius@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q9883xrS059506; Mon, 8 Oct 2012 08:03:59 GMT (envelope-from glebius@svn.freebsd.org) Message-Id: <201210080803.q9883xrS059506@svn.freebsd.org> From: Gleb Smirnoff Date: Mon, 8 Oct 2012 08:03:59 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r241344 - in head/sys: netgraph netinet netinet6 netpfil/ipfw netpfil/pf X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 08 Oct 2012 08:03:59 -0000 Author: glebius Date: Mon Oct 8 08:03:58 2012 New Revision: 241344 URL: http://svn.freebsd.org/changeset/base/241344 Log: After r241245 it appeared that in_delayed_cksum(), which still expects host byte order, was sometimes called with net byte order. Since we are moving towards net byte order throughout the stack, the function was converted to expect net byte order, and its consumers fixed appropriately: - ip_output(), ipfilter(4) not changed, since already call in_delayed_cksum() with header in net byte order. - divert(4), ng_nat(4), ipfw_nat(4) now don't need to swap byte order there and back. - mrouting code and IPv6 ipsec now need to switch byte order there and back, but I hope, this is temporary solution. - In ipsec(4) shifted switch to net byte order prior to in_delayed_cksum(). - pf_route() catches up on r241245 changes to ip_output(). Modified: head/sys/netgraph/ng_nat.c head/sys/netinet/ip_divert.c head/sys/netinet/ip_ipsec.c head/sys/netinet/ip_mroute.c head/sys/netinet/ip_output.c head/sys/netinet6/ip6_ipsec.c head/sys/netpfil/ipfw/ip_fw_nat.c head/sys/netpfil/pf/pf.c Modified: head/sys/netgraph/ng_nat.c ============================================================================== --- head/sys/netgraph/ng_nat.c Mon Oct 8 07:33:43 2012 (r241343) +++ head/sys/netgraph/ng_nat.c Mon Oct 8 08:03:58 2012 (r241344) @@ -756,18 +756,18 @@ ng_nat_rcvdata(hook_p hook, item_p item */ if (th->th_x2) { + uint16_t ip_len = ntohs(ip->ip_len); + th->th_x2 = 0; - ip->ip_len = ntohs(ip->ip_len); th->th_sum = in_pseudo(ip->ip_src.s_addr, ip->ip_dst.s_addr, htons(IPPROTO_TCP + - ip->ip_len - (ip->ip_hl << 2))); + ip_len - (ip->ip_hl << 2))); if ((m->m_pkthdr.csum_flags & CSUM_TCP) == 0) { m->m_pkthdr.csum_data = offsetof(struct tcphdr, th_sum); in_delayed_cksum(m); } - ip->ip_len = htons(ip->ip_len); } } Modified: head/sys/netinet/ip_divert.c ============================================================================== --- head/sys/netinet/ip_divert.c Mon Oct 8 07:33:43 2012 (r241343) +++ head/sys/netinet/ip_divert.c Mon Oct 8 08:03:58 2012 (r241344) @@ -208,10 +208,8 @@ divert_packet(struct mbuf *m, int incomi /* Delayed checksums are currently not compatible with divert. */ if (m->m_pkthdr.csum_flags & CSUM_DELAY_DATA) { - ip->ip_len = ntohs(ip->ip_len); in_delayed_cksum(m); m->m_pkthdr.csum_flags &= ~CSUM_DELAY_DATA; - ip->ip_len = htons(ip->ip_len); } #ifdef SCTP if (m->m_pkthdr.csum_flags & CSUM_SCTP) { Modified: head/sys/netinet/ip_ipsec.c ============================================================================== --- head/sys/netinet/ip_ipsec.c Mon Oct 8 07:33:43 2012 (r241343) +++ head/sys/netinet/ip_ipsec.c Mon Oct 8 08:03:58 2012 (r241344) @@ -332,6 +332,9 @@ ip_ipsec_output(struct mbuf **m, struct } } + ip->ip_len = htons(ip->ip_len); + ip->ip_off = htons(ip->ip_off); + /* * Do delayed checksums now because we send before * this is done in the normal processing path. @@ -346,8 +349,6 @@ ip_ipsec_output(struct mbuf **m, struct (*m)->m_pkthdr.csum_flags &= ~CSUM_SCTP; } #endif - ip->ip_len = htons(ip->ip_len); - ip->ip_off = htons(ip->ip_off); /* NB: callee frees mbuf */ *error = ipsec4_process_packet(*m, sp->req, *flags, 0); Modified: head/sys/netinet/ip_mroute.c ============================================================================== --- head/sys/netinet/ip_mroute.c Mon Oct 8 07:33:43 2012 (r241343) +++ head/sys/netinet/ip_mroute.c Mon Oct 8 08:03:58 2012 (r241344) @@ -2376,7 +2376,10 @@ pim_register_prepare(struct ip *ip, stru /* Take care of delayed checksums */ if (m->m_pkthdr.csum_flags & CSUM_DELAY_DATA) { + /* XXX: in_delayed_cksum() expects net byte order */ + ip->ip_len = htons(ip->ip_len); in_delayed_cksum(m); + ip->ip_len = ntohs(ip->ip_len); m->m_pkthdr.csum_flags &= ~CSUM_DELAY_DATA; } Modified: head/sys/netinet/ip_output.c ============================================================================== --- head/sys/netinet/ip_output.c Mon Oct 8 07:33:43 2012 (r241343) +++ head/sys/netinet/ip_output.c Mon Oct 8 08:03:58 2012 (r241344) @@ -882,11 +882,12 @@ void in_delayed_cksum(struct mbuf *m) { struct ip *ip; - u_short csum, offset; + uint16_t csum, offset, ip_len; ip = mtod(m, struct ip *); offset = ip->ip_hl << 2 ; - csum = in_cksum_skip(m, ip->ip_len, offset); + ip_len = ntohs(ip->ip_len); + csum = in_cksum_skip(m, ip_len, offset); if (m->m_pkthdr.csum_flags & CSUM_UDP && csum == 0) csum = 0xffff; offset += m->m_pkthdr.csum_data; /* checksum offset */ Modified: head/sys/netinet6/ip6_ipsec.c ============================================================================== --- head/sys/netinet6/ip6_ipsec.c Mon Oct 8 07:33:43 2012 (r241343) +++ head/sys/netinet6/ip6_ipsec.c Mon Oct 8 08:03:58 2012 (r241344) @@ -295,9 +295,15 @@ ip6_ipsec_output(struct mbuf **m, struct */ #ifdef INET if ((*m)->m_pkthdr.csum_flags & CSUM_DELAY_DATA) { + struct ip *ip; + ipseclog((LOG_DEBUG, "%s: we do not support IPv4 over IPv6", __func__)); + /* XXX: in_delayed_cksum() expects net byte order */ + ip = mtod(m, struct ip *); + ip->ip_len = htons(ip->ip_len); in_delayed_cksum(*m); + ip->ip_len = ntohs(ip->ip_len); (*m)->m_pkthdr.csum_flags &= ~CSUM_DELAY_DATA; } #endif Modified: head/sys/netpfil/ipfw/ip_fw_nat.c ============================================================================== --- head/sys/netpfil/ipfw/ip_fw_nat.c Mon Oct 8 07:33:43 2012 (r241343) +++ head/sys/netpfil/ipfw/ip_fw_nat.c Mon Oct 8 08:03:58 2012 (r241344) @@ -336,11 +336,11 @@ ipfw_nat(struct ip_fw_args *args, struct if (ldt) { struct tcphdr *th; struct udphdr *uh; - u_short cksum; + uint16_t ip_len, cksum; - ip->ip_len = ntohs(ip->ip_len); + ip_len = ntohs(ip->ip_len); cksum = in_pseudo(ip->ip_src.s_addr, ip->ip_dst.s_addr, - htons(ip->ip_p + ip->ip_len - (ip->ip_hl << 2))); + htons(ip->ip_p + ip_len - (ip->ip_hl << 2))); switch (ip->ip_p) { case IPPROTO_TCP: @@ -366,7 +366,6 @@ ipfw_nat(struct ip_fw_args *args, struct in_delayed_cksum(mcl); mcl->m_pkthdr.csum_flags &= ~CSUM_DELAY_DATA; } - ip->ip_len = htons(ip->ip_len); } args->m = mcl; return (IP_FW_NAT); Modified: head/sys/netpfil/pf/pf.c ============================================================================== --- head/sys/netpfil/pf/pf.c Mon Oct 8 07:33:43 2012 (r241343) +++ head/sys/netpfil/pf/pf.c Mon Oct 8 08:03:58 2012 (r241344) @@ -5149,7 +5149,7 @@ pf_route(struct mbuf **m, struct pf_rule struct pf_addr naddr; struct pf_src_node *sn = NULL; int error = 0; - int sw_csum; + uint16_t ip_len, ip_off, sw_csum; KASSERT(m && *m && r && oifp, ("%s: invalid parameters", __func__)); KASSERT(dir == PF_IN || dir == PF_OUT, ("%s: invalid direction", @@ -5244,9 +5244,8 @@ pf_route(struct mbuf **m, struct pf_rule if (ifp->if_flags & IFF_LOOPBACK) m0->m_flags |= M_SKIP_FIREWALL; - /* Back to host byte order. */ - ip->ip_len = ntohs(ip->ip_len); - ip->ip_off = ntohs(ip->ip_off); + ip_len = ntohs(ip->ip_len); + ip_off = ntohs(ip->ip_off); /* Copied from FreeBSD 10.0-CURRENT ip_output. */ m0->m_pkthdr.csum_flags |= CSUM_IP; @@ -5267,11 +5266,9 @@ pf_route(struct mbuf **m, struct pf_rule * If small enough for interface, or the interface will take * care of the fragmentation for us, we can just send directly. */ - if (ip->ip_len <= ifp->if_mtu || + if (ip_len <= ifp->if_mtu || (m0->m_pkthdr.csum_flags & ifp->if_hwassist & CSUM_TSO) != 0 || - ((ip->ip_off & IP_DF) == 0 && (ifp->if_hwassist & CSUM_FRAGMENT))) { - ip->ip_len = htons(ip->ip_len); - ip->ip_off = htons(ip->ip_off); + ((ip_off & IP_DF) == 0 && (ifp->if_hwassist & CSUM_FRAGMENT))) { ip->ip_sum = 0; if (sw_csum & CSUM_DELAY_IP) ip->ip_sum = in_cksum(m0, ip->ip_hl << 2); @@ -5281,7 +5278,7 @@ pf_route(struct mbuf **m, struct pf_rule } /* Balk when DF bit is set or the interface didn't support TSO. */ - if ((ip->ip_off & IP_DF) || (m0->m_pkthdr.csum_flags & CSUM_TSO)) { + if ((ip_off & IP_DF) || (m0->m_pkthdr.csum_flags & CSUM_TSO)) { error = EMSGSIZE; KMOD_IPSTAT_INC(ips_cantfrag); if (r->rt != PF_DUPTO) { From owner-svn-src-head@FreeBSD.ORG Mon Oct 8 08:08:37 2012 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id 0176C106564A; Mon, 8 Oct 2012 08:08:37 +0000 (UTC) (envelope-from brde@optusnet.com.au) Received: from mail15.syd.optusnet.com.au (mail15.syd.optusnet.com.au [211.29.132.196]) by mx1.freebsd.org (Postfix) with ESMTP id 11DDE8FC08; Mon, 8 Oct 2012 08:08:35 +0000 (UTC) Received: from c122-106-175-26.carlnfd1.nsw.optusnet.com.au (c122-106-175-26.carlnfd1.nsw.optusnet.com.au [122.106.175.26]) by mail15.syd.optusnet.com.au (8.13.1/8.13.1) with ESMTP id q9888Ol4026684 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=NO); Mon, 8 Oct 2012 19:08:26 +1100 Date: Mon, 8 Oct 2012 19:08:24 +1100 (EST) From: Bruce Evans X-X-Sender: bde@besplex.bde.org To: Marcel Moolenaar In-Reply-To: <81CB9A3A-4BFF-41B2-A1F9-3721A40F6260@xcllnt.net> Message-ID: <20121008165228.F7997@besplex.bde.org> References: <201210062001.q96K16Or030755@svn.freebsd.org> <20121007161440.C7605@besplex.bde.org> <81CB9A3A-4BFF-41B2-A1F9-3721A40F6260@xcllnt.net> MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII; format=flowed Cc: "svn-src-head@FreeBSD.org" , "svn-src-all@FreeBSD.org" , "src-committers@FreeBSD.org" , Bruce Evans , Simon Gerraty Subject: Re: svn commit: r241298 - in head: . gnu/usr.bin/cc/cc_int gnu/usr.bin/cc/include kerberos5 kerberos5/tools/asn1_compile kerberos5/tools/slc lib/clang/include share/mk tools/build/make_check usr.sbin/c... X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 08 Oct 2012 08:08:37 -0000 On Sun, 7 Oct 2012, Marcel Moolenaar wrote: > On Oct 6, 2012, at 10:31 PM, Bruce Evans wrote: > >> On Sat, 6 Oct 2012, Marcel Moolenaar wrote: >> >>> Log: >>> Add support for bmake. This includes: >>> .... >>> Modified: head/share/mk/bsd.dep.mk >>> ============================================================================== >>> --- head/share/mk/bsd.dep.mk Sat Oct 6 19:57:27 2012 (r241297) >>> +++ head/share/mk/bsd.dep.mk Sat Oct 6 20:01:05 2012 (r241298) >>> @@ -102,8 +102,8 @@ ${_YC} y.tab.h: ${_YSRC} >>> CLEANFILES+= y.tab.c y.tab.h >>> .elif !empty(YFLAGS:M-d) >>> .for _YH in ${_YC:R}.h >>> -.ORDER: ${_YC} ${_YH} >>> -${_YC} ${_YH}: ${_YSRC} >>> +${_YH}: ${_YC} >>> +${_YC}: ${_YSRC} >>> ${YACC} ${YFLAGS} -o ${_YC} ${.ALLSRC} >>> SRCS+= ${_YH} >>> CLEANFILES+= ${_YH} >> >> This is broken. Yacc headers don't depend on generated yacc .c files. >> Now there is only a null rule to create the headers. One broken case >> is when the header somehow gets deleted. It bcomes out of date, but >> running make to update it only runs the null rule, so it remains >> nonexistent. > > The problem with the old rule is that it's broken as well. The > change attempts to fix a real parallel build problem. Your > comment is valid though. What about the following (possibly > white-space corrupted) patch from Simon: What's wrong with the old rule? It uses the .ORDER directive to force creation of the 2 generated files in sequential order, so that parallel builds can't happen. > Index: share/mk/bsd.dep.mk > =================================================================== > --- share/mk/bsd.dep.mk (revision 241871) > +++ share/mk/bsd.dep.mk (working copy) > @@ -95,16 +95,17 @@ CLEANFILES+= ${_LC} > SRCS:= ${SRCS:S/${_YSRC}/${_YC}/} > CLEANFILES+= ${_YC} > .if !empty(YFLAGS:M-d) && !empty(SRCS:My.tab.h) > -.ORDER: ${_YC} y.tab.h > -${_YC} y.tab.h: ${_YSRC} > +y.tab.h: ${_YSRC} > ${YACC} ${YFLAGS} ${.ALLSRC} > +${_YC}: y.tab.h > cp y.tab.c ${_YC} > CLEANFILES+= y.tab.c y.tab.h > .elif !empty(YFLAGS:M-d) > .for _YH in ${_YC:R}.h > -${_YH}: ${_YC} > -${_YC}: ${_YSRC} > +${_YH}: ${_YSRC} > ${YACC} ${YFLAGS} -o ${_YC} ${.ALLSRC} > +${_YC}: ${_YH} > + @touch ${.TARGET} > SRCS+= ${_YH} > CLEANFILES+= ${_YH} > .endfor > > This makes sure the C file is always more recent than the H > file and important to keep make happy in all situations. It > doesn't fix the the problem of removing the C file entirely. > At least the C file is recreated, but not with the right > contents. I don't like it much. With better yacc(1) options, we could run separate yacc commands to create each file, but that requires 2 commands in all cases so it is not more efficient than a working .ORDER. It could avoid the separate cp command. Hmm, is that command the only actual problem? The dependencies and ordering are incomplete for the intermediate file y.tab.c, so it might be clobbered before it is copied. This case is just compatibility cruft for sources that don't name the yacc header sensibily, but use the bad old default name y.tab.h even if they don't use y.tab.c directly. Such sources are still too common. I see many ways to make the cp step more robust, so this is easy to fix if it is the problem. A mv instead of a cp would be more robust, but is intentionally not used, since the y.tab.c has self references which are used by at least (gdb) debugging. y.tab.c is kept so that these references are to an existent file (just not the actual source file). Bruce From owner-svn-src-head@FreeBSD.ORG Mon Oct 8 10:34:50 2012 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id 72E51106564A; Mon, 8 Oct 2012 10:34:50 +0000 (UTC) (envelope-from dougb@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 5DC258FC0C; Mon, 8 Oct 2012 10:34:50 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id q98AYosv079864; Mon, 8 Oct 2012 10:34:50 GMT (envelope-from dougb@svn.freebsd.org) Received: (from dougb@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q98AYoDH079862; Mon, 8 Oct 2012 10:34:50 GMT (envelope-from dougb@svn.freebsd.org) Message-Id: <201210081034.q98AYoDH079862@svn.freebsd.org> From: Doug Barton Date: Mon, 8 Oct 2012 10:34:50 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r241345 - head X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 08 Oct 2012 10:34:50 -0000 Author: dougb Date: Mon Oct 8 10:34:49 2012 New Revision: 241345 URL: http://svn.freebsd.org/changeset/base/241345 Log: Remove my pre-commit review request for mergemaster Modified: head/MAINTAINERS Modified: head/MAINTAINERS ============================================================================== --- head/MAINTAINERS Mon Oct 8 08:03:58 2012 (r241344) +++ head/MAINTAINERS Mon Oct 8 10:34:49 2012 (r241345) @@ -21,7 +21,6 @@ It is not a registry of 'turf' or privat subsystem login notes ----------------------------- kqueue jmg Pre-commit review requested. -mergemaster dougb Prefers to pre-approve commits libc/posix1e rwatson Pre-commit review requested. POSIX.1e ACLs rwatson Pre-commit review requested. UFS EAs rwatson Pre-commit review requested. From owner-svn-src-head@FreeBSD.ORG Mon Oct 8 10:53:58 2012 Return-Path: Delivered-To: svn-src-head@FreeBSD.org Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id 0D3B0106564A; Mon, 8 Oct 2012 10:53:58 +0000 (UTC) (envelope-from peter@rulingia.com) Received: from vps.rulingia.com (host-122-100-2-194.octopus.com.au [122.100.2.194]) by mx1.freebsd.org (Postfix) with ESMTP id 8E75E8FC1B; Mon, 8 Oct 2012 10:53:56 +0000 (UTC) Received: from server.rulingia.com (c220-239-248-178.belrs5.nsw.optusnet.com.au [220.239.248.178]) by vps.rulingia.com (8.14.5/8.14.5) with ESMTP id q98ArnpM025381 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=OK); Mon, 8 Oct 2012 21:53:49 +1100 (EST) (envelope-from peter@rulingia.com) X-Bogosity: Ham, spamicity=0.000000 Received: from server.rulingia.com (localhost.rulingia.com [127.0.0.1]) by server.rulingia.com (8.14.5/8.14.5) with ESMTP id q98ArhV6069892 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=NO); Mon, 8 Oct 2012 21:53:43 +1100 (EST) (envelope-from peter@server.rulingia.com) Received: (from peter@localhost) by server.rulingia.com (8.14.5/8.14.5/Submit) id q98Arhjl069891; Mon, 8 Oct 2012 21:53:43 +1100 (EST) (envelope-from peter) Date: Mon, 8 Oct 2012 21:53:43 +1100 From: Peter Jeremy To: Gleb Smirnoff Message-ID: <20121008105343.GI22291@server.rulingia.com> References: <201210050751.q957pL1X020732@svn.freebsd.org> MIME-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha1; protocol="application/pgp-signature"; boundary="HCdXmnRlPgeNBad2" Content-Disposition: inline In-Reply-To: <201210050751.q957pL1X020732@svn.freebsd.org> X-PGP-Key: http://www.rulingia.com/keys/peter.pgp User-Agent: Mutt/1.5.21 (2010-09-15) Cc: svn-src-head@FreeBSD.org, svn-src-all@FreeBSD.org, src-committers@FreeBSD.org Subject: Re: svn commit: r241221 - in head: contrib/tcpdump usr.sbin/tcpdump/tcpdump X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 08 Oct 2012 10:53:58 -0000 --HCdXmnRlPgeNBad2 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline Content-Transfer-Encoding: quoted-printable On 2012-Oct-05 07:51:21 +0000, Gleb Smirnoff wrote: > Provide ability for printing and decoding pfsync(4) traffic. This > doesn't mean supporting IFT_PFSYNC (which I hope will eventually > die). This means decoding packets with IP protocol of 240 caught > on any normal interface like Ethernet. You might like to look at bin/124825 as well. --=20 Peter Jeremy --HCdXmnRlPgeNBad2 Content-Type: application/pgp-signature -----BEGIN PGP SIGNATURE----- Version: GnuPG v2.0.19 (FreeBSD) iEYEARECAAYFAlBysLcACgkQ/opHv/APuIfqjACfQNYkBxFe/VHL38vPWMEn2S5z 64IAnjcsmrPjjaeuqSP54uxt4HTsEx74 =2tPZ -----END PGP SIGNATURE----- --HCdXmnRlPgeNBad2-- From owner-svn-src-head@FreeBSD.ORG Mon Oct 8 13:45:40 2012 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id B8B2B106564A; Mon, 8 Oct 2012 13:45:40 +0000 (UTC) (envelope-from avg@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 9F4F98FC08; Mon, 8 Oct 2012 13:45:40 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id q98Dje65010423; Mon, 8 Oct 2012 13:45:40 GMT (envelope-from avg@svn.freebsd.org) Received: (from avg@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q98Djei3010421; Mon, 8 Oct 2012 13:45:40 GMT (envelope-from avg@svn.freebsd.org) Message-Id: <201210081345.q98Djei3010421@svn.freebsd.org> From: Andriy Gapon Date: Mon, 8 Oct 2012 13:45:40 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r241349 - head/sys/netinet6 X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 08 Oct 2012 13:45:40 -0000 Author: avg Date: Mon Oct 8 13:45:40 2012 New Revision: 241349 URL: http://svn.freebsd.org/changeset/base/241349 Log: ip6_ipsec_output: fix a typo in r241344 Acting as a remote drone of glebius. Modified: head/sys/netinet6/ip6_ipsec.c Modified: head/sys/netinet6/ip6_ipsec.c ============================================================================== --- head/sys/netinet6/ip6_ipsec.c Mon Oct 8 13:14:00 2012 (r241348) +++ head/sys/netinet6/ip6_ipsec.c Mon Oct 8 13:45:40 2012 (r241349) @@ -300,7 +300,7 @@ ip6_ipsec_output(struct mbuf **m, struct ipseclog((LOG_DEBUG, "%s: we do not support IPv4 over IPv6", __func__)); /* XXX: in_delayed_cksum() expects net byte order */ - ip = mtod(m, struct ip *); + ip = mtod(*m, struct ip *); ip->ip_len = htons(ip->ip_len); in_delayed_cksum(*m); ip->ip_len = ntohs(ip->ip_len); From owner-svn-src-head@FreeBSD.ORG Mon Oct 8 14:08:14 2012 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id 30B14106566C; Mon, 8 Oct 2012 14:08:14 +0000 (UTC) (envelope-from obrien@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 1A99A8FC17; Mon, 8 Oct 2012 14:08:14 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id q98E8DNd013663; Mon, 8 Oct 2012 14:08:13 GMT (envelope-from obrien@svn.freebsd.org) Received: (from obrien@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q98E8DFU013661; Mon, 8 Oct 2012 14:08:13 GMT (envelope-from obrien@svn.freebsd.org) Message-Id: <201210081408.q98E8DFU013661@svn.freebsd.org> From: "David E. O'Brien" Date: Mon, 8 Oct 2012 14:08:13 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r241351 - head/sys/modules X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 08 Oct 2012 14:08:14 -0000 Author: obrien Date: Mon Oct 8 14:08:13 2012 New Revision: 241351 URL: http://svn.freebsd.org/changeset/base/241351 Log: Restrict the module to varied environments. Modified: head/sys/modules/Makefile Modified: head/sys/modules/Makefile ============================================================================== --- head/sys/modules/Makefile Mon Oct 8 14:05:00 2012 (r241350) +++ head/sys/modules/Makefile Mon Oct 8 14:08:13 2012 (r241351) @@ -108,7 +108,7 @@ SUBDIR= \ fdc \ fdescfs \ ${_fe} \ - filemon \ + ${_filemon} \ firewire \ firmware \ ${_fxp} \ @@ -364,6 +364,10 @@ SUBDIR= \ ${_zfs} \ zlib \ +.if ${MACHINE_CPUARCH} == "i386" || ${MACHINE_CPUARCH} == "amd64" +_filemon= filemon +.endif + .if ${MACHINE_CPUARCH} != "powerpc" && ${MACHINE_CPUARCH} != "arm" && \ ${MACHINE_CPUARCH} != "mips" _syscons= syscons From owner-svn-src-head@FreeBSD.ORG Mon Oct 8 16:57:05 2012 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id D0B471065670; Mon, 8 Oct 2012 16:57:05 +0000 (UTC) (envelope-from alc@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id BAAED8FC0C; Mon, 8 Oct 2012 16:57:05 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id q98Gv5f3037729; Mon, 8 Oct 2012 16:57:05 GMT (envelope-from alc@svn.freebsd.org) Received: (from alc@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q98Gv5fH037726; Mon, 8 Oct 2012 16:57:05 GMT (envelope-from alc@svn.freebsd.org) Message-Id: <201210081657.q98Gv5fH037726@svn.freebsd.org> From: Alan Cox Date: Mon, 8 Oct 2012 16:57:05 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r241353 - in head/sys/i386: i386 xen X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 08 Oct 2012 16:57:06 -0000 Author: alc Date: Mon Oct 8 16:57:05 2012 New Revision: 241353 URL: http://svn.freebsd.org/changeset/base/241353 Log: In a few places, like the implementation of ptrace(), a thread may call upon pmap_enter() to create a mapping within a different address space, i.e., not the thread's own address space. On i386, this entails the creation of a temporary mapping to the affected page table page (PTP). In general, pmap_enter() will read from this PTP, allocate a PV entry, and write to this PTP. The trouble comes when the system is short of memory. In order to allocate a new PV entry, an older PV entry has to be reclaimed. Reclaiming a PV entry involves destroying a mapping, which requires access to the affected PTP. Thus, the PTP mapped at the beginning of pmap_enter() is no longer mapped at the end of pmap_enter(), which leads to pmap_enter() modifying the wrong PTP. To address this problem, pmap_pv_reclaim() is changed to use an alternate method of mapping PTPs. Update a related comment. Reported by: pho Diagnosed by: kib MFC after: 5 days Modified: head/sys/i386/i386/pmap.c head/sys/i386/xen/pmap.c Modified: head/sys/i386/i386/pmap.c ============================================================================== --- head/sys/i386/i386/pmap.c Mon Oct 8 16:00:33 2012 (r241352) +++ head/sys/i386/i386/pmap.c Mon Oct 8 16:57:05 2012 (r241353) @@ -475,7 +475,8 @@ pmap_bootstrap(vm_paddr_t firstaddr) KPTmap -= i386_btop(KPTDI << PDRSHIFT); /* - * ptemap is used for pmap_pte_quick + * PADDR1 and PADDR2 are used by pmap_pte_quick() and pmap_pte(), + * respectively. */ SYSMAP(pt_entry_t *, PMAP1, PADDR1, 1) SYSMAP(pt_entry_t *, PMAP2, PADDR2, 1) @@ -2228,7 +2229,6 @@ pmap_pv_reclaim(pmap_t locked_pmap) pmap = NULL; free = m_pc = NULL; TAILQ_INIT(&newtail); - sched_pin(); while ((pc = TAILQ_FIRST(&pv_chunks)) != NULL && (pv_vafree == 0 || free == NULL)) { TAILQ_REMOVE(&pv_chunks, pc, pc_lru); @@ -2262,10 +2262,13 @@ pmap_pv_reclaim(pmap_t locked_pmap) pde = pmap_pde(pmap, va); if ((*pde & PG_PS) != 0) continue; - pte = pmap_pte_quick(pmap, va); - if ((*pte & PG_W) != 0) + pte = pmap_pte(pmap, va); + tpte = *pte; + if ((tpte & PG_W) == 0) + tpte = pte_load_clear(pte); + pmap_pte_release(pte); + if ((tpte & PG_W) != 0) continue; - tpte = pte_load_clear(pte); if ((tpte & PG_G) != 0) pmap_invalidate_page(pmap, va); m = PHYS_TO_VM_PAGE(tpte & PG_FRAME); @@ -2323,7 +2326,6 @@ pmap_pv_reclaim(pmap_t locked_pmap) } } out: - sched_unpin(); TAILQ_CONCAT(&pv_chunks, &newtail, pc_lru); if (pmap != NULL) { pmap_invalidate_all(pmap); Modified: head/sys/i386/xen/pmap.c ============================================================================== --- head/sys/i386/xen/pmap.c Mon Oct 8 16:00:33 2012 (r241352) +++ head/sys/i386/xen/pmap.c Mon Oct 8 16:57:05 2012 (r241353) @@ -429,7 +429,8 @@ pmap_bootstrap(vm_paddr_t firstaddr) SYSMAP(struct msgbuf *, unused, msgbufp, atop(round_page(msgbufsize))) /* - * ptemap is used for pmap_pte_quick + * PADDR1 and PADDR2 are used by pmap_pte_quick() and pmap_pte(), + * respectively. */ SYSMAP(pt_entry_t *, PMAP1, PADDR1, 1) SYSMAP(pt_entry_t *, PMAP2, PADDR2, 1) @@ -1976,7 +1977,6 @@ pmap_pv_reclaim(pmap_t locked_pmap) pmap = NULL; free = m_pc = NULL; TAILQ_INIT(&newtail); - sched_pin(); while ((pc = TAILQ_FIRST(&pv_chunks)) != NULL && (pv_vafree == 0 || free == NULL)) { TAILQ_REMOVE(&pv_chunks, pc, pc_lru); @@ -2007,10 +2007,13 @@ pmap_pv_reclaim(pmap_t locked_pmap) bit = bsfl(inuse); pv = &pc->pc_pventry[field * 32 + bit]; va = pv->pv_va; - pte = pmap_pte_quick(pmap, va); - if ((*pte & PG_W) != 0) + pte = pmap_pte(pmap, va); + tpte = *pte; + if ((tpte & PG_W) == 0) + tpte = pte_load_clear(pte); + pmap_pte_release(pte); + if ((tpte & PG_W) != 0) continue; - tpte = pte_load_clear(pte); if ((tpte & PG_G) != 0) pmap_invalidate_page(pmap, va); m = PHYS_TO_VM_PAGE(tpte & PG_FRAME); @@ -2062,7 +2065,6 @@ pmap_pv_reclaim(pmap_t locked_pmap) } } out: - sched_unpin(); TAILQ_CONCAT(&pv_chunks, &newtail, pc_lru); if (pmap != NULL) { pmap_invalidate_all(pmap); From owner-svn-src-head@FreeBSD.ORG Mon Oct 8 17:50:40 2012 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id 636C6106566C; Mon, 8 Oct 2012 17:50:40 +0000 (UTC) (envelope-from marcel@xcllnt.net) Received: from mail.xcllnt.net (mail.xcllnt.net [70.36.220.4]) by mx1.freebsd.org (Postfix) with ESMTP id 1A0E88FC14; Mon, 8 Oct 2012 17:50:39 +0000 (UTC) Received: from sa-nc-cs-116.static.jnpr.net (natint3.juniper.net [66.129.224.36]) (authenticated bits=0) by mail.xcllnt.net (8.14.5/8.14.5) with ESMTP id q98HocJJ083517 (version=TLSv1/SSLv3 cipher=AES128-SHA bits=128 verify=NO); Mon, 8 Oct 2012 10:50:39 -0700 (PDT) (envelope-from marcel@xcllnt.net) Content-Type: text/plain; charset=us-ascii Mime-Version: 1.0 (Mac OS X Mail 6.2 \(1499\)) From: Marcel Moolenaar In-Reply-To: <20121008165228.F7997@besplex.bde.org> Date: Mon, 8 Oct 2012 10:50:33 -0700 Content-Transfer-Encoding: quoted-printable Message-Id: <965E2363-6866-4A10-A7B1-C428B3C78925@xcllnt.net> References: <201210062001.q96K16Or030755@svn.freebsd.org> <20121007161440.C7605@besplex.bde.org> <81CB9A3A-4BFF-41B2-A1F9-3721A40F6260@xcllnt.net> <20121008165228.F7997@besplex.bde.org> To: Bruce Evans X-Mailer: Apple Mail (2.1499) Cc: "svn-src-head@FreeBSD.org" , "svn-src-all@FreeBSD.org" , "src-committers@FreeBSD.org" , Simon Gerraty Subject: Re: svn commit: r241298 - in head: . gnu/usr.bin/cc/cc_int gnu/usr.bin/cc/include kerberos5 kerberos5/tools/asn1_compile kerberos5/tools/slc lib/clang/include share/mk tools/build/make_check usr.sbin/c... X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 08 Oct 2012 17:50:40 -0000 On Oct 8, 2012, at 1:08 AM, Bruce Evans wrote: > On Sun, 7 Oct 2012, Marcel Moolenaar wrote: >=20 >> On Oct 6, 2012, at 10:31 PM, Bruce Evans = wrote: >>=20 >>> On Sat, 6 Oct 2012, Marcel Moolenaar wrote: >>>=20 >>>> Log: >>>> Add support for bmake. This includes: >>>> .... >>>> Modified: head/share/mk/bsd.dep.mk >>>> = =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D >>>> --- head/share/mk/bsd.dep.mk Sat Oct 6 19:57:27 2012 = (r241297) >>>> +++ head/share/mk/bsd.dep.mk Sat Oct 6 20:01:05 2012 = (r241298) >>>> @@ -102,8 +102,8 @@ ${_YC} y.tab.h: ${_YSRC} >>>> CLEANFILES+=3D y.tab.c y.tab.h >>>> .elif !empty(YFLAGS:M-d) >>>> .for _YH in ${_YC:R}.h >>>> -.ORDER: ${_YC} ${_YH} >>>> -${_YC} ${_YH}: ${_YSRC} >>>> +${_YH}: ${_YC} >>>> +${_YC}: ${_YSRC} >>>> ${YACC} ${YFLAGS} -o ${_YC} ${.ALLSRC} >>>> SRCS+=3D ${_YH} >>>> CLEANFILES+=3D ${_YH} >>>=20 >>> This is broken. Yacc headers don't depend on generated yacc .c = files. >>> Now there is only a null rule to create the headers. One broken = case >>> is when the header somehow gets deleted. It bcomes out of date, but >>> running make to update it only runs the null rule, so it remains >>> nonexistent. >>=20 >> The problem with the old rule is that it's broken as well. The >> change attempts to fix a real parallel build problem. Your >> comment is valid though. What about the following (possibly >> white-space corrupted) patch from Simon: >=20 > What's wrong with the old rule? It uses the .ORDER directive to force > creation of the 2 generated files in sequential order, so that = parallel > builds can't happen. Since the source file is re-created when the header is created, any parallel work done with the C file is a problem. At HP, where we used clearcase & clearmake, we had to create an intermediate tarfile, the result of the yacc(1) rule and then have the .h and .c file depend on the tarfile. Each got unique created by extracting only ${.TARGET}. Roughly and loosely speaking: .tar: .y yacc and create tar file .c: .tar tar x y.tab.c .h: .tar tar x y.tab.h I think something like this is the only way to get something that's 100% correct. --=20 Marcel Moolenaar marcel@xcllnt.net From owner-svn-src-head@FreeBSD.ORG Mon Oct 8 18:33:09 2012 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id 5F0011065670; Mon, 8 Oct 2012 18:33:09 +0000 (UTC) (envelope-from kib@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 49A1E8FC14; Mon, 8 Oct 2012 18:33:09 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id q98IX90O050574; Mon, 8 Oct 2012 18:33:09 GMT (envelope-from kib@svn.freebsd.org) Received: (from kib@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q98IX9wW050572; Mon, 8 Oct 2012 18:33:09 GMT (envelope-from kib@svn.freebsd.org) Message-Id: <201210081833.q98IX9wW050572@svn.freebsd.org> From: Konstantin Belousov Date: Mon, 8 Oct 2012 18:33:09 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r241356 - head/sys/i386/i386 X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 08 Oct 2012 18:33:09 -0000 Author: kib Date: Mon Oct 8 18:33:08 2012 New Revision: 241356 URL: http://svn.freebsd.org/changeset/base/241356 Log: Add several asserts to i386 pmap, which mostly state that pv entry shall have corresponding pte. Reviewed by: alc Tested by: pho MFC after: 3 days Modified: head/sys/i386/i386/pmap.c Modified: head/sys/i386/i386/pmap.c ============================================================================== --- head/sys/i386/i386/pmap.c Mon Oct 8 17:27:54 2012 (r241355) +++ head/sys/i386/i386/pmap.c Mon Oct 8 18:33:08 2012 (r241356) @@ -2269,6 +2269,9 @@ pmap_pv_reclaim(pmap_t locked_pmap) pmap_pte_release(pte); if ((tpte & PG_W) != 0) continue; + KASSERT(tpte != 0, + ("pmap_pv_reclaim: pmap %p va %x zero pte", + pmap, va)); if ((tpte & PG_G) != 0) pmap_invalidate_page(pmap, va); m = PHYS_TO_VM_PAGE(tpte & PG_FRAME); @@ -2865,6 +2868,8 @@ pmap_remove_pte(pmap_t pmap, pt_entry_t rw_assert(&pvh_global_lock, RA_WLOCKED); PMAP_LOCK_ASSERT(pmap, MA_OWNED); oldpte = pte_load_clear(ptq); + KASSERT(oldpte != 0, + ("pmap_remove_pte: pmap %p va %x zero pte", pmap, va)); if (oldpte & PG_W) pmap->pm_stats.wired_count -= 1; /* @@ -3069,6 +3074,8 @@ small_mappings: " a 4mpage in page %p's pv list", m)); pte = pmap_pte_quick(pmap, pv->pv_va); tpte = pte_load_clear(pte); + KASSERT(tpte != 0, ("pmap_remove_all: pmap %p va %x zero pte", + pmap, pv->pv_va)); if (tpte & PG_W) pmap->pm_stats.wired_count--; if (tpte & PG_A) @@ -4368,6 +4375,8 @@ pmap_remove_pages(pmap_t pmap) PMAP_LOCK(pmap); sched_pin(); TAILQ_FOREACH_SAFE(pc, &pmap->pm_pvchunk, pc_list, npc) { + KASSERT(pc->pc_pmap == pmap, ("Wrong pmap %p %p", pmap, + pc->pc_pmap)); allfree = 1; for (field = 0; field < _NPCM; field++) { inuse = ~pc->pc_map[field] & pc_freemask[field]; From owner-svn-src-head@FreeBSD.ORG Tue Oct 9 06:29:13 2012 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id CD270C6; Tue, 9 Oct 2012 06:29:03 +0000 (UTC) (envelope-from dteske@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 9E07390308; Mon, 8 Oct 2012 23:02:35 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id q98N2ZtP084962; Mon, 8 Oct 2012 23:02:35 GMT (envelope-from dteske@svn.freebsd.org) Received: (from dteske@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q98N2ZGD084958; Mon, 8 Oct 2012 23:02:35 GMT (envelope-from dteske@svn.freebsd.org) Message-Id: <201210082302.q98N2ZGD084958@svn.freebsd.org> From: Devin Teske Date: Mon, 8 Oct 2012 23:02:35 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r241361 - head/sys/boot/forth X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 09 Oct 2012 06:29:13 -0000 Author: dteske Date: Mon Oct 8 23:02:35 2012 New Revision: 241361 URL: http://svn.freebsd.org/changeset/base/241361 Log: Add an echo to say we're "Booting..." when the overloaded "boot" Ficl word is executed to better differentiate between loader-specific errors and kernel- specific errors (if ever any of either). This type of functionality hasn't been required before the introduction of the advanced menu system (r222417). Adding this functionality will help different- iate errors at the loader-level such as a BTX halt caused by heap exhaustion and errors that may be involved with executing the kernel (wrong architecture for example). A user can learn that messages before "Booting..." are related to the loader(8) environment and it's Forth-ilk, while those after are not related to loader(8) -- the point that loader(8) has ``left the building''. This patch also includes a man-page update to color.4th(8) as the color logic moves to a lower-level (from being included by beastie.4th to being included by loader.4th). After noticing a delay between execution of the overloaded "boot" FICL word and the display of text on-screen, gcooper confirmed that the introduction of a builtin memory test (disabled by adding hw.memtest.tests="0" to loader.conf(5)) was the cause of the delay. This patch adds an echo to produce "Booting..." when the overloaded "boot" word is executed (this includes from the interactive command-prompt on all arches, from the menu system on arches that run the beastie menu, and even those arches that run the menu but disable it by setting beastie_disable="YES" in loader.conf(5)). When loader_color="YES" in loader.conf(5), the same message is produced but in white text on a blue background (only the letters produced have this background -- opposed to perhaps the entire line). Modified: head/sys/boot/forth/beastie.4th head/sys/boot/forth/color.4th.8 head/sys/boot/forth/loader.4th Modified: head/sys/boot/forth/beastie.4th ============================================================================== --- head/sys/boot/forth/beastie.4th Mon Oct 8 23:02:32 2012 (r241360) +++ head/sys/boot/forth/beastie.4th Mon Oct 8 23:02:35 2012 (r241361) @@ -28,7 +28,6 @@ marker task-beastie.4th -include /boot/color.4th include /boot/delay.4th variable logoX Modified: head/sys/boot/forth/color.4th.8 ============================================================================== --- head/sys/boot/forth/color.4th.8 Mon Oct 8 23:02:32 2012 (r241360) +++ head/sys/boot/forth/color.4th.8 Mon Oct 8 23:02:35 2012 (r241361) @@ -50,7 +50,7 @@ through the command: .Dl include color.4th .Pp This line is present in -.Pa /boot/beastie.4th +.Pa /boot/loader.4th file, so it is not needed (and should not be re-issued) in a normal setup. .Pp The commands provided by it are: @@ -102,7 +102,6 @@ loader_color="YES" .Sh SEE ALSO .Xr loader.conf 5 , .Xr loader 8 , -.Xr beastie.4th 8 , .Xr loader.4th 8 .Sh HISTORY The Modified: head/sys/boot/forth/loader.4th ============================================================================== --- head/sys/boot/forth/loader.4th Mon Oct 8 23:02:32 2012 (r241360) +++ head/sys/boot/forth/loader.4th Mon Oct 8 23:02:35 2012 (r241361) @@ -40,6 +40,7 @@ s" arch-i386" environment? [if] [if] 2048 dictincrease ! \ 2048 additional cells each time include /boot/support.4th +include /boot/color.4th only forth also support-functions also builtins definitions @@ -64,6 +65,12 @@ only forth also support-functions also b : boot 0= if ( interpreted ) get_arguments then + loader_color? if + ." Booting..." cr + else + ." Booting..." cr + then + \ Unload only if a path was passed dup if >r over r> swap From owner-svn-src-head@FreeBSD.ORG Tue Oct 9 06:29:18 2012 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id A3637571; Tue, 9 Oct 2012 06:29:18 +0000 (UTC) (envelope-from glebius@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 77469902F5; Mon, 8 Oct 2012 22:58:29 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id q98MwTw2084378; Mon, 8 Oct 2012 22:58:29 GMT (envelope-from glebius@svn.freebsd.org) Received: (from glebius@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q98MwSQG084374; Mon, 8 Oct 2012 22:58:28 GMT (envelope-from glebius@svn.freebsd.org) Message-Id: <201210082258.q98MwSQG084374@svn.freebsd.org> From: Gleb Smirnoff Date: Mon, 8 Oct 2012 22:58:28 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r241359 - head/sys/netpfil/ipfw X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 09 Oct 2012 06:29:18 -0000 Author: glebius Date: Mon Oct 8 22:58:28 2012 New Revision: 241359 URL: http://svn.freebsd.org/changeset/base/241359 Log: Catch up with r241245 and do not return packet back in host byte order. Modified: head/sys/netpfil/ipfw/ip_fw_pfil.c Modified: head/sys/netpfil/ipfw/ip_fw_pfil.c ============================================================================== --- head/sys/netpfil/ipfw/ip_fw_pfil.c Mon Oct 8 22:38:15 2012 (r241358) +++ head/sys/netpfil/ipfw/ip_fw_pfil.c Mon Oct 8 22:58:28 2012 (r241359) @@ -138,11 +138,8 @@ again: if (tag != NULL) { args.rule = *((struct ipfw_rule_ref *)(tag+1)); m_tag_delete(*m0, tag); - if (args.rule.info & IPFW_ONEPASS) { - if (mtod(*m0, struct ip *)->ip_v == 4) - SET_HOST_IPLEN(mtod(*m0, struct ip *)); + if (args.rule.info & IPFW_ONEPASS) return (0); - } } args.m = *m0; From owner-svn-src-head@FreeBSD.ORG Tue Oct 9 06:32:26 2012 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id EC81D1078; Tue, 9 Oct 2012 06:32:26 +0000 (UTC) (envelope-from kevlo@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id B91348FC1D; Tue, 9 Oct 2012 06:32:26 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id q996FGcg051580; Tue, 9 Oct 2012 06:15:16 GMT (envelope-from kevlo@svn.freebsd.org) Received: (from kevlo@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q996FGxQ051576; Tue, 9 Oct 2012 06:15:16 GMT (envelope-from kevlo@svn.freebsd.org) Message-Id: <201210090615.q996FGxQ051576@svn.freebsd.org> From: Kevin Lo Date: Tue, 9 Oct 2012 06:15:16 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r241369 - in head/sys: dev/arcmsr netgraph/netflow netpfil/ipfw X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 09 Oct 2012 06:32:27 -0000 Author: kevlo Date: Tue Oct 9 06:15:16 2012 New Revision: 241369 URL: http://svn.freebsd.org/changeset/base/241369 Log: Fix typo: s/unknow/unknown Modified: head/sys/dev/arcmsr/arcmsr.c head/sys/netgraph/netflow/ng_netflow.c head/sys/netpfil/ipfw/ip_dn_glue.c Modified: head/sys/dev/arcmsr/arcmsr.c ============================================================================== --- head/sys/dev/arcmsr/arcmsr.c Tue Oct 9 05:06:30 2012 (r241368) +++ head/sys/dev/arcmsr/arcmsr.c Tue Oct 9 06:15:16 2012 (r241369) @@ -753,11 +753,11 @@ static void arcmsr_report_srb_state(stru } break; default: - printf("arcmsr%d: scsi id=%d lun=%d isr got command error done,but got unknow DeviceStatus=0x%x \n" + printf("arcmsr%d: scsi id=%d lun=%d isr got command error done,but got unknown DeviceStatus=0x%x \n" , acb->pci_unit, target, lun ,srb->arcmsr_cdb.DeviceStatus); acb->devstate[target][lun]=ARECA_RAID_GONE; srb->pccb->ccb_h.status |= CAM_UNCOR_PARITY; - /*unknow error or crc error just for retry*/ + /*unknown error or crc error just for retry*/ arcmsr_srb_complete(srb, 1); break; } @@ -1789,7 +1789,7 @@ static void arcmsr_interrupt(struct Adap break; default: printf("arcmsr%d: interrupt service," - " unknow adapter type =%d\n", acb->pci_unit, acb->adapter_type); + " unknown adapter type =%d\n", acb->pci_unit, acb->adapter_type); break; } } Modified: head/sys/netgraph/netflow/ng_netflow.c ============================================================================== --- head/sys/netgraph/netflow/ng_netflow.c Tue Oct 9 05:06:30 2012 (r241368) +++ head/sys/netgraph/netflow/ng_netflow.c Tue Oct 9 06:15:16 2012 (r241369) @@ -832,7 +832,7 @@ ng_netflow_rcvdata (hook_p hook, item_p goto loopend; #endif /* - * Any unknow header (new extension or IPv6/IPv4 + * Any unknown header (new extension or IPv6/IPv4 * header for tunnels) ends loop. */ default: Modified: head/sys/netpfil/ipfw/ip_dn_glue.c ============================================================================== --- head/sys/netpfil/ipfw/ip_dn_glue.c Tue Oct 9 05:06:30 2012 (r241368) +++ head/sys/netpfil/ipfw/ip_dn_glue.c Tue Oct 9 06:15:16 2012 (r241369) @@ -315,10 +315,10 @@ static size_t pipesizemax8 = sizeof(stru /* Indicate 'ipfw' version * 1: from FreeBSD 7.2 * 0: from FreeBSD 8 - * -1: unknow (for now is unused) + * -1: unknown (for now is unused) * * It is update when a IP_DUMMYNET_DEL or IP_DUMMYNET_CONFIGURE request arrives - * NOTE: if a IP_DUMMYNET_GET arrives and the 'ipfw' version is unknow, + * NOTE: if a IP_DUMMYNET_GET arrives and the 'ipfw' version is unknown, * it is suppose to be the FreeBSD 8 version. */ static int is7 = 0; From owner-svn-src-head@FreeBSD.ORG Tue Oct 9 06:32:27 2012 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id 7C6DC107D; Tue, 9 Oct 2012 06:32:27 +0000 (UTC) (envelope-from dteske@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 633C48FC21; Tue, 9 Oct 2012 06:32:27 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id q993sruf026363; Tue, 9 Oct 2012 03:54:53 GMT (envelope-from dteske@svn.freebsd.org) Received: (from dteske@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q993srnT026361; Tue, 9 Oct 2012 03:54:53 GMT (envelope-from dteske@svn.freebsd.org) Message-Id: <201210090354.q993srnT026361@svn.freebsd.org> From: Devin Teske Date: Tue, 9 Oct 2012 03:54:53 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r241367 - head/sys/boot/forth X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 09 Oct 2012 06:32:27 -0000 Author: dteske Date: Tue Oct 9 03:54:53 2012 New Revision: 241367 URL: http://svn.freebsd.org/changeset/base/241367 Log: Fix a typo (s/prefix/suffix/) and comment. NOTE: This is in an unused portion of the menu framework. Reviewed by: eadler, adrian (co-mentor) Approved by: adrian (co-mentor) Modified: head/sys/boot/forth/menu-commands.4th Modified: head/sys/boot/forth/menu-commands.4th ============================================================================== --- head/sys/boot/forth/menu-commands.4th Tue Oct 9 03:41:59 2012 (r241366) +++ head/sys/boot/forth/menu-commands.4th Tue Oct 9 03:54:53 2012 (r241367) @@ -164,8 +164,8 @@ marker task-menu-commands.4th @ \ dereference address into value 48 + \ convert to ASCII numeral - s" set root=${root_prefix}${root[N]}${root_prefix}" - \ command to assemble full kernel-path + s" set root=${root_prefix}${root[N]}${root_suffix}" + \ command to assemble root image-path -rot tuck 30 + c! swap \ replace 'N' with array index value evaluate \ sets $kernel to full kernel-path From owner-svn-src-head@FreeBSD.ORG Tue Oct 9 06:32:27 2012 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id E52F91081; Tue, 9 Oct 2012 06:32:27 +0000 (UTC) (envelope-from dteske@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id CB1158FC26; Tue, 9 Oct 2012 06:32:27 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id q993BGIO019899; Tue, 9 Oct 2012 03:11:16 GMT (envelope-from dteske@svn.freebsd.org) Received: (from dteske@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q993BGGB019897; Tue, 9 Oct 2012 03:11:16 GMT (envelope-from dteske@svn.freebsd.org) Message-Id: <201210090311.q993BGGB019897@svn.freebsd.org> From: Devin Teske Date: Tue, 9 Oct 2012 03:11:16 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r241365 - head/sys/boot/forth X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 09 Oct 2012 06:32:28 -0000 Author: dteske Date: Tue Oct 9 03:11:15 2012 New Revision: 241365 URL: http://svn.freebsd.org/changeset/base/241365 Log: Fix an oversight that cyclic menu items actually are zero-based and can accommodate 10 different states. Reviewed by: eadler, adrian (co-mentor) Approved by: adrian (co-mentor) Modified: head/sys/boot/forth/menu.4th Modified: head/sys/boot/forth/menu.4th ============================================================================== --- head/sys/boot/forth/menu.4th Tue Oct 9 02:52:56 2012 (r241364) +++ head/sys/boot/forth/menu.4th Tue Oct 9 03:11:15 2012 (r241365) @@ -935,23 +935,23 @@ create init_text8 255 allot s" menu_caption[x][y]" \ cycle_menuitem caption -rot 2dup 13 + c! rot \ replace 'x' - 49 -rot + 48 -rot begin 16 2over rot + c! \ replace 'y' 2dup unsetenv - rot 1+ dup 56 > 2swap rot + rot 1+ dup 57 > 2swap rot until 2drop drop s" ansi_caption[x][y]" \ cycle_menuitem ANSI caption -rot 2dup 13 + c! rot \ replace 'x' - 49 -rot + 48 -rot begin 16 2over rot + c! \ replace 'y' 2dup unsetenv - rot 1+ dup 56 > 2swap rot + rot 1+ dup 57 > 2swap rot until 2drop drop From owner-svn-src-head@FreeBSD.ORG Tue Oct 9 12:22:44 2012 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id A5A6B154; Tue, 9 Oct 2012 12:22:44 +0000 (UTC) (envelope-from attilio@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 8AD458FC16; Tue, 9 Oct 2012 12:22:44 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id q99CMiNL003876; Tue, 9 Oct 2012 12:22:44 GMT (envelope-from attilio@svn.freebsd.org) Received: (from attilio@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q99CMixu003864; Tue, 9 Oct 2012 12:22:44 GMT (envelope-from attilio@svn.freebsd.org) Message-Id: <201210091222.q99CMixu003864@svn.freebsd.org> From: Attilio Rao Date: Tue, 9 Oct 2012 12:22:44 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r241371 - in head/sys: amd64/amd64 amd64/include i386/i386 i386/include pc98/pc98 sparc64/include sparc64/sparc64 x86/x86 X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 09 Oct 2012 12:22:44 -0000 Author: attilio Date: Tue Oct 9 12:22:43 2012 New Revision: 241371 URL: http://svn.freebsd.org/changeset/base/241371 Log: Reverts r234074,234105,234564,234723,234989,235231-235232 and part of r234247. Use, instead, the static intializer introduced in r239923 for x86 and sparc64 intr_cpus, unwinding the code to the initial version. Reviewed by: marius Modified: head/sys/amd64/amd64/machdep.c head/sys/amd64/amd64/mp_machdep.c head/sys/amd64/include/intr_machdep.h head/sys/i386/i386/machdep.c head/sys/i386/i386/mp_machdep.c head/sys/i386/include/intr_machdep.h head/sys/pc98/pc98/machdep.c head/sys/sparc64/include/intr_machdep.h head/sys/sparc64/sparc64/intr_machdep.c head/sys/sparc64/sparc64/machdep.c head/sys/x86/x86/intr_machdep.c Modified: head/sys/amd64/amd64/machdep.c ============================================================================== --- head/sys/amd64/amd64/machdep.c Tue Oct 9 08:27:40 2012 (r241370) +++ head/sys/amd64/amd64/machdep.c Tue Oct 9 12:22:43 2012 (r241371) @@ -298,11 +298,6 @@ cpu_startup(dummy) vm_pager_bufferinit(); cpu_setregs(); - - /* - * Add BSP as an interrupt target. - */ - intr_add_cpu(0); } /* Modified: head/sys/amd64/amd64/mp_machdep.c ============================================================================== --- head/sys/amd64/amd64/mp_machdep.c Tue Oct 9 08:27:40 2012 (r241370) +++ head/sys/amd64/amd64/mp_machdep.c Tue Oct 9 12:22:43 2012 (r241371) @@ -784,6 +784,8 @@ init_secondary(void) * We tell the I/O APIC code about all the CPUs we want to receive * interrupts. If we don't want certain CPUs to receive IRQs we * can simply not tell the I/O APIC code about them in this function. + * We also do not tell it about the BSP since it tells itself about + * the BSP internally to work with UP kernels and on UP machines. */ static void set_interrupt_apic_ids(void) @@ -794,6 +796,8 @@ set_interrupt_apic_ids(void) apic_id = cpu_apic_ids[i]; if (apic_id == -1) continue; + if (cpu_info[apic_id].cpu_bsp) + continue; if (cpu_info[apic_id].cpu_disabled) continue; Modified: head/sys/amd64/include/intr_machdep.h ============================================================================== --- head/sys/amd64/include/intr_machdep.h Tue Oct 9 08:27:40 2012 (r241370) +++ head/sys/amd64/include/intr_machdep.h Tue Oct 9 12:22:43 2012 (r241371) @@ -140,7 +140,9 @@ int elcr_probe(void); enum intr_trigger elcr_read_trigger(u_int irq); void elcr_resume(void); void elcr_write_trigger(u_int irq, enum intr_trigger trigger); +#ifdef SMP void intr_add_cpu(u_int cpu); +#endif int intr_add_handler(const char *name, int vector, driver_filter_t filter, driver_intr_t handler, void *arg, enum intr_type flags, void **cookiep); Modified: head/sys/i386/i386/machdep.c ============================================================================== --- head/sys/i386/i386/machdep.c Tue Oct 9 08:27:40 2012 (r241370) +++ head/sys/i386/i386/machdep.c Tue Oct 9 12:22:43 2012 (r241371) @@ -338,11 +338,6 @@ cpu_startup(dummy) #ifndef XEN cpu_setregs(); #endif - - /* - * Add BSP as an interrupt target. - */ - intr_add_cpu(0); } /* Modified: head/sys/i386/i386/mp_machdep.c ============================================================================== --- head/sys/i386/i386/mp_machdep.c Tue Oct 9 08:27:40 2012 (r241370) +++ head/sys/i386/i386/mp_machdep.c Tue Oct 9 12:22:43 2012 (r241371) @@ -823,6 +823,8 @@ init_secondary(void) * We tell the I/O APIC code about all the CPUs we want to receive * interrupts. If we don't want certain CPUs to receive IRQs we * can simply not tell the I/O APIC code about them in this function. + * We also do not tell it about the BSP since it tells itself about + * the BSP internally to work with UP kernels and on UP machines. */ static void set_interrupt_apic_ids(void) @@ -833,6 +835,8 @@ set_interrupt_apic_ids(void) apic_id = cpu_apic_ids[i]; if (apic_id == -1) continue; + if (cpu_info[apic_id].cpu_bsp) + continue; if (cpu_info[apic_id].cpu_disabled) continue; Modified: head/sys/i386/include/intr_machdep.h ============================================================================== --- head/sys/i386/include/intr_machdep.h Tue Oct 9 08:27:40 2012 (r241370) +++ head/sys/i386/include/intr_machdep.h Tue Oct 9 12:22:43 2012 (r241371) @@ -131,7 +131,9 @@ int elcr_probe(void); enum intr_trigger elcr_read_trigger(u_int irq); void elcr_resume(void); void elcr_write_trigger(u_int irq, enum intr_trigger trigger); +#ifdef SMP void intr_add_cpu(u_int cpu); +#endif int intr_add_handler(const char *name, int vector, driver_filter_t filter, driver_intr_t handler, void *arg, enum intr_type flags, void **cookiep); #ifdef SMP Modified: head/sys/pc98/pc98/machdep.c ============================================================================== --- head/sys/pc98/pc98/machdep.c Tue Oct 9 08:27:40 2012 (r241370) +++ head/sys/pc98/pc98/machdep.c Tue Oct 9 12:22:43 2012 (r241371) @@ -273,11 +273,6 @@ cpu_startup(dummy) bufinit(); vm_pager_bufferinit(); cpu_setregs(); - - /* - * Add BSP as an interrupt target. - */ - intr_add_cpu(0); } /* Modified: head/sys/sparc64/include/intr_machdep.h ============================================================================== --- head/sys/sparc64/include/intr_machdep.h Tue Oct 9 08:27:40 2012 (r241370) +++ head/sys/sparc64/include/intr_machdep.h Tue Oct 9 12:22:43 2012 (r241371) @@ -91,10 +91,10 @@ struct intr_vector { extern ih_func_t *intr_handlers[]; extern struct intr_vector intr_vectors[]; -void intr_add_cpu(u_int cpu); #ifdef SMP -int intr_bind(int vec, u_char cpu); +void intr_add_cpu(u_int cpu); #endif +int intr_bind(int vec, u_char cpu); int intr_describe(int vec, void *ih, const char *descr); void intr_setup(int level, ih_func_t *ihf, int pri, iv_func_t *ivf, void *iva); Modified: head/sys/sparc64/sparc64/intr_machdep.c ============================================================================== --- head/sys/sparc64/sparc64/intr_machdep.c Tue Oct 9 08:27:40 2012 (r241370) +++ head/sys/sparc64/sparc64/intr_machdep.c Tue Oct 9 12:22:43 2012 (r241371) @@ -456,7 +456,7 @@ intr_describe(int vec, void *ih, const c * allocate CPUs round-robin. */ -static cpuset_t intr_cpus; +static cpuset_t intr_cpus = CPUSET_T_INITIALIZER(0x1); static int current_cpu; static void @@ -554,11 +554,4 @@ intr_shuffle_irqs(void *arg __unused) } SYSINIT(intr_shuffle_irqs, SI_SUB_SMP, SI_ORDER_SECOND, intr_shuffle_irqs, NULL); -#else /* !SMP */ -/* Use an empty stub for compatibility. */ -void -intr_add_cpu(u_int cpu __unused) -{ - -} #endif Modified: head/sys/sparc64/sparc64/machdep.c ============================================================================== --- head/sys/sparc64/sparc64/machdep.c Tue Oct 9 08:27:40 2012 (r241370) +++ head/sys/sparc64/sparc64/machdep.c Tue Oct 9 12:22:43 2012 (r241371) @@ -196,11 +196,6 @@ cpu_startup(void *arg) printf("machine: %s\n", sparc64_model); cpu_identify(rdpr(ver), PCPU_GET(clock), curcpu); - - /* - * Add BSP as an interrupt target. - */ - intr_add_cpu(0); } void Modified: head/sys/x86/x86/intr_machdep.c ============================================================================== --- head/sys/x86/x86/intr_machdep.c Tue Oct 9 08:27:40 2012 (r241370) +++ head/sys/x86/x86/intr_machdep.c Tue Oct 9 12:22:43 2012 (r241371) @@ -452,7 +452,7 @@ DB_SHOW_COMMAND(irqs, db_show_irqs) * allocate CPUs round-robin. */ -static cpuset_t intr_cpus; +static cpuset_t intr_cpus = CPUSET_T_INITIALIZER(0x1); static int current_cpu; /* @@ -565,11 +565,4 @@ intr_next_cpu(void) return (PCPU_GET(apic_id)); } - -/* Use an empty stub for compatibility. */ -void -intr_add_cpu(u_int cpu __unused) -{ - -} #endif From owner-svn-src-head@FreeBSD.ORG Tue Oct 9 14:25:15 2012 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id 9594CCE2; Tue, 9 Oct 2012 14:25:15 +0000 (UTC) (envelope-from eadler@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 7D8768FC18; Tue, 9 Oct 2012 14:25:15 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id q99EPFJT020790; Tue, 9 Oct 2012 14:25:15 GMT (envelope-from eadler@svn.freebsd.org) Received: (from eadler@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q99EPFS6020787; Tue, 9 Oct 2012 14:25:15 GMT (envelope-from eadler@svn.freebsd.org) Message-Id: <201210091425.q99EPFS6020787@svn.freebsd.org> From: Eitan Adler Date: Tue, 9 Oct 2012 14:25:15 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r241373 - head/lib/libc/stdlib X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 09 Oct 2012 14:25:15 -0000 Author: eadler Date: Tue Oct 9 14:25:14 2012 New Revision: 241373 URL: http://svn.freebsd.org/changeset/base/241373 Log: Remove undefined behavior from sranddev() and srandomdev(). This doesn't actually work with any modern C compiler: In particular, both clang and modern gcc verisons silently elide any xor operation with 'junk'. Approved by: secteam MFC after: 3 days Modified: head/lib/libc/stdlib/rand.c head/lib/libc/stdlib/random.c Modified: head/lib/libc/stdlib/rand.c ============================================================================== --- head/lib/libc/stdlib/rand.c Tue Oct 9 13:21:08 2012 (r241372) +++ head/lib/libc/stdlib/rand.c Tue Oct 9 14:25:14 2012 (r241373) @@ -130,10 +130,9 @@ sranddev() if (!done) { struct timeval tv; - unsigned long junk; gettimeofday(&tv, NULL); - srand((getpid() << 16) ^ tv.tv_sec ^ tv.tv_usec ^ junk); + srand((getpid() << 16) ^ tv.tv_sec ^ tv.tv_usec); } } Modified: head/lib/libc/stdlib/random.c ============================================================================== --- head/lib/libc/stdlib/random.c Tue Oct 9 13:21:08 2012 (r241372) +++ head/lib/libc/stdlib/random.c Tue Oct 9 14:25:14 2012 (r241373) @@ -312,10 +312,9 @@ srandomdev(void) if (!done) { struct timeval tv; - volatile unsigned long junk; gettimeofday(&tv, NULL); - srandom((getpid() << 16) ^ tv.tv_sec ^ tv.tv_usec ^ junk); + srandom((getpid() << 16) ^ tv.tv_sec ^ tv.tv_usec); return; } From owner-svn-src-head@FreeBSD.ORG Tue Oct 9 14:32:31 2012 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id B7F74FF4; Tue, 9 Oct 2012 14:32:31 +0000 (UTC) (envelope-from attilio@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 9CA6E8FC0A; Tue, 9 Oct 2012 14:32:31 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id q99EWV9j021738; Tue, 9 Oct 2012 14:32:31 GMT (envelope-from attilio@svn.freebsd.org) Received: (from attilio@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q99EWVQm021726; Tue, 9 Oct 2012 14:32:31 GMT (envelope-from attilio@svn.freebsd.org) Message-Id: <201210091432.q99EWVQm021726@svn.freebsd.org> From: Attilio Rao Date: Tue, 9 Oct 2012 14:32:31 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r241374 - in head/sys: amd64/include gnu/fs/xfs/FreeBSD i386/include kern mips/include pc98/include sparc64/include sys x86/include X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 09 Oct 2012 14:32:31 -0000 Author: attilio Date: Tue Oct 9 14:32:30 2012 New Revision: 241374 URL: http://svn.freebsd.org/changeset/base/241374 Log: Add an unified macro to deny ability from the compiler to reorder instruction loads/stores at its will. The macro __compiler_membar() is currently supported for both gcc and clang, but kernel compilation will fail otherwise. Reviewed by: bde, kib Discussed with: dim, theraven MFC after: 2 weeks Modified: head/sys/amd64/include/atomic.h head/sys/gnu/fs/xfs/FreeBSD/xfs_compat.h head/sys/gnu/fs/xfs/FreeBSD/xfs_freebsd.h head/sys/i386/include/atomic.h head/sys/kern/kern_rmlock.c head/sys/mips/include/cpufunc.h head/sys/pc98/include/bus.h head/sys/sparc64/include/atomic.h head/sys/sys/cdefs.h head/sys/x86/include/bus.h Modified: head/sys/amd64/include/atomic.h ============================================================================== --- head/sys/amd64/include/atomic.h Tue Oct 9 14:25:14 2012 (r241373) +++ head/sys/amd64/include/atomic.h Tue Oct 9 14:32:30 2012 (r241374) @@ -226,7 +226,7 @@ atomic_fetchadd_long(volatile u_long *p, static __inline void \ atomic_store_rel_##TYPE(volatile u_##TYPE *p, u_##TYPE v)\ { \ - __asm __volatile("" : : : "memory"); \ + __compiler_membar(); \ *p = v; \ } \ struct __hack @@ -240,7 +240,7 @@ atomic_load_acq_##TYPE(volatile u_##TYPE u_##TYPE tmp; \ \ tmp = *p; \ - __asm __volatile("" : : : "memory"); \ + __compiler_membar(); \ return (tmp); \ } \ struct __hack Modified: head/sys/gnu/fs/xfs/FreeBSD/xfs_compat.h ============================================================================== --- head/sys/gnu/fs/xfs/FreeBSD/xfs_compat.h Tue Oct 9 14:25:14 2012 (r241373) +++ head/sys/gnu/fs/xfs/FreeBSD/xfs_compat.h Tue Oct 9 14:32:30 2012 (r241374) @@ -129,10 +129,6 @@ typedef dev_t os_dev_t; #define copy_from_user(dst, src, len) copyin((src), (dst), (len)) #endif -#ifndef barrier -#define barrier() __asm__ __volatile__("": : :"memory") -#endif - /* * Map simple global vairables to FreeBSD kernel equivalents */ Modified: head/sys/gnu/fs/xfs/FreeBSD/xfs_freebsd.h ============================================================================== --- head/sys/gnu/fs/xfs/FreeBSD/xfs_freebsd.h Tue Oct 9 14:25:14 2012 (r241373) +++ head/sys/gnu/fs/xfs/FreeBSD/xfs_freebsd.h Tue Oct 9 14:32:30 2012 (r241374) @@ -162,7 +162,7 @@ */ #define EFSCORRUPTED 990 /* Filesystem is corrupted */ -#define SYNCHRONIZE() barrier() +#define SYNCHRONIZE() __compiler_membar() #define __return_address __builtin_return_address(0) /* Modified: head/sys/i386/include/atomic.h ============================================================================== --- head/sys/i386/include/atomic.h Tue Oct 9 14:25:14 2012 (r241373) +++ head/sys/i386/include/atomic.h Tue Oct 9 14:32:30 2012 (r241374) @@ -296,7 +296,7 @@ atomic_fetchadd_int(volatile u_int *p, u static __inline void \ atomic_store_rel_##TYPE(volatile u_##TYPE *p, u_##TYPE v)\ { \ - __asm __volatile("" : : : "memory"); \ + __compiler_membar(); \ *p = v; \ } \ struct __hack @@ -310,7 +310,7 @@ atomic_load_acq_##TYPE(volatile u_##TYPE u_##TYPE tmp; \ \ tmp = *p; \ - __asm __volatile("" : : : "memory"); \ + __compiler_membar(); \ return (tmp); \ } \ struct __hack Modified: head/sys/kern/kern_rmlock.c ============================================================================== --- head/sys/kern/kern_rmlock.c Tue Oct 9 14:25:14 2012 (r241373) +++ head/sys/kern/kern_rmlock.c Tue Oct 9 14:32:30 2012 (r241374) @@ -65,10 +65,6 @@ __FBSDID("$FreeBSD$"); * does not seem very useful */ -static __inline void compiler_memory_barrier(void) { - __asm __volatile("":::"memory"); -} - static void assert_rm(const struct lock_object *lock, int what); static void lock_rm(struct lock_object *lock, int how); #ifdef KDTRACE_HOOKS @@ -353,7 +349,7 @@ _rm_rlock(struct rmlock *rm, struct rm_p td->td_critnest++; /* critical_enter(); */ - compiler_memory_barrier(); + __compiler_membar(); pc = cpuid_to_pcpu[td->td_oncpu]; /* pcpu_find(td->td_oncpu); */ @@ -361,7 +357,7 @@ _rm_rlock(struct rmlock *rm, struct rm_p sched_pin(); - compiler_memory_barrier(); + __compiler_membar(); td->td_critnest--; Modified: head/sys/mips/include/cpufunc.h ============================================================================== --- head/sys/mips/include/cpufunc.h Tue Oct 9 14:25:14 2012 (r241373) +++ head/sys/mips/include/cpufunc.h Tue Oct 9 14:32:30 2012 (r241374) @@ -70,7 +70,7 @@ static __inline void mips_barrier(void) { #if defined(CPU_CNMIPS) || defined(CPU_RMI) || defined(CPU_NLM) - __asm __volatile("" : : : "memory"); + __compiler_membar(); #else __asm __volatile (".set noreorder\n\t" "nop\n\t" Modified: head/sys/pc98/include/bus.h ============================================================================== --- head/sys/pc98/include/bus.h Tue Oct 9 14:25:14 2012 (r241373) +++ head/sys/pc98/include/bus.h Tue Oct 9 14:32:30 2012 (r241374) @@ -593,7 +593,7 @@ bus_space_barrier(bus_space_tag_t tag, b if (flags & BUS_SPACE_BARRIER_READ) __asm __volatile("lock; addl $0,0(%%esp)" : : : "memory"); else - __asm __volatile("" : : : "memory"); + __compiler_membar(); } #ifdef BUS_SPACE_NO_LEGACY Modified: head/sys/sparc64/include/atomic.h ============================================================================== --- head/sys/sparc64/include/atomic.h Tue Oct 9 14:25:14 2012 (r241373) +++ head/sys/sparc64/include/atomic.h Tue Oct 9 14:32:30 2012 (r241374) @@ -97,7 +97,7 @@ #define atomic_cas_acq(p, e, s, sz) ({ \ itype(sz) v; \ v = atomic_cas((p), (e), (s), sz); \ - __asm __volatile("" : : : "memory"); \ + __compiler_membar(); \ v; \ }) @@ -122,7 +122,7 @@ #define atomic_op_acq(p, op, v, sz) ({ \ itype(sz) t; \ t = atomic_op((p), op, (v), sz); \ - __asm __volatile("" : : : "memory"); \ + __compiler_membar(); \ t; \ }) @@ -139,7 +139,7 @@ #define atomic_load_acq(p, sz) ({ \ itype(sz) v; \ v = atomic_load((p), sz); \ - __asm __volatile("" : : : "memory"); \ + __compiler_membar(); \ v; \ }) Modified: head/sys/sys/cdefs.h ============================================================================== --- head/sys/sys/cdefs.h Tue Oct 9 14:25:14 2012 (r241373) +++ head/sys/sys/cdefs.h Tue Oct 9 14:32:30 2012 (r241374) @@ -82,6 +82,13 @@ # define __GNUC_VA_LIST_COMPATIBILITY 1 #endif +/* + * Compiler memory barriers, specific to gcc and clang. + */ +#if defined(__GNUC__) +#define __compiler_membar() __asm __volatile(" " : : : "memory") +#endif + #ifndef __INTEL_COMPILER # define __GNUCLIKE_BUILTIN_NEXT_ARG 1 # define __GNUCLIKE_MATH_BUILTIN_RELOPS Modified: head/sys/x86/include/bus.h ============================================================================== --- head/sys/x86/include/bus.h Tue Oct 9 14:25:14 2012 (r241373) +++ head/sys/x86/include/bus.h Tue Oct 9 14:32:30 2012 (r241374) @@ -1014,7 +1014,7 @@ bus_space_barrier(bus_space_tag_t tag __ __asm __volatile("lock; addl $0,0(%%esp)" : : : "memory"); #endif else - __asm __volatile("" : : : "memory"); + __compiler_membar(); #endif } From owner-svn-src-head@FreeBSD.ORG Tue Oct 9 16:09:43 2012 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id 87549465; Tue, 9 Oct 2012 16:09:43 +0000 (UTC) (envelope-from rpaulo@FreeBSD.org) Received: from felyko.com (unknown [IPv6:2607:f2f8:a528::3:1337:ca7]) by mx1.freebsd.org (Postfix) with ESMTP id 435438FC0A; Tue, 9 Oct 2012 16:09:43 +0000 (UTC) Received: from [IPv6:2601:9:4d00:85:31ca:3bc6:fc9c:e577] (unknown [IPv6:2601:9:4d00:85:31ca:3bc6:fc9c:e577]) (using TLSv1 with cipher AES128-SHA (128/128 bits)) (No client certificate requested) by felyko.com (Postfix) with ESMTPSA id 3470439828; Tue, 9 Oct 2012 09:09:36 -0700 (PDT) Content-Type: text/plain; charset=us-ascii Mime-Version: 1.0 (Mac OS X Mail 6.2 \(1499\)) Subject: Re: svn commit: r241370 - in head: share/examples/kld/dyn_sysctl share/examples/kld/firmware/fwconsumer share/man/man9 sys/amd64/linux32 sys/cddl/contrib/opensolaris/uts/common/fs/zfs sys/compat/svr4 s... From: Rui Paulo In-Reply-To: <201210090827.q998Rfbw069843@svn.freebsd.org> Date: Tue, 9 Oct 2012 09:09:35 -0700 Content-Transfer-Encoding: quoted-printable Message-Id: References: <201210090827.q998Rfbw069843@svn.freebsd.org> To: Kevin Lo X-Mailer: Apple Mail (2.1499) Cc: svn-src-head@freebsd.org, svn-src-all@freebsd.org, src-committers@freebsd.org X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 09 Oct 2012 16:09:43 -0000 On 9 Oct 2012, at 01:27, Kevin Lo wrote: > Author: kevlo > Date: Tue Oct 9 08:27:40 2012 > New Revision: 241370 > URL: http://svn.freebsd.org/changeset/base/241370 >=20 > Log: > Prefer NULL over 0 for pointers Very dubious benefit and no one review this...? Did you even check if the MD5/SHA-1 checksum of the affected files did = not change after your modifications? -- Rui Paulo From owner-svn-src-head@FreeBSD.ORG Tue Oct 9 16:33:39 2012 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id 4E3D9DCF for ; Tue, 9 Oct 2012 16:33:39 +0000 (UTC) (envelope-from ache@vniz.net) Received: from mail-la0-f54.google.com (mail-la0-f54.google.com [209.85.215.54]) by mx1.freebsd.org (Postfix) with ESMTP id 5E6788FC1A for ; Tue, 9 Oct 2012 16:33:37 +0000 (UTC) Received: by mail-la0-f54.google.com with SMTP id e12so3837049lag.13 for ; Tue, 09 Oct 2012 09:33:36 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20120113; h=sender:message-id:disposition-notification-to:date:from:user-agent :mime-version:to:cc:subject:references:in-reply-to:openpgp :content-type:content-transfer-encoding:x-gm-message-state; bh=7E7OarEG0pKxEk5veo8pPVkb9NIFp9mdnpFrlTCcMQw=; b=N4zFL5C37Y+gsPkUV8nFayy+YLBorg0QnnA6fhkMgPEqYVumLWRbEetEeWfqONfWmQ IV2pgiFyKBo+fu7eMp9yn/56BzxloX3CTeKGkNqC9v8f+Uj/uFRvuvOLthTRjntyUabk RMwiyVbsOSF0L756XYtYADj0Q2j/e/rNCZvj8N8M6VctGx5EfgJawEVWvW4k/RTAnT9u RPA/1PLAKRekhxTdD9F+ER7LSOr/z4HAOoGtA/ZunI036669jawr/UdTt35976poLwcn dlsV+dKsjJgaJU3gQwEIiAqVBnryxikOuMDUkEZdLc0t3jlNdKSKmd3FOANbeNR0zpFx Ws2A== Received: by 10.152.132.168 with SMTP id ov8mr17273806lab.0.1349800416762; Tue, 09 Oct 2012 09:33:36 -0700 (PDT) Received: from [192.168.1.2] ([89.169.140.97]) by mx.google.com with ESMTPS id h8sm6159426lbk.0.2012.10.09.09.33.36 (version=SSLv3 cipher=OTHER); Tue, 09 Oct 2012 09:33:36 -0700 (PDT) Sender: "Chernov, Andrey" Message-ID: <507451DE.9060909@freebsd.org> Date: Tue, 09 Oct 2012 20:33:34 +0400 From: Andrey Chernov User-Agent: Mozilla/5.0 (Windows NT 6.1; WOW64; rv:15.0) Gecko/20120907 Thunderbird/15.0.1 MIME-Version: 1.0 To: Eitan Adler Subject: Re: svn commit: r241373 - head/lib/libc/stdlib References: <201210091425.q99EPFS6020787@svn.freebsd.org> In-Reply-To: <201210091425.q99EPFS6020787@svn.freebsd.org> OpenPGP: id=964474DD Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit X-Gm-Message-State: ALoCoQnmWqO4BACyYZME+VOHQG8yPrb5jkRSZsyKIcj8UZpeYCaVfAv/ed6hVTMU93NuEO6zI1Kc Cc: svn-src-head@freebsd.org, svn-src-all@freebsd.org, src-committers@freebsd.org X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 09 Oct 2012 16:33:39 -0000 Do you check assembler output for _both_ cases? In my testing clang and gcc xor's 'junk' properly in case it have 'volatile' keyword (as in srandomdev()) and elide it without 'volatile'. IMHO this change should be backed out for srandomdev() and adding 'volatile' for sranddev() instead. On 09.10.2012 18:25, Eitan Adler wrote: > Author: eadler > Date: Tue Oct 9 14:25:14 2012 > New Revision: 241373 > URL: http://svn.freebsd.org/changeset/base/241373 > > Log: > Remove undefined behavior from sranddev() and > srandomdev(). This doesn't actually work > with any modern C compiler: > > In particular, both clang and modern gcc > verisons silently elide any xor operation > with 'junk'. > > Approved by: secteam > MFC after: 3 days > > Modified: > head/lib/libc/stdlib/rand.c > head/lib/libc/stdlib/random.c > > Modified: head/lib/libc/stdlib/rand.c > ============================================================================== > --- head/lib/libc/stdlib/rand.c Tue Oct 9 13:21:08 2012 (r241372) > +++ head/lib/libc/stdlib/rand.c Tue Oct 9 14:25:14 2012 (r241373) > @@ -130,10 +130,9 @@ sranddev() > > if (!done) { > struct timeval tv; > - unsigned long junk; > > gettimeofday(&tv, NULL); > - srand((getpid() << 16) ^ tv.tv_sec ^ tv.tv_usec ^ junk); > + srand((getpid() << 16) ^ tv.tv_sec ^ tv.tv_usec); > } > } > > > Modified: head/lib/libc/stdlib/random.c > ============================================================================== > --- head/lib/libc/stdlib/random.c Tue Oct 9 13:21:08 2012 (r241372) > +++ head/lib/libc/stdlib/random.c Tue Oct 9 14:25:14 2012 (r241373) > @@ -312,10 +312,9 @@ srandomdev(void) > > if (!done) { > struct timeval tv; > - volatile unsigned long junk; > > gettimeofday(&tv, NULL); > - srandom((getpid() << 16) ^ tv.tv_sec ^ tv.tv_usec ^ junk); > + srandom((getpid() << 16) ^ tv.tv_sec ^ tv.tv_usec); > return; > } > > From owner-svn-src-head@FreeBSD.ORG Tue Oct 9 17:06:33 2012 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id 890496E2; Tue, 9 Oct 2012 17:06:33 +0000 (UTC) (envelope-from mav@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 722DF8FC0A; Tue, 9 Oct 2012 17:06:33 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id q99H6X4l041476; Tue, 9 Oct 2012 17:06:33 GMT (envelope-from mav@svn.freebsd.org) Received: (from mav@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q99H6XEG041469; Tue, 9 Oct 2012 17:06:33 GMT (envelope-from mav@svn.freebsd.org) Message-Id: <201210091706.q99H6XEG041469@svn.freebsd.org> From: Alexander Motin Date: Tue, 9 Oct 2012 17:06:32 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r241375 - head/sys/dev/sound/pci/hda X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 09 Oct 2012 17:06:33 -0000 Author: mav Date: Tue Oct 9 17:06:31 2012 New Revision: 241375 URL: http://svn.freebsd.org/changeset/base/241375 Log: Cast vendor-specific spell on VIA VT1818S codecs alike to VT1708S to make analog input loopback and dual-stream playback work by enabling signal mixing by nid 22, as it should be according to info returned by the CODEC. Otherwise pin nid 28 receives only signal from DAC nid 16. PR: kern/169124 MFC after: 1 week Modified: head/sys/dev/sound/pci/hda/hdaa_patches.c Modified: head/sys/dev/sound/pci/hda/hdaa_patches.c ============================================================================== --- head/sys/dev/sound/pci/hda/hdaa_patches.c Tue Oct 9 14:32:30 2012 (r241374) +++ head/sys/dev/sound/pci/hda/hdaa_patches.c Tue Oct 9 17:06:31 2012 (r241375) @@ -608,6 +608,8 @@ hdaa_patch_direct(struct hdaa_devinfo *d /* Enable Mic Boost Volume controls. */ hda_command(dev, HDA_CMD_12BIT(0, devinfo->nid, 0xf98, 0x01)); + /* Fall though */ + case HDA_CODEC_VT1818S: /* Don't bypass mixer. */ hda_command(dev, HDA_CMD_12BIT(0, devinfo->nid, 0xf88, 0xc0)); From owner-svn-src-head@FreeBSD.ORG Tue Oct 9 17:17:02 2012 Return-Path: Delivered-To: svn-src-head@FreeBSD.org Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id 1B0FF937; Tue, 9 Oct 2012 17:17:02 +0000 (UTC) (envelope-from theraven@FreeBSD.org) Received: from theravensnest.org (theraven.freebsd.your.org [216.14.102.27]) by mx1.freebsd.org (Postfix) with ESMTP id CB85A8FC0A; Tue, 9 Oct 2012 17:17:01 +0000 (UTC) Received: from [192.168.0.2] (cpc2-cmbg15-2-0-cust445.5-4.cable.virginmedia.com [86.26.13.190]) (authenticated bits=0) by theravensnest.org (8.14.5/8.14.5) with ESMTP id q99HGrDk003024 (version=TLSv1/SSLv3 cipher=DHE-DSS-AES128-SHA bits=128 verify=NO); Tue, 9 Oct 2012 17:16:59 GMT (envelope-from theraven@FreeBSD.org) Subject: Re: svn commit: r241373 - head/lib/libc/stdlib Mime-Version: 1.0 (Apple Message framework v1278) Content-Type: text/plain; charset=us-ascii From: David Chisnall In-Reply-To: <507451DE.9060909@freebsd.org> Date: Tue, 9 Oct 2012 18:16:48 +0100 Content-Transfer-Encoding: quoted-printable Message-Id: <977E1107-46D4-476F-A04D-AEFD87D1DE53@FreeBSD.org> References: <201210091425.q99EPFS6020787@svn.freebsd.org> <507451DE.9060909@freebsd.org> To: Andrey Chernov X-Mailer: Apple Mail (2.1278) Cc: svn-src-head@FreeBSD.org, svn-src-all@FreeBSD.org, src-committers@FreeBSD.org, Eitan Adler X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 09 Oct 2012 17:17:02 -0000 On 9 Oct 2012, at 17:33, Andrey Chernov wrote: > Do you check assembler output for _both_ cases? > In my testing clang and gcc xor's 'junk' properly in case it have > 'volatile' keyword (as in srandomdev()) and elide it without = 'volatile'. > IMHO this change should be backed out for srandomdev() and adding > 'volatile' for sranddev() instead. In it's original form, it is very dangerous - the whole expression = reduces to undefined and so the LLVM IR for the call is: call void @srand(i32 undef) The back end is then free to use any value for the call argument, = including any register value or 0. Since the value is passed in a = register, it will probably just use whatever the last value there is, = which may or may not be anything sensible. On MIPS, for example, this = is most likely to be &tv, and so is 100% deterministic. Adding the volatile means that we are doing an XOR with a value left on = the stack. If this is early on in the application, then it is most = likely to be 0. If it's later on, then there may be a value here, but = it's still not very likely to be something particularly unpredictable. =20= David= From owner-svn-src-head@FreeBSD.ORG Tue Oct 9 17:27:28 2012 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id 166B8DB3; Tue, 9 Oct 2012 17:27:28 +0000 (UTC) (envelope-from mdf356@gmail.com) Received: from mail-pb0-f54.google.com (mail-pb0-f54.google.com [209.85.160.54]) by mx1.freebsd.org (Postfix) with ESMTP id 65AFE8FC0C; Tue, 9 Oct 2012 17:27:27 +0000 (UTC) Received: by mail-pb0-f54.google.com with SMTP id rp8so6061994pbb.13 for ; Tue, 09 Oct 2012 10:27:27 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:sender:in-reply-to:references:date :x-google-sender-auth:message-id:subject:from:to:cc:content-type :content-transfer-encoding; bh=7KmQktE6dOBy9XPMk1iqSeshPsfweNF+4vOFZk3w85o=; b=Z8T3QEkHwrYRkc16xbi9h9KlDoNTl0V/JP7AsCrGSj9MxVET559eiRkNUyiRBPOB8O tFysedafKWDOggEfhPGjWKx/TNQQeLBFPq71aQlENzkg73MoC7U83AF6FaIfdvVWydJp g6fp1jadD5lZPe+oLjqd6jHHN8/lTunhI47oyijfqK8A0HWH5SoIxGUm6ut2oISRZyPS YzQASYwbCURPVDv/0WfikFmaCVo3JTE3B2S5a5fQXqAtgZvmnFZXvihbjKKLVj/recX1 qr1tUMHqU5Vs1QlmqdDJ6FVO0oKTAT6lMqYL8Qe0dYyIAFWN7pMSHuy9H/K/H/XgP7ca FQCw== MIME-Version: 1.0 Received: by 10.66.74.65 with SMTP id r1mr54152285pav.75.1349803647206; Tue, 09 Oct 2012 10:27:27 -0700 (PDT) Sender: mdf356@gmail.com Received: by 10.68.13.170 with HTTP; Tue, 9 Oct 2012 10:27:27 -0700 (PDT) In-Reply-To: <977E1107-46D4-476F-A04D-AEFD87D1DE53@FreeBSD.org> References: <201210091425.q99EPFS6020787@svn.freebsd.org> <507451DE.9060909@freebsd.org> <977E1107-46D4-476F-A04D-AEFD87D1DE53@FreeBSD.org> Date: Tue, 9 Oct 2012 10:27:27 -0700 X-Google-Sender-Auth: FJsX_n3ohqHxO089cGEl-ATDBcI Message-ID: Subject: Re: svn commit: r241373 - head/lib/libc/stdlib From: mdf@FreeBSD.org To: David Chisnall Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: quoted-printable Cc: svn-src-head@freebsd.org, Eitan Adler , svn-src-all@freebsd.org, src-committers@freebsd.org, Andrey Chernov X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 09 Oct 2012 17:27:28 -0000 On Tue, Oct 9, 2012 at 10:16 AM, David Chisnall wrot= e: > On 9 Oct 2012, at 17:33, Andrey Chernov wrote: > >> Do you check assembler output for _both_ cases? >> In my testing clang and gcc xor's 'junk' properly in case it have >> 'volatile' keyword (as in srandomdev()) and elide it without 'volatile'. >> IMHO this change should be backed out for srandomdev() and adding >> 'volatile' for sranddev() instead. > > In it's original form, it is very dangerous - the whole expression reduce= s to undefined and so the LLVM IR for the call is: > > call void @srand(i32 undef) > > The back end is then free to use any value for the call argument, includi= ng any register value or 0. Since the value is passed in a register, it wi= ll probably just use whatever the last value there is, which may or may not= be anything sensible. On MIPS, for example, this is most likely to be &tv= , and so is 100% deterministic. > > Adding the volatile means that we are doing an XOR with a value left on t= he stack. If this is early on in the application, then it is most likely t= o be 0. If it's later on, then there may be a value here, but it's still n= ot very likely to be something particularly unpredictable. > The original behavior can be recovered by using inline assembly to fetch the value from a register into a local C variable; this would at least not rely on undefined behavior. But I agree it's of dubious value anyways. From owner-svn-src-head@FreeBSD.ORG Tue Oct 9 17:47:51 2012 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id 59FA93AC for ; Tue, 9 Oct 2012 17:47:51 +0000 (UTC) (envelope-from lists@eitanadler.com) Received: from mail-pb0-f54.google.com (mail-pb0-f54.google.com [209.85.160.54]) by mx1.freebsd.org (Postfix) with ESMTP id C568D8FC1A for ; Tue, 9 Oct 2012 17:47:50 +0000 (UTC) Received: by mail-pb0-f54.google.com with SMTP id rp8so6086984pbb.13 for ; Tue, 09 Oct 2012 10:47:50 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=eitanadler.com; s=0xdeadbeef; h=mime-version:sender:in-reply-to:references:from:date :x-google-sender-auth:message-id:subject:to:cc:content-type; bh=lIeh5LcE/O/HgiQOyV76aLryNW/EHoDku1QAycSLd9s=; b=YvhhW4Vk8wNkoh/VKOqkwCveAbVeaOoUMKvU6NBUnbDOqtPmkG6NJwP+j598N5jDox MtuIoufwWxwXw7HGoPZEpLT2H0TdpQoBdyRAC3AVrA2B8sPYQBY1pnmTK38XPbIO84xl Edu9rux7tb/WXd1npEWSyhTCa3RcOshig9nTI= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20120113; h=mime-version:sender:in-reply-to:references:from:date :x-google-sender-auth:message-id:subject:to:cc:content-type :x-gm-message-state; bh=lIeh5LcE/O/HgiQOyV76aLryNW/EHoDku1QAycSLd9s=; b=lX60ZWkH1ACHh/p54FS+uhF8uGmSLWiaGbB0uYRz39tFdbR2AB38qt1HynN2l/RICi TXqrhK8BJDGNsS72jtS5z/Eadhugsg94ZOxmNdslZ4deBgyytcnscD7PI4NvYEp8xy7Q dDo0Cdl4kZ5vEqDP7X4tdcj5KlUkd8+MZDRebgjn+5Kl9XWchBed8ccRgGen616eqlIw IaFwKCXyvSO0S9Uk4Ad4/AUyl16YR2QFtXA60u3atdKXDEFLkr2r+izwiwd5thUImTZ3 gHeP1n2gDXtPC2Gs8Rf48XSMmUI1IthANILiulhBs2lA56AawoSSMkFdErHEhom18QY9 Kz7A== Received: by 10.66.77.40 with SMTP id p8mr54449126paw.78.1349804870329; Tue, 09 Oct 2012 10:47:50 -0700 (PDT) MIME-Version: 1.0 Sender: lists@eitanadler.com Received: by 10.66.161.163 with HTTP; Tue, 9 Oct 2012 10:47:20 -0700 (PDT) In-Reply-To: <507451DE.9060909@freebsd.org> References: <201210091425.q99EPFS6020787@svn.freebsd.org> <507451DE.9060909@freebsd.org> From: Eitan Adler Date: Tue, 9 Oct 2012 13:47:20 -0400 X-Google-Sender-Auth: luk8TWlNzV065ae0uL0Luu8jRX8 Message-ID: Subject: Re: svn commit: r241373 - head/lib/libc/stdlib To: Andrey Chernov Content-Type: text/plain; charset=UTF-8 X-Gm-Message-State: ALoCoQnmgMW26eiLfdihBJL+zz34t+5IIoZ4qjUvaKIGOzmpcMfg4mPo9pCpng3zrESHuXPbZFBc Cc: svn-src-head@freebsd.org, svn-src-all@freebsd.org, src-committers@freebsd.org X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 09 Oct 2012 17:47:51 -0000 On 9 October 2012 12:33, Andrey Chernov wrote: > Do you check assembler output for _both_ cases? Yes. > In my testing clang and gcc xor's 'junk' properly in case it have > 'volatile' keyword (as in srandomdev()) and elide it without 'volatile'. volatile is still undefined: see 5.1.2.2.3 and 6.7.2.4 of ISO9899 > IMHO this change should be backed out for srandomdev() and adding > 'volatile' for sranddev() instead. http://blog.eitanadler.com/2012/10/reduced-entropy-in-rand-and-random.html for additional details and actual assembler output. -- Eitan Adler Source & Ports committer X11, Bugbusting teams From owner-svn-src-head@FreeBSD.ORG Tue Oct 9 17:50:56 2012 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id 41E73673 for ; Tue, 9 Oct 2012 17:50:56 +0000 (UTC) (envelope-from lists@eitanadler.com) Received: from mail-pa0-f54.google.com (mail-pa0-f54.google.com [209.85.220.54]) by mx1.freebsd.org (Postfix) with ESMTP id B635B8FC1C for ; Tue, 9 Oct 2012 17:50:55 +0000 (UTC) Received: by mail-pa0-f54.google.com with SMTP id bi1so6028253pad.13 for ; Tue, 09 Oct 2012 10:50:55 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=eitanadler.com; s=0xdeadbeef; h=mime-version:sender:in-reply-to:references:from:date :x-google-sender-auth:message-id:subject:to:cc:content-type :content-transfer-encoding; bh=4H6sWTB4mfNgbxTFgiovJd1tP1gB+y91aqb70kaDMAU=; b=rXtDJJstmMwi2Hx8f2l10b0V8NBIwNoiRS5mPPlCBEKYJJjMbJOvZqtYdQVTYk9KlN 8GK5l+kEOYSGsJ2LHaAmSoQgNgjtZHddBENAqCbfS1pkc32wgFHu3VSuKQyWvfDmi0hX E9KhZbWzgSGJHJdTvddXF29DJ9RQaxRDRapqw= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20120113; h=mime-version:sender:in-reply-to:references:from:date :x-google-sender-auth:message-id:subject:to:cc:content-type :content-transfer-encoding:x-gm-message-state; bh=4H6sWTB4mfNgbxTFgiovJd1tP1gB+y91aqb70kaDMAU=; b=a1BPBd3obxBshlofAgN11EJqU4rrDro46c94YLnk9QQiup8aGQfIJ4s2aUcDNCP6fV Yd4JEIxYuK6NlDnw4aQQwhrOm4Pk4kkEyBbPXaYbBGqNgmwmBQfdA78cQ+HZgOTK8Vjw Iip9dLFiW3duvd7FZLkZpdKj+gVglPAGDATj2tTrEoV8xwgBWckHDY3x5lUXx+HN0dkX OjmBWzlE0cJ34Rm1RVhWzjk+dHgkVQghvDtQ5WKWHIdxNSPqffvrKWQoE7Z0n4L/WabP d70iw58t2olWLbcifBCGz5sSrDa7N84layKpTrPkt1NLp4ymaGcotS78VISfW9dnFQox ILaw== Received: by 10.66.81.103 with SMTP id z7mr54602824pax.57.1349805055046; Tue, 09 Oct 2012 10:50:55 -0700 (PDT) MIME-Version: 1.0 Sender: lists@eitanadler.com Received: by 10.66.161.163 with HTTP; Tue, 9 Oct 2012 10:50:24 -0700 (PDT) In-Reply-To: <977E1107-46D4-476F-A04D-AEFD87D1DE53@FreeBSD.org> References: <201210091425.q99EPFS6020787@svn.freebsd.org> <507451DE.9060909@freebsd.org> <977E1107-46D4-476F-A04D-AEFD87D1DE53@FreeBSD.org> From: Eitan Adler Date: Tue, 9 Oct 2012 13:50:24 -0400 X-Google-Sender-Auth: oeThPxwWbcEA7rcNU2ZeyC6BuKo Message-ID: Subject: Re: svn commit: r241373 - head/lib/libc/stdlib To: David Chisnall Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: quoted-printable X-Gm-Message-State: ALoCoQlIKZAuUEurM+xEP+56qpJ/ucQOAL7l/Vju4OgTgN9QUL5ND3KlebKU/qnJ8MOWWF1qSL4U Cc: svn-src-head@freebsd.org, svn-src-all@freebsd.org, src-committers@freebsd.org, Andrey Chernov X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 09 Oct 2012 17:50:56 -0000 On 9 October 2012 13:16, David Chisnall wrote: > On 9 Oct 2012, at 17:33, Andrey Chernov wrote: > >> Do you check assembler output for _both_ cases? >> In my testing clang and gcc xor's 'junk' properly in case it have >> 'volatile' keyword (as in srandomdev()) and elide it without 'volatile'. >> IMHO this change should be backed out for srandomdev() and adding >> 'volatile' for sranddev() instead. > > In it's original form, it is very dangerous - the whole expression reduce= s to undefined and so the LLVM IR for the call is: > > call void @srand(i32 undef) > > The back end is then free to use any value for the call argument, includi= ng any register value or 0. In fact, the backend is free to jump to a random location and potentially kill kittens. There is *no* guarantee when it comes to undefined behavior. > Adding the volatile means that we are doing an XOR with a value left on t= he stack. If this is early on in the application, then it is most likely t= o be 0. If it's later on, then there may be a value here, but it's still n= ot very likely to be something particularly unpredictable. volatile only helps by mistake because clang is overly aggressive is turning off optimizers. The code is still undefined. --=20 Eitan Adler Source & Ports committer X11, Bugbusting teams From owner-svn-src-head@FreeBSD.ORG Tue Oct 9 17:51:37 2012 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id 405648CF for ; Tue, 9 Oct 2012 17:51:37 +0000 (UTC) (envelope-from lists@eitanadler.com) Received: from mail-pb0-f54.google.com (mail-pb0-f54.google.com [209.85.160.54]) by mx1.freebsd.org (Postfix) with ESMTP id 0588A8FC1B for ; Tue, 9 Oct 2012 17:51:36 +0000 (UTC) Received: by mail-pb0-f54.google.com with SMTP id rp8so6091594pbb.13 for ; Tue, 09 Oct 2012 10:51:36 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=eitanadler.com; s=0xdeadbeef; h=mime-version:sender:in-reply-to:references:from:date :x-google-sender-auth:message-id:subject:to:cc:content-type; bh=4tmUThP+jrS6LqvrhNEPtQotVfbr6sRr9lI1+3Qd8KU=; b=rHwKXCla/8AxHiA5dgnXkgu2fRscgCo8jtKVFM0+wVHpkA0oeE6z8qa7TZjKRUOn3/ ifcVrkh/JcSfittE/rBgkoXzsW1O5hNmISkJS10MO+hCY8eL3f5nS4TX0eUto0V1Ypsu 89f43RQLP+iOrYijHK/M7/EY+5hNvqV3UqHAw= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20120113; h=mime-version:sender:in-reply-to:references:from:date :x-google-sender-auth:message-id:subject:to:cc:content-type :x-gm-message-state; bh=4tmUThP+jrS6LqvrhNEPtQotVfbr6sRr9lI1+3Qd8KU=; b=mqsR7I/V+soEfFi8OS0vzFjXW3P8QOEOoontiFArgKBHzMTSSdODx9dXSSkFtZzNuZ IwbNS+0y7TOP9gvO9oTKJPHqURtSlH6bEEP2Wt8NO6qjl2sDGjyUyLGVv5MUe6dc6If7 gF6jfKcPRXgEOPQMcXcwIlpSiBehw4Ass7PvcwERl0vdWLIoweotbhCe4n21sk82KU+Q w/F2g932CP1oveP488PiZKMSFYDXwOxgLKW10dS7p3GlUFrbj3Ncx9br387xEvgF+FKD gVC8IaaxYTGMbEyoGl+bY5iTBfGVsyvQDhgLWrZTFJGr9KppVK09KjY2FLzzrKiG0t0b MkXg== Received: by 10.68.222.105 with SMTP id ql9mr65348787pbc.97.1349805096477; Tue, 09 Oct 2012 10:51:36 -0700 (PDT) MIME-Version: 1.0 Sender: lists@eitanadler.com Received: by 10.66.161.163 with HTTP; Tue, 9 Oct 2012 10:51:05 -0700 (PDT) In-Reply-To: References: <201210091425.q99EPFS6020787@svn.freebsd.org> <507451DE.9060909@freebsd.org> <977E1107-46D4-476F-A04D-AEFD87D1DE53@FreeBSD.org> From: Eitan Adler Date: Tue, 9 Oct 2012 13:51:05 -0400 X-Google-Sender-Auth: nchJqhgrvqBHKR1M2i13oGPkKXw Message-ID: Subject: Re: svn commit: r241373 - head/lib/libc/stdlib To: mdf@freebsd.org Content-Type: text/plain; charset=UTF-8 X-Gm-Message-State: ALoCoQk05hIxvbagpG60JQlC7iXYOOgq8O7zy9Kcx0sPYarftaLrvsKkei4hZeOn9yMc2Zn7xqwv Cc: svn-src-head@freebsd.org, Andrey Chernov , svn-src-all@freebsd.org, src-committers@freebsd.org, David Chisnall X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 09 Oct 2012 17:51:37 -0000 On 9 October 2012 13:27, wrote: > The original behavior can be recovered by using inline assembly to > fetch the value from a register into a local C variable; this would at > least not rely on undefined behavior. But I agree it's of dubious > value anyways. I proposed this (with a patch). We want to move to not using /dev/random and instead make a kernel system call directly. The patch for this is not finished yet though. -- Eitan Adler Source & Ports committer X11, Bugbusting teams From owner-svn-src-head@FreeBSD.ORG Tue Oct 9 18:25:00 2012 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id F1608932 for ; Tue, 9 Oct 2012 18:25:00 +0000 (UTC) (envelope-from ache@vniz.net) Received: from mail-la0-f54.google.com (mail-la0-f54.google.com [209.85.215.54]) by mx1.freebsd.org (Postfix) with ESMTP id 67C428FC0A for ; Tue, 9 Oct 2012 18:25:00 +0000 (UTC) Received: by mail-la0-f54.google.com with SMTP id e12so3943700lag.13 for ; Tue, 09 Oct 2012 11:24:59 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20120113; h=sender:message-id:disposition-notification-to:date:from:user-agent :mime-version:to:cc:subject:references:in-reply-to:openpgp :content-type:content-transfer-encoding:x-gm-message-state; bh=TVjcFz5S/PGFmD+VTcRMCphFZ9Eo0k+AYJLG+DfzOqY=; b=P9L+3BetbwHXs23vZec/2IL3am3ZEIfTqWmCPAfYl/6HrR+pLCjWsbSjXb3ucJlxQj fSxhVC3Cf272yVj7O4Bc/o7u68C3gWHYgSnmBNvn4i1PMU/QZq4a+A3ANqU9X080nLUS HE0Bf1tXZLMhPJfoCu2I1Qc+vgPR1vaWhIqzq7gbmY5ayy6QhUdIqwm4ZM8FcAiMt+Wu 8u2n/PGUjIKnVx/zPgikd3eOY6wtFmV7J6rvGVamkeM4pitd51RZSNzPb0RYfUbZ5ga9 ekF67usj0HQyfLLavtqCrRdrEf6qSxHebdZk/beuBolH2TGdNOJ/UU/heJ8NVEOHJ0ap gCsw== Received: by 10.112.38.134 with SMTP id g6mr8483301lbk.39.1349807098838; Tue, 09 Oct 2012 11:24:58 -0700 (PDT) Received: from [192.168.1.2] ([89.169.140.97]) by mx.google.com with ESMTPS id e4sm84017lby.12.2012.10.09.11.24.57 (version=SSLv3 cipher=OTHER); Tue, 09 Oct 2012 11:24:58 -0700 (PDT) Sender: "Chernov, Andrey" Message-ID: <50746BF8.5010307@freebsd.org> Date: Tue, 09 Oct 2012 22:24:56 +0400 From: Andrey Chernov User-Agent: Mozilla/5.0 (Windows NT 6.1; WOW64; rv:15.0) Gecko/20120907 Thunderbird/15.0.1 MIME-Version: 1.0 To: Eitan Adler Subject: Re: svn commit: r241373 - head/lib/libc/stdlib References: <201210091425.q99EPFS6020787@svn.freebsd.org> <507451DE.9060909@freebsd.org> In-Reply-To: OpenPGP: id=964474DD Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit X-Gm-Message-State: ALoCoQkdpTCkupTZqClGWeM4BQdki84ZN+W4DIVncaGO+v1jFCaYpnme4cGizHSWWAJUo+8LdSvu Cc: svn-src-head@freebsd.org, svn-src-all@freebsd.org, src-committers@freebsd.org, theraven@freebsd.org X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 09 Oct 2012 18:25:01 -0000 On 09.10.2012 21:47, Eitan Adler wrote: > On 9 October 2012 12:33, Andrey Chernov wrote: >> Do you check assembler output for _both_ cases? > > Yes. ... > http://blog.eitanadler.com/2012/10/reduced-entropy-in-rand-and-random.html At this URL I see only already known buggy assembler without 'volatile' keyword (which is fixed by adding 'volatile' in srandomdev()). As I already mention, adding 'volatile' helps any gcc and clang finally generated assembler code (checked by cc -S ...). What happens with LLVM intermediate code, I mean mentioned by David call void @srand(i32 undef) is a big question and perhaps clang bug. Please note that we use 'volatile' a lot in the kernel, just 'grep -r volatile /sys'. Some of that potentially can hit the same (probably) bug. And, in case it is the bug, it should be fixed in clang. > volatile is still undefined: see 5.1.2.2.3 and 6.7.2.4 of ISO9899 I don't have ISO9899 nearby, could you directly quote mentioned sections, please? Do you against 'volatile' usage at all? It seems whole kernel (see above) contradicts with such point of view. From owner-svn-src-head@FreeBSD.ORG Tue Oct 9 20:24:30 2012 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id 8254725C for ; Tue, 9 Oct 2012 20:24:30 +0000 (UTC) (envelope-from lists@eitanadler.com) Received: from mail-pa0-f54.google.com (mail-pa0-f54.google.com [209.85.220.54]) by mx1.freebsd.org (Postfix) with ESMTP id 41A408FC16 for ; Tue, 9 Oct 2012 20:24:30 +0000 (UTC) Received: by mail-pa0-f54.google.com with SMTP id bi1so6210664pad.13 for ; Tue, 09 Oct 2012 13:24:30 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=eitanadler.com; s=0xdeadbeef; h=mime-version:sender:in-reply-to:references:from:date :x-google-sender-auth:message-id:subject:to:cc:content-type; bh=Ca0OYCi/v0MHzglnMQ4zy9jxV6ZpsY+v8vX9YBHgEUo=; b=Zc82K1IXO4iBCtL2d0YNLl7x7emCuNa1s4E1SpJVLhJKaAsHk+CvROnqSZj7Hqs8GI UkVZjDkIyzlA1aLdk3MP2M+IC289/8b+P8fjHhZ6MN6KSPvXPZiAfncAeMmR5HZaYfA7 KDjE27TJ/MwE3naqLJ+Zwb/khrWfGWB1W+S/o= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20120113; h=mime-version:sender:in-reply-to:references:from:date :x-google-sender-auth:message-id:subject:to:cc:content-type :x-gm-message-state; bh=Ca0OYCi/v0MHzglnMQ4zy9jxV6ZpsY+v8vX9YBHgEUo=; b=hHEGa4Cwoq4qyHMdD0F9WtYpKN77ShTBlTRqeiXa+e9DJr/QzQvW6btRnHuCjX7vsJ cKzj2wzt93Tkwmrhj5aHK4BTR3MJ24eoDYic+EepUtMmp4n0a4j8eHUZRiTXzfbEgWLy QaqC8m9dEDQ+nHD/oSKbYOxpM5Gi8pafvM8t5VeBVadZlM8ge0ADPZVnoxjqrUMB8ev3 OcS3f6DhL4SHtQdytm8SZzLi+JqJHnqwKD0+sLRy/KFvV40Mn5QpASSkaMEr189jh5E9 WbHcz0kitaY/QE1iqyNO/bL6cMTzyaMCjZBVGGT0uimn3HV6lwcUrFGOJfIdl10kEa7d DDvg== Received: by 10.68.129.72 with SMTP id nu8mr66337044pbb.29.1349814269855; Tue, 09 Oct 2012 13:24:29 -0700 (PDT) MIME-Version: 1.0 Sender: lists@eitanadler.com Received: by 10.66.161.163 with HTTP; Tue, 9 Oct 2012 13:23:59 -0700 (PDT) In-Reply-To: <50746BF8.5010307@freebsd.org> References: <201210091425.q99EPFS6020787@svn.freebsd.org> <507451DE.9060909@freebsd.org> <50746BF8.5010307@freebsd.org> From: Eitan Adler Date: Tue, 9 Oct 2012 16:23:59 -0400 X-Google-Sender-Auth: 8QxLwMsR5cHvBMqOH7svtbGDxjI Message-ID: Subject: Re: svn commit: r241373 - head/lib/libc/stdlib To: Andrey Chernov Content-Type: text/plain; charset=UTF-8 X-Gm-Message-State: ALoCoQkbSeBrQPd5ysPo1GhGGjjKTrD38Xtiknw/hpk47gMJiCjENWA/GyO+qMjT4a19zWLcZKZ0 Cc: svn-src-head@freebsd.org, svn-src-all@freebsd.org, src-committers@freebsd.org, theraven@freebsd.org X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 09 Oct 2012 20:24:30 -0000 On 9 October 2012 14:24, Andrey Chernov wrote: > I don't have ISO9899 nearby, could you directly quote mentioned > sections, please? Accesses to volatile object (a) produce side effects (b) have implementation defined values. A more careful re-reading of the relevant section leads me to believe I may have been wrong with this comment. It isn't made explicit, but the C standard never says that accesses to uninitialized volatile is defined. On the other hand, the existence of "const volatile" proves me wrong. Interestingly, clang and gcc disagree on whether to warn: [8084 eitan@radar ~ ]%gcc46 -Wall -Wextra -ansi -pedantic a.c [8089 eitan@radar ~ ]%clang -Wall -Wextra -ansi -pedantic a.c a.c:3:9: warning: variable 'a' is uninitialized when used here [-Wuninitialized] I still don't like volatile though here for the other reasons mentioned. In general, the entire piece of code should be replaced with something that can't fail, so this is a moot point. > Do you against 'volatile' usage at all? It seems whole > kernel (see above) contradicts with such point of view. Not, I never said any such thing. Volatile is designed for memory mapped I/O and it makes sense to use for such things. I haven't audited every use of 'volatile' though. -- Eitan Adler Source & Ports committer X11, Bugbusting teams From owner-svn-src-head@FreeBSD.ORG Tue Oct 9 21:30:06 2012 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id 566FF315; Tue, 9 Oct 2012 21:30:06 +0000 (UTC) (envelope-from sgk@troutmask.apl.washington.edu) Received: from troutmask.apl.washington.edu (troutmask.apl.washington.edu [128.95.76.21]) by mx1.freebsd.org (Postfix) with ESMTP id 02BC98FC18; Tue, 9 Oct 2012 21:30:05 +0000 (UTC) Received: from troutmask.apl.washington.edu (localhost.apl.washington.edu [127.0.0.1]) by troutmask.apl.washington.edu (8.14.5/8.14.5) with ESMTP id q99LPc4a068010; Tue, 9 Oct 2012 14:25:38 -0700 (PDT) (envelope-from sgk@troutmask.apl.washington.edu) Received: (from sgk@localhost) by troutmask.apl.washington.edu (8.14.5/8.14.5/Submit) id q99LPcLI068009; Tue, 9 Oct 2012 14:25:38 -0700 (PDT) (envelope-from sgk) Date: Tue, 9 Oct 2012 14:25:38 -0700 From: Steve Kargl To: Eitan Adler Subject: Re: svn commit: r241373 - head/lib/libc/stdlib Message-ID: <20121009212538.GA67848@troutmask.apl.washington.edu> References: <201210091425.q99EPFS6020787@svn.freebsd.org> <507451DE.9060909@freebsd.org> <50746BF8.5010307@freebsd.org> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: User-Agent: Mutt/1.5.21 (2010-09-15) Cc: svn-src-head@freebsd.org, theraven@freebsd.org, svn-src-all@freebsd.org, src-committers@freebsd.org, Andrey Chernov X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 09 Oct 2012 21:30:06 -0000 On Tue, Oct 09, 2012 at 04:23:59PM -0400, Eitan Adler wrote: > On 9 October 2012 14:24, Andrey Chernov wrote: > > I don't have ISO9899 nearby, could you directly quote mentioned > > sections, please? > > Accesses to volatile object (a) produce side effects (b) have > implementation defined values. > > A more careful re-reading of the relevant section leads me to believe > I may have been wrong > with this comment. It isn't made explicit, but the C standard never > says that accesses > to uninitialized volatile is defined. On the other hand, the existence > of "const volatile" proves me wrong. > Interestingly, clang and gcc disagree on whether to warn: > > [8084 eitan@radar ~ ]%gcc46 -Wall -Wextra -ansi -pedantic a.c > [8089 eitan@radar ~ ]%clang -Wall -Wextra -ansi -pedantic a.c > a.c:3:9: warning: variable 'a' is uninitialized when used here > [-Wuninitialized] Given that I cannot see a.c, I'll assume that 'a' is declared with a volatile-qualified type. In that case, it appears that clang has a bug. From 6.7.3, page 109 in n1256.pdf, one finds: An object that has volatile-qualified type may be modified in ways unknown to the implementation or have other unknown side effects. Therefore any expression referring to such an object shall be evaluated strictly according to the rules of the abstract machine, as described in 5.1.2.3. Furthermore, at every sequence point the value last stored in the object shall agree with that prescribed by the abstract machine, except as modified by the unknown factors mentioned previously. 116) 116) A volatile declaration may be used to describe an object corresponding to a memory-mapped input/output port or an object accessed by an asynchronously interrupting function. Actions on objects so declared shall not be ``optimized out'' by an implementation or reordered except as permitted by the rules for evaluating expressions. Clang has no way of determining if 'a' is initialized or not. If David is correct that 'junk' is optimized out by clang/llvm, then it seems that clang violates footnote 116. Yes, I know it is non-normative text. > I still don't like volatile though here for the other reasons > mentioned. In general, the entire piece of code should be replaced > with something that can't fail, so this is a moot point. Agreed. -- Steve From owner-svn-src-head@FreeBSD.ORG Tue Oct 9 22:07:36 2012 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id 16DC39DA for ; Tue, 9 Oct 2012 22:07:36 +0000 (UTC) (envelope-from lists@eitanadler.com) Received: from mail-pb0-f54.google.com (mail-pb0-f54.google.com [209.85.160.54]) by mx1.freebsd.org (Postfix) with ESMTP id C56558FC1D for ; Tue, 9 Oct 2012 22:07:32 +0000 (UTC) Received: by mail-pb0-f54.google.com with SMTP id rp8so6375861pbb.13 for ; Tue, 09 Oct 2012 15:07:26 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=eitanadler.com; s=0xdeadbeef; h=mime-version:sender:in-reply-to:references:from:date :x-google-sender-auth:message-id:subject:to:cc:content-type; bh=1Jq1MyTbcte64Ycjozh71ayKXcInc/HsvnuuO4KiEMY=; b=fQD1VNB6YkAki7UCvwB96ZmT7VTFtk+jIscItg8CjfumnkP9wxdZlkBRt9seH9kHVO Isd0779YffdFT3NA8elIin6TONMcOcBd9JUzzUREzN/trr14cUZpeMeSdbQZU2mzcvj8 9urjbQriQWnkh858XIXozIXWTqyHHSQcYinXk= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20120113; h=mime-version:sender:in-reply-to:references:from:date :x-google-sender-auth:message-id:subject:to:cc:content-type :x-gm-message-state; bh=1Jq1MyTbcte64Ycjozh71ayKXcInc/HsvnuuO4KiEMY=; b=g90OcDo3u6pgL7IULYqlS1v6J05AcSTZcSk38/9K5o91ONjc0h13fOFbkZTsTDFmUo rQts0Gg2csjK1amxBA3n24+FX5e9mRzZJxiHaHupU8v+P+5uPqPKyVe9qpOAVIWp9aCK uaUFsSGEidhBK+0p28IfpcEVugrdmSHae1Efy+lzPvGYIUyiClILhyJnVYb1fZykkQEp C5unYtZkrdCkLKY+Y12Ywv70TpSQ7OTP6FHFzYhJkLF85lt0j2dAk5z3rSUNY4wFcp4p JkYj9MMP2twj0SqUOxG9objTyTQ75MHF0JNg43KKwoFuhJ0rG0KI1uhuVLRD8csJAszM eevw== Received: by 10.68.222.105 with SMTP id ql9mr67147769pbc.97.1349820446646; Tue, 09 Oct 2012 15:07:26 -0700 (PDT) MIME-Version: 1.0 Sender: lists@eitanadler.com Received: by 10.66.161.163 with HTTP; Tue, 9 Oct 2012 15:06:55 -0700 (PDT) In-Reply-To: <20121009212538.GA67848@troutmask.apl.washington.edu> References: <201210091425.q99EPFS6020787@svn.freebsd.org> <507451DE.9060909@freebsd.org> <50746BF8.5010307@freebsd.org> <20121009212538.GA67848@troutmask.apl.washington.edu> From: Eitan Adler Date: Tue, 9 Oct 2012 18:06:55 -0400 X-Google-Sender-Auth: bb3HpjCOHUfrfqdZEbyFZzB8ao0 Message-ID: Subject: Re: svn commit: r241373 - head/lib/libc/stdlib To: Steve Kargl Content-Type: text/plain; charset=UTF-8 X-Gm-Message-State: ALoCoQkDkSfTIleuNSm40bKh9Hp0ZsYxPX8y26Q4f/K2s5sPQReiKVggSQNZv9OPeByDrbJsc2Mg Cc: svn-src-head@freebsd.org, theraven@freebsd.org, svn-src-all@freebsd.org, src-committers@freebsd.org, Andrey Chernov X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 09 Oct 2012 22:07:36 -0000 On 9 October 2012 17:25, Steve Kargl wrote: ... yes, I was misreading the text. > Clang has no way of determining if 'a' is initialized or not. > If David is correct that 'junk' is optimized out by clang/llvm, > then it seems that clang violates footnote 116. Yes, I know > it is non-normative text. Sorry if I was not clear: clang does *not* optimize away the volatile version. I removed it for other reasons. > >> I still don't like volatile though here for the other reasons >> mentioned. In general, the entire piece of code should be replaced >> with something that can't fail, so this is a moot point. > > Agreed. > > -- > Steve > -- Eitan Adler Source & Ports committer X11, Bugbusting teams From owner-svn-src-head@FreeBSD.ORG Tue Oct 9 22:10:19 2012 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id 2BE1FAB7 for ; Tue, 9 Oct 2012 22:10:19 +0000 (UTC) (envelope-from lists@eitanadler.com) Received: from mail-pa0-f54.google.com (mail-pa0-f54.google.com [209.85.220.54]) by mx1.freebsd.org (Postfix) with ESMTP id 9E48C8FC1A for ; Tue, 9 Oct 2012 22:10:18 +0000 (UTC) Received: by mail-pa0-f54.google.com with SMTP id bi1so6321818pad.13 for ; Tue, 09 Oct 2012 15:10:18 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=eitanadler.com; s=0xdeadbeef; h=mime-version:sender:in-reply-to:references:from:date :x-google-sender-auth:message-id:subject:to:cc:content-type; bh=GitZfSfwvH+PayGcX1RCIshLQOVZs0IgF57NhrT1rPU=; b=i0a/Oi4BS1sS93Yizqb28wl/SwItFGs3K53OFXPRoJdbLt3jmPNCYCodLNYjcH6VZr YR/FH7939jf46s6lbDBaSmE9MfHNyD24KZ9Vzp/HFX0P6VeNFkqLmZTWK2QG1KInO8aK IvGK4q1jZ4hMgJIQ3sj3/3X6bcQUKyxj1ChmE= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20120113; h=mime-version:sender:in-reply-to:references:from:date :x-google-sender-auth:message-id:subject:to:cc:content-type :x-gm-message-state; bh=GitZfSfwvH+PayGcX1RCIshLQOVZs0IgF57NhrT1rPU=; b=XapMU5CUQPVWyEF8l9c4kOmGPUglG372W5Hw3H96QSNa5q/NRpmj8uzZXFhL1y+Y81 O73vCUqGGOcL9+uItm3z/FQMZ3rJRJIyKFNsvboKhEqr7hlBMhJFPAeGHscF9zEA1/h3 Fp7ZGDtjjcTAKp8RZ9MNpnzMH1vSxn4RLEGdOrFS6gM3vmnEfF72mzAS8bT6HyS9qGYJ ouzwwBF4SisDb42ap0pUto2daO5KlgzA4iTFNRCeYbB7SAkCJdTuSu9mwAcXMt+QUmKl 5wRPn34Gj/himgPh4HsHb+asn740V9uon6JMjaWdWYTxx27iPUE+YsCJKtxgvFBLG630 NQrA== Received: by 10.66.81.202 with SMTP id c10mr56218578pay.31.1349820618205; Tue, 09 Oct 2012 15:10:18 -0700 (PDT) MIME-Version: 1.0 Sender: lists@eitanadler.com Received: by 10.66.161.163 with HTTP; Tue, 9 Oct 2012 15:09:47 -0700 (PDT) In-Reply-To: References: <201210091425.q99EPFS6020787@svn.freebsd.org> <507451DE.9060909@freebsd.org> <50746BF8.5010307@freebsd.org> <20121009212538.GA67848@troutmask.apl.washington.edu> From: Eitan Adler Date: Tue, 9 Oct 2012 18:09:47 -0400 X-Google-Sender-Auth: t-lgaH4aocFxIamnoFy32MfM6ek Message-ID: Subject: Re: svn commit: r241373 - head/lib/libc/stdlib To: Steve Kargl Content-Type: text/plain; charset=UTF-8 X-Gm-Message-State: ALoCoQmKbnZI4Z21UyhE+KgTW/teR7QsGO2noonv9GG0OV8TUHCVZvPJNBeD3WLfcndYrLQf8nRX Cc: svn-src-head@freebsd.org, theraven@freebsd.org, svn-src-all@freebsd.org, src-committers@freebsd.org, Andrey Chernov X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 09 Oct 2012 22:10:19 -0000 On 9 October 2012 18:06, Eitan Adler wrote: > On 9 October 2012 17:25, Steve Kargl wrote: > > ... yes, I was misreading the text. > >> Clang has no way of determining if 'a' is initialized or not. >> If David is correct that 'junk' is optimized out by clang/llvm, >> then it seems that clang violates footnote 116. Yes, I know >> it is non-normative text. > > Sorry if I was not clear: clang does *not* optimize away the volatile > version. I removed it for other reasons. For those interested in "volatile" you may also want to read: www.cs.utah.edu/~regehr/papers/emsoft08-preprint.pdf -- Eitan Adler Source & Ports committer X11, Bugbusting teams From owner-svn-src-head@FreeBSD.ORG Tue Oct 9 23:08:12 2012 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id 7AB3B4FC; Tue, 9 Oct 2012 23:08:12 +0000 (UTC) (envelope-from sgk@troutmask.apl.washington.edu) Received: from troutmask.apl.washington.edu (troutmask.apl.washington.edu [128.95.76.21]) by mx1.freebsd.org (Postfix) with ESMTP id 308938FC0A; Tue, 9 Oct 2012 23:08:12 +0000 (UTC) Received: from troutmask.apl.washington.edu (localhost.apl.washington.edu [127.0.0.1]) by troutmask.apl.washington.edu (8.14.5/8.14.5) with ESMTP id q99N8Bo1068392; Tue, 9 Oct 2012 16:08:11 -0700 (PDT) (envelope-from sgk@troutmask.apl.washington.edu) Received: (from sgk@localhost) by troutmask.apl.washington.edu (8.14.5/8.14.5/Submit) id q99N8BBI068391; Tue, 9 Oct 2012 16:08:11 -0700 (PDT) (envelope-from sgk) Date: Tue, 9 Oct 2012 16:08:11 -0700 From: Steve Kargl To: Eitan Adler Subject: Re: svn commit: r241373 - head/lib/libc/stdlib Message-ID: <20121009230811.GA68376@troutmask.apl.washington.edu> References: <201210091425.q99EPFS6020787@svn.freebsd.org> <507451DE.9060909@freebsd.org> <50746BF8.5010307@freebsd.org> <20121009212538.GA67848@troutmask.apl.washington.edu> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: User-Agent: Mutt/1.5.21 (2010-09-15) Cc: svn-src-head@freebsd.org, theraven@freebsd.org, svn-src-all@freebsd.org, src-committers@freebsd.org, Andrey Chernov X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 09 Oct 2012 23:08:12 -0000 On Tue, Oct 09, 2012 at 06:06:55PM -0400, Eitan Adler wrote: > On 9 October 2012 17:25, Steve Kargl wrote: > > ... yes, I was misreading the text. > > > Clang has no way of determining if 'a' is initialized or not. > > If David is correct that 'junk' is optimized out by clang/llvm, > > then it seems that clang violates footnote 116. Yes, I know > > it is non-normative text. > > Sorry if I was not clear: clang does *not* optimize away the volatile > version. I removed it for other reasons. OK, but clang still has a bug. Clang should not issue a warning that "'a' is uninitialized" because 'a' is volatile and clang has no way of knowning whether 'a' has been initialized by some other means. At most, clang can state "'a' may be uninitialized". -- Steve From owner-svn-src-head@FreeBSD.ORG Wed Oct 10 00:06:32 2012 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id 50549C9F; Wed, 10 Oct 2012 00:06:32 +0000 (UTC) (envelope-from neel@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 391C78FC0A; Wed, 10 Oct 2012 00:06:32 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id q9A06WRI013348; Wed, 10 Oct 2012 00:06:32 GMT (envelope-from neel@svn.freebsd.org) Received: (from neel@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q9A06Wxt013346; Wed, 10 Oct 2012 00:06:32 GMT (envelope-from neel@svn.freebsd.org) Message-Id: <201210100006.q9A06Wxt013346@svn.freebsd.org> From: Neel Natu Date: Wed, 10 Oct 2012 00:06:32 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r241386 - head/sys/dev/acpica X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 10 Oct 2012 00:06:32 -0000 Author: neel Date: Wed Oct 10 00:06:31 2012 New Revision: 241386 URL: http://svn.freebsd.org/changeset/base/241386 Log: Grab the softc from the ACPI host-pci bridge device instead of from the pci endpoint device. Reviewed by: jhb Modified: head/sys/dev/acpica/acpi_pcib_acpi.c Modified: head/sys/dev/acpica/acpi_pcib_acpi.c ============================================================================== --- head/sys/dev/acpica/acpi_pcib_acpi.c Tue Oct 9 20:07:24 2012 (r241385) +++ head/sys/dev/acpica/acpi_pcib_acpi.c Wed Oct 10 00:06:31 2012 (r241386) @@ -502,7 +502,7 @@ acpi_pcib_map_msi(device_t pcib, device_ if (error) return (error); - sc = device_get_softc(dev); + sc = device_get_softc(pcib); if (sc->ap_addr == -1) return (0); /* XXX: Assumes all bridges are on bus 0. */ From owner-svn-src-head@FreeBSD.ORG Wed Oct 10 01:24:03 2012 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id 43E42D7; Wed, 10 Oct 2012 01:24:03 +0000 (UTC) (envelope-from yongari@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 230CC8FC19; Wed, 10 Oct 2012 01:24:03 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id q9A1O2Iw024004; Wed, 10 Oct 2012 01:24:02 GMT (envelope-from yongari@svn.freebsd.org) Received: (from yongari@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q9A1O2JO024001; Wed, 10 Oct 2012 01:24:02 GMT (envelope-from yongari@svn.freebsd.org) Message-Id: <201210100124.q9A1O2JO024001@svn.freebsd.org> From: Pyun YongHyeon Date: Wed, 10 Oct 2012 01:24:02 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r241388 - head/sys/dev/bge X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 10 Oct 2012 01:24:03 -0000 Author: yongari Date: Wed Oct 10 01:24:02 2012 New Revision: 241388 URL: http://svn.freebsd.org/changeset/base/241388 Log: If the maximum payload size is 256 bytes or more, set the DMA write water mark to 256 bytes. Otherwise controller will encounter DMA write under run errors and would result in RX DMA hang. If the maximum payload size is 128 bytes, the water mark is set to 128 bytes as usual. While here, set maximum read request size to 2048 for BCM5719/BCM5720. For other PCIe devices, use 4096. And reprogram the maximum read request size whenever device reset is performed. Modified: head/sys/dev/bge/if_bge.c head/sys/dev/bge/if_bgereg.h Modified: head/sys/dev/bge/if_bge.c ============================================================================== --- head/sys/dev/bge/if_bge.c Wed Oct 10 00:11:06 2012 (r241387) +++ head/sys/dev/bge/if_bge.c Wed Oct 10 01:24:02 2012 (r241388) @@ -1466,8 +1466,10 @@ bge_chipinit(struct bge_softc *sc) dma_rw_ctl = BGE_PCIDMARWCTL_RD_CMD_SHIFT(6) | BGE_PCIDMARWCTL_WR_CMD_SHIFT(7); if (sc->bge_flags & BGE_FLAG_PCIE) { - /* Read watermark not used, 128 bytes for write. */ - dma_rw_ctl |= BGE_PCIDMARWCTL_WR_WAT_SHIFT(3); + if (sc->bge_mps >= 256) + dma_rw_ctl |= BGE_PCIDMARWCTL_WR_WAT_SHIFT(7); + else + dma_rw_ctl |= BGE_PCIDMARWCTL_WR_WAT_SHIFT(3); } else if (sc->bge_flags & BGE_FLAG_PCIX) { if (BGE_IS_5714_FAMILY(sc)) { /* 256 bytes for read and write. */ @@ -3161,11 +3163,16 @@ bge_attach(device_t dev) */ sc->bge_flags |= BGE_FLAG_PCIE; sc->bge_expcap = reg; + /* Extract supported maximum payload size. */ + sc->bge_mps = pci_read_config(dev, sc->bge_expcap + + PCIER_DEVICE_CAP, 2); + sc->bge_mps = 128 << (sc->bge_mps & PCIEM_CAP_MAX_PAYLOAD); if (sc->bge_asicrev == BGE_ASICREV_BCM5719 || sc->bge_asicrev == BGE_ASICREV_BCM5720) - pci_set_max_read_req(dev, 2048); - else if (pci_get_max_read_req(dev) != 4096) - pci_set_max_read_req(dev, 4096); + sc->bge_expmrq = 2048; + else + sc->bge_expmrq = 4096; + pci_set_max_read_req(dev, sc->bge_expmrq); } else { /* * Check if the device is in PCI-X Mode. @@ -3642,6 +3649,7 @@ bge_reset(struct bge_softc *sc) PCIEM_CTL_NOSNOOP_ENABLE); pci_write_config(dev, sc->bge_expcap + PCIER_DEVICE_CTL, devctl, 2); + pci_set_max_read_req(dev, sc->bge_expmrq); /* Clear error status. */ pci_write_config(dev, sc->bge_expcap + PCIER_DEVICE_STA, PCIEM_STA_CORRECTABLE_ERROR | Modified: head/sys/dev/bge/if_bgereg.h ============================================================================== --- head/sys/dev/bge/if_bgereg.h Wed Oct 10 00:11:06 2012 (r241387) +++ head/sys/dev/bge/if_bgereg.h Wed Oct 10 01:24:02 2012 (r241388) @@ -2792,6 +2792,7 @@ struct bge_softc { struct resource *bge_res; struct ifmedia bge_ifmedia; /* TBI media info */ int bge_expcap; + int bge_expmrq; int bge_msicap; int bge_pcixcap; uint32_t bge_flags; @@ -2835,6 +2836,7 @@ struct bge_softc { uint32_t bge_chiprev; uint8_t bge_asf_mode; uint8_t bge_asf_count; + uint16_t bge_mps; struct bge_ring_data bge_ldata; /* rings */ struct bge_chain_data bge_cdata; /* mbufs */ uint16_t bge_tx_saved_considx; From owner-svn-src-head@FreeBSD.ORG Wed Oct 10 01:59:54 2012 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id 05D42806; Wed, 10 Oct 2012 01:59:54 +0000 (UTC) (envelope-from yongari@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id C8EA48FC08; Wed, 10 Oct 2012 01:59:53 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id q9A1xrtf029181; Wed, 10 Oct 2012 01:59:53 GMT (envelope-from yongari@svn.freebsd.org) Received: (from yongari@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q9A1xrUp029179; Wed, 10 Oct 2012 01:59:53 GMT (envelope-from yongari@svn.freebsd.org) Message-Id: <201210100159.q9A1xrUp029179@svn.freebsd.org> From: Pyun YongHyeon Date: Wed, 10 Oct 2012 01:59:53 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r241389 - head/sys/dev/bge X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 10 Oct 2012 01:59:54 -0000 Author: yongari Date: Wed Oct 10 01:59:53 2012 New Revision: 241389 URL: http://svn.freebsd.org/changeset/base/241389 Log: On PHY write error use hex number to show the value. Add more comments. Modified: head/sys/dev/bge/if_bge.c Modified: head/sys/dev/bge/if_bge.c ============================================================================== --- head/sys/dev/bge/if_bge.c Wed Oct 10 01:24:02 2012 (r241388) +++ head/sys/dev/bge/if_bge.c Wed Oct 10 01:59:53 2012 (r241389) @@ -885,7 +885,7 @@ bge_miibus_writereg(device_t dev, int ph if (i == BGE_TIMEOUT) device_printf(sc->bge_dev, - "PHY write timed out (phy %d, reg %d, val %d)\n", + "PHY write timed out (phy %d, reg %d, val 0x%04x)\n", phy, reg, val); return (0); @@ -2036,6 +2036,7 @@ bge_blockinit(struct bge_softc *sc) if (!(BGE_IS_5705_PLUS(sc))) CSR_WRITE_4(sc, BGE_RXLS_MODE, BGE_RXLSMODE_ENABLE); + /* Turn on DMA, clear stats. */ val = BGE_MACMODE_TXDMA_ENB | BGE_MACMODE_RXDMA_ENB | BGE_MACMODE_RX_STATS_CLEAR | BGE_MACMODE_TX_STATS_CLEAR | BGE_MACMODE_RX_STATS_ENB | BGE_MACMODE_TX_STATS_ENB | @@ -2048,7 +2049,6 @@ bge_blockinit(struct bge_softc *sc) else val |= BGE_PORTMODE_MII; - /* Turn on DMA, clear stats */ CSR_WRITE_4(sc, BGE_MAC_MODE, val); DELAY(40); @@ -4071,10 +4071,12 @@ bge_poll(struct ifnet *ifp, enum poll_cm bus_dmamap_sync(sc->bge_cdata.bge_status_tag, sc->bge_cdata.bge_status_map, BUS_DMASYNC_POSTREAD | BUS_DMASYNC_POSTWRITE); + /* Fetch updates from the status block. */ rx_prod = sc->bge_ldata.bge_status_block->bge_idx[0].bge_rx_prod_idx; tx_cons = sc->bge_ldata.bge_status_block->bge_idx[0].bge_tx_cons_idx; statusword = sc->bge_ldata.bge_status_block->bge_status; + /* Clear the status so the next pass only sees the changes. */ sc->bge_ldata.bge_status_block->bge_status = 0; bus_dmamap_sync(sc->bge_cdata.bge_status_tag, @@ -4142,11 +4144,12 @@ bge_intr_task(void *arg, int pending) sc->bge_cdata.bge_status_map, BUS_DMASYNC_POSTREAD | BUS_DMASYNC_POSTWRITE); - /* Save producer/consumer indexess. */ + /* Save producer/consumer indices. */ rx_prod = sc->bge_ldata.bge_status_block->bge_idx[0].bge_rx_prod_idx; tx_cons = sc->bge_ldata.bge_status_block->bge_idx[0].bge_tx_cons_idx; status = sc->bge_ldata.bge_status_block->bge_status; status_tag = sc->bge_ldata.bge_status_block->bge_status_tag << 24; + /* Dirty the status flag. */ sc->bge_ldata.bge_status_block->bge_status = 0; bus_dmamap_sync(sc->bge_cdata.bge_status_tag, sc->bge_cdata.bge_status_map, @@ -5686,7 +5689,7 @@ bge_link_upd(struct bge_softc *sc) bge_miibus_statchg(sc->bge_dev); } - /* Clear the attention. */ + /* Disable MAC attention when link is up. */ CSR_WRITE_4(sc, BGE_MAC_STS, BGE_MACSTAT_SYNC_CHANGED | BGE_MACSTAT_CFG_CHANGED | BGE_MACSTAT_MI_COMPLETE | BGE_MACSTAT_LINK_CHANGED); From owner-svn-src-head@FreeBSD.ORG Wed Oct 10 02:21:36 2012 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id BF981BAF; Wed, 10 Oct 2012 02:21:36 +0000 (UTC) (envelope-from yongari@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id A8D228FC08; Wed, 10 Oct 2012 02:21:36 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id q9A2LaMj032266; Wed, 10 Oct 2012 02:21:36 GMT (envelope-from yongari@svn.freebsd.org) Received: (from yongari@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q9A2LarF032264; Wed, 10 Oct 2012 02:21:36 GMT (envelope-from yongari@svn.freebsd.org) Message-Id: <201210100221.q9A2LarF032264@svn.freebsd.org> From: Pyun YongHyeon Date: Wed, 10 Oct 2012 02:21:36 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r241390 - head/sys/dev/bge X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 10 Oct 2012 02:21:36 -0000 Author: yongari Date: Wed Oct 10 02:21:36 2012 New Revision: 241390 URL: http://svn.freebsd.org/changeset/base/241390 Log: Honor PHY type fiber for BCM5717/BCM5718/BCM5719/BCM5720. Modified: head/sys/dev/bge/if_bge.c Modified: head/sys/dev/bge/if_bge.c ============================================================================== --- head/sys/dev/bge/if_bge.c Wed Oct 10 01:59:53 2012 (r241389) +++ head/sys/dev/bge/if_bge.c Wed Oct 10 02:21:36 2012 (r241390) @@ -3381,7 +3381,7 @@ bge_attach(device_t dev) /* The SysKonnect SK-9D41 is a 1000baseSX card. */ if ((pci_read_config(dev, BGE_PCI_SUBSYS, 4) >> 16) == SK_SUBSYSID_9D41 || (hwcfg & BGE_HWCFG_MEDIA) == BGE_MEDIA_FIBER) { - if (BGE_IS_5714_FAMILY(sc)) + if (BGE_IS_5705_PLUS(sc)) sc->bge_flags |= BGE_FLAG_MII_SERDES; else sc->bge_flags |= BGE_FLAG_TBI; From owner-svn-src-head@FreeBSD.ORG Wed Oct 10 02:35:10 2012 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id AAA04D21; Wed, 10 Oct 2012 02:35:10 +0000 (UTC) (envelope-from yongari@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 938A68FC16; Wed, 10 Oct 2012 02:35:10 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id q9A2ZADD034391; Wed, 10 Oct 2012 02:35:10 GMT (envelope-from yongari@svn.freebsd.org) Received: (from yongari@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q9A2ZACd034389; Wed, 10 Oct 2012 02:35:10 GMT (envelope-from yongari@svn.freebsd.org) Message-Id: <201210100235.q9A2ZACd034389@svn.freebsd.org> From: Pyun YongHyeon Date: Wed, 10 Oct 2012 02:35:10 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r241391 - head/sys/dev/bge X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 10 Oct 2012 02:35:10 -0000 Author: yongari Date: Wed Oct 10 02:35:10 2012 New Revision: 241391 URL: http://svn.freebsd.org/changeset/base/241391 Log: Do not force PCIe 1.0a mode in device reset on BCM5717 and newer controllers. BCM5785 does not require PCI 1.0a mode as well during reset. Modified: head/sys/dev/bge/if_bge.c Modified: head/sys/dev/bge/if_bge.c ============================================================================== --- head/sys/dev/bge/if_bge.c Wed Oct 10 02:21:36 2012 (r241390) +++ head/sys/dev/bge/if_bge.c Wed Oct 10 02:35:10 2012 (r241391) @@ -3604,8 +3604,11 @@ bge_reset(struct bge_softc *sc) /* XXX: Broadcom Linux driver. */ if (sc->bge_flags & BGE_FLAG_PCIE) { - if (CSR_READ_4(sc, 0x7E2C) == 0x60) /* PCIE 1.0 */ - CSR_WRITE_4(sc, 0x7E2C, 0x20); + if (sc->bge_asicrev != BGE_ASICREV_BCM5785 && + (sc->bge_flags & BGE_FLAG_5717_PLUS) == 0) { + if (CSR_READ_4(sc, 0x7E2C) == 0x60) /* PCIE 1.0 */ + CSR_WRITE_4(sc, 0x7E2C, 0x20); + } if (sc->bge_chipid != BGE_CHIPID_BCM5750_A0) { /* Prevent PCIE link training during global reset */ CSR_WRITE_4(sc, BGE_MISC_CFG, 1 << 29); From owner-svn-src-head@FreeBSD.ORG Wed Oct 10 04:38:30 2012 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id 2024EAD1; Wed, 10 Oct 2012 04:38:30 +0000 (UTC) (envelope-from yongari@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 08C2D8FC14; Wed, 10 Oct 2012 04:38:30 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id q9A4cTsk051563; Wed, 10 Oct 2012 04:38:29 GMT (envelope-from yongari@svn.freebsd.org) Received: (from yongari@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q9A4cTam051561; Wed, 10 Oct 2012 04:38:29 GMT (envelope-from yongari@svn.freebsd.org) Message-Id: <201210100438.q9A4cTam051561@svn.freebsd.org> From: Pyun YongHyeon Date: Wed, 10 Oct 2012 04:38:29 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r241392 - head/sys/dev/bge X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 10 Oct 2012 04:38:30 -0000 Author: yongari Date: Wed Oct 10 04:38:29 2012 New Revision: 241392 URL: http://svn.freebsd.org/changeset/base/241392 Log: Fix a long standing VCPU reset sequence bug on BCM5906. The VCPU(Virtual CPU) of BCM5906 is used to provide a mechanism to control the bootcode execution and to pick up configuration data stored inside the EEPROM. The bootcode of BCM5906 will check the BGE_VCPU_STATUS_DRV_RESET bit to decide which booting procedure to choose. Data sheet indicates the VCPU of BCM5906 should set BGE_VCPU_STATUS_DRV_RESET bit *before* VCPU reset or global reset. Modified: head/sys/dev/bge/if_bge.c Modified: head/sys/dev/bge/if_bge.c ============================================================================== --- head/sys/dev/bge/if_bge.c Wed Oct 10 02:35:10 2012 (r241391) +++ head/sys/dev/bge/if_bge.c Wed Oct 10 04:38:29 2012 (r241392) @@ -3616,6 +3616,15 @@ bge_reset(struct bge_softc *sc) } } + if (sc->bge_asicrev == BGE_ASICREV_BCM5906) { + val = CSR_READ_4(sc, BGE_VCPU_STATUS); + CSR_WRITE_4(sc, BGE_VCPU_STATUS, + val | BGE_VCPU_STATUS_DRV_RESET); + val = CSR_READ_4(sc, BGE_VCPU_EXT_CTRL); + CSR_WRITE_4(sc, BGE_VCPU_EXT_CTRL, + val & ~BGE_VCPU_EXT_CTRL_HALT_CPU); + } + /* * Set GPHY Power Down Override to leave GPHY * powered up in D0 uninitialized. @@ -3627,15 +3636,6 @@ bge_reset(struct bge_softc *sc) /* Issue global reset */ write_op(sc, BGE_MISC_CFG, reset); - if (sc->bge_asicrev == BGE_ASICREV_BCM5906) { - val = CSR_READ_4(sc, BGE_VCPU_STATUS); - CSR_WRITE_4(sc, BGE_VCPU_STATUS, - val | BGE_VCPU_STATUS_DRV_RESET); - val = CSR_READ_4(sc, BGE_VCPU_EXT_CTRL); - CSR_WRITE_4(sc, BGE_VCPU_EXT_CTRL, - val & ~BGE_VCPU_EXT_CTRL_HALT_CPU); - } - DELAY(1000); /* XXX: Broadcom Linux driver. */ From owner-svn-src-head@FreeBSD.ORG Wed Oct 10 05:43:05 2012 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id 4D58D45E; Wed, 10 Oct 2012 05:43:05 +0000 (UTC) (envelope-from yongari@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 363EC8FC0A; Wed, 10 Oct 2012 05:43:05 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id q9A5h5jB060893; Wed, 10 Oct 2012 05:43:05 GMT (envelope-from yongari@svn.freebsd.org) Received: (from yongari@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q9A5h5PB060891; Wed, 10 Oct 2012 05:43:05 GMT (envelope-from yongari@svn.freebsd.org) Message-Id: <201210100543.q9A5h5PB060891@svn.freebsd.org> From: Pyun YongHyeon Date: Wed, 10 Oct 2012 05:43:05 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r241393 - head/sys/dev/bge X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 10 Oct 2012 05:43:05 -0000 Author: yongari Date: Wed Oct 10 05:43:04 2012 New Revision: 241393 URL: http://svn.freebsd.org/changeset/base/241393 Log: Remove unnecessary delay. I don't see any comments in data sheet that requires 10ms delay after device reset. Because that code was there from day 1, I guess it was added to give enough settlement time after updating BGE_MAC_MODE register. The recommended delay time for BGE_MAC_MODE after updating is 40us and it was already done in r241219. Modified: head/sys/dev/bge/if_bge.c Modified: head/sys/dev/bge/if_bge.c ============================================================================== --- head/sys/dev/bge/if_bge.c Wed Oct 10 04:38:29 2012 (r241392) +++ head/sys/dev/bge/if_bge.c Wed Oct 10 05:43:04 2012 (r241393) @@ -3784,7 +3784,6 @@ bge_reset(struct bge_softc *sc) val = CSR_READ_4(sc, 0x7C00); CSR_WRITE_4(sc, 0x7C00, val | (1 << 25)); } - DELAY(10000); if (sc->bge_asicrev == BGE_ASICREV_BCM5720) BGE_CLRBIT(sc, BGE_CPMU_CLCK_ORIDE, From owner-svn-src-head@FreeBSD.ORG Wed Oct 10 08:36:40 2012 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id 695901F6; Wed, 10 Oct 2012 08:36:40 +0000 (UTC) (envelope-from kevlo@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 4DD348FC08; Wed, 10 Oct 2012 08:36:40 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id q9A8ae2q088352; Wed, 10 Oct 2012 08:36:40 GMT (envelope-from kevlo@svn.freebsd.org) Received: (from kevlo@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q9A8adKj088270; Wed, 10 Oct 2012 08:36:39 GMT (envelope-from kevlo@svn.freebsd.org) Message-Id: <201210100836.q9A8adKj088270@svn.freebsd.org> From: Kevin Lo Date: Wed, 10 Oct 2012 08:36:39 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r241394 - in head: share/examples/kld/dyn_sysctl share/examples/kld/firmware/fwconsumer share/man/man9 sys/amd64/linux32 sys/cddl/contrib/opensolaris/uts/common/fs/zfs sys/compat/svr4 s... X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 10 Oct 2012 08:36:40 -0000 Author: kevlo Date: Wed Oct 10 08:36:38 2012 New Revision: 241394 URL: http://svn.freebsd.org/changeset/base/241394 Log: Revert previous commit... Pointyhat to: kevlo (myself) Modified: head/share/examples/kld/dyn_sysctl/dyn_sysctl.c head/share/examples/kld/firmware/fwconsumer/fw_consumer.c head/share/man/man9/module.9 head/sys/amd64/linux32/linux32_sysvec.c head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_ioctl.c head/sys/compat/svr4/svr4_sysvec.c head/sys/contrib/ipfilter/netinet/mlfk_ipl.c head/sys/contrib/rdma/rdma_addr.c head/sys/contrib/rdma/rdma_cma.c head/sys/contrib/rdma/rdma_device.c head/sys/contrib/rdma/rdma_iwcm.c head/sys/crypto/rc4/rc4.c head/sys/dev/bktr/bktr_mem.c head/sys/dev/cxgb/cxgb_t3fw.c head/sys/dev/cxgb/ulp/iw_cxgb/iw_cxgb.c head/sys/dev/cxgb/ulp/tom/cxgb_tom.c head/sys/dev/cxgbe/tom/t4_tom.c head/sys/dev/drm2/drm_drv.c head/sys/dev/iscsi/initiator/iscsi.c head/sys/dev/mxge/mxge_eth_z8e.c head/sys/dev/mxge/mxge_ethp_z8e.c head/sys/dev/mxge/mxge_rss_eth_z8e.c head/sys/dev/mxge/mxge_rss_ethp_z8e.c head/sys/dev/nvd/nvd.c head/sys/dev/nvme/nvme.c head/sys/dev/rndtest/rndtest.c head/sys/dev/streams/streams.c head/sys/dev/tdfx/tdfx_linux.c head/sys/dev/usb/net/usb_ethernet.c head/sys/dev/utopia/utopia.c head/sys/dev/virtio/virtio.c head/sys/i386/ibcs2/ibcs2_sysvec.c head/sys/i386/isa/elink.c head/sys/i386/linux/linux_sysvec.c head/sys/net/bridgestp.c head/sys/net/if_arcsubr.c head/sys/net/if_atmsubr.c head/sys/net/if_bridge.c head/sys/net/if_enc.c head/sys/net/if_epair.c head/sys/net/if_ethersubr.c head/sys/net/if_faith.c head/sys/net/if_fddisubr.c head/sys/net/if_fwsubr.c head/sys/net/if_gif.c head/sys/net/if_gre.c head/sys/net/if_iso88025subr.c head/sys/net/if_lagg.c head/sys/net/if_loop.c head/sys/net/if_spppsubr.c head/sys/net/if_stf.c head/sys/net/if_tun.c head/sys/net/if_vlan.c head/sys/net/zlib.c head/sys/net80211/ieee80211_freebsd.c head/sys/net80211/ieee80211_freebsd.h head/sys/netgraph/atm/ngatmbase.c head/sys/netinet/igmp.c head/sys/netinet/ip_carp.c head/sys/netinet/ip_divert.c head/sys/netinet/ip_mroute.c head/sys/netinet/toecore.c head/sys/netinet6/ip6_mroute.c head/sys/netinet6/mld6.c head/sys/netinet6/send.c head/sys/netpfil/ipfw/ip_fw2.c head/sys/netpfil/ipfw/ip_fw_nat.c head/sys/netpfil/pf/if_pflog.c head/sys/netpfil/pf/if_pfsync.c head/sys/netpfil/pf/pf_ioctl.c head/sys/nfs/nfs_nfssvc.c head/sys/nfsserver/nfs_srvsubs.c head/sys/opencrypto/cryptodev.c head/sys/tools/fw_stub.awk head/tools/regression/kthread/kld/kthrdlk.c head/tools/regression/net80211/ccmp/test_ccmp.c head/tools/regression/net80211/tkip/test_tkip.c head/tools/regression/net80211/wep/test_wep.c head/tools/tools/kttcp/sys/kttcp.c Modified: head/share/examples/kld/dyn_sysctl/dyn_sysctl.c ============================================================================== --- head/share/examples/kld/dyn_sysctl/dyn_sysctl.c Wed Oct 10 05:43:04 2012 (r241393) +++ head/share/examples/kld/dyn_sysctl/dyn_sysctl.c Wed Oct 10 08:36:38 2012 (r241394) @@ -163,7 +163,7 @@ load(module_t mod, int cmd, void *arg) static moduledata_t mod_data = { "dyn_sysctl", load, - NULL + 0 }; DECLARE_MODULE(dyn_sysctl, mod_data, SI_SUB_EXEC, SI_ORDER_ANY); Modified: head/share/examples/kld/firmware/fwconsumer/fw_consumer.c ============================================================================== --- head/share/examples/kld/firmware/fwconsumer/fw_consumer.c Wed Oct 10 05:43:04 2012 (r241393) +++ head/share/examples/kld/firmware/fwconsumer/fw_consumer.c Wed Oct 10 08:36:38 2012 (r241394) @@ -71,7 +71,7 @@ fw_consumer_modevent(module_t mod, int t static moduledata_t fw_consumer_mod = { "fw_consumer", fw_consumer_modevent, - NULL + 0 }; DECLARE_MODULE(fw_consumer, fw_consumer_mod, SI_SUB_DRIVERS, SI_ORDER_ANY); MODULE_VERSION(fw_consumer, 1); Modified: head/share/man/man9/module.9 ============================================================================== --- head/share/man/man9/module.9 Wed Oct 10 05:43:04 2012 (r241393) +++ head/share/man/man9/module.9 Wed Oct 10 08:36:38 2012 (r241394) @@ -99,7 +99,7 @@ static int foo_handler(module_t mod, int static moduledata_t mod_data= { "foo", foo_handler, - NULL + 0 }; MODULE_VERSION(foo, 1); Modified: head/sys/amd64/linux32/linux32_sysvec.c ============================================================================== --- head/sys/amd64/linux32/linux32_sysvec.c Wed Oct 10 05:43:04 2012 (r241393) +++ head/sys/amd64/linux32/linux32_sysvec.c Wed Oct 10 08:36:38 2012 (r241394) @@ -1198,7 +1198,7 @@ linux_elf_modevent(module_t mod, int typ static moduledata_t linux_elf_mod = { "linuxelf", linux_elf_modevent, - NULL + 0 }; DECLARE_MODULE_TIED(linuxelf, linux_elf_mod, SI_SUB_EXEC, SI_ORDER_ANY); Modified: head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_ioctl.c ============================================================================== --- head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_ioctl.c Wed Oct 10 05:43:04 2012 (r241393) +++ head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_ioctl.c Wed Oct 10 08:36:38 2012 (r241394) @@ -5526,7 +5526,7 @@ zfs_modevent(module_t mod, int type, voi static moduledata_t zfs_mod = { "zfsctrl", zfs_modevent, - NULL + 0 }; DECLARE_MODULE(zfsctrl, zfs_mod, SI_SUB_VFS, SI_ORDER_ANY); MODULE_DEPEND(zfsctrl, opensolaris, 1, 1, 1); Modified: head/sys/compat/svr4/svr4_sysvec.c ============================================================================== --- head/sys/compat/svr4/svr4_sysvec.c Wed Oct 10 05:43:04 2012 (r241393) +++ head/sys/compat/svr4/svr4_sysvec.c Wed Oct 10 08:36:38 2012 (r241394) @@ -308,7 +308,7 @@ svr4_elf_modevent(module_t mod, int type static moduledata_t svr4_elf_mod = { "svr4elf", svr4_elf_modevent, - NULL + 0 }; DECLARE_MODULE_TIED(svr4elf, svr4_elf_mod, SI_SUB_EXEC, SI_ORDER_ANY); MODULE_DEPEND(svr4elf, streams, 1, 1, 1); Modified: head/sys/contrib/ipfilter/netinet/mlfk_ipl.c ============================================================================== --- head/sys/contrib/ipfilter/netinet/mlfk_ipl.c Wed Oct 10 05:43:04 2012 (r241393) +++ head/sys/contrib/ipfilter/netinet/mlfk_ipl.c Wed Oct 10 08:36:38 2012 (r241394) @@ -275,7 +275,7 @@ ipf_modunload() static moduledata_t ipfiltermod = { "ipfilter", ipfilter_modevent, - NULL + 0 }; Modified: head/sys/contrib/rdma/rdma_addr.c ============================================================================== --- head/sys/contrib/rdma/rdma_addr.c Wed Oct 10 05:43:04 2012 (r241393) +++ head/sys/contrib/rdma/rdma_addr.c Wed Oct 10 08:36:38 2012 (r241394) @@ -407,7 +407,7 @@ addr_load(module_t mod, int cmd, void *a static moduledata_t mod_data = { "rdma_addr", addr_load, - NULL + 0 }; MODULE_VERSION(rdma_addr, 1); Modified: head/sys/contrib/rdma/rdma_cma.c ============================================================================== --- head/sys/contrib/rdma/rdma_cma.c Wed Oct 10 05:43:04 2012 (r241393) +++ head/sys/contrib/rdma/rdma_cma.c Wed Oct 10 08:36:38 2012 (r241394) @@ -2990,7 +2990,7 @@ cma_load(module_t mod, int cmd, void *ar static moduledata_t mod_data = { "rdma_cma", cma_load, - NULL + 0 }; MODULE_VERSION(rdma_cma, 1); Modified: head/sys/contrib/rdma/rdma_device.c ============================================================================== --- head/sys/contrib/rdma/rdma_device.c Wed Oct 10 05:43:04 2012 (r241393) +++ head/sys/contrib/rdma/rdma_device.c Wed Oct 10 08:36:38 2012 (r241394) @@ -769,7 +769,7 @@ rdma_core_load(module_t mod, int cmd, vo static moduledata_t mod_data = { "rdma_core", rdma_core_load, - NULL + 0 }; MODULE_VERSION(rdma_core, 1); Modified: head/sys/contrib/rdma/rdma_iwcm.c ============================================================================== --- head/sys/contrib/rdma/rdma_iwcm.c Wed Oct 10 05:43:04 2012 (r241393) +++ head/sys/contrib/rdma/rdma_iwcm.c Wed Oct 10 08:36:38 2012 (r241394) @@ -1078,7 +1078,7 @@ iw_cm_load(module_t mod, int cmd, void * static moduledata_t mod_data = { "rdma_iwcm", iw_cm_load, - NULL + 0 }; MODULE_VERSION(rdma_iwcm, 1); Modified: head/sys/crypto/rc4/rc4.c ============================================================================== --- head/sys/crypto/rc4/rc4.c Wed Oct 10 05:43:04 2012 (r241393) +++ head/sys/crypto/rc4/rc4.c Wed Oct 10 08:36:38 2012 (r241394) @@ -122,7 +122,7 @@ rc4_modevent(module_t mod, int type, voi static moduledata_t rc4_mod = { "rc4", rc4_modevent, - NULL + 0 }; DECLARE_MODULE(rc4, rc4_mod, SI_SUB_DRIVERS, SI_ORDER_FIRST); MODULE_VERSION(rc4, 1); Modified: head/sys/dev/bktr/bktr_mem.c ============================================================================== --- head/sys/dev/bktr/bktr_mem.c Wed Oct 10 05:43:04 2012 (r241393) +++ head/sys/dev/bktr/bktr_mem.c Wed Oct 10 08:36:38 2012 (r241394) @@ -182,7 +182,7 @@ bktr_retrieve_address(int unit, int type static moduledata_t bktr_mem_mod = { "bktr_mem", bktr_mem_modevent, - NULL + 0 }; /* Modified: head/sys/dev/cxgb/cxgb_t3fw.c ============================================================================== --- head/sys/dev/cxgb/cxgb_t3fw.c Wed Oct 10 05:43:04 2012 (r241393) +++ head/sys/dev/cxgb/cxgb_t3fw.c Wed Oct 10 08:36:38 2012 (r241394) @@ -43,7 +43,7 @@ cxgb_t3fw_modevent(module_t mod, int typ static moduledata_t cxgb_t3fw_mod = { "cxgb_t3fw", cxgb_t3fw_modevent, - NULL + 0 }; DECLARE_MODULE(cxgb_t3fw, cxgb_t3fw_mod, SI_SUB_DRIVERS, SI_ORDER_FIRST); MODULE_VERSION(cxgb_t3fw, 1); @@ -76,7 +76,7 @@ cxgb_t3b_protocol_sram_modevent(module_t static moduledata_t cxgb_t3b_protocol_sram_mod = { "cxgb_t3b_protocol_sram", cxgb_t3b_protocol_sram_modevent, - NULL + 0 }; DECLARE_MODULE(cxgb_t3b_protocol_sram, cxgb_t3b_protocol_sram_mod, SI_SUB_DRIVERS, SI_ORDER_FIRST); MODULE_VERSION(cxgb_t3b_protocol_sram, 1); @@ -109,7 +109,7 @@ cxgb_t3b_tp_eeprom_modevent(module_t mod static moduledata_t cxgb_t3b_tp_eeprom_mod = { "cxgb_t3b_tp_eeprom", cxgb_t3b_tp_eeprom_modevent, - NULL + 0 }; DECLARE_MODULE(cxgb_t3b_tp_eeprom, cxgb_t3b_tp_eeprom_mod, SI_SUB_DRIVERS, SI_ORDER_FIRST); MODULE_VERSION(cxgb_t3b_tp_eeprom, 1); @@ -142,7 +142,7 @@ cxgb_t3c_protocol_sram_modevent(module_t static moduledata_t cxgb_t3c_protocol_sram_mod = { "cxgb_t3c_protocol_sram", cxgb_t3c_protocol_sram_modevent, - NULL + 0 }; DECLARE_MODULE(cxgb_t3c_protocol_sram, cxgb_t3c_protocol_sram_mod, SI_SUB_DRIVERS, SI_ORDER_FIRST); MODULE_VERSION(cxgb_t3c_protocol_sram, 1); @@ -175,7 +175,7 @@ cxgb_t3c_tp_eeprom_modevent(module_t mod static moduledata_t cxgb_t3c_tp_eeprom_mod = { "cxgb_t3c_tp_eeprom", cxgb_t3c_tp_eeprom_modevent, - NULL + 0 }; DECLARE_MODULE(cxgb_t3c_tp_eeprom, cxgb_t3c_tp_eeprom_mod, SI_SUB_DRIVERS, SI_ORDER_FIRST); MODULE_VERSION(cxgb_t3c_tp_eeprom, 1); Modified: head/sys/dev/cxgb/ulp/iw_cxgb/iw_cxgb.c ============================================================================== --- head/sys/dev/cxgb/ulp/iw_cxgb/iw_cxgb.c Wed Oct 10 05:43:04 2012 (r241393) +++ head/sys/dev/cxgb/ulp/iw_cxgb/iw_cxgb.c Wed Oct 10 08:36:38 2012 (r241394) @@ -290,7 +290,7 @@ iwch_modevent(module_t mod, int cmd, voi static moduledata_t iwch_mod_data = { "iw_cxgb", iwch_modevent, - NULL + 0 }; MODULE_VERSION(iw_cxgb, 1); Modified: head/sys/dev/cxgb/ulp/tom/cxgb_tom.c ============================================================================== --- head/sys/dev/cxgb/ulp/tom/cxgb_tom.c Wed Oct 10 05:43:04 2012 (r241393) +++ head/sys/dev/cxgb/ulp/tom/cxgb_tom.c Wed Oct 10 08:36:38 2012 (r241394) @@ -387,7 +387,7 @@ t3_tom_modevent(module_t mod, int cmd, v static moduledata_t t3_tom_moddata= { "t3_tom", t3_tom_modevent, - NULL + 0 }; MODULE_VERSION(t3_tom, 1); Modified: head/sys/dev/cxgbe/tom/t4_tom.c ============================================================================== --- head/sys/dev/cxgbe/tom/t4_tom.c Wed Oct 10 05:43:04 2012 (r241393) +++ head/sys/dev/cxgbe/tom/t4_tom.c Wed Oct 10 08:36:38 2012 (r241394) @@ -768,7 +768,7 @@ t4_tom_modevent(module_t mod, int cmd, v static moduledata_t t4_tom_moddata= { "t4_tom", t4_tom_modevent, - NULL + 0 }; MODULE_VERSION(t4_tom, 1); Modified: head/sys/dev/drm2/drm_drv.c ============================================================================== --- head/sys/dev/drm2/drm_drv.c Wed Oct 10 05:43:04 2012 (r241393) +++ head/sys/dev/drm2/drm_drv.c Wed Oct 10 08:36:38 2012 (r241394) @@ -74,7 +74,7 @@ drm_modevent(module_t mod, int type, voi static moduledata_t drm_mod = { "drmn", drm_modevent, - NULL + 0 }; DECLARE_MODULE(drmn, drm_mod, SI_SUB_DRIVERS, SI_ORDER_FIRST); MODULE_VERSION(drmn, 1); Modified: head/sys/dev/iscsi/initiator/iscsi.c ============================================================================== --- head/sys/dev/iscsi/initiator/iscsi.c Wed Oct 10 05:43:04 2012 (r241393) +++ head/sys/dev/iscsi/initiator/iscsi.c Wed Oct 10 08:36:38 2012 (r241394) @@ -855,9 +855,9 @@ iscsi_modevent(module_t mod, int what, v } moduledata_t iscsi_mod = { - "iscsi", - (modeventhand_t) iscsi_modevent, - NULL + "iscsi", + (modeventhand_t) iscsi_modevent, + 0 }; #ifdef ISCSI_ROOT Modified: head/sys/dev/mxge/mxge_eth_z8e.c ============================================================================== --- head/sys/dev/mxge/mxge_eth_z8e.c Wed Oct 10 05:43:04 2012 (r241393) +++ head/sys/dev/mxge/mxge_eth_z8e.c Wed Oct 10 08:36:38 2012 (r241394) @@ -39,7 +39,7 @@ mxge_eth_z8e_fw_modevent(module_t mod, i static moduledata_t mxge_eth_z8e_fw_mod = { "mxge_eth_z8e_fw", mxge_eth_z8e_fw_modevent, - NULL + 0 }; DECLARE_MODULE(mxge_eth_z8e_fw, mxge_eth_z8e_fw_mod, SI_SUB_DRIVERS, SI_ORDER_FIRST); MODULE_VERSION(mxge_eth_z8e_fw, 1); Modified: head/sys/dev/mxge/mxge_ethp_z8e.c ============================================================================== --- head/sys/dev/mxge/mxge_ethp_z8e.c Wed Oct 10 05:43:04 2012 (r241393) +++ head/sys/dev/mxge/mxge_ethp_z8e.c Wed Oct 10 08:36:38 2012 (r241394) @@ -39,7 +39,7 @@ mxge_ethp_z8e_fw_modevent(module_t mod, static moduledata_t mxge_ethp_z8e_fw_mod = { "mxge_ethp_z8e_fw", mxge_ethp_z8e_fw_modevent, - NULL + 0 }; DECLARE_MODULE(mxge_ethp_z8e_fw, mxge_ethp_z8e_fw_mod, SI_SUB_DRIVERS, SI_ORDER_FIRST); MODULE_VERSION(mxge_ethp_z8e_fw, 1); Modified: head/sys/dev/mxge/mxge_rss_eth_z8e.c ============================================================================== --- head/sys/dev/mxge/mxge_rss_eth_z8e.c Wed Oct 10 05:43:04 2012 (r241393) +++ head/sys/dev/mxge/mxge_rss_eth_z8e.c Wed Oct 10 08:36:38 2012 (r241394) @@ -39,7 +39,7 @@ mxge_rss_eth_z8e_fw_modevent(module_t mo static moduledata_t mxge_rss_eth_z8e_fw_mod = { "mxge_rss_eth_z8e_fw", mxge_rss_eth_z8e_fw_modevent, - NULL + 0 }; DECLARE_MODULE(mxge_rss_eth_z8e_fw, mxge_rss_eth_z8e_fw_mod, SI_SUB_DRIVERS, SI_ORDER_FIRST); MODULE_VERSION(mxge_rss_eth_z8e_fw, 1); Modified: head/sys/dev/mxge/mxge_rss_ethp_z8e.c ============================================================================== --- head/sys/dev/mxge/mxge_rss_ethp_z8e.c Wed Oct 10 05:43:04 2012 (r241393) +++ head/sys/dev/mxge/mxge_rss_ethp_z8e.c Wed Oct 10 08:36:38 2012 (r241394) @@ -39,7 +39,7 @@ mxge_rss_ethp_z8e_fw_modevent(module_t m static moduledata_t mxge_rss_ethp_z8e_fw_mod = { "mxge_rss_ethp_z8e_fw", mxge_rss_ethp_z8e_fw_modevent, - NULL + 0 }; DECLARE_MODULE(mxge_rss_ethp_z8e_fw, mxge_rss_ethp_z8e_fw_mod, SI_SUB_DRIVERS, SI_ORDER_FIRST); MODULE_VERSION(mxge_rss_ethp_z8e_fw, 1); Modified: head/sys/dev/nvd/nvd.c ============================================================================== --- head/sys/dev/nvd/nvd.c Wed Oct 10 05:43:04 2012 (r241393) +++ head/sys/dev/nvd/nvd.c Wed Oct 10 08:36:38 2012 (r241394) @@ -93,7 +93,7 @@ static int nvd_modevent(module_t mod, in moduledata_t nvd_mod = { "nvd", (modeventhand_t)nvd_modevent, - NULL + 0 }; DECLARE_MODULE(nvd, nvd_mod, SI_SUB_DRIVERS, SI_ORDER_ANY); Modified: head/sys/dev/nvme/nvme.c ============================================================================== --- head/sys/dev/nvme/nvme.c Wed Oct 10 05:43:04 2012 (r241393) +++ head/sys/dev/nvme/nvme.c Wed Oct 10 08:36:38 2012 (r241394) @@ -177,7 +177,7 @@ nvme_modevent(module_t mod, int type, vo moduledata_t nvme_mod = { "nvme", (modeventhand_t)nvme_modevent, - NULL + 0 }; DECLARE_MODULE(nvme, nvme_mod, SI_SUB_DRIVERS, SI_ORDER_FIRST); Modified: head/sys/dev/rndtest/rndtest.c ============================================================================== --- head/sys/dev/rndtest/rndtest.c Wed Oct 10 05:43:04 2012 (r241393) +++ head/sys/dev/rndtest/rndtest.c Wed Oct 10 08:36:38 2012 (r241394) @@ -402,7 +402,7 @@ rndtest_modevent(module_t mod, int type, static moduledata_t rndtest_mod = { "rndtest", rndtest_modevent, - NULL + 0 }; DECLARE_MODULE(rndtest, rndtest_mod, SI_SUB_DRIVERS, SI_ORDER_ANY); MODULE_VERSION(rndtest, 1); Modified: head/sys/dev/streams/streams.c ============================================================================== --- head/sys/dev/streams/streams.c Wed Oct 10 05:43:04 2012 (r241393) +++ head/sys/dev/streams/streams.c Wed Oct 10 08:36:38 2012 (r241394) @@ -171,7 +171,7 @@ streams_modevent(module_t mod, int type, static moduledata_t streams_mod = { "streams", streams_modevent, - NULL + 0 }; DECLARE_MODULE(streams, streams_mod, SI_SUB_DRIVERS, SI_ORDER_ANY); MODULE_VERSION(streams, 1); Modified: head/sys/dev/tdfx/tdfx_linux.c ============================================================================== --- head/sys/dev/tdfx/tdfx_linux.c Wed Oct 10 05:43:04 2012 (r241393) +++ head/sys/dev/tdfx/tdfx_linux.c Wed Oct 10 08:36:38 2012 (r241394) @@ -78,7 +78,7 @@ tdfx_linux_modevent(struct module *mod _ static moduledata_t tdfx_linux_mod = { "tdfx_linux", tdfx_linux_modevent, - NULL + 0 }; /* As in SYSCALL_MODULE */ Modified: head/sys/dev/usb/net/usb_ethernet.c ============================================================================== --- head/sys/dev/usb/net/usb_ethernet.c Wed Oct 10 05:43:04 2012 (r241393) +++ head/sys/dev/usb/net/usb_ethernet.c Wed Oct 10 08:36:38 2012 (r241394) @@ -549,7 +549,7 @@ uether_modevent(module_t mod, int type, static moduledata_t uether_mod = { "uether", uether_modevent, - NULL + 0 }; struct mbuf * Modified: head/sys/dev/utopia/utopia.c ============================================================================== --- head/sys/dev/utopia/utopia.c Wed Oct 10 05:43:04 2012 (r241393) +++ head/sys/dev/utopia/utopia.c Wed Oct 10 08:36:38 2012 (r241394) @@ -668,7 +668,7 @@ utopia_mod_init(module_t mod, int what, static moduledata_t utopia_mod = { "utopia", utopia_mod_init, - NULL + 0 }; DECLARE_MODULE(utopia, utopia_mod, SI_SUB_INIT_IF, SI_ORDER_ANY); Modified: head/sys/dev/virtio/virtio.c ============================================================================== --- head/sys/dev/virtio/virtio.c Wed Oct 10 05:43:04 2012 (r241393) +++ head/sys/dev/virtio/virtio.c Wed Oct 10 08:36:38 2012 (r241394) @@ -269,7 +269,7 @@ virtio_modevent(module_t mod, int type, static moduledata_t virtio_mod = { "virtio", virtio_modevent, - NULL + 0 }; DECLARE_MODULE(virtio, virtio_mod, SI_SUB_DRIVERS, SI_ORDER_FIRST); Modified: head/sys/i386/ibcs2/ibcs2_sysvec.c ============================================================================== --- head/sys/i386/ibcs2/ibcs2_sysvec.c Wed Oct 10 05:43:04 2012 (r241393) +++ head/sys/i386/ibcs2/ibcs2_sysvec.c Wed Oct 10 08:36:38 2012 (r241394) @@ -133,6 +133,6 @@ ibcs2_modevent(module_t mod, int type, v static moduledata_t ibcs2_mod = { "ibcs2", ibcs2_modevent, - NULL + 0 }; DECLARE_MODULE_TIED(ibcs2, ibcs2_mod, SI_SUB_PSEUDO, SI_ORDER_ANY); Modified: head/sys/i386/isa/elink.c ============================================================================== --- head/sys/i386/isa/elink.c Wed Oct 10 05:43:04 2012 (r241393) +++ head/sys/i386/isa/elink.c Wed Oct 10 08:36:38 2012 (r241394) @@ -87,7 +87,7 @@ elink_idseq(u_char p) static moduledata_t elink_mod = { "elink",/* module name */ NULL, /* event handler */ - NULL /* extra data */ + 0 /* extra data */ }; DECLARE_MODULE(elink, elink_mod, SI_SUB_PSEUDO, SI_ORDER_ANY); Modified: head/sys/i386/linux/linux_sysvec.c ============================================================================== --- head/sys/i386/linux/linux_sysvec.c Wed Oct 10 05:43:04 2012 (r241393) +++ head/sys/i386/linux/linux_sysvec.c Wed Oct 10 08:36:38 2012 (r241394) @@ -1173,7 +1173,7 @@ linux_elf_modevent(module_t mod, int typ static moduledata_t linux_elf_mod = { "linuxelf", linux_elf_modevent, - NULL + 0 }; DECLARE_MODULE_TIED(linuxelf, linux_elf_mod, SI_SUB_EXEC, SI_ORDER_ANY); Modified: head/sys/net/bridgestp.c ============================================================================== --- head/sys/net/bridgestp.c Wed Oct 10 05:43:04 2012 (r241393) +++ head/sys/net/bridgestp.c Wed Oct 10 08:36:38 2012 (r241394) @@ -2124,7 +2124,7 @@ bstp_modevent(module_t mod, int type, vo static moduledata_t bstp_mod = { "bridgestp", bstp_modevent, - NULL + 0 }; DECLARE_MODULE(bridgestp, bstp_mod, SI_SUB_PSEUDO, SI_ORDER_ANY); Modified: head/sys/net/if_arcsubr.c ============================================================================== --- head/sys/net/if_arcsubr.c Wed Oct 10 05:43:04 2012 (r241393) +++ head/sys/net/if_arcsubr.c Wed Oct 10 08:36:38 2012 (r241394) @@ -878,7 +878,7 @@ arc_modevent(module_t mod, int type, voi static moduledata_t arc_mod = { "arcnet", arc_modevent, - NULL + 0 }; DECLARE_MODULE(arcnet, arc_mod, SI_SUB_INIT_IF, SI_ORDER_ANY); Modified: head/sys/net/if_atmsubr.c ============================================================================== --- head/sys/net/if_atmsubr.c Wed Oct 10 05:43:04 2012 (r241393) +++ head/sys/net/if_atmsubr.c Wed Oct 10 08:36:38 2012 (r241394) @@ -496,7 +496,7 @@ atm_modevent(module_t mod, int type, voi static moduledata_t atm_mod = { "atm", atm_modevent, - NULL + 0 }; DECLARE_MODULE(atm, atm_mod, SI_SUB_INIT_IF, SI_ORDER_ANY); Modified: head/sys/net/if_bridge.c ============================================================================== --- head/sys/net/if_bridge.c Wed Oct 10 05:43:04 2012 (r241393) +++ head/sys/net/if_bridge.c Wed Oct 10 08:36:38 2012 (r241394) @@ -523,7 +523,7 @@ bridge_modevent(module_t mod, int type, static moduledata_t bridge_mod = { "if_bridge", bridge_modevent, - NULL + 0 }; DECLARE_MODULE(if_bridge, bridge_mod, SI_SUB_PSEUDO, SI_ORDER_ANY); Modified: head/sys/net/if_enc.c ============================================================================== --- head/sys/net/if_enc.c Wed Oct 10 05:43:04 2012 (r241393) +++ head/sys/net/if_enc.c Wed Oct 10 08:36:38 2012 (r241394) @@ -181,7 +181,7 @@ enc_modevent(module_t mod, int type, voi static moduledata_t enc_mod = { "if_enc", enc_modevent, - NULL + 0 }; DECLARE_MODULE(if_enc, enc_mod, SI_SUB_PROTO_IFATTACHDOMAIN, SI_ORDER_ANY); Modified: head/sys/net/if_epair.c ============================================================================== --- head/sys/net/if_epair.c Wed Oct 10 05:43:04 2012 (r241393) +++ head/sys/net/if_epair.c Wed Oct 10 08:36:38 2012 (r241394) @@ -978,7 +978,7 @@ epair_modevent(module_t mod, int type, v static moduledata_t epair_mod = { "if_epair", epair_modevent, - NULL + 0 }; DECLARE_MODULE(if_epair, epair_mod, SI_SUB_PSEUDO, SI_ORDER_ANY); Modified: head/sys/net/if_ethersubr.c ============================================================================== --- head/sys/net/if_ethersubr.c Wed Oct 10 05:43:04 2012 (r241393) +++ head/sys/net/if_ethersubr.c Wed Oct 10 08:36:38 2012 (r241394) @@ -1237,7 +1237,7 @@ ether_modevent(module_t mod, int type, v static moduledata_t ether_mod = { "ether", ether_modevent, - NULL + 0 }; void Modified: head/sys/net/if_faith.c ============================================================================== --- head/sys/net/if_faith.c Wed Oct 10 05:43:04 2012 (r241393) +++ head/sys/net/if_faith.c Wed Oct 10 08:36:38 2012 (r241394) @@ -136,7 +136,7 @@ faithmodevent(mod, type, data) static moduledata_t faith_mod = { "if_faith", faithmodevent, - NULL + 0 }; DECLARE_MODULE(if_faith, faith_mod, SI_SUB_PSEUDO, SI_ORDER_ANY); Modified: head/sys/net/if_fddisubr.c ============================================================================== --- head/sys/net/if_fddisubr.c Wed Oct 10 05:43:04 2012 (r241393) +++ head/sys/net/if_fddisubr.c Wed Oct 10 08:36:38 2012 (r241394) @@ -792,7 +792,7 @@ fddi_resolvemulti(ifp, llsa, sa) static moduledata_t fddi_mod = { "fddi", /* module name */ NULL, /* event handler */ - NULL /* extra data */ + 0 /* extra data */ }; DECLARE_MODULE(fddi, fddi_mod, SI_SUB_PSEUDO, SI_ORDER_ANY); Modified: head/sys/net/if_fwsubr.c ============================================================================== --- head/sys/net/if_fwsubr.c Wed Oct 10 05:43:04 2012 (r241393) +++ head/sys/net/if_fwsubr.c Wed Oct 10 08:36:38 2012 (r241394) @@ -845,7 +845,7 @@ firewire_modevent(module_t mod, int type static moduledata_t firewire_mod = { "if_firewire", firewire_modevent, - NULL + 0 }; DECLARE_MODULE(if_firewire, firewire_mod, SI_SUB_INIT_IF, SI_ORDER_ANY); Modified: head/sys/net/if_gif.c ============================================================================== --- head/sys/net/if_gif.c Wed Oct 10 05:43:04 2012 (r241393) +++ head/sys/net/if_gif.c Wed Oct 10 08:36:38 2012 (r241394) @@ -272,7 +272,7 @@ gifmodevent(mod, type, data) static moduledata_t gif_mod = { "if_gif", gifmodevent, - NULL + 0 }; DECLARE_MODULE(if_gif, gif_mod, SI_SUB_PSEUDO, SI_ORDER_ANY); Modified: head/sys/net/if_gre.c ============================================================================== --- head/sys/net/if_gre.c Wed Oct 10 05:43:04 2012 (r241393) +++ head/sys/net/if_gre.c Wed Oct 10 08:36:38 2012 (r241394) @@ -973,7 +973,7 @@ gremodevent(module_t mod, int type, void static moduledata_t gre_mod = { "if_gre", gremodevent, - NULL + 0 }; DECLARE_MODULE(if_gre, gre_mod, SI_SUB_PSEUDO, SI_ORDER_ANY); Modified: head/sys/net/if_iso88025subr.c ============================================================================== --- head/sys/net/if_iso88025subr.c Wed Oct 10 05:43:04 2012 (r241393) +++ head/sys/net/if_iso88025subr.c Wed Oct 10 08:36:38 2012 (r241394) @@ -823,7 +823,7 @@ iso88025_modevent(module_t mod, int type static moduledata_t iso88025_mod = { "iso88025", iso88025_modevent, - NULL + 0 }; DECLARE_MODULE(iso88025, iso88025_mod, SI_SUB_PSEUDO, SI_ORDER_ANY); Modified: head/sys/net/if_lagg.c ============================================================================== --- head/sys/net/if_lagg.c Wed Oct 10 05:43:04 2012 (r241393) +++ head/sys/net/if_lagg.c Wed Oct 10 08:36:38 2012 (r241394) @@ -211,7 +211,7 @@ lagg_modevent(module_t mod, int type, vo static moduledata_t lagg_mod = { "if_lagg", lagg_modevent, - NULL + 0 }; DECLARE_MODULE(if_lagg, lagg_mod, SI_SUB_PSEUDO, SI_ORDER_ANY); Modified: head/sys/net/if_loop.c ============================================================================== --- head/sys/net/if_loop.c Wed Oct 10 05:43:04 2012 (r241393) +++ head/sys/net/if_loop.c Wed Oct 10 08:36:38 2012 (r241394) @@ -205,7 +205,7 @@ loop_modevent(module_t mod, int type, vo static moduledata_t loop_mod = { "if_lo", loop_modevent, - NULL + 0 }; DECLARE_MODULE(if_lo, loop_mod, SI_SUB_PROTO_IFATTACHDOMAIN, SI_ORDER_ANY); Modified: head/sys/net/if_spppsubr.c ============================================================================== --- head/sys/net/if_spppsubr.c Wed Oct 10 05:43:04 2012 (r241393) +++ head/sys/net/if_spppsubr.c Wed Oct 10 08:36:38 2012 (r241394) @@ -494,7 +494,7 @@ sppp_modevent(module_t mod, int type, vo static moduledata_t spppmod = { "sppp", sppp_modevent, - NULL + 0 }; MODULE_VERSION(sppp, 1); DECLARE_MODULE(sppp, spppmod, SI_SUB_DRIVERS, SI_ORDER_ANY); Modified: head/sys/net/if_stf.c ============================================================================== --- head/sys/net/if_stf.c Wed Oct 10 05:43:04 2012 (r241393) +++ head/sys/net/if_stf.c Wed Oct 10 08:36:38 2012 (r241394) @@ -301,7 +301,7 @@ stfmodevent(mod, type, data) static moduledata_t stf_mod = { "if_stf", stfmodevent, - NULL + 0 }; DECLARE_MODULE(if_stf, stf_mod, SI_SUB_PSEUDO, SI_ORDER_ANY); Modified: head/sys/net/if_tun.c ============================================================================== --- head/sys/net/if_tun.c Wed Oct 10 05:43:04 2012 (r241393) +++ head/sys/net/if_tun.c Wed Oct 10 08:36:38 2012 (r241394) @@ -317,7 +317,7 @@ tunmodevent(module_t mod, int type, void static moduledata_t tun_mod = { "if_tun", tunmodevent, - NULL + 0 }; DECLARE_MODULE(if_tun, tun_mod, SI_SUB_PSEUDO, SI_ORDER_ANY); Modified: head/sys/net/if_vlan.c ============================================================================== --- head/sys/net/if_vlan.c Wed Oct 10 05:43:04 2012 (r241393) +++ head/sys/net/if_vlan.c Wed Oct 10 08:36:38 2012 (r241394) @@ -762,7 +762,7 @@ vlan_modevent(module_t mod, int type, vo static moduledata_t vlan_mod = { "if_vlan", vlan_modevent, - NULL + 0 }; DECLARE_MODULE(if_vlan, vlan_mod, SI_SUB_PSEUDO, SI_ORDER_ANY); Modified: head/sys/net/zlib.c ============================================================================== --- head/sys/net/zlib.c Wed Oct 10 05:43:04 2012 (r241393) +++ head/sys/net/zlib.c Wed Oct 10 08:36:38 2012 (r241394) @@ -5400,7 +5400,7 @@ zlib_modevent(module_t mod, int type, vo static moduledata_t zlib_mod = { "zlib", zlib_modevent, - NULL + 0 }; DECLARE_MODULE(zlib, zlib_mod, SI_SUB_DRIVERS, SI_ORDER_FIRST); MODULE_VERSION(zlib, 1); Modified: head/sys/net80211/ieee80211_freebsd.c ============================================================================== --- head/sys/net80211/ieee80211_freebsd.c Wed Oct 10 05:43:04 2012 (r241393) +++ head/sys/net80211/ieee80211_freebsd.c Wed Oct 10 08:36:38 2012 (r241394) @@ -822,7 +822,7 @@ wlan_modevent(module_t mod, int type, vo static moduledata_t wlan_mod = { "wlan", wlan_modevent, - NULL + 0 }; DECLARE_MODULE(wlan, wlan_mod, SI_SUB_DRIVERS, SI_ORDER_FIRST); MODULE_VERSION(wlan, 1); Modified: head/sys/net80211/ieee80211_freebsd.h ============================================================================== --- head/sys/net80211/ieee80211_freebsd.h Wed Oct 10 05:43:04 2012 (r241393) +++ head/sys/net80211/ieee80211_freebsd.h Wed Oct 10 08:36:38 2012 (r241394) @@ -323,7 +323,7 @@ wlan_##name##_modevent(module_t mod, int static moduledata_t name##_mod = { \ "wlan_" #name, \ wlan_##name##_modevent, \ - NULL \ + 0 \ }; \ DECLARE_MODULE(wlan_##name, name##_mod, SI_SUB_DRIVERS, SI_ORDER_FIRST);\ MODULE_VERSION(wlan_##name, version); \ Modified: head/sys/netgraph/atm/ngatmbase.c ============================================================================== --- head/sys/netgraph/atm/ngatmbase.c Wed Oct 10 05:43:04 2012 (r241393) +++ head/sys/netgraph/atm/ngatmbase.c Wed Oct 10 08:36:38 2012 (r241394) @@ -51,7 +51,7 @@ static int ngatm_handler(module_t, int, static moduledata_t ngatm_data = { "ngatmbase", ngatm_handler, - NULL + 0 }; MODULE_VERSION(ngatmbase, NGATMBASE_VERSION); Modified: head/sys/netinet/igmp.c ============================================================================== --- head/sys/netinet/igmp.c Wed Oct 10 05:43:04 2012 (r241393) +++ head/sys/netinet/igmp.c Wed Oct 10 08:36:38 2012 (r241394) @@ -3644,6 +3644,6 @@ igmp_modevent(module_t mod, int type, vo static moduledata_t igmp_mod = { "igmp", igmp_modevent, - NULL + 0 }; DECLARE_MODULE(igmp, igmp_mod, SI_SUB_PSEUDO, SI_ORDER_ANY); Modified: head/sys/netinet/ip_carp.c ============================================================================== --- head/sys/netinet/ip_carp.c Wed Oct 10 05:43:04 2012 (r241393) +++ head/sys/netinet/ip_carp.c Wed Oct 10 08:36:38 2012 (r241394) @@ -2145,7 +2145,7 @@ carp_modevent(module_t mod, int type, vo static moduledata_t carp_mod = { "carp", carp_modevent, - NULL + 0 }; DECLARE_MODULE(carp, carp_mod, SI_SUB_PROTO_DOMAIN, SI_ORDER_ANY); Modified: head/sys/netinet/ip_divert.c ============================================================================== --- head/sys/netinet/ip_divert.c Wed Oct 10 05:43:04 2012 (r241393) +++ head/sys/netinet/ip_divert.c Wed Oct 10 08:36:38 2012 (r241394) @@ -834,7 +834,7 @@ div_modevent(module_t mod, int type, voi static moduledata_t ipdivertmod = { "ipdivert", div_modevent, - NULL + 0 }; DECLARE_MODULE(ipdivert, ipdivertmod, SI_SUB_PROTO_IFATTACHDOMAIN, SI_ORDER_ANY); Modified: head/sys/netinet/ip_mroute.c ============================================================================== --- head/sys/netinet/ip_mroute.c Wed Oct 10 05:43:04 2012 (r241393) +++ head/sys/netinet/ip_mroute.c Wed Oct 10 08:36:38 2012 (r241394) @@ -2944,7 +2944,7 @@ ip_mroute_modevent(module_t mod, int typ static moduledata_t ip_mroutemod = { "ip_mroute", ip_mroute_modevent, - NULL + 0 }; DECLARE_MODULE(ip_mroute, ip_mroutemod, SI_SUB_PSEUDO, SI_ORDER_MIDDLE); Modified: head/sys/netinet/toecore.c ============================================================================== --- head/sys/netinet/toecore.c Wed Oct 10 05:43:04 2012 (r241393) +++ head/sys/netinet/toecore.c Wed Oct 10 08:36:38 2012 (r241394) @@ -570,7 +570,7 @@ toecore_mod_handler(module_t mod, int cm static moduledata_t mod_data= { "toecore", toecore_mod_handler, - NULL + 0 }; MODULE_VERSION(toecore, 1); Modified: head/sys/netinet6/ip6_mroute.c ============================================================================== --- head/sys/netinet6/ip6_mroute.c Wed Oct 10 05:43:04 2012 (r241393) +++ head/sys/netinet6/ip6_mroute.c Wed Oct 10 08:36:38 2012 (r241394) @@ -2059,7 +2059,7 @@ ip6_mroute_modevent(module_t mod, int ty static moduledata_t ip6_mroutemod = { "ip6_mroute", ip6_mroute_modevent, - NULL + 0 }; DECLARE_MODULE(ip6_mroute, ip6_mroutemod, SI_SUB_PSEUDO, SI_ORDER_ANY); Modified: head/sys/netinet6/mld6.c ============================================================================== --- head/sys/netinet6/mld6.c Wed Oct 10 05:43:04 2012 (r241393) +++ head/sys/netinet6/mld6.c Wed Oct 10 08:36:38 2012 (r241394) @@ -3309,6 +3309,6 @@ mld_modevent(module_t mod, int type, voi static moduledata_t mld_mod = { "mld", mld_modevent, - NULL + 0 }; DECLARE_MODULE(mld, mld_mod, SI_SUB_PSEUDO, SI_ORDER_ANY); Modified: head/sys/netinet6/send.c ============================================================================== --- head/sys/netinet6/send.c Wed Oct 10 05:43:04 2012 (r241393) +++ head/sys/netinet6/send.c Wed Oct 10 08:36:38 2012 (r241394) @@ -361,7 +361,7 @@ send_modevent(module_t mod, int type, vo static moduledata_t sendmod = { "send", send_modevent, - NULL + 0 }; DECLARE_MODULE(send, sendmod, SI_SUB_PROTO_DOMAIN, SI_ORDER_ANY); Modified: head/sys/netpfil/ipfw/ip_fw2.c ============================================================================== --- head/sys/netpfil/ipfw/ip_fw2.c Wed Oct 10 05:43:04 2012 (r241393) +++ head/sys/netpfil/ipfw/ip_fw2.c Wed Oct 10 08:36:38 2012 (r241394) @@ -2756,7 +2756,7 @@ ipfw_modevent(module_t mod, int type, vo static moduledata_t ipfwmod = { "ipfw", ipfw_modevent, - NULL + 0 }; /* Define startup order. */ Modified: head/sys/netpfil/ipfw/ip_fw_nat.c ============================================================================== --- head/sys/netpfil/ipfw/ip_fw_nat.c Wed Oct 10 05:43:04 2012 (r241393) +++ head/sys/netpfil/ipfw/ip_fw_nat.c Wed Oct 10 08:36:38 2012 (r241394) @@ -651,7 +651,7 @@ ipfw_nat_modevent(module_t mod, int type static moduledata_t ipfw_nat_mod = { "ipfw_nat", ipfw_nat_modevent, - NULL + 0 }; DECLARE_MODULE(ipfw_nat, ipfw_nat_mod, SI_SUB_PROTO_IFATTACHDOMAIN, SI_ORDER_ANY); Modified: head/sys/netpfil/pf/if_pflog.c ============================================================================== --- head/sys/netpfil/pf/if_pflog.c Wed Oct 10 05:43:04 2012 (r241393) +++ head/sys/netpfil/pf/if_pflog.c Wed Oct 10 08:36:38 2012 (r241394) @@ -281,7 +281,7 @@ pflog_modevent(module_t mod, int type, v return error; } -static moduledata_t pflog_mod = { "pflog", pflog_modevent, NULL }; +static moduledata_t pflog_mod = { "pflog", pflog_modevent, 0 }; #define PFLOG_MODVER 1 Modified: head/sys/netpfil/pf/if_pfsync.c ============================================================================== --- head/sys/netpfil/pf/if_pfsync.c Wed Oct 10 05:43:04 2012 (r241393) +++ head/sys/netpfil/pf/if_pfsync.c Wed Oct 10 08:36:38 2012 (r241394) @@ -2402,7 +2402,7 @@ pfsync_modevent(module_t mod, int type, static moduledata_t pfsync_mod = { "pfsync", pfsync_modevent, - NULL + 0 }; #define PFSYNC_MODVER 1 Modified: head/sys/netpfil/pf/pf_ioctl.c ============================================================================== --- head/sys/netpfil/pf/pf_ioctl.c Wed Oct 10 05:43:04 2012 (r241393) +++ head/sys/netpfil/pf/pf_ioctl.c Wed Oct 10 08:36:38 2012 (r241394) @@ -3722,7 +3722,7 @@ pf_modevent(module_t mod, int type, void static moduledata_t pf_mod = { "pf", pf_modevent, - NULL + 0 }; DECLARE_MODULE(pf, pf_mod, SI_SUB_PSEUDO, SI_ORDER_FIRST); Modified: head/sys/nfs/nfs_nfssvc.c ============================================================================== --- head/sys/nfs/nfs_nfssvc.c Wed Oct 10 05:43:04 2012 (r241393) +++ head/sys/nfs/nfs_nfssvc.c Wed Oct 10 08:36:38 2012 (r241394) @@ -147,7 +147,7 @@ nfssvc_modevent(module_t mod, int type, static moduledata_t nfssvc_mod = { "nfssvc", nfssvc_modevent, - NULL + NULL, }; DECLARE_MODULE(nfssvc, nfssvc_mod, SI_SUB_VFS, SI_ORDER_ANY); Modified: head/sys/nfsserver/nfs_srvsubs.c ============================================================================== --- head/sys/nfsserver/nfs_srvsubs.c Wed Oct 10 05:43:04 2012 (r241393) +++ head/sys/nfsserver/nfs_srvsubs.c Wed Oct 10 08:36:38 2012 (r241394) @@ -552,7 +552,7 @@ nfsrv_modevent(module_t mod, int type, v static moduledata_t nfsserver_mod = { "nfsserver", nfsrv_modevent, - NULL + NULL, }; DECLARE_MODULE(nfsserver, nfsserver_mod, SI_SUB_VFS, SI_ORDER_ANY); Modified: head/sys/opencrypto/cryptodev.c ============================================================================== --- head/sys/opencrypto/cryptodev.c Wed Oct 10 05:43:04 2012 (r241393) +++ head/sys/opencrypto/cryptodev.c Wed Oct 10 08:36:38 2012 (r241394) @@ -1171,7 +1171,7 @@ cryptodev_modevent(module_t mod, int typ static moduledata_t cryptodev_mod = { "cryptodev", cryptodev_modevent, - NULL + 0 }; MODULE_VERSION(cryptodev, 1); DECLARE_MODULE(cryptodev, cryptodev_mod, SI_SUB_PSEUDO, SI_ORDER_ANY); Modified: head/sys/tools/fw_stub.awk ============================================================================== --- head/sys/tools/fw_stub.awk Wed Oct 10 05:43:04 2012 (r241393) +++ head/sys/tools/fw_stub.awk Wed Oct 10 08:36:38 2012 (r241394) @@ -215,7 +215,7 @@ printc("\t\treturn (error);\ static moduledata_t " modname "_fw_mod = {\ \"" modname "_fw\",\ " modname "_fw_modevent,\ - NULL\ + 0\ };\ DECLARE_MODULE(" modname "_fw, " modname "_fw_mod, SI_SUB_DRIVERS, SI_ORDER_FIRST);\ MODULE_VERSION(" modname "_fw, 1);\ Modified: head/tools/regression/kthread/kld/kthrdlk.c ============================================================================== --- head/tools/regression/kthread/kld/kthrdlk.c Wed Oct 10 05:43:04 2012 (r241393) +++ head/tools/regression/kthread/kld/kthrdlk.c Wed Oct 10 08:36:38 2012 (r241394) @@ -193,11 +193,12 @@ kthrdlk_handler(module_t mod, int /*mode } static moduledata_t mod_data= { - "kthrdlk", - kthrdlk_handler, - NULL -}; + "kthrdlk", + kthrdlk_handler, + 0 + }; MODULE_VERSION(kthrdlk, 1); DECLARE_MODULE(kthrdlk, mod_data, SI_SUB_EXEC, SI_ORDER_ANY); + Modified: head/tools/regression/net80211/ccmp/test_ccmp.c ============================================================================== --- head/tools/regression/net80211/ccmp/test_ccmp.c Wed Oct 10 05:43:04 2012 (r241393) +++ head/tools/regression/net80211/ccmp/test_ccmp.c Wed Oct 10 08:36:38 2012 (r241394) @@ -742,7 +742,7 @@ test_ccmp_modevent(module_t mod, int typ static moduledata_t test_ccmp_mod = { "test_ccmp", test_ccmp_modevent, - NULL + 0 }; DECLARE_MODULE(test_ccmp, test_ccmp_mod, SI_SUB_DRIVERS, SI_ORDER_FIRST); MODULE_VERSION(test_ccmp, 1); Modified: head/tools/regression/net80211/tkip/test_tkip.c ============================================================================== --- head/tools/regression/net80211/tkip/test_tkip.c Wed Oct 10 05:43:04 2012 (r241393) +++ head/tools/regression/net80211/tkip/test_tkip.c Wed Oct 10 08:36:38 2012 (r241394) @@ -381,7 +381,7 @@ test_tkip_modevent(module_t mod, int typ static moduledata_t test_tkip_mod = { "test_tkip", test_tkip_modevent, - NULL + 0 }; DECLARE_MODULE(test_tkip, test_tkip_mod, SI_SUB_DRIVERS, SI_ORDER_FIRST); MODULE_VERSION(test_tkip, 1); Modified: head/tools/regression/net80211/wep/test_wep.c ============================================================================== --- head/tools/regression/net80211/wep/test_wep.c Wed Oct 10 05:43:04 2012 (r241393) +++ head/tools/regression/net80211/wep/test_wep.c Wed Oct 10 08:36:38 2012 (r241394) @@ -328,7 +328,7 @@ test_wep_modevent(module_t mod, int type static moduledata_t test_wep_mod = { "test_wep", test_wep_modevent, - NULL + 0 }; DECLARE_MODULE(test_wep, test_wep_mod, SI_SUB_DRIVERS, SI_ORDER_FIRST); MODULE_VERSION(test_wep, 1); Modified: head/tools/tools/kttcp/sys/kttcp.c ============================================================================== --- head/tools/tools/kttcp/sys/kttcp.c Wed Oct 10 05:43:04 2012 (r241393) +++ head/tools/tools/kttcp/sys/kttcp.c Wed Oct 10 08:36:38 2012 (r241394) @@ -268,7 +268,7 @@ kttcpdev_modevent(module_t mod, int type static moduledata_t kttcpdev_mod = { "kttcpdev", kttcpdev_modevent, - NULL + 0 }; MODULE_VERSION(kttcpdev, 1); DECLARE_MODULE(kttcpdev, kttcpdev_mod, SI_SUB_PSEUDO, SI_ORDER_ANY); From owner-svn-src-head@FreeBSD.ORG Wed Oct 10 14:47:47 2012 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id 7AFC9AFC; Wed, 10 Oct 2012 14:47:47 +0000 (UTC) (envelope-from jhb@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 635788FC14; Wed, 10 Oct 2012 14:47:47 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id q9AEllnL047183; Wed, 10 Oct 2012 14:47:47 GMT (envelope-from jhb@svn.freebsd.org) Received: (from jhb@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q9AEllVK047181; Wed, 10 Oct 2012 14:47:47 GMT (envelope-from jhb@svn.freebsd.org) Message-Id: <201210101447.q9AEllVK047181@svn.freebsd.org> From: John Baldwin Date: Wed, 10 Oct 2012 14:47:47 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r241395 - head/usr.sbin/config X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 10 Oct 2012 14:47:47 -0000 Author: jhb Date: Wed Oct 10 14:47:46 2012 New Revision: 241395 URL: http://svn.freebsd.org/changeset/base/241395 Log: - Fix the error message when a dependency string is not provided to reference a missing dependency rather than a missing compile command. - Don't append a newline to the auto-generated compile command. The compile command has a newline appended when it is later output to the Makefile. MFC after: 2 weeks Modified: head/usr.sbin/config/mkmakefile.c Modified: head/usr.sbin/config/mkmakefile.c ============================================================================== --- head/usr.sbin/config/mkmakefile.c Wed Oct 10 08:36:38 2012 (r241394) +++ head/usr.sbin/config/mkmakefile.c Wed Oct 10 14:47:46 2012 (r241395) @@ -431,7 +431,7 @@ nextparam: next_quoted_word(fp, wd); if (wd == 0) { fprintf(stderr, - "%s: %s missing compile command string.\n", + "%s: %s missing dependency string.\n", fname, this); exit(1); } @@ -762,7 +762,7 @@ do_rules(FILE *f) break; } snprintf(cmd, sizeof(cmd), - "${%s_%c%s}\n", ftype, + "${%s_%c%s}", ftype, toupper(och), ftp->f_flags & NOWERROR ? "_NOWERROR" : ""); compilewith = cmd; From owner-svn-src-head@FreeBSD.ORG Wed Oct 10 16:07:24 2012 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id 25E59DDA; Wed, 10 Oct 2012 16:07:24 +0000 (UTC) (envelope-from jhb@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 0DA608FC0A; Wed, 10 Oct 2012 16:07:24 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id q9AG7NR4059230; Wed, 10 Oct 2012 16:07:23 GMT (envelope-from jhb@svn.freebsd.org) Received: (from jhb@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q9AG7N0Q059228; Wed, 10 Oct 2012 16:07:23 GMT (envelope-from jhb@svn.freebsd.org) Message-Id: <201210101607.q9AG7N0Q059228@svn.freebsd.org> From: John Baldwin Date: Wed, 10 Oct 2012 16:07:23 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r241396 - head/share/man/man7 X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 10 Oct 2012 16:07:24 -0000 Author: jhb Date: Wed Oct 10 16:07:23 2012 New Revision: 241396 URL: http://svn.freebsd.org/changeset/base/241396 Log: WITH_CTF is now a "normal" build option (WITHOUT_CTF is supported and MK_CTF is used internally). Reviewed by: fjoe Modified: head/share/man/man7/build.7 Modified: head/share/man/man7/build.7 ============================================================================== --- head/share/man/man7/build.7 Wed Oct 10 14:47:46 2012 (r241395) +++ head/share/man/man7/build.7 Wed Oct 10 16:07:23 2012 (r241396) @@ -24,7 +24,7 @@ .\" .\" $FreeBSD$ .\" -.Dd July 2, 2012 +.Dd October 10, 2012 .Dt BUILD 7 .Os .Sh NAME @@ -382,12 +382,6 @@ even if the makefile says otherwise. .It Va WITH_CTF If defined, the build process will run the DTrace CTF conversion tools on built objects. -Please note that this WITH_ option is handled differently than all -other WITH_ options (there is no -.Va WITHOUT_CTF , -or corresponding -.Va MK_CTF -in the build system). .El .Pp Additionally, builds in From owner-svn-src-head@FreeBSD.ORG Wed Oct 10 16:52:40 2012 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id 23D90613; Wed, 10 Oct 2012 16:52:40 +0000 (UTC) (envelope-from np@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 0CFBA8FC14; Wed, 10 Oct 2012 16:52:40 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id q9AGqdaA065059; Wed, 10 Oct 2012 16:52:39 GMT (envelope-from np@svn.freebsd.org) Received: (from np@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q9AGqdCV065056; Wed, 10 Oct 2012 16:52:39 GMT (envelope-from np@svn.freebsd.org) Message-Id: <201210101652.q9AGqdCV065056@svn.freebsd.org> From: Navdeep Parhar Date: Wed, 10 Oct 2012 16:52:39 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r241397 - head/sys/dev/cxgbe X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 10 Oct 2012 16:52:40 -0000 Author: np Date: Wed Oct 10 16:52:39 2012 New Revision: 241397 URL: http://svn.freebsd.org/changeset/base/241397 Log: Remove unused item. cxgbe's rx queue's lock was removed a long time ago. MFC after: 3 days Modified: head/sys/dev/cxgbe/adapter.h head/sys/dev/cxgbe/t4_sge.c Modified: head/sys/dev/cxgbe/adapter.h ============================================================================== --- head/sys/dev/cxgbe/adapter.h Wed Oct 10 16:07:23 2012 (r241396) +++ head/sys/dev/cxgbe/adapter.h Wed Oct 10 16:52:39 2012 (r241397) @@ -282,7 +282,6 @@ struct sge_iq { bus_dma_tag_t desc_tag; bus_dmamap_t desc_map; bus_addr_t ba; /* bus address of descriptor ring */ - char lockname[16]; uint32_t flags; uint16_t abs_id; /* absolute SGE id for the iq */ int8_t intr_pktc_idx; /* packet count threshold index */ Modified: head/sys/dev/cxgbe/t4_sge.c ============================================================================== --- head/sys/dev/cxgbe/t4_sge.c Wed Oct 10 16:07:23 2012 (r241396) +++ head/sys/dev/cxgbe/t4_sge.c Wed Oct 10 16:52:39 2012 (r241397) @@ -120,7 +120,7 @@ static struct mbuf *get_fl_payload(struc int *); static int t4_eth_rx(struct sge_iq *, const struct rss_header *, struct mbuf *); static inline void init_iq(struct sge_iq *, struct adapter *, int, int, int, - int, char *); + int); static inline void init_fl(struct sge_fl *, int, int, char *); static inline void init_eq(struct sge_eq *, int, int, uint8_t, uint16_t, char *); @@ -595,10 +595,8 @@ t4_setup_port_queues(struct port_info *p */ for_each_rxq(pi, i, rxq) { - snprintf(name, sizeof(name), "%s rxq%d-iq", - device_get_nameunit(pi->dev), i); init_iq(&rxq->iq, sc, pi->tmr_idx, pi->pktc_idx, pi->qsize_rxq, - RX_IQ_ESIZE, name); + RX_IQ_ESIZE); snprintf(name, sizeof(name), "%s rxq%d-fl", device_get_nameunit(pi->dev), i); @@ -620,10 +618,8 @@ t4_setup_port_queues(struct port_info *p #ifdef TCP_OFFLOAD for_each_ofld_rxq(pi, i, ofld_rxq) { - snprintf(name, sizeof(name), "%s ofld_rxq%d-iq", - device_get_nameunit(pi->dev), i); init_iq(&ofld_rxq->iq, sc, pi->tmr_idx, pi->pktc_idx, - pi->qsize_rxq, RX_IQ_ESIZE, name); + pi->qsize_rxq, RX_IQ_ESIZE); snprintf(name, sizeof(name), "%s ofld_rxq%d-fl", device_get_nameunit(pi->dev), i); @@ -1478,7 +1474,7 @@ can_resume_tx(struct sge_eq *eq) static inline void init_iq(struct sge_iq *iq, struct adapter *sc, int tmr_idx, int pktc_idx, - int qsize, int esize, char *name) + int qsize, int esize) { KASSERT(tmr_idx >= 0 && tmr_idx < SGE_NTIMERS, ("%s: bad tmr_idx %d", __func__, tmr_idx)); @@ -1495,7 +1491,6 @@ init_iq(struct sge_iq *iq, struct adapte } iq->qsize = roundup(qsize, 16); /* See FW_IQ_CMD/iqsize */ iq->esize = max(esize, 16); /* See FW_IQ_CMD/iqesize */ - strlcpy(iq->lockname, name, sizeof(iq->lockname)); } static inline void @@ -1793,12 +1788,10 @@ alloc_fwq(struct adapter *sc) { int rc, intr_idx; struct sge_iq *fwq = &sc->sge.fwq; - char name[16]; struct sysctl_oid *oid = device_get_sysctl_tree(sc->dev); struct sysctl_oid_list *children = SYSCTL_CHILDREN(oid); - snprintf(name, sizeof(name), "%s fwq", device_get_nameunit(sc->dev)); - init_iq(fwq, sc, 0, 0, FW_IQ_QSIZE, FW_IQ_ESIZE, name); + init_iq(fwq, sc, 0, 0, FW_IQ_QSIZE, FW_IQ_ESIZE); fwq->flags |= IQ_INTR; /* always */ intr_idx = sc->intr_count > 1 ? 1 : 0; rc = alloc_iq_fl(sc->port[0], fwq, NULL, intr_idx, -1); From owner-svn-src-head@FreeBSD.ORG Wed Oct 10 16:54:15 2012 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id 02B66799; Wed, 10 Oct 2012 16:54:15 +0000 (UTC) (envelope-from np@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id E09338FC08; Wed, 10 Oct 2012 16:54:14 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id q9AGsEin065283; Wed, 10 Oct 2012 16:54:14 GMT (envelope-from np@svn.freebsd.org) Received: (from np@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q9AGsETJ065281; Wed, 10 Oct 2012 16:54:14 GMT (envelope-from np@svn.freebsd.org) Message-Id: <201210101654.q9AGsETJ065281@svn.freebsd.org> From: Navdeep Parhar Date: Wed, 10 Oct 2012 16:54:14 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r241398 - head/sys/dev/cxgbe X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 10 Oct 2012 16:54:15 -0000 Author: np Date: Wed Oct 10 16:54:14 2012 New Revision: 241398 URL: http://svn.freebsd.org/changeset/base/241398 Log: There is no need to report the same error twice. MFC after: 3 days Modified: head/sys/dev/cxgbe/t4_sge.c Modified: head/sys/dev/cxgbe/t4_sge.c ============================================================================== --- head/sys/dev/cxgbe/t4_sge.c Wed Oct 10 16:52:39 2012 (r241397) +++ head/sys/dev/cxgbe/t4_sge.c Wed Oct 10 16:54:14 2012 (r241398) @@ -417,22 +417,14 @@ t4_setup_adapter_queues(struct adapter * * Firmware event queue */ rc = alloc_fwq(sc); - if (rc != 0) { - device_printf(sc->dev, - "failed to create firmware event queue: %d\n", rc); + if (rc != 0) return (rc); - } /* * Management queue. This is just a control queue that uses the fwq as * its associated iq. */ rc = alloc_mgmtq(sc); - if (rc != 0) { - device_printf(sc->dev, - "failed to create management queue: %d\n", rc); - return (rc); - } return (rc); } From owner-svn-src-head@FreeBSD.ORG Wed Oct 10 17:13:46 2012 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id C267E65F; Wed, 10 Oct 2012 17:13:46 +0000 (UTC) (envelope-from np@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id A0E118FC0A; Wed, 10 Oct 2012 17:13:46 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id q9AHDkP2068146; Wed, 10 Oct 2012 17:13:46 GMT (envelope-from np@svn.freebsd.org) Received: (from np@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q9AHDkDV068141; Wed, 10 Oct 2012 17:13:46 GMT (envelope-from np@svn.freebsd.org) Message-Id: <201210101713.q9AHDkDV068141@svn.freebsd.org> From: Navdeep Parhar Date: Wed, 10 Oct 2012 17:13:46 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r241399 - in head/sys/dev/cxgbe: . common X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 10 Oct 2012 17:13:46 -0000 Author: np Date: Wed Oct 10 17:13:46 2012 New Revision: 241399 URL: http://svn.freebsd.org/changeset/base/241399 Log: Add a driver ioctl to read a byte from any device on a port's i2c bus. This lets userspace read arbitrary information from the SFP+ modules etc. on this bus. Reading multiple bytes in the same transaction isn't possible right now. I'll update the driver once the chip's firmware supports this. MFC after: 3 days Modified: head/sys/dev/cxgbe/common/common.h head/sys/dev/cxgbe/common/t4_hw.c head/sys/dev/cxgbe/t4_ioctl.h head/sys/dev/cxgbe/t4_main.c Modified: head/sys/dev/cxgbe/common/common.h ============================================================================== --- head/sys/dev/cxgbe/common/common.h Wed Oct 10 16:54:14 2012 (r241398) +++ head/sys/dev/cxgbe/common/common.h Wed Oct 10 17:13:46 2012 (r241399) @@ -521,6 +521,8 @@ int t4_enable_vi(struct adapter *adap, u bool rx_en, bool tx_en); int t4_identify_port(struct adapter *adap, unsigned int mbox, unsigned int viid, unsigned int nblinks); +int t4_i2c_rd(struct adapter *adap, unsigned int mbox, unsigned int port_id, + u8 dev_addr, u8 offset, u8 *valp); int t4_mdio_rd(struct adapter *adap, unsigned int mbox, unsigned int phy_addr, unsigned int mmd, unsigned int reg, unsigned int *valp); int t4_mdio_wr(struct adapter *adap, unsigned int mbox, unsigned int phy_addr, Modified: head/sys/dev/cxgbe/common/t4_hw.c ============================================================================== --- head/sys/dev/cxgbe/common/t4_hw.c Wed Oct 10 16:54:14 2012 (r241398) +++ head/sys/dev/cxgbe/common/t4_hw.c Wed Oct 10 17:13:46 2012 (r241399) @@ -3885,6 +3885,36 @@ int t4_fwaddrspace_write(struct adapter } /** + * t4_i2c_rd - read a byte from an i2c addressable device + * @adap: the adapter + * @mbox: mailbox to use for the FW command + * @port_id: the port id + * @dev_addr: the i2c device address + * @offset: the byte offset to read from + * @valp: where to store the value + */ +int t4_i2c_rd(struct adapter *adap, unsigned int mbox, unsigned int port_id, + u8 dev_addr, u8 offset, u8 *valp) +{ + int ret; + struct fw_ldst_cmd c; + + memset(&c, 0, sizeof(c)); + c.op_to_addrspace = htonl(V_FW_CMD_OP(FW_LDST_CMD) | F_FW_CMD_REQUEST | + F_FW_CMD_READ | + V_FW_LDST_CMD_ADDRSPACE(FW_LDST_ADDRSPC_FUNC_I2C)); + c.cycles_to_len16 = htonl(FW_LEN16(c)); + c.u.i2c.pid_pkd = V_FW_LDST_CMD_PID(port_id); + c.u.i2c.base = dev_addr; + c.u.i2c.boffset = offset; + + ret = t4_wr_mbox(adap, mbox, &c, sizeof(c), &c); + if (ret == 0) + *valp = c.u.i2c.data; + return ret; +} + +/** * t4_mdio_rd - read a PHY register through MDIO * @adap: the adapter * @mbox: mailbox to use for the FW command Modified: head/sys/dev/cxgbe/t4_ioctl.h ============================================================================== --- head/sys/dev/cxgbe/t4_ioctl.h Wed Oct 10 16:54:14 2012 (r241398) +++ head/sys/dev/cxgbe/t4_ioctl.h Wed Oct 10 17:13:46 2012 (r241399) @@ -49,6 +49,7 @@ enum { T4_GET_SGE_CONTEXT, /* get SGE context for a queue */ T4_LOAD_FW, /* flash firmware */ T4_GET_MEM, /* read memory */ + T4_GET_I2C, /* read from i2c addressible device */ }; struct t4_reg { @@ -69,6 +70,14 @@ struct t4_data { uint8_t *data; }; +struct t4_i2c_data { + uint8_t port_id; + uint8_t dev_addr; + uint8_t offset; + uint8_t len; + uint8_t data[8]; +}; + /* * A hardware filter is some valid combination of these. */ @@ -224,4 +233,5 @@ struct t4_mem_range { struct t4_sge_context) #define CHELSIO_T4_LOAD_FW _IOW('f', T4_LOAD_FW, struct t4_data) #define CHELSIO_T4_GET_MEM _IOW('f', T4_GET_MEM, struct t4_mem_range) +#define CHELSIO_T4_GET_I2C _IOWR('f', T4_GET_I2C, struct t4_i2c_data) #endif Modified: head/sys/dev/cxgbe/t4_main.c ============================================================================== --- head/sys/dev/cxgbe/t4_main.c Wed Oct 10 16:54:14 2012 (r241398) +++ head/sys/dev/cxgbe/t4_main.c Wed Oct 10 17:13:46 2012 (r241399) @@ -349,6 +349,7 @@ static int set_filter_wr(struct adapter static int del_filter_wr(struct adapter *, int); static int get_sge_context(struct adapter *, struct t4_sge_context *); static int read_card_mem(struct adapter *, struct t4_mem_range *); +static int read_i2c(struct adapter *, struct t4_i2c_data *); #ifdef TCP_OFFLOAD static int toe_capability(struct port_info *, int); #endif @@ -5170,6 +5171,27 @@ proceed: return (rc); } +static int +read_i2c(struct adapter *sc, struct t4_i2c_data *i2cd) +{ + int rc; + + ADAPTER_LOCK_ASSERT_OWNED(sc); /* for mbox */ + + if (i2cd->len == 0 || i2cd->port_id >= sc->params.nports) + return (EINVAL); + + if (i2cd->len > 1) { + /* XXX: need fw support for longer reads in one go */ + return (ENOTSUP); + } + + rc = -t4_i2c_rd(sc, sc->mbox, i2cd->port_id, i2cd->dev_addr, + i2cd->offset, &i2cd->data[0]); + + return (rc); +} + int t4_os_find_pci_capability(struct adapter *sc, int cap) { @@ -5373,6 +5395,11 @@ t4_ioctl(struct cdev *dev, unsigned long case CHELSIO_T4_GET_MEM: rc = read_card_mem(sc, (struct t4_mem_range *)data); break; + case CHELSIO_T4_GET_I2C: + ADAPTER_LOCK(sc); + rc = read_i2c(sc, (struct t4_i2c_data *)data); + ADAPTER_UNLOCK(sc); + break; default: rc = EINVAL; } From owner-svn-src-head@FreeBSD.ORG Wed Oct 10 17:15:35 2012 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id 917B4966; Wed, 10 Oct 2012 17:15:35 +0000 (UTC) (envelope-from alc@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 7A41B8FC16; Wed, 10 Oct 2012 17:15:35 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id q9AHFZNB068415; Wed, 10 Oct 2012 17:15:35 GMT (envelope-from alc@svn.freebsd.org) Received: (from alc@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q9AHFZT1068413; Wed, 10 Oct 2012 17:15:35 GMT (envelope-from alc@svn.freebsd.org) Message-Id: <201210101715.q9AHFZT1068413@svn.freebsd.org> From: Alan Cox Date: Wed, 10 Oct 2012 17:15:35 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r241400 - head/sys/i386/xen X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 10 Oct 2012 17:15:35 -0000 Author: alc Date: Wed Oct 10 17:15:34 2012 New Revision: 241400 URL: http://svn.freebsd.org/changeset/base/241400 Log: MFi386 r241356 Add several asserts. MFC after: 3 days Modified: head/sys/i386/xen/pmap.c Modified: head/sys/i386/xen/pmap.c ============================================================================== --- head/sys/i386/xen/pmap.c Wed Oct 10 17:13:46 2012 (r241399) +++ head/sys/i386/xen/pmap.c Wed Oct 10 17:15:34 2012 (r241400) @@ -2014,6 +2014,9 @@ pmap_pv_reclaim(pmap_t locked_pmap) pmap_pte_release(pte); if ((tpte & PG_W) != 0) continue; + KASSERT(tpte != 0, + ("pmap_pv_reclaim: pmap %p va %x zero pte", + pmap, va)); if ((tpte & PG_G) != 0) pmap_invalidate_page(pmap, va); m = PHYS_TO_VM_PAGE(tpte & PG_FRAME); @@ -2286,6 +2289,8 @@ pmap_remove_pte(pmap_t pmap, pt_entry_t PMAP_LOCK_ASSERT(pmap, MA_OWNED); oldpte = *ptq; PT_SET_VA_MA(ptq, 0, TRUE); + KASSERT(oldpte != 0, + ("pmap_remove_pte: pmap %p va %x zero pte", pmap, va)); if (oldpte & PG_W) pmap->pm_stats.wired_count -= 1; /* @@ -2470,6 +2475,8 @@ pmap_remove_all(vm_page_t m) pte = pmap_pte_quick(pmap, pv->pv_va); tpte = *pte; PT_SET_VA_MA(pte, 0, TRUE); + KASSERT(tpte != 0, ("pmap_remove_all: pmap %p va %x zero pte", + pmap, pv->pv_va)); if (tpte & PG_W) pmap->pm_stats.wired_count--; if (tpte & PG_A) @@ -3533,6 +3540,8 @@ pmap_remove_pages(pmap_t pmap) PMAP_LOCK(pmap); sched_pin(); TAILQ_FOREACH_SAFE(pc, &pmap->pm_pvchunk, pc_list, npc) { + KASSERT(pc->pc_pmap == pmap, ("Wrong pmap %p %p", pmap, + pc->pc_pmap)); allfree = 1; for (field = 0; field < _NPCM; field++) { inuse = ~pc->pc_map[field] & pc_freemask[field]; From owner-svn-src-head@FreeBSD.ORG Wed Oct 10 17:29:52 2012 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id A4326121; Wed, 10 Oct 2012 17:29:52 +0000 (UTC) (envelope-from np@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 83EE98FC22; Wed, 10 Oct 2012 17:29:52 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id q9AHTq7C070398; Wed, 10 Oct 2012 17:29:52 GMT (envelope-from np@svn.freebsd.org) Received: (from np@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q9AHTqYO070396; Wed, 10 Oct 2012 17:29:52 GMT (envelope-from np@svn.freebsd.org) Message-Id: <201210101729.q9AHTqYO070396@svn.freebsd.org> From: Navdeep Parhar Date: Wed, 10 Oct 2012 17:29:52 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r241401 - head/tools/tools/cxgbetool X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 10 Oct 2012 17:29:52 -0000 Author: np Date: Wed Oct 10 17:29:51 2012 New Revision: 241401 URL: http://svn.freebsd.org/changeset/base/241401 Log: Add an "i2c" subcommand to cxgbetool. You can use this to read information from the transceivers connected to the ports of a cxgbe(4) based card. # cxgbetool t4nex0 i2c [] For example: # cxgbetool t4nex0 i2c 0 0xa0 3 0x10 [16] (As per SFF-8472 the SFP+ module is at 0xa0 and bit 4 in the value at address 3 indicates it's a 10Gbase-SR module, which it is.) Modified: head/tools/tools/cxgbetool/cxgbetool.c Modified: head/tools/tools/cxgbetool/cxgbetool.c ============================================================================== --- head/tools/tools/cxgbetool/cxgbetool.c Wed Oct 10 17:15:34 2012 (r241400) +++ head/tools/tools/cxgbetool/cxgbetool.c Wed Oct 10 17:29:51 2012 (r241401) @@ -37,6 +37,7 @@ __FBSDID("$FreeBSD$"); #include #include #include +#include #include #include #include @@ -86,6 +87,7 @@ usage(FILE *fp) "\tfilter delete|clear delete a filter\n" "\tfilter list list all filters\n" "\tfilter mode [] ... get/set global filter mode\n" + "\ti2c [] read from i2c device\n" "\tloadfw install firmware\n" "\tmemdump dump a memory range\n" "\treg
[=] read/write register\n" @@ -1522,6 +1524,60 @@ read_tcb(int argc, const char *argv[]) } static int +read_i2c(int argc, const char *argv[]) +{ + char *p; + long l; + struct t4_i2c_data i2cd; + int rc, i; + + if (argc < 3 || argc > 4) { + warnx("incorrect number of arguments."); + return (EINVAL); + } + + p = str_to_number(argv[0], &l, NULL); + if (*p || l > UCHAR_MAX) { + warnx("invalid port id \"%s\"", argv[0]); + return (EINVAL); + } + i2cd.port_id = l; + + p = str_to_number(argv[1], &l, NULL); + if (*p || l > UCHAR_MAX) { + warnx("invalid i2c device address \"%s\"", argv[1]); + return (EINVAL); + } + i2cd.dev_addr = l; + + p = str_to_number(argv[2], &l, NULL); + if (*p || l > UCHAR_MAX) { + warnx("invalid byte offset \"%s\"", argv[2]); + return (EINVAL); + } + i2cd.offset = l; + + if (argc == 4) { + p = str_to_number(argv[3], &l, NULL); + if (*p || l > sizeof(i2cd.data)) { + warnx("invalid number of bytes \"%s\"", argv[3]); + return (EINVAL); + } + i2cd.len = l; + } else + i2cd.len = 1; + + rc = doit(CHELSIO_T4_GET_I2C, &i2cd); + if (rc != 0) + return (rc); + + for (i = 0; i < i2cd.len; i++) + printf("0x%x [%u]\n", i2cd.data[i], i2cd.data[i]); + + return (0); +} + +static int run_cmd(int argc, const char *argv[]) { int rc = -1; @@ -1547,6 +1603,8 @@ run_cmd(int argc, const char *argv[]) rc = memdump(argc, argv); else if (!strcmp(cmd, "tcb")) rc = read_tcb(argc, argv); + else if (!strcmp(cmd, "i2c")) + rc = read_i2c(argc, argv); else { rc = EINVAL; warnx("invalid command \"%s\"", cmd); From owner-svn-src-head@FreeBSD.ORG Wed Oct 10 17:51:24 2012 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id 542E0DD6; Wed, 10 Oct 2012 17:51:24 +0000 (UTC) (envelope-from mav@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 3E2608FC16; Wed, 10 Oct 2012 17:51:24 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id q9AHpOdi073286; Wed, 10 Oct 2012 17:51:24 GMT (envelope-from mav@svn.freebsd.org) Received: (from mav@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q9AHpONG073284; Wed, 10 Oct 2012 17:51:24 GMT (envelope-from mav@svn.freebsd.org) Message-Id: <201210101751.q9AHpONG073284@svn.freebsd.org> From: Alexander Motin Date: Wed, 10 Oct 2012 17:51:24 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r241402 - head/sys/dev/ata X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 10 Oct 2012 17:51:24 -0000 Author: mav Date: Wed Oct 10 17:51:23 2012 New Revision: 241402 URL: http://svn.freebsd.org/changeset/base/241402 Log: Add checks for ata_sata_scr_read() return statuses. It is mostly to silence Clang Static Analyzer warnings as errors there are usually unlikely. Modified: head/sys/dev/ata/ata-sata.c Modified: head/sys/dev/ata/ata-sata.c ============================================================================== --- head/sys/dev/ata/ata-sata.c Wed Oct 10 17:29:51 2012 (r241401) +++ head/sys/dev/ata/ata-sata.c Wed Oct 10 17:51:23 2012 (r241402) @@ -53,7 +53,8 @@ ata_sata_phy_check_events(device_t dev, struct ata_channel *ch = device_get_softc(dev); u_int32_t error, status; - ata_sata_scr_read(ch, port, ATA_SERROR, &error); + if (ata_sata_scr_read(ch, port, ATA_SERROR, &error)) + return; /* Check that SError value is sane. */ if (error == 0xffffffff) @@ -66,8 +67,9 @@ ata_sata_phy_check_events(device_t dev, /* if we have a connection event deal with it */ if ((error & ATA_SE_PHY_CHANGED) && (ch->pm_level == 0)) { if (bootverbose) { - ata_sata_scr_read(ch, port, ATA_SSTATUS, &status); - if (((status & ATA_SS_DET_MASK) == ATA_SS_DET_PHY_ONLINE) && + if (ata_sata_scr_read(ch, port, ATA_SSTATUS, &status)) { + device_printf(dev, "PHYRDY change\n"); + } else if (((status & ATA_SS_DET_MASK) == ATA_SS_DET_PHY_ONLINE) && ((status & ATA_SS_SPD_MASK) != ATA_SS_SPD_NO_SPEED) && ((status & ATA_SS_IPM_MASK) == ATA_SS_IPM_ACTIVE)) { device_printf(dev, "CONNECT requested\n"); From owner-svn-src-head@FreeBSD.ORG Wed Oct 10 18:01:56 2012 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id AD768392; Wed, 10 Oct 2012 18:01:56 +0000 (UTC) (envelope-from jimharris@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 94F2F8FC08; Wed, 10 Oct 2012 18:01:56 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id q9AI1u1q074727; Wed, 10 Oct 2012 18:01:56 GMT (envelope-from jimharris@svn.freebsd.org) Received: (from jimharris@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q9AI1utf074723; Wed, 10 Oct 2012 18:01:56 GMT (envelope-from jimharris@svn.freebsd.org) Message-Id: <201210101801.q9AI1utf074723@svn.freebsd.org> From: Jim Harris Date: Wed, 10 Oct 2012 18:01:56 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r241403 - head/sys/dev/isci X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 10 Oct 2012 18:01:56 -0000 Author: jimharris Date: Wed Oct 10 18:01:56 2012 New Revision: 241403 URL: http://svn.freebsd.org/changeset/base/241403 Log: Add support for locate LED. While here, change ISCI_LED to ISCI_PHY since conceptually the hardware ties the LEDs to a phy and the LEDs for a given phy cannot be controlled independently. Submitted by: Paul Maulberger (with modifications) Modified: head/sys/dev/isci/isci.c head/sys/dev/isci/isci.h head/sys/dev/isci/isci_controller.c Modified: head/sys/dev/isci/isci.c ============================================================================== --- head/sys/dev/isci/isci.c Wed Oct 10 17:51:23 2012 (r241402) +++ head/sys/dev/isci/isci.c Wed Oct 10 18:01:56 2012 (r241403) @@ -223,9 +223,13 @@ isci_detach(device_t device) if (controller->remote_device_memory != NULL) free(controller->remote_device_memory, M_ISCI); - for (phy = 0; phy < SCI_MAX_PHYS; phy++) - if (controller->led[phy].cdev) - led_destroy(controller->led[phy].cdev); + for (phy = 0; phy < SCI_MAX_PHYS; phy++) { + if (controller->phys[phy].cdev_fault) + led_destroy(controller->phys[phy].cdev_fault); + + if (controller->phys[phy].cdev_locate) + led_destroy(controller->phys[phy].cdev_locate); + } while (1) { sci_pool_get(controller->unmap_buffer_pool, unmap_buffer); Modified: head/sys/dev/isci/isci.h ============================================================================== --- head/sys/dev/isci/isci.h Wed Oct 10 17:51:23 2012 (r241402) +++ head/sys/dev/isci/isci.h Wed Oct 10 18:01:56 2012 (r241403) @@ -143,11 +143,14 @@ struct ISCI_INTERRUPT_INFO }; -struct ISCI_LED +struct ISCI_PHY { - struct cdev *cdev; + struct cdev *cdev_fault; + struct cdev *cdev_locate; SCI_CONTROLLER_HANDLE_T handle; int index; + int led_fault; + int led_locate; }; struct ISCI_CONTROLLER @@ -176,7 +179,7 @@ struct ISCI_CONTROLLER uint32_t queue_depth; uint32_t sim_queue_depth; SCI_FAST_LIST_T pending_device_reset_list; - struct ISCI_LED led[SCI_MAX_PHYS]; + struct ISCI_PHY phys[SCI_MAX_PHYS]; SCI_MEMORY_DESCRIPTOR_LIST_HANDLE_T mdl; Modified: head/sys/dev/isci/isci_controller.c ============================================================================== --- head/sys/dev/isci/isci_controller.c Wed Oct 10 17:51:23 2012 (r241402) +++ head/sys/dev/isci/isci_controller.c Wed Oct 10 18:01:56 2012 (r241403) @@ -274,12 +274,24 @@ void isci_controller_construct(struct IS sci_pool_initialize(controller->unmap_buffer_pool); } -static void isci_led_func(void *priv, int onoff) +static void isci_led_fault_func(void *priv, int onoff) { - struct ISCI_LED *led = priv; + struct ISCI_PHY *phy = priv; + + /* map onoff to the fault LED */ + phy->led_fault = onoff; + scic_sgpio_update_led_state(phy->handle, 1 << phy->index, + phy->led_fault, phy->led_locate, 0); +} + +static void isci_led_locate_func(void *priv, int onoff) +{ + struct ISCI_PHY *phy = priv; /* map onoff to the locate LED */ - scic_sgpio_update_led_state(led->handle, 1 << led->index, 0, onoff, 0); + phy->led_locate = onoff; + scic_sgpio_update_led_state(phy->handle, 1 << phy->index, + phy->led_fault, phy->led_locate, 0); } SCI_STATUS isci_controller_initialize(struct ISCI_CONTROLLER *controller) @@ -368,12 +380,20 @@ SCI_STATUS isci_controller_initialize(st mtx_unlock(&controller->lock); for (i = 0; i < SCI_MAX_PHYS; i++) { - controller->led[i].handle = scic_controller_handle; - controller->led[i].index = i; - sprintf(led_name, "isci.bus%d.port%d.locate", - controller->index, i); - controller->led[i].cdev = led_create(isci_led_func, - &controller->led[i], led_name); + controller->phys[i].handle = scic_controller_handle; + controller->phys[i].index = i; + + /* fault */ + controller->phys[i].led_fault = 0; + sprintf(led_name, "isci.bus%d.port%d.fault", controller->index, i); + controller->phys[i].cdev_fault = led_create(isci_led_fault_func, + &controller->phys[i], led_name); + + /* locate */ + controller->phys[i].led_locate = 0; + sprintf(led_name, "isci.bus%d.port%d.locate", controller->index, i); + controller->phys[i].cdev_locate = led_create(isci_led_locate_func, + &controller->phys[i], led_name); } return (scif_controller_initialize(controller->scif_controller_handle)); From owner-svn-src-head@FreeBSD.ORG Wed Oct 10 18:10:12 2012 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id 3CBDE7B2; Wed, 10 Oct 2012 18:10:12 +0000 (UTC) (envelope-from mav@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 2449F8FC23; Wed, 10 Oct 2012 18:10:12 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id q9AIABuK075787; Wed, 10 Oct 2012 18:10:11 GMT (envelope-from mav@svn.freebsd.org) Received: (from mav@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q9AIABh8075775; Wed, 10 Oct 2012 18:10:11 GMT (envelope-from mav@svn.freebsd.org) Message-Id: <201210101810.q9AIABh8075775@svn.freebsd.org> From: Alexander Motin Date: Wed, 10 Oct 2012 18:10:11 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r241404 - in head/sys/cam: ata scsi X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 10 Oct 2012 18:10:12 -0000 Author: mav Date: Wed Oct 10 18:10:11 2012 New Revision: 241404 URL: http://svn.freebsd.org/changeset/base/241404 Log: Remove 'periph == NULL' check from bunch of periph drivers. This condition can never be true as functions are called from single place and the checks just pollute the code and confuse Clang Static Analyzer. Modified: head/sys/cam/ata/ata_da.c head/sys/cam/ata/ata_pmp.c head/sys/cam/ata/ata_xpt.c head/sys/cam/scsi/scsi_cd.c head/sys/cam/scsi/scsi_ch.c head/sys/cam/scsi/scsi_da.c head/sys/cam/scsi/scsi_pass.c head/sys/cam/scsi/scsi_sa.c head/sys/cam/scsi/scsi_sg.c head/sys/cam/scsi/scsi_xpt.c Modified: head/sys/cam/ata/ata_da.c ============================================================================== --- head/sys/cam/ata/ata_da.c Wed Oct 10 18:01:56 2012 (r241403) +++ head/sys/cam/ata/ata_da.c Wed Oct 10 18:10:11 2012 (r241404) @@ -943,11 +943,6 @@ adaregister(struct cam_periph *periph, v int legacy_id, quirks; cgd = (struct ccb_getdev *)arg; - if (periph == NULL) { - printf("adaregister: periph was NULL!!\n"); - return(CAM_REQ_CMP_ERR); - } - if (cgd == NULL) { printf("adaregister: no getdev CCB, can't register device\n"); return(CAM_REQ_CMP_ERR); Modified: head/sys/cam/ata/ata_pmp.c ============================================================================== --- head/sys/cam/ata/ata_pmp.c Wed Oct 10 18:01:56 2012 (r241403) +++ head/sys/cam/ata/ata_pmp.c Wed Oct 10 18:10:11 2012 (r241404) @@ -367,11 +367,6 @@ pmpregister(struct cam_periph *periph, v struct ccb_getdev *cgd; cgd = (struct ccb_getdev *)arg; - if (periph == NULL) { - printf("pmpregister: periph was NULL!!\n"); - return(CAM_REQ_CMP_ERR); - } - if (cgd == NULL) { printf("pmpregister: no getdev CCB, can't register device\n"); return(CAM_REQ_CMP_ERR); Modified: head/sys/cam/ata/ata_xpt.c ============================================================================== --- head/sys/cam/ata/ata_xpt.c Wed Oct 10 18:01:56 2012 (r241403) +++ head/sys/cam/ata/ata_xpt.c Wed Oct 10 18:10:11 2012 (r241404) @@ -224,11 +224,6 @@ proberegister(struct cam_periph *periph, probe_softc *softc; request_ccb = (union ccb *)arg; - if (periph == NULL) { - printf("proberegister: periph was NULL!!\n"); - return(CAM_REQ_CMP_ERR); - } - if (request_ccb == NULL) { printf("proberegister: no probe CCB, " "can't register device\n"); Modified: head/sys/cam/scsi/scsi_cd.c ============================================================================== --- head/sys/cam/scsi/scsi_cd.c Wed Oct 10 18:01:56 2012 (r241403) +++ head/sys/cam/scsi/scsi_cd.c Wed Oct 10 18:10:11 2012 (r241404) @@ -692,10 +692,6 @@ cdregister(struct cam_periph *periph, vo caddr_t match; cgd = (struct ccb_getdev *)arg; - if (periph == NULL) { - printf("cdregister: periph was NULL!!\n"); - return(CAM_REQ_CMP_ERR); - } if (cgd == NULL) { printf("cdregister: no getdev CCB, can't register device\n"); return(CAM_REQ_CMP_ERR); Modified: head/sys/cam/scsi/scsi_ch.c ============================================================================== --- head/sys/cam/scsi/scsi_ch.c Wed Oct 10 18:01:56 2012 (r241403) +++ head/sys/cam/scsi/scsi_ch.c Wed Oct 10 18:10:11 2012 (r241404) @@ -324,11 +324,6 @@ chregister(struct cam_periph *periph, vo struct ccb_pathinq cpi; cgd = (struct ccb_getdev *)arg; - if (periph == NULL) { - printf("chregister: periph was NULL!!\n"); - return(CAM_REQ_CMP_ERR); - } - if (cgd == NULL) { printf("chregister: no getdev CCB, can't register device\n"); return(CAM_REQ_CMP_ERR); Modified: head/sys/cam/scsi/scsi_da.c ============================================================================== --- head/sys/cam/scsi/scsi_da.c Wed Oct 10 18:01:56 2012 (r241403) +++ head/sys/cam/scsi/scsi_da.c Wed Oct 10 18:10:11 2012 (r241404) @@ -1583,11 +1583,6 @@ daregister(struct cam_periph *periph, vo caddr_t match; cgd = (struct ccb_getdev *)arg; - if (periph == NULL) { - printf("daregister: periph was NULL!!\n"); - return(CAM_REQ_CMP_ERR); - } - if (cgd == NULL) { printf("daregister: no getdev CCB, can't register device\n"); return(CAM_REQ_CMP_ERR); Modified: head/sys/cam/scsi/scsi_pass.c ============================================================================== --- head/sys/cam/scsi/scsi_pass.c Wed Oct 10 18:01:56 2012 (r241403) +++ head/sys/cam/scsi/scsi_pass.c Wed Oct 10 18:10:11 2012 (r241404) @@ -312,11 +312,6 @@ passregister(struct cam_periph *periph, int no_tags; cgd = (struct ccb_getdev *)arg; - if (periph == NULL) { - printf("%s: periph was NULL!!\n", __func__); - return(CAM_REQ_CMP_ERR); - } - if (cgd == NULL) { printf("%s: no getdev CCB, can't register device\n", __func__); return(CAM_REQ_CMP_ERR); Modified: head/sys/cam/scsi/scsi_sa.c ============================================================================== --- head/sys/cam/scsi/scsi_sa.c Wed Oct 10 18:01:56 2012 (r241403) +++ head/sys/cam/scsi/scsi_sa.c Wed Oct 10 18:10:11 2012 (r241404) @@ -1445,11 +1445,6 @@ saregister(struct cam_periph *periph, vo int i; cgd = (struct ccb_getdev *)arg; - if (periph == NULL) { - printf("saregister: periph was NULL!!\n"); - return (CAM_REQ_CMP_ERR); - } - if (cgd == NULL) { printf("saregister: no getdev CCB, can't register device\n"); return (CAM_REQ_CMP_ERR); Modified: head/sys/cam/scsi/scsi_sg.c ============================================================================== --- head/sys/cam/scsi/scsi_sg.c Wed Oct 10 18:01:56 2012 (r241403) +++ head/sys/cam/scsi/scsi_sg.c Wed Oct 10 18:10:11 2012 (r241404) @@ -261,11 +261,6 @@ sgregister(struct cam_periph *periph, vo int no_tags; cgd = (struct ccb_getdev *)arg; - if (periph == NULL) { - printf("sgregister: periph was NULL!!\n"); - return (CAM_REQ_CMP_ERR); - } - if (cgd == NULL) { printf("sgregister: no getdev CCB, can't register device\n"); return (CAM_REQ_CMP_ERR); Modified: head/sys/cam/scsi/scsi_xpt.c ============================================================================== --- head/sys/cam/scsi/scsi_xpt.c Wed Oct 10 18:01:56 2012 (r241403) +++ head/sys/cam/scsi/scsi_xpt.c Wed Oct 10 18:10:11 2012 (r241404) @@ -615,11 +615,6 @@ proberegister(struct cam_periph *periph, probe_softc *softc; request_ccb = (union ccb *)arg; - if (periph == NULL) { - printf("proberegister: periph was NULL!!\n"); - return(CAM_REQ_CMP_ERR); - } - if (request_ccb == NULL) { printf("proberegister: no probe CCB, " "can't register device\n"); From owner-svn-src-head@FreeBSD.ORG Wed Oct 10 18:34:16 2012 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id 7CE3B2B6; Wed, 10 Oct 2012 18:34:16 +0000 (UTC) (envelope-from mav@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 66B2C8FC0A; Wed, 10 Oct 2012 18:34:16 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id q9AIYGmM079117; Wed, 10 Oct 2012 18:34:16 GMT (envelope-from mav@svn.freebsd.org) Received: (from mav@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q9AIYGsN079115; Wed, 10 Oct 2012 18:34:16 GMT (envelope-from mav@svn.freebsd.org) Message-Id: <201210101834.q9AIYGsN079115@svn.freebsd.org> From: Alexander Motin Date: Wed, 10 Oct 2012 18:34:16 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r241405 - head/sys/cam X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 10 Oct 2012 18:34:16 -0000 Author: mav Date: Wed Oct 10 18:34:15 2012 New Revision: 241405 URL: http://svn.freebsd.org/changeset/base/241405 Log: Really handle xpt_compile_path() error in xpt_bus_register() instead of print error message and probably crash just after it on NULL dereference. Found by: Clang Static Analyzer Modified: head/sys/cam/cam_xpt.c Modified: head/sys/cam/cam_xpt.c ============================================================================== --- head/sys/cam/cam_xpt.c Wed Oct 10 18:10:11 2012 (r241404) +++ head/sys/cam/cam_xpt.c Wed Oct 10 18:34:15 2012 (r241405) @@ -3898,8 +3898,11 @@ xpt_bus_register(struct cam_sim *sim, de status = xpt_compile_path(path, /*periph*/NULL, sim->path_id, CAM_TARGET_WILDCARD, CAM_LUN_WILDCARD); - if (status != CAM_REQ_CMP) - printf("xpt_compile_path returned %d\n", status); + if (status != CAM_REQ_CMP) { + xpt_release_bus(new_bus); + free(path, M_CAMXPT); + return (CAM_RESRC_UNAVAIL); + } xpt_setup_ccb(&cpi.ccb_h, path, CAM_PRIORITY_NORMAL); cpi.ccb_h.func_code = XPT_PATH_INQ; From owner-svn-src-head@FreeBSD.ORG Wed Oct 10 19:06:12 2012 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id C0AF3A2; Wed, 10 Oct 2012 19:06:12 +0000 (UTC) (envelope-from melifaro@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 9F1E18FC16; Wed, 10 Oct 2012 19:06:12 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id q9AJ6Cof083397; Wed, 10 Oct 2012 19:06:12 GMT (envelope-from melifaro@svn.freebsd.org) Received: (from melifaro@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q9AJ6CAI083391; Wed, 10 Oct 2012 19:06:12 GMT (envelope-from melifaro@svn.freebsd.org) Message-Id: <201210101906.q9AJ6CAI083391@svn.freebsd.org> From: "Alexander V. Chernikov" Date: Wed, 10 Oct 2012 19:06:12 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r241406 - head/sys/netinet X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 10 Oct 2012 19:06:12 -0000 Author: melifaro Date: Wed Oct 10 19:06:11 2012 New Revision: 241406 URL: http://svn.freebsd.org/changeset/base/241406 Log: Do not check if found IPv4 rte is dynamic if net.inet.icmp.drop_redirect is enabled. This eliminates one mtx_lock() per each routing lookup thus improving performance in several cases (routing to directly connected interface or routing to default gateway). Icmp redirects should not be used to provide routing direction nowadays, even for end hosts. Routers should not use them too (and this is explicitly restricted in IPv6, see RFC 4861, clause 8.2). Current commit changes rnh_machaddr function to 'stock' rn_match (and back) for every AF_INET routing table in given VNET instance on drop_redirect sysctl change. This change is part of bigger patch eliminating rte locking. Sponsored by: Yandex LLC MFC after: 2 weeks Modified: head/sys/netinet/in_rmx.c head/sys/netinet/in_var.h head/sys/netinet/ip_icmp.c head/sys/netinet/ip_var.h Modified: head/sys/netinet/in_rmx.c ============================================================================== --- head/sys/netinet/in_rmx.c Wed Oct 10 18:34:15 2012 (r241405) +++ head/sys/netinet/in_rmx.c Wed Oct 10 19:06:11 2012 (r241406) @@ -58,6 +58,8 @@ __FBSDID("$FreeBSD$"); #include #include +#include +#include #include extern int in_inithead(void **head, int off); @@ -340,6 +342,13 @@ in_rtqdrain(void) VNET_LIST_RUNLOCK_NOSLEEP(); } +void +in_setmatchfunc(struct radix_node_head *rnh, int val) +{ + + rnh->rnh_matchaddr = (val != 0) ? rn_match : in_matroute; +} + static int _in_rt_was_here; /* * Initialize our routing tree. @@ -365,7 +374,7 @@ in_inithead(void **head, int off) rnh = *head; rnh->rnh_addaddr = in_addroute; - rnh->rnh_matchaddr = in_matroute; + in_setmatchfunc(rnh, V_drop_redirect); rnh->rnh_close = in_clsroute; if (_in_rt_was_here == 0 ) { callout_init(&V_rtq_timer, CALLOUT_MPSAFE); Modified: head/sys/netinet/in_var.h ============================================================================== --- head/sys/netinet/in_var.h Wed Oct 10 18:34:15 2012 (r241405) +++ head/sys/netinet/in_var.h Wed Oct 10 19:06:11 2012 (r241406) @@ -424,6 +424,7 @@ inm_acquire_locked(struct in_multi *inm) struct rtentry; struct route; struct ip_moptions; +struct radix_node_head; int imo_multi_filter(const struct ip_moptions *, const struct ifnet *, const struct sockaddr *, const struct sockaddr *); @@ -464,6 +465,7 @@ void in_rtredirect(struct sockaddr *, s struct sockaddr *, int, struct sockaddr *, u_int); int in_rtrequest(int, struct sockaddr *, struct sockaddr *, struct sockaddr *, int, struct rtentry **, u_int); +void in_setmatchfunc(struct radix_node_head *, int); #if 0 int in_rt_getifa(struct rt_addrinfo *, u_int fibnum); Modified: head/sys/netinet/ip_icmp.c ============================================================================== --- head/sys/netinet/ip_icmp.c Wed Oct 10 18:34:15 2012 (r241405) +++ head/sys/netinet/ip_icmp.c Wed Oct 10 19:06:11 2012 (r241406) @@ -108,11 +108,7 @@ SYSCTL_VNET_UINT(_net_inet_icmp, OID_AUT &VNET_NAME(icmpmaskfake), 0, "Fake reply to ICMP Address Mask Request packets."); -static VNET_DEFINE(int, drop_redirect) = 0; -#define V_drop_redirect VNET(drop_redirect) -SYSCTL_VNET_INT(_net_inet_icmp, OID_AUTO, drop_redirect, CTLFLAG_RW, - &VNET_NAME(drop_redirect), 0, - "Ignore ICMP redirects"); +VNET_DEFINE(int, drop_redirect) = 0; static VNET_DEFINE(int, log_redirect) = 0; #define V_log_redirect VNET(log_redirect) @@ -157,6 +153,39 @@ static void icmp_send(struct mbuf *, str extern struct protosw inetsw[]; +static int +sysctl_net_icmp_drop_redir(SYSCTL_HANDLER_ARGS) +{ + int error, new; + int i; + struct radix_node_head *rnh; + + new = V_drop_redirect; + error = sysctl_handle_int(oidp, &new, 0, req); + if (error == 0 && req->newptr) { + new = (new != 0) ? 1 : 0; + + if (new == V_drop_redirect) + return (0); + + for (i = 0; i < rt_numfibs; i++) { + if ((rnh = rt_tables_get_rnh(i, AF_INET)) == NULL) + continue; + RADIX_NODE_HEAD_LOCK(rnh); + in_setmatchfunc(rnh, new); + RADIX_NODE_HEAD_UNLOCK(rnh); + } + + V_drop_redirect = new; + } + + return (error); +} + +SYSCTL_VNET_PROC(_net_inet_icmp, OID_AUTO, drop_redirect, + CTLTYPE_INT|CTLFLAG_RW, 0, 0, + sysctl_net_icmp_drop_redir, "I", "Ignore ICMP redirects"); + /* * Kernel module interface for updating icmpstat. The argument is an index * into icmpstat treated as an array of u_long. While this encodes the Modified: head/sys/netinet/ip_var.h ============================================================================== --- head/sys/netinet/ip_var.h Wed Oct 10 18:34:15 2012 (r241405) +++ head/sys/netinet/ip_var.h Wed Oct 10 19:06:11 2012 (r241406) @@ -188,6 +188,7 @@ VNET_DECLARE(struct socket *, ip_mrouter extern int (*legal_vif_num)(int); extern u_long (*ip_mcast_src)(int); VNET_DECLARE(int, rsvp_on); +VNET_DECLARE(int, drop_redirect); extern struct pr_usrreqs rip_usrreqs; #define V_ipstat VNET(ipstat) @@ -200,6 +201,7 @@ extern struct pr_usrreqs rip_usrreqs; #define V_ip_rsvpd VNET(ip_rsvpd) #define V_ip_mrouter VNET(ip_mrouter) #define V_rsvp_on VNET(rsvp_on) +#define V_drop_redirect VNET(drop_redirect) void inp_freemoptions(struct ip_moptions *); int inp_getmoptions(struct inpcb *, struct sockopt *); From owner-svn-src-head@FreeBSD.ORG Wed Oct 10 19:27:41 2012 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id 35885A24; Wed, 10 Oct 2012 19:27:41 +0000 (UTC) (envelope-from np@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 1EBFC8FC17; Wed, 10 Oct 2012 19:27:41 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id q9AJReww086315; Wed, 10 Oct 2012 19:27:40 GMT (envelope-from np@svn.freebsd.org) Received: (from np@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q9AJRer9086312; Wed, 10 Oct 2012 19:27:40 GMT (envelope-from np@svn.freebsd.org) Message-Id: <201210101927.q9AJRer9086312@svn.freebsd.org> From: Navdeep Parhar Date: Wed, 10 Oct 2012 19:27:40 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r241409 - head/sys/dev/cxgbe X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 10 Oct 2012 19:27:41 -0000 Author: np Date: Wed Oct 10 19:27:40 2012 New Revision: 241409 URL: http://svn.freebsd.org/changeset/base/241409 Log: Add a driver ioctl to clear a port's MAC statistics. Submitted by: gnn@ MFC after: 3 days Modified: head/sys/dev/cxgbe/t4_ioctl.h head/sys/dev/cxgbe/t4_main.c Modified: head/sys/dev/cxgbe/t4_ioctl.h ============================================================================== --- head/sys/dev/cxgbe/t4_ioctl.h Wed Oct 10 19:08:46 2012 (r241408) +++ head/sys/dev/cxgbe/t4_ioctl.h Wed Oct 10 19:27:40 2012 (r241409) @@ -50,6 +50,7 @@ enum { T4_LOAD_FW, /* flash firmware */ T4_GET_MEM, /* read memory */ T4_GET_I2C, /* read from i2c addressible device */ + T4_CLEAR_STATS, /* clear a port's MAC statistics */ }; struct t4_reg { @@ -234,4 +235,5 @@ struct t4_mem_range { #define CHELSIO_T4_LOAD_FW _IOW('f', T4_LOAD_FW, struct t4_data) #define CHELSIO_T4_GET_MEM _IOW('f', T4_GET_MEM, struct t4_mem_range) #define CHELSIO_T4_GET_I2C _IOWR('f', T4_GET_I2C, struct t4_i2c_data) +#define CHELSIO_T4_CLEAR_STATS _IOW('f', T4_CLEAR_STATS, uint32_t) #endif Modified: head/sys/dev/cxgbe/t4_main.c ============================================================================== --- head/sys/dev/cxgbe/t4_main.c Wed Oct 10 19:08:46 2012 (r241408) +++ head/sys/dev/cxgbe/t4_main.c Wed Oct 10 19:27:40 2012 (r241409) @@ -5400,6 +5400,15 @@ t4_ioctl(struct cdev *dev, unsigned long rc = read_i2c(sc, (struct t4_i2c_data *)data); ADAPTER_UNLOCK(sc); break; + case CHELSIO_T4_CLEAR_STATS: { + u_int port_id = *(uint32_t *)data; + + if (port_id >= sc->params.nports) + return (EINVAL); + + t4_clr_port_stats(sc, port_id); + break; + } default: rc = EINVAL; } From owner-svn-src-head@FreeBSD.ORG Wed Oct 10 19:32:41 2012 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id 820C3C23; Wed, 10 Oct 2012 19:32:41 +0000 (UTC) (envelope-from mav@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 6AEB88FC14; Wed, 10 Oct 2012 19:32:41 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id q9AJWfHU087009; Wed, 10 Oct 2012 19:32:41 GMT (envelope-from mav@svn.freebsd.org) Received: (from mav@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q9AJWfI6087007; Wed, 10 Oct 2012 19:32:41 GMT (envelope-from mav@svn.freebsd.org) Message-Id: <201210101932.q9AJWfI6087007@svn.freebsd.org> From: Alexander Motin Date: Wed, 10 Oct 2012 19:32:41 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r241410 - head/sys/cam/scsi X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 10 Oct 2012 19:32:41 -0000 Author: mav Date: Wed Oct 10 19:32:40 2012 New Revision: 241410 URL: http://svn.freebsd.org/changeset/base/241410 Log: There are SCSI conditions that are not an errors. In those cases cderror() returns zero while request status is not CAM_REQ_CMP. That could cause partial device attach or other unexpected results. Found by: Clang Static Analyzer Modified: head/sys/cam/scsi/scsi_cd.c Modified: head/sys/cam/scsi/scsi_cd.c ============================================================================== --- head/sys/cam/scsi/scsi_cd.c Wed Oct 10 19:27:40 2012 (r241409) +++ head/sys/cam/scsi/scsi_cd.c Wed Oct 10 19:32:40 2012 (r241410) @@ -1741,6 +1741,7 @@ cddone(struct cam_periph *periph, union * bytes. */ struct cd_params *cdp; + int error; cdp = &softc->params; @@ -1749,28 +1750,26 @@ cddone(struct cam_periph *periph, union cdp->disksize = scsi_4btoul (rdcap->addr) + 1; cdp->blksize = scsi_4btoul (rdcap->length); - if ((csio->ccb_h.status & CAM_STATUS_MASK) == CAM_REQ_CMP) { + /* + * Retry any UNIT ATTENTION type errors. They + * are expected at boot. + */ + if ((csio->ccb_h.status & CAM_STATUS_MASK) == CAM_REQ_CMP || + (error = cderror(done_ccb, CAM_RETRY_SELTO, + SF_RETRY_UA | SF_NO_PRINT)) == 0) { snprintf(announce_buf, sizeof(announce_buf), "cd present [%lu x %lu byte records]", cdp->disksize, (u_long)cdp->blksize); } else { - int error; - /* - * Retry any UNIT ATTENTION type errors. They - * are expected at boot. - */ - error = cderror(done_ccb, CAM_RETRY_SELTO, - SF_RETRY_UA | SF_NO_PRINT); if (error == ERESTART) { /* * A retry was scheuled, so * just return. */ return; - } else if (error != 0) { - + } else { int asc, ascq; int sense_key, error_code; int have_sense; From owner-svn-src-head@FreeBSD.ORG Wed Oct 10 19:46:47 2012 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id 2F76A696; Wed, 10 Oct 2012 19:46:47 +0000 (UTC) (envelope-from mav@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 180698FC0A; Wed, 10 Oct 2012 19:46:47 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id q9AJkklg089027; Wed, 10 Oct 2012 19:46:46 GMT (envelope-from mav@svn.freebsd.org) Received: (from mav@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q9AJkkvx089025; Wed, 10 Oct 2012 19:46:46 GMT (envelope-from mav@svn.freebsd.org) Message-Id: <201210101946.q9AJkkvx089025@svn.freebsd.org> From: Alexander Motin Date: Wed, 10 Oct 2012 19:46:46 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r241413 - head/sys/kern X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 10 Oct 2012 19:46:47 -0000 Author: mav Date: Wed Oct 10 19:46:46 2012 New Revision: 241413 URL: http://svn.freebsd.org/changeset/base/241413 Log: panic() with reasonable message instead of returning zero frequency causing division by zero later if event timer's minimal period is above one second. For now it is just a theoretical possibility. Found by: Clang Static Analyzer Modified: head/sys/kern/kern_clocksource.c Modified: head/sys/kern/kern_clocksource.c ============================================================================== --- head/sys/kern/kern_clocksource.c Wed Oct 10 19:43:45 2012 (r241412) +++ head/sys/kern/kern_clocksource.c Wed Oct 10 19:46:46 2012 (r241413) @@ -602,7 +602,8 @@ round_freq(struct eventtimer *et, int fr freq = (et->et_frequency + div / 2) / div; } if (et->et_min_period.sec > 0) - freq = 0; + panic("Event timer \"%s\" doesn't support sub-second periods!", + et->et_name); else if (et->et_min_period.frac != 0) freq = min(freq, BT2FREQ(&et->et_min_period)); if (et->et_max_period.sec == 0 && et->et_max_period.frac != 0) From owner-svn-src-head@FreeBSD.ORG Wed Oct 10 19:47:52 2012 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id EF529813; Wed, 10 Oct 2012 19:47:52 +0000 (UTC) (envelope-from delphij@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id D76B18FC08; Wed, 10 Oct 2012 19:47:52 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id q9AJlqZD089209; Wed, 10 Oct 2012 19:47:52 GMT (envelope-from delphij@svn.freebsd.org) Received: (from delphij@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q9AJlqQf089205; Wed, 10 Oct 2012 19:47:52 GMT (envelope-from delphij@svn.freebsd.org) Message-Id: <201210101947.q9AJlqQf089205@svn.freebsd.org> From: Xin LI Date: Wed, 10 Oct 2012 19:47:52 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r241414 - in head/contrib/bind9: . bin/named X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 10 Oct 2012 19:47:53 -0000 Author: delphij Date: Wed Oct 10 19:47:52 2012 New Revision: 241414 URL: http://svn.freebsd.org/changeset/base/241414 Log: Upgrade to 9.8.3-P4: Prevents a lockup when queried a deliberately constructed combination of records. [CVE-2012-5166] For more information: https://kb.isc.org/article/AA-00801 Modified: head/contrib/bind9/CHANGES head/contrib/bind9/bin/named/query.c head/contrib/bind9/version Directory Properties: head/contrib/bind9/ (props changed) Modified: head/contrib/bind9/CHANGES ============================================================================== --- head/contrib/bind9/CHANGES Wed Oct 10 19:46:46 2012 (r241413) +++ head/contrib/bind9/CHANGES Wed Oct 10 19:47:52 2012 (r241414) @@ -1,3 +1,9 @@ + --- 9.8.3-P4 released --- + +3383. [security] A certain combination of records in the RBT could + cause named to hang while populating the additional + section of a response. [RT #31090] + --- 9.8.3-P3 released --- 3364. [security] Named could die on specially crafted record. Modified: head/contrib/bind9/bin/named/query.c ============================================================================== --- head/contrib/bind9/bin/named/query.c Wed Oct 10 19:46:46 2012 (r241413) +++ head/contrib/bind9/bin/named/query.c Wed Oct 10 19:47:52 2012 (r241414) @@ -1119,13 +1119,6 @@ query_isduplicate(ns_client_t *client, d mname = NULL; } - /* - * If the dns_name_t we're looking up is already in the message, - * we don't want to trigger the caller's name replacement logic. - */ - if (name == mname) - mname = NULL; - if (mnamep != NULL) *mnamep = mname; @@ -1324,6 +1317,7 @@ query_addadditional(void *arg, dns_name_ if (dns_rdataset_isassociated(rdataset) && !query_isduplicate(client, fname, type, &mname)) { if (mname != NULL) { + INSIST(mname != fname); query_releasename(client, &fname); fname = mname; } else @@ -1393,11 +1387,13 @@ query_addadditional(void *arg, dns_name_ #endif if (!query_isduplicate(client, fname, dns_rdatatype_a, &mname)) { - if (mname != NULL) { - query_releasename(client, &fname); - fname = mname; - } else - need_addname = ISC_TRUE; + if (mname != fname) { + if (mname != NULL) { + query_releasename(client, &fname); + fname = mname; + } else + need_addname = ISC_TRUE; + } ISC_LIST_APPEND(fname->list, rdataset, link); added_something = ISC_TRUE; if (sigrdataset != NULL && @@ -1450,11 +1446,13 @@ query_addadditional(void *arg, dns_name_ #endif if (!query_isduplicate(client, fname, dns_rdatatype_aaaa, &mname)) { - if (mname != NULL) { - query_releasename(client, &fname); - fname = mname; - } else - need_addname = ISC_TRUE; + if (mname != fname) { + if (mname != NULL) { + query_releasename(client, &fname); + fname = mname; + } else + need_addname = ISC_TRUE; + } ISC_LIST_APPEND(fname->list, rdataset, link); added_something = ISC_TRUE; if (sigrdataset != NULL && @@ -1977,22 +1975,24 @@ query_addadditional2(void *arg, dns_name crdataset->type == dns_rdatatype_aaaa) { if (!query_isduplicate(client, fname, crdataset->type, &mname)) { - if (mname != NULL) { - /* - * A different type of this name is - * already stored in the additional - * section. We'll reuse the name. - * Note that this should happen at most - * once. Otherwise, fname->link could - * leak below. - */ - INSIST(mname0 == NULL); - - query_releasename(client, &fname); - fname = mname; - mname0 = mname; - } else - need_addname = ISC_TRUE; + if (mname != fname) { + if (mname != NULL) { + /* + * A different type of this name is + * already stored in the additional + * section. We'll reuse the name. + * Note that this should happen at most + * once. Otherwise, fname->link could + * leak below. + */ + INSIST(mname0 == NULL); + + query_releasename(client, &fname); + fname = mname; + mname0 = mname; + } else + need_addname = ISC_TRUE; + } ISC_LIST_UNLINK(cfname.list, crdataset, link); ISC_LIST_APPEND(fname->list, crdataset, link); added_something = ISC_TRUE; Modified: head/contrib/bind9/version ============================================================================== --- head/contrib/bind9/version Wed Oct 10 19:46:46 2012 (r241413) +++ head/contrib/bind9/version Wed Oct 10 19:47:52 2012 (r241414) @@ -7,4 +7,4 @@ MAJORVER=9 MINORVER=8 PATCHVER=3 RELEASETYPE=-P -RELEASEVER=3 +RELEASEVER=4 From owner-svn-src-head@FreeBSD.ORG Wed Oct 10 20:09:20 2012 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id 5AA51617; Wed, 10 Oct 2012 20:09:20 +0000 (UTC) (envelope-from np@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 43F518FC12; Wed, 10 Oct 2012 20:09:20 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id q9AK9KpQ092195; Wed, 10 Oct 2012 20:09:20 GMT (envelope-from np@svn.freebsd.org) Received: (from np@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q9AK9KZr092193; Wed, 10 Oct 2012 20:09:20 GMT (envelope-from np@svn.freebsd.org) Message-Id: <201210102009.q9AK9KZr092193@svn.freebsd.org> From: Navdeep Parhar Date: Wed, 10 Oct 2012 20:09:20 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r241416 - head/tools/tools/cxgbetool X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 10 Oct 2012 20:09:20 -0000 Author: np Date: Wed Oct 10 20:09:19 2012 New Revision: 241416 URL: http://svn.freebsd.org/changeset/base/241416 Log: Add a "clearstats" subcommand to cxgbetool that lets you clear the MAC statistics for any port. For example: # cxgbetool t4nex0 clearstats 0 Submitted by: gnn@ MFC after: 3 days Modified: head/tools/tools/cxgbetool/cxgbetool.c Modified: head/tools/tools/cxgbetool/cxgbetool.c ============================================================================== --- head/tools/tools/cxgbetool/cxgbetool.c Wed Oct 10 19:50:15 2012 (r241415) +++ head/tools/tools/cxgbetool/cxgbetool.c Wed Oct 10 20:09:19 2012 (r241416) @@ -82,6 +82,7 @@ usage(FILE *fp) { fprintf(fp, "Usage: %s [operation]\n", progname); fprintf(fp, + "\tclearstats clear port statistics\n" "\tcontext show an SGE context\n" "\tfilter [ ] ... set a filter\n" "\tfilter delete|clear delete a filter\n" @@ -1578,6 +1579,28 @@ read_i2c(int argc, const char *argv[]) } static int +clearstats(int argc, const char *argv[]) +{ + char *p; + long l; + uint32_t port; + + if (argc != 1) { + warnx("incorrect number of arguments."); + return (EINVAL); + } + + p = str_to_number(argv[0], &l, NULL); + if (*p) { + warnx("invalid port id \"%s\"", argv[0]); + return (EINVAL); + } + port = l; + + return doit(CHELSIO_T4_CLEAR_STATS, &port); +} + +static int run_cmd(int argc, const char *argv[]) { int rc = -1; @@ -1605,6 +1628,8 @@ run_cmd(int argc, const char *argv[]) rc = read_tcb(argc, argv); else if (!strcmp(cmd, "i2c")) rc = read_i2c(argc, argv); + else if (!strcmp(cmd, "clearstats")) + rc = clearstats(argc, argv); else { rc = EINVAL; warnx("invalid command \"%s\"", cmd); From owner-svn-src-head@FreeBSD.ORG Wed Oct 10 20:41:38 2012 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id 5B4C5125; Wed, 10 Oct 2012 20:41:38 +0000 (UTC) (envelope-from mav@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 45E518FC0C; Wed, 10 Oct 2012 20:41:38 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id q9AKfcaK096460; Wed, 10 Oct 2012 20:41:38 GMT (envelope-from mav@svn.freebsd.org) Received: (from mav@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q9AKfc6R096458; Wed, 10 Oct 2012 20:41:38 GMT (envelope-from mav@svn.freebsd.org) Message-Id: <201210102041.q9AKfc6R096458@svn.freebsd.org> From: Alexander Motin Date: Wed, 10 Oct 2012 20:41:38 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r241418 - head/sys/geom/raid X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 10 Oct 2012 20:41:38 -0000 Author: mav Date: Wed Oct 10 20:41:37 2012 New Revision: 241418 URL: http://svn.freebsd.org/changeset/base/241418 Log: NULL-ify last previously used pointer instead of last possible pointer. This should be only a cosmetic change. Found by: Clang Static Analyzer Modified: head/sys/geom/raid/md_promise.c Modified: head/sys/geom/raid/md_promise.c ============================================================================== --- head/sys/geom/raid/md_promise.c Wed Oct 10 20:37:57 2012 (r241417) +++ head/sys/geom/raid/md_promise.c Wed Oct 10 20:41:37 2012 (r241418) @@ -544,7 +544,7 @@ g_raid_md_promise_purge_disks(struct g_r free(pd->pd_meta[i], M_MD_PROMISE); for (j = i; j < pd->pd_subdisks - 1; j++) pd->pd_meta[j] = pd->pd_meta[j + 1]; - pd->pd_meta[PROMISE_MAX_SUBDISKS - 1] = NULL; + pd->pd_meta[pd->pd_subdisks - 1] = NULL; pd->pd_subdisks--; pd->pd_updated = 1; } @@ -650,7 +650,7 @@ g_raid_md_promise_start_disk(struct g_ra free(pd->pd_meta[sdn], M_MD_PROMISE); for (i = sdn; i < pd->pd_subdisks - 1; i++) pd->pd_meta[i] = pd->pd_meta[i + 1]; - pd->pd_meta[PROMISE_MAX_SUBDISKS - 1] = NULL; + pd->pd_meta[pd->pd_subdisks - 1] = NULL; pd->pd_subdisks--; } /* If we are in the start process, that's all for now. */ @@ -1094,7 +1094,7 @@ g_raid_md_taste_promise(struct g_raid_md free(metaarr[i], M_MD_PROMISE); for (j = i; j < subdisks - 1; j++) metaarr[i] = metaarr[j + 1]; - metaarr[PROMISE_MAX_SUBDISKS - 1] = NULL; + metaarr[subdisks - 1] = NULL; subdisks--; } From owner-svn-src-head@FreeBSD.ORG Wed Oct 10 21:29:01 2012 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id 6CAD5CC3; Wed, 10 Oct 2012 21:29:01 +0000 (UTC) (envelope-from dim@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 567288FC1C; Wed, 10 Oct 2012 21:29:01 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id q9ALT1Ri005299; Wed, 10 Oct 2012 21:29:01 GMT (envelope-from dim@svn.freebsd.org) Received: (from dim@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q9ALT1sf005296; Wed, 10 Oct 2012 21:29:01 GMT (envelope-from dim@svn.freebsd.org) Message-Id: <201210102129.q9ALT1sf005296@svn.freebsd.org> From: Dimitry Andric Date: Wed, 10 Oct 2012 21:29:01 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r241427 - in head/contrib/llvm/lib: Support Target/X86 X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 10 Oct 2012 21:29:01 -0000 Author: dim Date: Wed Oct 10 21:29:00 2012 New Revision: 241427 URL: http://svn.freebsd.org/changeset/base/241427 Log: Pull in r163710 from upstream llvm trunk: Add support for AMD Geode. MFC after: 3 days Modified: head/contrib/llvm/lib/Support/Host.cpp head/contrib/llvm/lib/Target/X86/X86.td Modified: head/contrib/llvm/lib/Support/Host.cpp ============================================================================== --- head/contrib/llvm/lib/Support/Host.cpp Wed Oct 10 21:27:30 2012 (r241426) +++ head/contrib/llvm/lib/Support/Host.cpp Wed Oct 10 21:29:00 2012 (r241427) @@ -303,6 +303,7 @@ std::string sys::getHostCPUName() { case 8: return "k6-2"; case 9: case 13: return "k6-3"; + case 10: return "geode"; default: return "pentium"; } case 6: Modified: head/contrib/llvm/lib/Target/X86/X86.td ============================================================================== --- head/contrib/llvm/lib/Target/X86/X86.td Wed Oct 10 21:27:30 2012 (r241426) +++ head/contrib/llvm/lib/Target/X86/X86.td Wed Oct 10 21:29:00 2012 (r241427) @@ -227,6 +227,7 @@ def : Proc<"bdver2", [FeatureXO FeatureAES, FeaturePCLMUL, FeatureF16C, FeatureLZCNT, FeaturePOPCNT, FeatureBMI, FeatureFMA]>; +def : Proc<"geode", [Feature3DNowA]>; def : Proc<"winchip-c6", [FeatureMMX]>; def : Proc<"winchip2", [Feature3DNow]>; From owner-svn-src-head@FreeBSD.ORG Wed Oct 10 21:37:21 2012 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id D815C3F6; Wed, 10 Oct 2012 21:37:21 +0000 (UTC) (envelope-from dim@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id BE43F8FC1B; Wed, 10 Oct 2012 21:37:21 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id q9ALbLl4006636; Wed, 10 Oct 2012 21:37:21 GMT (envelope-from dim@svn.freebsd.org) Received: (from dim@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q9ALbLY0006621; Wed, 10 Oct 2012 21:37:21 GMT (envelope-from dim@svn.freebsd.org) Message-Id: <201210102137.q9ALbLY0006621@svn.freebsd.org> From: Dimitry Andric Date: Wed, 10 Oct 2012 21:37:21 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r241430 - in head/contrib/llvm: include/llvm/Support lib/CodeGen lib/Target/ARM/MCTargetDesc lib/Target/MBlaze/MCTargetDesc lib/Target/Mips/MCTargetDesc lib/Target/PowerPC/MCTargetDesc ... X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 10 Oct 2012 21:37:21 -0000 Author: dim Date: Wed Oct 10 21:37:21 2012 New Revision: 241430 URL: http://svn.freebsd.org/changeset/base/241430 Log: Pull in r164132 from upstream llvm trunk: When creating MCAsmBackend pass the CPU string as well. In X86AsmBackend store this and use it to not emit long nops when the CPU is geode which doesnt support them. Fixes PR11212. Pull in r164133 from upstream clang trunk: Follow up on llvm r164132. This should prevent illegal instructions when building world on Geode CPUs (e.g. Soekris). MFC after: 3 days Modified: head/contrib/llvm/include/llvm/Support/TargetRegistry.h head/contrib/llvm/lib/CodeGen/LLVMTargetMachine.cpp head/contrib/llvm/lib/Target/ARM/MCTargetDesc/ARMAsmBackend.cpp head/contrib/llvm/lib/Target/ARM/MCTargetDesc/ARMMCTargetDesc.h head/contrib/llvm/lib/Target/MBlaze/MCTargetDesc/MBlazeAsmBackend.cpp head/contrib/llvm/lib/Target/MBlaze/MCTargetDesc/MBlazeMCTargetDesc.h head/contrib/llvm/lib/Target/Mips/MCTargetDesc/MipsAsmBackend.cpp head/contrib/llvm/lib/Target/Mips/MCTargetDesc/MipsMCTargetDesc.h head/contrib/llvm/lib/Target/PowerPC/MCTargetDesc/PPCAsmBackend.cpp head/contrib/llvm/lib/Target/PowerPC/MCTargetDesc/PPCMCTargetDesc.h head/contrib/llvm/lib/Target/X86/MCTargetDesc/X86AsmBackend.cpp head/contrib/llvm/lib/Target/X86/MCTargetDesc/X86MCTargetDesc.h head/contrib/llvm/tools/clang/tools/driver/cc1as_main.cpp head/contrib/llvm/tools/llvm-mc/llvm-mc.cpp Modified: head/contrib/llvm/include/llvm/Support/TargetRegistry.h ============================================================================== --- head/contrib/llvm/include/llvm/Support/TargetRegistry.h Wed Oct 10 21:30:26 2012 (r241429) +++ head/contrib/llvm/include/llvm/Support/TargetRegistry.h Wed Oct 10 21:37:21 2012 (r241430) @@ -93,7 +93,9 @@ namespace llvm { CodeGenOpt::Level OL); typedef AsmPrinter *(*AsmPrinterCtorTy)(TargetMachine &TM, MCStreamer &Streamer); - typedef MCAsmBackend *(*MCAsmBackendCtorTy)(const Target &T, StringRef TT); + typedef MCAsmBackend *(*MCAsmBackendCtorTy)(const Target &T, + StringRef TT, + StringRef CPU); typedef MCTargetAsmLexer *(*MCAsmLexerCtorTy)(const Target &T, const MCRegisterInfo &MRI, const MCAsmInfo &MAI); @@ -353,10 +355,10 @@ namespace llvm { /// /// \arg Triple - The target triple string. /// \arg Backend - The target independent assembler object. - MCAsmBackend *createMCAsmBackend(StringRef Triple) const { + MCAsmBackend *createMCAsmBackend(StringRef Triple, StringRef CPU) const { if (!MCAsmBackendCtorFn) return 0; - return MCAsmBackendCtorFn(*this, Triple); + return MCAsmBackendCtorFn(*this, Triple, CPU); } /// createMCAsmLexer - Create a target specific assembly lexer. @@ -1063,8 +1065,9 @@ namespace llvm { } private: - static MCAsmBackend *Allocator(const Target &T, StringRef Triple) { - return new MCAsmBackendImpl(T, Triple); + static MCAsmBackend *Allocator(const Target &T, StringRef Triple, + StringRef CPU) { + return new MCAsmBackendImpl(T, Triple, CPU); } }; Modified: head/contrib/llvm/lib/CodeGen/LLVMTargetMachine.cpp ============================================================================== --- head/contrib/llvm/lib/CodeGen/LLVMTargetMachine.cpp Wed Oct 10 21:30:26 2012 (r241429) +++ head/contrib/llvm/lib/CodeGen/LLVMTargetMachine.cpp Wed Oct 10 21:37:21 2012 (r241430) @@ -172,7 +172,7 @@ bool LLVMTargetMachine::addPassesToEmitF const MCSubtargetInfo &STI = getSubtarget(); MCE = getTarget().createMCCodeEmitter(*getInstrInfo(), MRI, STI, *Context); - MAB = getTarget().createMCAsmBackend(getTargetTriple()); + MAB = getTarget().createMCAsmBackend(getTargetTriple(), TargetCPU); } MCStreamer *S = getTarget().createAsmStreamer(*Context, Out, @@ -191,7 +191,7 @@ bool LLVMTargetMachine::addPassesToEmitF // emission fails. MCCodeEmitter *MCE = getTarget().createMCCodeEmitter(*getInstrInfo(), MRI, STI, *Context); - MCAsmBackend *MAB = getTarget().createMCAsmBackend(getTargetTriple()); + MCAsmBackend *MAB = getTarget().createMCAsmBackend(getTargetTriple(), TargetCPU); if (MCE == 0 || MAB == 0) return true; @@ -266,7 +266,7 @@ bool LLVMTargetMachine::addPassesToEmitM const MCSubtargetInfo &STI = getSubtarget(); MCCodeEmitter *MCE = getTarget().createMCCodeEmitter(*getInstrInfo(), MRI, STI, *Ctx); - MCAsmBackend *MAB = getTarget().createMCAsmBackend(getTargetTriple()); + MCAsmBackend *MAB = getTarget().createMCAsmBackend(getTargetTriple(), TargetCPU); if (MCE == 0 || MAB == 0) return true; Modified: head/contrib/llvm/lib/Target/ARM/MCTargetDesc/ARMAsmBackend.cpp ============================================================================== --- head/contrib/llvm/lib/Target/ARM/MCTargetDesc/ARMAsmBackend.cpp Wed Oct 10 21:30:26 2012 (r241429) +++ head/contrib/llvm/lib/Target/ARM/MCTargetDesc/ARMAsmBackend.cpp Wed Oct 10 21:37:21 2012 (r241430) @@ -674,7 +674,7 @@ void DarwinARMAsmBackend::applyFixup(con } // end anonymous namespace -MCAsmBackend *llvm::createARMAsmBackend(const Target &T, StringRef TT) { +MCAsmBackend *llvm::createARMAsmBackend(const Target &T, StringRef TT, StringRef CPU) { Triple TheTriple(TT); if (TheTriple.isOSDarwin()) { Modified: head/contrib/llvm/lib/Target/ARM/MCTargetDesc/ARMMCTargetDesc.h ============================================================================== --- head/contrib/llvm/lib/Target/ARM/MCTargetDesc/ARMMCTargetDesc.h Wed Oct 10 21:30:26 2012 (r241429) +++ head/contrib/llvm/lib/Target/ARM/MCTargetDesc/ARMMCTargetDesc.h Wed Oct 10 21:37:21 2012 (r241430) @@ -46,7 +46,7 @@ MCCodeEmitter *createARMMCCodeEmitter(co const MCSubtargetInfo &STI, MCContext &Ctx); -MCAsmBackend *createARMAsmBackend(const Target &T, StringRef TT); +MCAsmBackend *createARMAsmBackend(const Target &T, StringRef TT, StringRef CPU); /// createARMELFObjectWriter - Construct an ELF Mach-O object writer. MCObjectWriter *createARMELFObjectWriter(raw_ostream &OS, Modified: head/contrib/llvm/lib/Target/MBlaze/MCTargetDesc/MBlazeAsmBackend.cpp ============================================================================== --- head/contrib/llvm/lib/Target/MBlaze/MCTargetDesc/MBlazeAsmBackend.cpp Wed Oct 10 21:30:26 2012 (r241429) +++ head/contrib/llvm/lib/Target/MBlaze/MCTargetDesc/MBlazeAsmBackend.cpp Wed Oct 10 21:37:21 2012 (r241430) @@ -156,7 +156,8 @@ void ELFMBlazeAsmBackend::applyFixup(con } } // end anonymous namespace -MCAsmBackend *llvm::createMBlazeAsmBackend(const Target &T, StringRef TT) { +MCAsmBackend *llvm::createMBlazeAsmBackend(const Target &T, StringRef TT, + StringRef CPU) { Triple TheTriple(TT); if (TheTriple.isOSDarwin()) Modified: head/contrib/llvm/lib/Target/MBlaze/MCTargetDesc/MBlazeMCTargetDesc.h ============================================================================== --- head/contrib/llvm/lib/Target/MBlaze/MCTargetDesc/MBlazeMCTargetDesc.h Wed Oct 10 21:30:26 2012 (r241429) +++ head/contrib/llvm/lib/Target/MBlaze/MCTargetDesc/MBlazeMCTargetDesc.h Wed Oct 10 21:37:21 2012 (r241430) @@ -35,7 +35,8 @@ MCCodeEmitter *createMBlazeMCCodeEmitter const MCSubtargetInfo &STI, MCContext &Ctx); -MCAsmBackend *createMBlazeAsmBackend(const Target &T, StringRef TT); +MCAsmBackend *createMBlazeAsmBackend(const Target &T, StringRef TT, + StringRef CPU); MCObjectWriter *createMBlazeELFObjectWriter(raw_ostream &OS, uint8_t OSABI); } // End llvm namespace Modified: head/contrib/llvm/lib/Target/Mips/MCTargetDesc/MipsAsmBackend.cpp ============================================================================== --- head/contrib/llvm/lib/Target/Mips/MCTargetDesc/MipsAsmBackend.cpp Wed Oct 10 21:30:26 2012 (r241429) +++ head/contrib/llvm/lib/Target/Mips/MCTargetDesc/MipsAsmBackend.cpp Wed Oct 10 21:37:21 2012 (r241430) @@ -244,22 +244,26 @@ public: } // namespace // MCAsmBackend -MCAsmBackend *llvm::createMipsAsmBackendEL32(const Target &T, StringRef TT) { +MCAsmBackend *llvm::createMipsAsmBackendEL32(const Target &T, StringRef TT, + StringRef CPU) { return new MipsAsmBackend(T, Triple(TT).getOS(), /*IsLittle*/true, /*Is64Bit*/false); } -MCAsmBackend *llvm::createMipsAsmBackendEB32(const Target &T, StringRef TT) { +MCAsmBackend *llvm::createMipsAsmBackendEB32(const Target &T, StringRef TT, + StringRef CPU) { return new MipsAsmBackend(T, Triple(TT).getOS(), /*IsLittle*/false, /*Is64Bit*/false); } -MCAsmBackend *llvm::createMipsAsmBackendEL64(const Target &T, StringRef TT) { +MCAsmBackend *llvm::createMipsAsmBackendEL64(const Target &T, StringRef TT, + StringRef CPU) { return new MipsAsmBackend(T, Triple(TT).getOS(), /*IsLittle*/true, /*Is64Bit*/true); } -MCAsmBackend *llvm::createMipsAsmBackendEB64(const Target &T, StringRef TT) { +MCAsmBackend *llvm::createMipsAsmBackendEB64(const Target &T, StringRef TT, + StringRef CPU) { return new MipsAsmBackend(T, Triple(TT).getOS(), /*IsLittle*/false, /*Is64Bit*/true); } Modified: head/contrib/llvm/lib/Target/Mips/MCTargetDesc/MipsMCTargetDesc.h ============================================================================== --- head/contrib/llvm/lib/Target/Mips/MCTargetDesc/MipsMCTargetDesc.h Wed Oct 10 21:30:26 2012 (r241429) +++ head/contrib/llvm/lib/Target/Mips/MCTargetDesc/MipsMCTargetDesc.h Wed Oct 10 21:37:21 2012 (r241430) @@ -42,10 +42,14 @@ MCCodeEmitter *createMipsMCCodeEmitterEL const MCSubtargetInfo &STI, MCContext &Ctx); -MCAsmBackend *createMipsAsmBackendEB32(const Target &T, StringRef TT); -MCAsmBackend *createMipsAsmBackendEL32(const Target &T, StringRef TT); -MCAsmBackend *createMipsAsmBackendEB64(const Target &T, StringRef TT); -MCAsmBackend *createMipsAsmBackendEL64(const Target &T, StringRef TT); +MCAsmBackend *createMipsAsmBackendEB32(const Target &T, StringRef TT, + StringRef CPU); +MCAsmBackend *createMipsAsmBackendEL32(const Target &T, StringRef TT, + StringRef CPU); +MCAsmBackend *createMipsAsmBackendEB64(const Target &T, StringRef TT, + StringRef CPU); +MCAsmBackend *createMipsAsmBackendEL64(const Target &T, StringRef TT, + StringRef CPU); MCObjectWriter *createMipsELFObjectWriter(raw_ostream &OS, uint8_t OSABI, Modified: head/contrib/llvm/lib/Target/PowerPC/MCTargetDesc/PPCAsmBackend.cpp ============================================================================== --- head/contrib/llvm/lib/Target/PowerPC/MCTargetDesc/PPCAsmBackend.cpp Wed Oct 10 21:30:26 2012 (r241429) +++ head/contrib/llvm/lib/Target/PowerPC/MCTargetDesc/PPCAsmBackend.cpp Wed Oct 10 21:37:21 2012 (r241430) @@ -181,7 +181,7 @@ namespace { -MCAsmBackend *llvm::createPPCAsmBackend(const Target &T, StringRef TT) { +MCAsmBackend *llvm::createPPCAsmBackend(const Target &T, StringRef TT, StringRef CPU) { if (Triple(TT).isOSDarwin()) return new DarwinPPCAsmBackend(T); Modified: head/contrib/llvm/lib/Target/PowerPC/MCTargetDesc/PPCMCTargetDesc.h ============================================================================== --- head/contrib/llvm/lib/Target/PowerPC/MCTargetDesc/PPCMCTargetDesc.h Wed Oct 10 21:30:26 2012 (r241429) +++ head/contrib/llvm/lib/Target/PowerPC/MCTargetDesc/PPCMCTargetDesc.h Wed Oct 10 21:37:21 2012 (r241430) @@ -36,7 +36,7 @@ MCCodeEmitter *createPPCMCCodeEmitter(co const MCSubtargetInfo &STI, MCContext &Ctx); -MCAsmBackend *createPPCAsmBackend(const Target &T, StringRef TT); +MCAsmBackend *createPPCAsmBackend(const Target &T, StringRef TT, StringRef CPU); /// createPPCELFObjectWriter - Construct an PPC ELF object writer. MCObjectWriter *createPPCELFObjectWriter(raw_ostream &OS, Modified: head/contrib/llvm/lib/Target/X86/MCTargetDesc/X86AsmBackend.cpp ============================================================================== --- head/contrib/llvm/lib/Target/X86/MCTargetDesc/X86AsmBackend.cpp Wed Oct 10 21:30:26 2012 (r241429) +++ head/contrib/llvm/lib/Target/X86/MCTargetDesc/X86AsmBackend.cpp Wed Oct 10 21:37:21 2012 (r241430) @@ -66,9 +66,10 @@ public: }; class X86AsmBackend : public MCAsmBackend { + StringRef CPU; public: - X86AsmBackend(const Target &T) - : MCAsmBackend() {} + X86AsmBackend(const Target &T, StringRef _CPU) + : MCAsmBackend(), CPU(_CPU) {} unsigned getNumFixupKinds() const { return X86::NumTargetFixupKinds; @@ -305,6 +306,13 @@ bool X86AsmBackend::writeNopData(uint64_ {0x66, 0x2e, 0x0f, 0x1f, 0x84, 0x00, 0x00, 0x00, 0x00, 0x00}, }; + // This CPU doesnt support long nops. If needed add more. + if (CPU == "geode") { + for (uint64_t i = 0; i < Count; ++i) + OW->Write8(0x90); + return true; + } + // Write an optimal sequence for the first 15 bytes. const uint64_t OptimalCount = (Count < 16) ? Count : 15; const uint64_t Prefixes = OptimalCount <= 10 ? 0 : OptimalCount - 10; @@ -327,8 +335,8 @@ namespace { class ELFX86AsmBackend : public X86AsmBackend { public: uint8_t OSABI; - ELFX86AsmBackend(const Target &T, uint8_t _OSABI) - : X86AsmBackend(T), OSABI(_OSABI) { + ELFX86AsmBackend(const Target &T, uint8_t _OSABI, StringRef CPU) + : X86AsmBackend(T, CPU), OSABI(_OSABI) { HasReliableSymbolDifference = true; } @@ -340,8 +348,8 @@ public: class ELFX86_32AsmBackend : public ELFX86AsmBackend { public: - ELFX86_32AsmBackend(const Target &T, uint8_t OSABI) - : ELFX86AsmBackend(T, OSABI) {} + ELFX86_32AsmBackend(const Target &T, uint8_t OSABI, StringRef CPU) + : ELFX86AsmBackend(T, OSABI, CPU) {} MCObjectWriter *createObjectWriter(raw_ostream &OS) const { return createX86ELFObjectWriter(OS, /*Is64Bit*/ false, OSABI); @@ -350,8 +358,8 @@ public: class ELFX86_64AsmBackend : public ELFX86AsmBackend { public: - ELFX86_64AsmBackend(const Target &T, uint8_t OSABI) - : ELFX86AsmBackend(T, OSABI) {} + ELFX86_64AsmBackend(const Target &T, uint8_t OSABI, StringRef CPU) + : ELFX86AsmBackend(T, OSABI, CPU) {} MCObjectWriter *createObjectWriter(raw_ostream &OS) const { return createX86ELFObjectWriter(OS, /*Is64Bit*/ true, OSABI); @@ -362,8 +370,8 @@ class WindowsX86AsmBackend : public X86A bool Is64Bit; public: - WindowsX86AsmBackend(const Target &T, bool is64Bit) - : X86AsmBackend(T) + WindowsX86AsmBackend(const Target &T, bool is64Bit, StringRef CPU) + : X86AsmBackend(T, CPU) , Is64Bit(is64Bit) { } @@ -374,14 +382,14 @@ public: class DarwinX86AsmBackend : public X86AsmBackend { public: - DarwinX86AsmBackend(const Target &T) - : X86AsmBackend(T) { } + DarwinX86AsmBackend(const Target &T, StringRef CPU) + : X86AsmBackend(T, CPU) { } }; class DarwinX86_32AsmBackend : public DarwinX86AsmBackend { public: - DarwinX86_32AsmBackend(const Target &T) - : DarwinX86AsmBackend(T) {} + DarwinX86_32AsmBackend(const Target &T, StringRef CPU) + : DarwinX86AsmBackend(T, CPU) {} MCObjectWriter *createObjectWriter(raw_ostream &OS) const { return createX86MachObjectWriter(OS, /*Is64Bit=*/false, @@ -392,8 +400,8 @@ public: class DarwinX86_64AsmBackend : public DarwinX86AsmBackend { public: - DarwinX86_64AsmBackend(const Target &T) - : DarwinX86AsmBackend(T) { + DarwinX86_64AsmBackend(const Target &T, StringRef CPU) + : DarwinX86AsmBackend(T, CPU) { HasReliableSymbolDifference = true; } @@ -439,28 +447,28 @@ public: } // end anonymous namespace -MCAsmBackend *llvm::createX86_32AsmBackend(const Target &T, StringRef TT) { +MCAsmBackend *llvm::createX86_32AsmBackend(const Target &T, StringRef TT, StringRef CPU) { Triple TheTriple(TT); if (TheTriple.isOSDarwin() || TheTriple.getEnvironment() == Triple::MachO) - return new DarwinX86_32AsmBackend(T); + return new DarwinX86_32AsmBackend(T, CPU); if (TheTriple.isOSWindows()) - return new WindowsX86AsmBackend(T, false); + return new WindowsX86AsmBackend(T, false, CPU); uint8_t OSABI = MCELFObjectTargetWriter::getOSABI(TheTriple.getOS()); - return new ELFX86_32AsmBackend(T, OSABI); + return new ELFX86_32AsmBackend(T, OSABI, CPU); } -MCAsmBackend *llvm::createX86_64AsmBackend(const Target &T, StringRef TT) { +MCAsmBackend *llvm::createX86_64AsmBackend(const Target &T, StringRef TT, StringRef CPU) { Triple TheTriple(TT); if (TheTriple.isOSDarwin() || TheTriple.getEnvironment() == Triple::MachO) - return new DarwinX86_64AsmBackend(T); + return new DarwinX86_64AsmBackend(T, CPU); if (TheTriple.isOSWindows()) - return new WindowsX86AsmBackend(T, true); + return new WindowsX86AsmBackend(T, true, CPU); uint8_t OSABI = MCELFObjectTargetWriter::getOSABI(TheTriple.getOS()); - return new ELFX86_64AsmBackend(T, OSABI); + return new ELFX86_64AsmBackend(T, OSABI, CPU); } Modified: head/contrib/llvm/lib/Target/X86/MCTargetDesc/X86MCTargetDesc.h ============================================================================== --- head/contrib/llvm/lib/Target/X86/MCTargetDesc/X86MCTargetDesc.h Wed Oct 10 21:30:26 2012 (r241429) +++ head/contrib/llvm/lib/Target/X86/MCTargetDesc/X86MCTargetDesc.h Wed Oct 10 21:37:21 2012 (r241430) @@ -80,8 +80,8 @@ MCCodeEmitter *createX86MCCodeEmitter(co const MCSubtargetInfo &STI, MCContext &Ctx); -MCAsmBackend *createX86_32AsmBackend(const Target &T, StringRef TT); -MCAsmBackend *createX86_64AsmBackend(const Target &T, StringRef TT); +MCAsmBackend *createX86_32AsmBackend(const Target &T, StringRef TT, StringRef CPU); +MCAsmBackend *createX86_64AsmBackend(const Target &T, StringRef TT, StringRef CPU); /// createX86MachObjectWriter - Construct an X86 Mach-O object writer. MCObjectWriter *createX86MachObjectWriter(raw_ostream &OS, Modified: head/contrib/llvm/tools/clang/tools/driver/cc1as_main.cpp ============================================================================== --- head/contrib/llvm/tools/clang/tools/driver/cc1as_main.cpp Wed Oct 10 21:30:26 2012 (r241429) +++ head/contrib/llvm/tools/clang/tools/driver/cc1as_main.cpp Wed Oct 10 21:37:21 2012 (r241430) @@ -329,7 +329,7 @@ static bool ExecuteAssembler(AssemblerIn MCAsmBackend *MAB = 0; if (Opts.ShowEncoding) { CE = TheTarget->createMCCodeEmitter(*MCII, *MRI, *STI, Ctx); - MAB = TheTarget->createMCAsmBackend(Opts.Triple); + MAB = TheTarget->createMCAsmBackend(Opts.Triple, Opts.CPU); } Str.reset(TheTarget->createAsmStreamer(Ctx, *Out, /*asmverbose*/true, /*useLoc*/ true, @@ -343,7 +343,7 @@ static bool ExecuteAssembler(AssemblerIn assert(Opts.OutputType == AssemblerInvocation::FT_Obj && "Invalid file type!"); MCCodeEmitter *CE = TheTarget->createMCCodeEmitter(*MCII, *MRI, *STI, Ctx); - MCAsmBackend *MAB = TheTarget->createMCAsmBackend(Opts.Triple); + MCAsmBackend *MAB = TheTarget->createMCAsmBackend(Opts.Triple, Opts.CPU); Str.reset(TheTarget->createMCObjectStreamer(Opts.Triple, Ctx, *MAB, *Out, CE, Opts.RelaxAll, Opts.NoExecStack)); Modified: head/contrib/llvm/tools/llvm-mc/llvm-mc.cpp ============================================================================== --- head/contrib/llvm/tools/llvm-mc/llvm-mc.cpp Wed Oct 10 21:30:26 2012 (r241429) +++ head/contrib/llvm/tools/llvm-mc/llvm-mc.cpp Wed Oct 10 21:37:21 2012 (r241430) @@ -409,7 +409,7 @@ int main(int argc, char **argv) { MCAsmBackend *MAB = 0; if (ShowEncoding) { CE = TheTarget->createMCCodeEmitter(*MCII, *MRI, *STI, Ctx); - MAB = TheTarget->createMCAsmBackend(TripleName); + MAB = TheTarget->createMCAsmBackend(TripleName, MCPU); } Str.reset(TheTarget->createAsmStreamer(Ctx, FOS, /*asmverbose*/true, /*useLoc*/ true, @@ -422,7 +422,7 @@ int main(int argc, char **argv) { } else { assert(FileType == OFT_ObjectFile && "Invalid file type!"); MCCodeEmitter *CE = TheTarget->createMCCodeEmitter(*MCII, *MRI, *STI, Ctx); - MCAsmBackend *MAB = TheTarget->createMCAsmBackend(TripleName); + MCAsmBackend *MAB = TheTarget->createMCAsmBackend(TripleName, MCPU); Str.reset(TheTarget->createMCObjectStreamer(TripleName, Ctx, *MAB, FOS, CE, RelaxAll, NoExecStack)); From owner-svn-src-head@FreeBSD.ORG Wed Oct 10 21:38:17 2012 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id AC2CE591; Wed, 10 Oct 2012 21:38:17 +0000 (UTC) (envelope-from jimharris@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 93A3D8FC0A; Wed, 10 Oct 2012 21:38:17 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id q9ALcH21006788; Wed, 10 Oct 2012 21:38:17 GMT (envelope-from jimharris@svn.freebsd.org) Received: (from jimharris@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q9ALcHZ4006784; Wed, 10 Oct 2012 21:38:17 GMT (envelope-from jimharris@svn.freebsd.org) Message-Id: <201210102138.q9ALcHZ4006784@svn.freebsd.org> From: Jim Harris Date: Wed, 10 Oct 2012 21:38:17 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r241431 - head/share/man/man4 X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 10 Oct 2012 21:38:17 -0000 Author: jimharris Date: Wed Oct 10 21:38:17 2012 New Revision: 241431 URL: http://svn.freebsd.org/changeset/base/241431 Log: Add man pages for nvme(4) and nvd(4). Sponsored by: Intel Reviewed by: joel Added: head/share/man/man4/nvd.4 (contents, props changed) head/share/man/man4/nvme.4 (contents, props changed) Modified: head/share/man/man4/Makefile Modified: head/share/man/man4/Makefile ============================================================================== --- head/share/man/man4/Makefile Wed Oct 10 21:37:21 2012 (r241430) +++ head/share/man/man4/Makefile Wed Oct 10 21:38:17 2012 (r241431) @@ -337,7 +337,9 @@ MAN= aac.4 \ nmdm.4 \ nsp.4 \ null.4 \ + ${_nvd.4} \ ${_nve.4} \ + ${_nvme.4} \ ${_nvram.4} \ ${_nvram2env.4} \ ${_nxge.4} \ @@ -758,7 +760,9 @@ _linux.4= linux.4 _ndis.4= ndis.4 _nfe.4= nfe.4 _nfsmb.4= nfsmb.4 +_nvd.4= nvd.4 _nve.4= nve.4 +_nvme.4= nvme.4 _nvram.4= nvram.4 _nxge.4= nxge.4 _virtio.4= virtio.4 Added: head/share/man/man4/nvd.4 ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ head/share/man/man4/nvd.4 Wed Oct 10 21:38:17 2012 (r241431) @@ -0,0 +1,91 @@ +.\" +.\" Copyright (c) 2012 Intel Corporation +.\" All rights reserved. +.\" +.\" Redistribution and use in source and binary forms, with or without +.\" modification, are permitted provided that the following conditions +.\" are met: +.\" 1. Redistributions of source code must retain the above copyright +.\" notice, this list of conditions, and the following disclaimer, +.\" without modification. +.\" 2. Redistributions in binary form must reproduce at minimum a disclaimer +.\" substantially similar to the "NO WARRANTY" disclaimer below +.\" ("Disclaimer") and any redistribution must be conditioned upon +.\" including a substantially similar Disclaimer requirement for further +.\" binary redistribution. +.\" +.\" NO WARRANTY +.\" THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +.\" "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +.\" LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR +.\" A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +.\" HOLDERS OR CONTRIBUTORS BE LIABLE FOR SPECIAL, EXEMPLARY, OR CONSEQUENTIAL +.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS +.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) +.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, +.\" STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING +.\" IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE +.\" POSSIBILITY OF SUCH DAMAGES. +.\" +.\" nvd driver man page. +.\" +.\" Author: Jim Harris +.\" +.\" $FreeBSD$ +.\" +.Dd October 10, 2012 +.Dt NVD 4 +.Os +.Sh NAME +.Nm nvd +.Nd NVM Express disk driver +.Sh SYNOPSIS +To compile this driver into your kernel, +place the following lines in your kernel configuration file: +.Bd -ragged -offset indent +.Cd "device nvme" +.Cd "device nvd" +.Ed +.Pp +Or, to load the driver as a module at boot, place the following lines in +.Xr loader.conf 5 : +.Bd -literal -offset indent +nvme_load="YES" +nvd_load="YES" +.Ed +.Sh DESCRIPTION +The +.Nm +driver exposes NVM Express (NVMe) namespaces as disks to the kernel disk +storage API. +It depends on the +.Xr nvme 4 +driver for notification of existing NVMe namespaces and submission of NVM +I/O commands. +.Sh SEE ALSO +.Xr nvme 4 , +.Xr nvmecontrol 8 , +.Xr disk 9 . +.Sh AUTHORS +.An -nosplit +The +.Nm +driver was developed by Intel and originally written by +.An Jim Harris Aq jimharris@FreeBSD.org , +with contributions from Joe Golio at EMC. +.Pp +This man page was written by +.An Jim Harris Aq jimharris@FreeBSD.org . +.Sh BUGS +The +.Nm +driver is considered experimental. +Development and testing have been primarily focused on amd64. +The following areas of development and testing are in progress: +.Bl -bullet +.It +testing on i386 +.It +command timeout error handling +.El + Added: head/share/man/man4/nvme.4 ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ head/share/man/man4/nvme.4 Wed Oct 10 21:38:17 2012 (r241431) @@ -0,0 +1,175 @@ +.\" +.\" Copyright (c) 2012 Intel Corporation +.\" All rights reserved. +.\" +.\" Redistribution and use in source and binary forms, with or without +.\" modification, are permitted provided that the following conditions +.\" are met: +.\" 1. Redistributions of source code must retain the above copyright +.\" notice, this list of conditions, and the following disclaimer, +.\" without modification. +.\" 2. Redistributions in binary form must reproduce at minimum a disclaimer +.\" substantially similar to the "NO WARRANTY" disclaimer below +.\" ("Disclaimer") and any redistribution must be conditioned upon +.\" including a substantially similar Disclaimer requirement for further +.\" binary redistribution. +.\" +.\" NO WARRANTY +.\" THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +.\" "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +.\" LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR +.\" A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +.\" HOLDERS OR CONTRIBUTORS BE LIABLE FOR SPECIAL, EXEMPLARY, OR CONSEQUENTIAL +.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS +.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) +.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, +.\" STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING +.\" IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE +.\" POSSIBILITY OF SUCH DAMAGES. +.\" +.\" nvme driver man page. +.\" +.\" Author: Jim Harris +.\" +.\" $FreeBSD$ +.\" +.Dd October 10, 2012 +.Dt NVME 4 +.Os +.Sh NAME +.Nm nvme +.Nd NVM Express core driver +.Sh SYNOPSIS +To compile this driver into your kernel, +place the following line in your kernel configuration file: +.Bd -ragged -offset indent +.Cd "device nvme" +.Ed +.Pp +Or, to load the driver as a module at boot, place the following line in +.Xr loader.conf 5 : +.Bd -literal -offset indent +nvme_load="YES" +.Ed +.Pp +Most users will also want to enable +.Xr nvd 4 +to surface NVM Express namespaces as disk devices. +Note that in NVM Express terms, a namespace is roughly equivalent to a +SCSI LUN. +.Sh DESCRIPTION +The +.Nm +driver provides support for NVM Express (NVMe) controllers, such as: +.Bl -bullet +.It +Hardware initialization +.It +Per-CPU IO queue pairs +.It +API for registering NVMe namespace consumers such as +.Xr nvd 4 +.It +API for submitting NVM commands to namespaces +.It +Ioctls for controller and namespace configuration and management +.Nm +creates controller devices in the format /dev/nvmeX and namespace devices in +the format /dev/nvmeXnsY. +Note that the NVM Express specification starts numbering namespaces at 1, +not 0, and this driver follows that convention. +.El +.Sh CONFIGURATION +By default, +.Nm +will create an I/O queue pair for each CPU, provided enough MSI-X vectors +can be allocated. +To force a single I/O queue pair shared by all CPUs, set the following +tunable value in +.Xr loader.conf 5 : +.Bd -literal -offset indent +hw.nvme.per_cpu_io_queues=0 +.Ed +.Pp +To force legacy interrupts for all +.Nm +driver instances, set the following tunable value in +.Xr loader.conf 5 : +.Bd -literal -offset indent +hw.nvme.force_intx=1 +.Ed +.Pp +Note that use of INTx implies disabling of per-CPU I/O queue pairs. +.Sh SYSCTL VARIABLES +The following controller-level sysctls are currently implemented: +.Bl -tag -width indent +.It Va dev.nvme.0.int_coal_time +(R/W) Interrupt coalescing timer period in microseconds. Set to 0 to disable. +.It Va dev.nvme.0.int_coal_threshold +(R/W) Interrupt coalescing threshold in number of command completions. +Set to 0 to disable. +.El +.Pp +The following queue pair-level sysctls are currently implemented. +Admin queue sysctls take the format of dev.nvme.0.adminq and I/O queue sysctls +take the format of dev.nvme.0.ioq0. +.Bl -tag -width indent +.It Va dev.nvme.0.ioq0.num_entries +(R) Number of entries in this queue pair's command and completion queue. +.It Va dev.nvme.0.ioq0.num_tr +(R) Number of nvme_tracker structures currently allocated for this queue pair. +.It Va dev.nvme.0.ioq0.num_prp_list +(R) Number of nvme_prp_list structures currently allocated for this queue pair. +.It Va dev.nvme.0.ioq0.sq_head +(R) Current location of the submission queue head pointer as observed by +the driver. +The head pointer is incremented by the controller as it takes commands off +of the submission queue. +.It Va dev.nvme.0.ioq0.sq_tail +(R) Current location of the submission queue tail pointer as observed by +the driver. +The driver increments the tail pointer after writing a command +into the submission queue to signal that a new command is ready to be +processed. +.It Va dev.nvme.0.ioq0.cq_head +(R) Current location of the completion queue head pointer as observed by +the driver. +The driver increments the head pointer after finishing +with a completion entry that was posted by the controller. +.It Va dev.nvme.0.ioq0.num_cmds +(R) Number of commands that have been submitted on this queue pair. +.It Va dev.nvme.0.ioq0.dump_debug +(W) Writing 1 to this sysctl will dump the full contents of the submission +and completion queues to the console. +.El +.Sh SEE ALSO +.Xr nvd 4 , +.Xr pci 4 , +.Xr nvmecontrol 8 , +.Xr disk 9 . +.Sh AUTHORS +.An -nosplit +The +.Nm +driver was developed by Intel and originally written by +.An Jim Harris Aq jimharris@FreeBSD.org , +with contributions from Joe Golio at EMC. +.Pp +This man page was written by +.An Jim Harris Aq jimharris@FreeBSD.org . +.Sh BUGS +The +.Nm +driver is considered experimental. +Development and testing have been primarily focused on amd64. +The following areas of development and testing are in progress: +.Bl -bullet +.It +testing on i386 +.It +asynchronous error reporting +.It +command timeout error handling +.It +controller-level resets +.El From owner-svn-src-head@FreeBSD.ORG Wed Oct 10 22:02:12 2012 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id 59B67EE8; Wed, 10 Oct 2012 22:02:12 +0000 (UTC) (envelope-from mav@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 431F08FC17; Wed, 10 Oct 2012 22:02:12 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id q9AM2CRB010155; Wed, 10 Oct 2012 22:02:12 GMT (envelope-from mav@svn.freebsd.org) Received: (from mav@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q9AM2CiQ010153; Wed, 10 Oct 2012 22:02:12 GMT (envelope-from mav@svn.freebsd.org) Message-Id: <201210102202.q9AM2CiQ010153@svn.freebsd.org> From: Alexander Motin Date: Wed, 10 Oct 2012 22:02:12 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r241432 - head/sys/dev/usb/storage X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 10 Oct 2012 22:02:12 -0000 Author: mav Date: Wed Oct 10 22:02:11 2012 New Revision: 241432 URL: http://svn.freebsd.org/changeset/base/241432 Log: - Remove ancient checks for sim->softc == NULL. It can't be NULL, as it is set not-NULL during SIM registration and set to UMASS_GONE on destruction. Debug messages there look broken for at least 9 years, as they dereference softc value that was just checked to be equal to NULL. - Remove magic pointer value UMASS_GONE and use simple NULL instead. Found by: Clang Static Analyzer Modified: head/sys/dev/usb/storage/umass.c Modified: head/sys/dev/usb/storage/umass.c ============================================================================== --- head/sys/dev/usb/storage/umass.c Wed Oct 10 21:38:17 2012 (r241431) +++ head/sys/dev/usb/storage/umass.c Wed Oct 10 22:02:11 2012 (r241432) @@ -175,8 +175,6 @@ TUNABLE_INT("hw.usb.umass.debug", &umass #define DPRINTF(...) do { } while (0) #endif -#define UMASS_GONE ((struct umass_softc *)1) - #define UMASS_BULK_SIZE (1 << 17) #define UMASS_CBI_DIAGNOSTIC_CMDLEN 12 /* bytes */ #define UMASS_MAX_CMDLEN MAX(12, CAM_MAX_CDBLEN) /* bytes */ @@ -2109,7 +2107,7 @@ umass_cam_detach_sim(struct umass_softc if (sc->sc_sim != NULL) { if (xpt_bus_deregister(cam_sim_path(sc->sc_sim))) { /* accessing the softc is not possible after this */ - sc->sc_sim->softc = UMASS_GONE; + sc->sc_sim->softc = NULL; cam_sim_free(sc->sc_sim, /* free_devq */ TRUE); } else { panic("%s: CAM layer is busy\n", @@ -2128,63 +2126,11 @@ umass_cam_action(struct cam_sim *sim, un { struct umass_softc *sc = (struct umass_softc *)sim->softc; - if (sc == UMASS_GONE || - (sc != NULL && !usbd_device_attached(sc->sc_udev))) { + if (sc == NULL) { ccb->ccb_h.status = CAM_SEL_TIMEOUT; xpt_done(ccb); return; } - /* - * Verify, depending on the operation to perform, that we either got - * a valid sc, because an existing target was referenced, or - * otherwise the SIM is addressed. - * - * This avoids bombing out at a printf and does give the CAM layer some - * sensible feedback on errors. - */ - switch (ccb->ccb_h.func_code) { - case XPT_SCSI_IO: - case XPT_RESET_DEV: - case XPT_GET_TRAN_SETTINGS: - case XPT_SET_TRAN_SETTINGS: - case XPT_CALC_GEOMETRY: - /* the opcodes requiring a target. These should never occur. */ - if (sc == NULL) { - DPRINTF(sc, UDMASS_GEN, "%s:%d:%d:%d:func_code 0x%04x: " - "Invalid target (target needed)\n", - DEVNAME_SIM, cam_sim_path(sc->sc_sim), - ccb->ccb_h.target_id, ccb->ccb_h.target_lun, - ccb->ccb_h.func_code); - - ccb->ccb_h.status = CAM_TID_INVALID; - xpt_done(ccb); - goto done; - } - break; - case XPT_PATH_INQ: - case XPT_NOOP: - /* - * The opcodes sometimes aimed at a target (sc is valid), - * sometimes aimed at the SIM (sc is invalid and target is - * CAM_TARGET_WILDCARD) - */ - if ((sc == NULL) && - (ccb->ccb_h.target_id != CAM_TARGET_WILDCARD)) { - DPRINTF(sc, UDMASS_SCSI, "%s:%d:%d:%d:func_code 0x%04x: " - "Invalid target (no wildcard)\n", - DEVNAME_SIM, cam_sim_path(sc->sc_sim), - ccb->ccb_h.target_id, ccb->ccb_h.target_lun, - ccb->ccb_h.func_code); - - ccb->ccb_h.status = CAM_TID_INVALID; - xpt_done(ccb); - goto done; - } - break; - default: - /* XXX Hm, we should check the input parameters */ - break; - } /* Perform the requested action */ switch (ccb->ccb_h.func_code) { @@ -2448,7 +2394,7 @@ umass_cam_poll(struct cam_sim *sim) { struct umass_softc *sc = (struct umass_softc *)sim->softc; - if (sc == UMASS_GONE) + if (sc == NULL) return; DPRINTF(sc, UDMASS_SCSI, "CAM poll\n"); From owner-svn-src-head@FreeBSD.ORG Wed Oct 10 23:28:58 2012 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id B2AC4C48; Wed, 10 Oct 2012 23:28:58 +0000 (UTC) (envelope-from jimharris@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 9B4228FC08; Wed, 10 Oct 2012 23:28:58 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id q9ANSwvI020977; Wed, 10 Oct 2012 23:28:58 GMT (envelope-from jimharris@svn.freebsd.org) Received: (from jimharris@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q9ANSwn0020974; Wed, 10 Oct 2012 23:28:58 GMT (envelope-from jimharris@svn.freebsd.org) Message-Id: <201210102328.q9ANSwn0020974@svn.freebsd.org> From: Jim Harris Date: Wed, 10 Oct 2012 23:28:58 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r241433 - head/sys/dev/nvme X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 10 Oct 2012 23:28:58 -0000 Author: jimharris Date: Wed Oct 10 23:28:58 2012 New Revision: 241433 URL: http://svn.freebsd.org/changeset/base/241433 Log: Put the nvme_qpair mutex on its own cacheline. Sponsored by: Intel Modified: head/sys/dev/nvme/nvme_private.h Modified: head/sys/dev/nvme/nvme_private.h ============================================================================== --- head/sys/dev/nvme/nvme_private.h Wed Oct 10 22:02:11 2012 (r241432) +++ head/sys/dev/nvme/nvme_private.h Wed Oct 10 23:28:58 2012 (r241433) @@ -88,6 +88,10 @@ MALLOC_DECLARE(M_NVME); #define NVME_TIMEOUT_IN_SEC (30) +#ifndef CACHE_LINE_SIZE +#define CACHE_LINE_SIZE (64) +#endif + struct nvme_prp_list { uint64_t prp[NVME_MAX_PRP_LIST_ENTRIES]; SLIST_ENTRY(nvme_prp_list) slist; @@ -131,8 +135,6 @@ struct nvme_qpair { int64_t num_cmds; - struct mtx lock; - struct nvme_command *cmd; struct nvme_completion *cpl; @@ -152,7 +154,10 @@ struct nvme_qpair { struct nvme_tracker **act_tr; SLIST_HEAD(, nvme_prp_list) free_prp_list; -}; + + struct mtx lock __aligned(CACHE_LINE_SIZE); + +} __aligned(CACHE_LINE_SIZE); struct nvme_namespace { From owner-svn-src-head@FreeBSD.ORG Wed Oct 10 23:35:17 2012 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id CB66390; Wed, 10 Oct 2012 23:35:17 +0000 (UTC) (envelope-from jimharris@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id A8F3C8FC0C; Wed, 10 Oct 2012 23:35:17 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id q9ANZHEx021775; Wed, 10 Oct 2012 23:35:17 GMT (envelope-from jimharris@svn.freebsd.org) Received: (from jimharris@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q9ANZHVG021771; Wed, 10 Oct 2012 23:35:17 GMT (envelope-from jimharris@svn.freebsd.org) Message-Id: <201210102335.q9ANZHVG021771@svn.freebsd.org> From: Jim Harris Date: Wed, 10 Oct 2012 23:35:17 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r241434 - head/sys/dev/nvme X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 10 Oct 2012 23:35:17 -0000 Author: jimharris Date: Wed Oct 10 23:35:16 2012 New Revision: 241434 URL: http://svn.freebsd.org/changeset/base/241434 Log: Count number of times each queue pair's interrupt handler is invoked. Also add sysctls to query and reset each queue pair's stats, including the new count added here. Sponsored by: Intel Modified: head/sys/dev/nvme/nvme_private.h head/sys/dev/nvme/nvme_qpair.c head/sys/dev/nvme/nvme_sysctl.c Modified: head/sys/dev/nvme/nvme_private.h ============================================================================== --- head/sys/dev/nvme/nvme_private.h Wed Oct 10 23:28:58 2012 (r241433) +++ head/sys/dev/nvme/nvme_private.h Wed Oct 10 23:35:16 2012 (r241434) @@ -134,6 +134,7 @@ struct nvme_qpair { uint32_t cq_head; int64_t num_cmds; + int64_t num_intr_handler_calls; struct nvme_command *cmd; struct nvme_completion *cpl; Modified: head/sys/dev/nvme/nvme_qpair.c ============================================================================== --- head/sys/dev/nvme/nvme_qpair.c Wed Oct 10 23:28:58 2012 (r241433) +++ head/sys/dev/nvme/nvme_qpair.c Wed Oct 10 23:35:16 2012 (r241434) @@ -125,6 +125,8 @@ nvme_qpair_process_completions(struct nv struct nvme_completion *cpl; boolean_t retry, error; + qpair->num_intr_handler_calls++; + while (1) { cpl = &qpair->cpl[qpair->cq_head]; @@ -238,6 +240,7 @@ nvme_qpair_construct(struct nvme_qpair * NULL, NULL, &qpair->dma_tag); qpair->num_cmds = 0; + qpair->num_intr_handler_calls = 0; qpair->num_tr = 0; qpair->num_prp_list = 0; qpair->sq_head = qpair->sq_tail = qpair->cq_head = 0; Modified: head/sys/dev/nvme/nvme_sysctl.c ============================================================================== --- head/sys/dev/nvme/nvme_sysctl.c Wed Oct 10 23:28:58 2012 (r241433) +++ head/sys/dev/nvme/nvme_sysctl.c Wed Oct 10 23:35:16 2012 (r241434) @@ -33,6 +33,16 @@ __FBSDID("$FreeBSD$"); #include "nvme_private.h" +/* + * CTLTYPE_S64 and sysctl_handle_64 were added in r217616. Define these + * explicitly here for older kernels that don't include the r217616 + * changeset. + */ +#ifndef CTLTYPE_S64 +#define CTLTYPE_S64 CTLTYPE_QUAD +#define sysctl_handle_64 sysctl_handle_quad +#endif + static void nvme_dump_queue(struct nvme_qpair *qpair) { @@ -114,6 +124,66 @@ nvme_sysctl_int_coal_threshold(SYSCTL_HA } static void +nvme_qpair_reset_stats(struct nvme_qpair *qpair) +{ + + qpair->num_cmds = 0; + qpair->num_intr_handler_calls = 0; +} + +static int +nvme_sysctl_num_cmds(SYSCTL_HANDLER_ARGS) +{ + struct nvme_controller *ctrlr = arg1; + int64_t num_cmds = 0; + int i; + + num_cmds = ctrlr->adminq.num_cmds; + + for (i = 0; i < ctrlr->num_io_queues; i++) + num_cmds += ctrlr->ioq[i].num_cmds; + + return (sysctl_handle_64(oidp, &num_cmds, 0, req)); +} + +static int +nvme_sysctl_num_intr_handler_calls(SYSCTL_HANDLER_ARGS) +{ + struct nvme_controller *ctrlr = arg1; + int64_t num_intr_handler_calls = 0; + int i; + + num_intr_handler_calls = ctrlr->adminq.num_intr_handler_calls; + + for (i = 0; i < ctrlr->num_io_queues; i++) + num_intr_handler_calls += ctrlr->ioq[i].num_intr_handler_calls; + + return (sysctl_handle_64(oidp, &num_intr_handler_calls, 0, req)); +} + +static int +nvme_sysctl_reset_stats(SYSCTL_HANDLER_ARGS) +{ + struct nvme_controller *ctrlr = arg1; + uint32_t i, val = 0; + + int error = sysctl_handle_int(oidp, &val, 0, req); + + if (error) + return (error); + + if (val != 0) { + nvme_qpair_reset_stats(&ctrlr->adminq); + + for (i = 0; i < ctrlr->num_io_queues; i++) + nvme_qpair_reset_stats(&ctrlr->ioq[i]); + } + + return (0); +} + + +static void nvme_sysctl_initialize_queue(struct nvme_qpair *qpair, struct sysctl_ctx_list *ctrlr_ctx, struct sysctl_oid *que_tree) { @@ -140,6 +210,11 @@ nvme_sysctl_initialize_queue(struct nvme SYSCTL_ADD_QUAD(ctrlr_ctx, que_list, OID_AUTO, "num_cmds", CTLFLAG_RD, &qpair->num_cmds, "Number of commands submitted"); + SYSCTL_ADD_QUAD(ctrlr_ctx, que_list, OID_AUTO, "num_intr_handler_calls", + CTLFLAG_RD, &qpair->num_intr_handler_calls, + "Number of times interrupt handler was invoked (will typically be " + "less than number of actual interrupts generated due to " + "coalescing)"); SYSCTL_ADD_PROC(ctrlr_ctx, que_list, OID_AUTO, "dump_debug", CTLTYPE_UINT | CTLFLAG_RW, qpair, 0, @@ -170,6 +245,22 @@ nvme_sysctl_initialize_ctrlr(struct nvme "int_coal_threshold", CTLTYPE_UINT | CTLFLAG_RW, ctrlr, 0, nvme_sysctl_int_coal_threshold, "IU", "Interrupt coalescing threshold"); + + SYSCTL_ADD_PROC(ctrlr_ctx, ctrlr_list, OID_AUTO, + "num_cmds", CTLTYPE_S64 | CTLFLAG_RD, + ctrlr, 0, nvme_sysctl_num_cmds, "IU", + "Number of commands submitted"); + + SYSCTL_ADD_PROC(ctrlr_ctx, ctrlr_list, OID_AUTO, + "num_intr_handler_calls", CTLTYPE_S64 | CTLFLAG_RD, + ctrlr, 0, nvme_sysctl_num_intr_handler_calls, "IU", + "Number of times interrupt handler was invoked (will " + "typically be less than number of actual interrupts " + "generated due to coalescing)"); + + SYSCTL_ADD_PROC(ctrlr_ctx, ctrlr_list, OID_AUTO, + "reset_stats", CTLTYPE_UINT | CTLFLAG_RW, ctrlr, 0, + nvme_sysctl_reset_stats, "IU", "Reset statistics to zero"); } que_tree = SYSCTL_ADD_NODE(ctrlr_ctx, ctrlr_list, OID_AUTO, "adminq", From owner-svn-src-head@FreeBSD.ORG Thu Oct 11 05:00:35 2012 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id 301B1B5C; Thu, 11 Oct 2012 05:00:35 +0000 (UTC) (envelope-from davide.italiano@gmail.com) Received: from mail-vc0-f182.google.com (mail-vc0-f182.google.com [209.85.220.182]) by mx1.freebsd.org (Postfix) with ESMTP id D986C8FC12; Thu, 11 Oct 2012 05:00:32 +0000 (UTC) Received: by mail-vc0-f182.google.com with SMTP id fw7so2151712vcb.13 for ; Wed, 10 Oct 2012 22:00:26 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:sender:in-reply-to:references:date :x-google-sender-auth:message-id:subject:from:to:cc:content-type; bh=ZkmrbfVPCTLP8C/Mw56sLIDe5Dh8Q8RJuYTEROEpQQk=; b=gHkA8CoNYuER50qrkZCoumb5E+DlX0Pp8Y+8VoFjkyn/hI/yppAXKlzWgxVPy+5sPV HS3B+3luQKX6WEWx25UDS6nLixzYVO/87e+eGGq8QM2InwKXPKrSD6HjvBApPfUfIfJF YI4ywIKKEwcuib01XivHlWKPLkNyRmsDRqwNChgqa/5/a1UM8/saREI6Jl0CeGER0Gap Dhr4kEHWxBjJafxr7CWpbEThNTygdIPovDtCmIUqzSCPHnyMcQx1AgM0xALuIWjx70Qf ILnRYXXcPmYvWyIbqL9eFEvvNc0eFOQ6pMRSJJ+tivmtFGiPaASJ+W+8UiDOUUF8Adax /dkQ== MIME-Version: 1.0 Received: by 10.220.115.138 with SMTP id i10mr10941281vcq.37.1349931626590; Wed, 10 Oct 2012 22:00:26 -0700 (PDT) Sender: davide.italiano@gmail.com Received: by 10.58.247.132 with HTTP; Wed, 10 Oct 2012 22:00:26 -0700 (PDT) In-Reply-To: <5006A7DD.9050509@FreeBSD.org> References: <201207162207.q6GM7UNS087234@svn.freebsd.org> <5006A7DD.9050509@FreeBSD.org> Date: Thu, 11 Oct 2012 07:00:26 +0200 X-Google-Sender-Auth: HV6bh30gsTzcSNKy7qUnuDinK74 Message-ID: Subject: Re: svn commit: r238539 - head/sys/fs/smbfs From: Davide Italiano To: Christian Brueffer Content-Type: text/plain; charset=ISO-8859-1 Cc: attilio@freebsd.org, svn-src-head@freebsd.org, svn-src-all@freebsd.org, src-committers@freebsd.org, Mateusz Guzik X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 11 Oct 2012 05:00:35 -0000 On Wed, Jul 18, 2012 at 2:11 PM, Christian Brueffer wrote: > On 7/17/12 0:10 , Attilio Rao wrote: >> 2012/7/16 Christian Brueffer : >>> Author: brueffer >>> Date: Mon Jul 16 22:07:29 2012 >>> New Revision: 238539 >>> URL: http://svn.freebsd.org/changeset/base/238539 >>> >>> Log: >>> Simply error handling by moving the allocation of np down to where it is >>> actually used. While here, improve style a little. >> >> Too bad that the biggest bug here is still in place. >> Right now smbfs inserts in the mount list half-constructed vnodes. >> Maybe you are interested in fixing this? >> > > I can give it a shot, no promises though. > > Cheers, > > Chris > This patch should fix the half-constructed vnode insertion issue. Can you give it a look, Attilio? http://people.freebsd.org/~davide/ix/smbfs_norollhash.diff Moreover, it makes the code relying on the global vfs_hash table, now it works using an home-made local hash table for vnodes. Thanks Davide From owner-svn-src-head@FreeBSD.ORG Thu Oct 11 05:48:05 2012 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id 595951CA; Thu, 11 Oct 2012 05:48:05 +0000 (UTC) (envelope-from yongari@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 41FE88FC0C; Thu, 11 Oct 2012 05:48:05 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id q9B5m5KO067258; Thu, 11 Oct 2012 05:48:05 GMT (envelope-from yongari@svn.freebsd.org) Received: (from yongari@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q9B5m5Zu067255; Thu, 11 Oct 2012 05:48:05 GMT (envelope-from yongari@svn.freebsd.org) Message-Id: <201210110548.q9B5m5Zu067255@svn.freebsd.org> From: Pyun YongHyeon Date: Thu, 11 Oct 2012 05:48:05 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r241436 - head/sys/dev/bge X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 11 Oct 2012 05:48:05 -0000 Author: yongari Date: Thu Oct 11 05:48:04 2012 New Revision: 241436 URL: http://svn.freebsd.org/changeset/base/241436 Log: Rework controller reset procedure. Previously driver saved BGE_PCI_PCISTATE register before issuing global reset. After issuing reset, it reads BGE_PCI_PCISTATE register again and compares the saved register value and current value. It was used to know whether the global reset operation was completed or not. Unfortunately, this logic caused several issues on recent BCM5717/ 5718/5719 and BCM5720 controllers. It seems APE firmware accesses some registers while global reset is in progress such that reading BGE_PCI_PCISTATE register after reset does not yield old pre-reset state value. This resulted in consuming too much time in global reset and sometimes it couldn't successfully complete reset. The BGE_MISCCFG_RESET_CORE_CLOCKS of BGE_MISC_CFG register is self-clearing bit so driver is able to know the reset completion. But the core-lock reset will disable indirect/flat/standard access modes such that driver cannot poll BGE_MISCCFG_RESET_CORE_CLOCKS bit of BGE_MISC_CFG register. So just wait enough time for core-clock reset to complete. Data sheet says driver should wait 100us for PCI/PCI-X devices and 100ms for PCIe devices. I chose 1ms for PCI/PCI-X since this value was used for many years in bge(4). For PCIe devices, use 100ms as recommended by data sheet. bge_chipinit() also cleared BGE_MAC_MODE register which shall clear firmware configured mode information. I think this will result in losing ASF/IPMI link in device attachment. Let bge_reset() honor firmware configured BGE_MAC_MODE register and don't announce driver is UP in bge_reset(). Firmware should have control over driver until it's fully initialized by driver. While I'm here, enable workaround for PCI-X BCM5704 A0 in bge_reset(). This will prevent internal arbitration logic from switching to the other DMA engine after a retry cycle. Modified: head/sys/dev/bge/if_bge.c head/sys/dev/bge/if_bgereg.h Modified: head/sys/dev/bge/if_bge.c ============================================================================== --- head/sys/dev/bge/if_bge.c Thu Oct 11 01:32:51 2012 (r241435) +++ head/sys/dev/bge/if_bge.c Thu Oct 11 05:48:04 2012 (r241436) @@ -1433,10 +1433,6 @@ bge_chipinit(struct bge_softc *sc) misc_ctl |= BGE_PCIMISCCTL_TAGGED_STATUS; pci_write_config(sc->bge_dev, BGE_PCI_MISC_CTL, misc_ctl, 4); - /* Clear the MAC control register */ - CSR_WRITE_4(sc, BGE_MAC_MODE, 0); - DELAY(40); - /* * Clear the MAC statistics block in the NIC's * internal memory. @@ -3560,13 +3556,16 @@ static int bge_reset(struct bge_softc *sc) { device_t dev; - uint32_t cachesize, command, pcistate, reset, val; + uint32_t cachesize, command, mac_mode, mac_mode_mask, reset, val; void (*write_op)(struct bge_softc *, int, int); uint16_t devctl; int i; dev = sc->bge_dev; + mac_mode_mask = BGE_MACMODE_HALF_DUPLEX | BGE_MACMODE_PORTMODE; + mac_mode = CSR_READ_4(sc, BGE_MAC_MODE) & mac_mode_mask; + if (BGE_IS_575X_PLUS(sc) && !BGE_IS_5714_FAMILY(sc) && (sc->bge_asicrev != BGE_ASICREV_BCM5906)) { if (sc->bge_flags & BGE_FLAG_PCIE) @@ -3579,7 +3578,6 @@ bge_reset(struct bge_softc *sc) /* Save some important PCI state. */ cachesize = pci_read_config(dev, BGE_PCI_CACHESZ, 4); command = pci_read_config(dev, BGE_PCI_CMD, 4); - pcistate = pci_read_config(dev, BGE_PCI_PCISTATE, 4); pci_write_config(dev, BGE_PCI_MISC_CTL, BGE_PCIMISCCTL_INDIRECT_ACCESS | BGE_PCIMISCCTL_MASK_PCI_INTR | @@ -3636,7 +3634,10 @@ bge_reset(struct bge_softc *sc) /* Issue global reset */ write_op(sc, BGE_MISC_CFG, reset); - DELAY(1000); + if (sc->bge_flags & BGE_FLAG_PCIE) + DELAY(100 * 1000); + else + DELAY(1000); /* XXX: Broadcom Linux driver. */ if (sc->bge_flags & BGE_FLAG_PCIE) { @@ -3664,9 +3665,13 @@ bge_reset(struct bge_softc *sc) pci_write_config(dev, BGE_PCI_MISC_CTL, BGE_PCIMISCCTL_INDIRECT_ACCESS | BGE_PCIMISCCTL_MASK_PCI_INTR | BGE_HIF_SWAP_OPTIONS | BGE_PCIMISCCTL_PCISTATE_RW, 4); + val = BGE_PCISTATE_ROM_ENABLE | BGE_PCISTATE_ROM_RETRY_ENABLE; + if (sc->bge_chipid == BGE_CHIPID_BCM5704_A0 && + (sc->bge_flags & BGE_FLAG_PCIX) != 0) + val |= BGE_PCISTATE_RETRY_SAME_DMA; + pci_write_config(dev, BGE_PCI_PCISTATE, val, 4); pci_write_config(dev, BGE_PCI_CACHESZ, cachesize, 4); pci_write_config(dev, BGE_PCI_CMD, command, 4); - write_op(sc, BGE_MISC_CFG, BGE_32BITTIME_66MHZ); /* * Disable PCI-X relaxed ordering to ensure status block update * comes first then packet buffer DMA. Otherwise driver may @@ -3705,6 +3710,14 @@ bge_reset(struct bge_softc *sc) } else CSR_WRITE_4(sc, BGE_MARB_MODE, BGE_MARBMODE_ENABLE); + /* Fix up byte swapping. */ + CSR_WRITE_4(sc, BGE_MODE_CTL, bge_dma_swap_options(sc)); + + val = CSR_READ_4(sc, BGE_MAC_MODE); + val = (val & ~mac_mode_mask) | mac_mode; + CSR_WRITE_4(sc, BGE_MAC_MODE, val); + DELAY(40); + if (sc->bge_asicrev == BGE_ASICREV_BCM5906) { for (i = 0; i < BGE_TIMEOUT; i++) { val = CSR_READ_4(sc, BGE_VCPU_STATUS); @@ -3740,30 +3753,6 @@ bge_reset(struct bge_softc *sc) } /* - * XXX Wait for the value of the PCISTATE register to - * return to its original pre-reset state. This is a - * fairly good indicator of reset completion. If we don't - * wait for the reset to fully complete, trying to read - * from the device's non-PCI registers may yield garbage - * results. - */ - for (i = 0; i < BGE_TIMEOUT; i++) { - if (pci_read_config(dev, BGE_PCI_PCISTATE, 4) == pcistate) - break; - DELAY(10); - } - - /* Fix up byte swapping. */ - CSR_WRITE_4(sc, BGE_MODE_CTL, bge_dma_swap_options(sc)); - - /* Tell the ASF firmware we are up */ - if (sc->bge_asf_mode & ASF_STACKUP) - BGE_SETBIT(sc, BGE_MODE_CTL, BGE_MODECTL_STACKUP); - - CSR_WRITE_4(sc, BGE_MAC_MODE, 0); - DELAY(40); - - /* * The 5704 in TBI mode apparently needs some special * adjustment to insure the SERDES drive level is set * to 1.2V. Modified: head/sys/dev/bge/if_bgereg.h ============================================================================== --- head/sys/dev/bge/if_bgereg.h Thu Oct 11 01:32:51 2012 (r241435) +++ head/sys/dev/bge/if_bgereg.h Thu Oct 11 05:48:04 2012 (r241436) @@ -430,10 +430,11 @@ #define BGE_PCISTATE_PCI_BUSMODE 0x00000004 /* 1 = PCI, 0 = PCI-X */ #define BGE_PCISTATE_PCI_BUSSPEED 0x00000008 /* 1 = 66/133, 0 = 33/66 */ #define BGE_PCISTATE_32BIT_BUS 0x00000010 /* 1 = 32bit, 0 = 64bit */ -#define BGE_PCISTATE_WANT_EXPROM 0x00000020 -#define BGE_PCISTATE_EXPROM_RETRY 0x00000040 +#define BGE_PCISTATE_ROM_ENABLE 0x00000020 +#define BGE_PCISTATE_ROM_RETRY_ENABLE 0x00000040 #define BGE_PCISTATE_FLATVIEW_MODE 0x00000100 #define BGE_PCISTATE_PCI_TGT_RETRY_MAX 0x00000E00 +#define BGE_PCISTATE_RETRY_SAME_DMA 0x00002000 /* * PCI Clock Control register -- note, this register is read only From owner-svn-src-head@FreeBSD.ORG Thu Oct 11 06:07:49 2012 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id 1A3FA821; Thu, 11 Oct 2012 06:07:49 +0000 (UTC) (envelope-from yongari@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 031058FC08; Thu, 11 Oct 2012 06:07:49 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id q9B67mDD069668; Thu, 11 Oct 2012 06:07:48 GMT (envelope-from yongari@svn.freebsd.org) Received: (from yongari@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q9B67mvD069666; Thu, 11 Oct 2012 06:07:48 GMT (envelope-from yongari@svn.freebsd.org) Message-Id: <201210110607.q9B67mvD069666@svn.freebsd.org> From: Pyun YongHyeon Date: Thu, 11 Oct 2012 06:07:48 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r241437 - head/sys/dev/mii X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 11 Oct 2012 06:07:49 -0000 Author: yongari Date: Thu Oct 11 06:07:48 2012 New Revision: 241437 URL: http://svn.freebsd.org/changeset/base/241437 Log: For 5717C/5719C/5720C and 57765 PHYs, do not perform any special handling(jumbo, wire speed etc) in brgphy_reset(). Touching BRGPHY_MII_AUXCTL register seems to confuse APE firmware such that it couldn't establish a link. Modified: head/sys/dev/mii/brgphy.c Modified: head/sys/dev/mii/brgphy.c ============================================================================== --- head/sys/dev/mii/brgphy.c Thu Oct 11 05:48:04 2012 (r241436) +++ head/sys/dev/mii/brgphy.c Thu Oct 11 06:07:48 2012 (r241437) @@ -918,6 +918,15 @@ brgphy_reset(struct mii_softc *sc) break; } break; + case MII_OUI_BROADCOM3: + switch (sc->mii_mpd_model) { + case MII_MODEL_BROADCOM3_BCM5717C: + case MII_MODEL_BROADCOM3_BCM5719C: + case MII_MODEL_BROADCOM3_BCM5720C: + case MII_MODEL_BROADCOM3_BCM57765: + return; + } + break; } ifp = sc->mii_pdata->mii_ifp; From owner-svn-src-head@FreeBSD.ORG Thu Oct 11 06:43:44 2012 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id 008391AA; Thu, 11 Oct 2012 06:43:43 +0000 (UTC) (envelope-from yongari@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 975C98FC12; Thu, 11 Oct 2012 06:43:43 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id q9B6hhUh074379; Thu, 11 Oct 2012 06:43:43 GMT (envelope-from yongari@svn.freebsd.org) Received: (from yongari@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q9B6hhLW074376; Thu, 11 Oct 2012 06:43:43 GMT (envelope-from yongari@svn.freebsd.org) Message-Id: <201210110643.q9B6hhLW074376@svn.freebsd.org> From: Pyun YongHyeon Date: Thu, 11 Oct 2012 06:43:43 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r241438 - head/sys/dev/bge X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 11 Oct 2012 06:43:44 -0000 Author: yongari Date: Thu Oct 11 06:43:43 2012 New Revision: 241438 URL: http://svn.freebsd.org/changeset/base/241438 Log: Add APE firmware support and improve firmware handshake procedure. This change will enable IPMI access on 5717/5718/5719/5720 and 5761 controllers. Because ASF is not available when APE firmware is present, bge_allow_asf tunable is ignored when driver detects APE firmware. Also bge(4) no longer performs two resets(one blind reset and the other reset with firmware in mind) in device attach. Now bge(4) performs a reset with enough information in bge_reset(). The APE firmware also needs special handling to make suspend/resume work but it was not implemented yet. With this change, bge(4) should work on any 5717/5718/5719/5720 controllers. Special thanks to Mike Hibler at Emulab who setup remote debugging on Dell R820. Without his help I couldn't be able to address several issues happened on Dell Rx20 systems. And many thanks to Broadcom for continuing to support FreeBSD! Submitted by: davidch (initial version) H/W donated by: Broadcom Tested by: many Tested on: Del R820/R720/R620/R420/R320 and HP Proliant DL 360 G8 Modified: head/sys/dev/bge/if_bge.c head/sys/dev/bge/if_bgereg.h Modified: head/sys/dev/bge/if_bge.c ============================================================================== --- head/sys/dev/bge/if_bge.c Thu Oct 11 06:07:48 2012 (r241437) +++ head/sys/dev/bge/if_bge.c Thu Oct 11 06:43:43 2012 (r241438) @@ -461,8 +461,9 @@ static void bge_miibus_statchg(device_t) static int bge_poll(struct ifnet *ifp, enum poll_cmd cmd, int count); #endif -#define BGE_RESET_START 1 -#define BGE_RESET_STOP 2 +#define BGE_RESET_SHUTDOWN 0 +#define BGE_RESET_START 1 +#define BGE_RESET_SUSPEND 2 static void bge_sig_post_reset(struct bge_softc *, int); static void bge_sig_legacy(struct bge_softc *, int); static void bge_sig_pre_reset(struct bge_softc *, int); @@ -470,6 +471,13 @@ static void bge_stop_fw(struct bge_softc static int bge_reset(struct bge_softc *); static void bge_link_upd(struct bge_softc *); +static void bge_ape_lock_init(struct bge_softc *); +static void bge_ape_read_fw_ver(struct bge_softc *); +static int bge_ape_lock(struct bge_softc *, int); +static void bge_ape_unlock(struct bge_softc *, int); +static void bge_ape_send_event(struct bge_softc *, uint32_t); +static void bge_ape_driver_state_change(struct bge_softc *, int); + /* * The BGE_REGISTER_DEBUG option is only for low-level debugging. It may * leak information to untrusted users. It is also known to cause alignment @@ -478,6 +486,7 @@ static void bge_link_upd(struct bge_soft #ifdef BGE_REGISTER_DEBUG static int bge_sysctl_debug_info(SYSCTL_HANDLER_ARGS); static int bge_sysctl_reg_read(SYSCTL_HANDLER_ARGS); +static int bge_sysctl_ape_read(SYSCTL_HANDLER_ARGS); static int bge_sysctl_mem_read(SYSCTL_HANDLER_ARGS); #endif static void bge_add_sysctls(struct bge_softc *); @@ -643,6 +652,318 @@ bge_writembx(struct bge_softc *sc, int o } /* + * Clear all stale locks and select the lock for this driver instance. + */ +static void +bge_ape_lock_init(struct bge_softc *sc) +{ + uint32_t bit, regbase; + int i; + + if (sc->bge_asicrev == BGE_ASICREV_BCM5761) + regbase = BGE_APE_LOCK_GRANT; + else + regbase = BGE_APE_PER_LOCK_GRANT; + + /* Clear any stale locks. */ + for (i = BGE_APE_LOCK_PHY0; i <= BGE_APE_LOCK_GPIO; i++) { + switch (i) { + case BGE_APE_LOCK_PHY0: + case BGE_APE_LOCK_PHY1: + case BGE_APE_LOCK_PHY2: + case BGE_APE_LOCK_PHY3: + bit = BGE_APE_LOCK_GRANT_DRIVER0; + break; + default: + if (sc->bge_func_addr != 0) + bit = BGE_APE_LOCK_GRANT_DRIVER0; + else + bit = (1 << sc->bge_func_addr); + } + APE_WRITE_4(sc, regbase + 4 * i, bit); + } + + /* Select the PHY lock based on the device's function number. */ + switch (sc->bge_func_addr) { + case 0: + sc->bge_phy_ape_lock = BGE_APE_LOCK_PHY0; + break; + case 1: + sc->bge_phy_ape_lock = BGE_APE_LOCK_PHY1; + break; + case 2: + sc->bge_phy_ape_lock = BGE_APE_LOCK_PHY2; + break; + case 3: + sc->bge_phy_ape_lock = BGE_APE_LOCK_PHY3; + break; + default: + device_printf(sc->bge_dev, + "PHY lock not supported on this function\n"); + } +} + +/* + * Check for APE firmware, set flags, and print version info. + */ +static void +bge_ape_read_fw_ver(struct bge_softc *sc) +{ + const char *fwtype; + uint32_t apedata, features; + + /* Check for a valid APE signature in shared memory. */ + apedata = APE_READ_4(sc, BGE_APE_SEG_SIG); + if (apedata != BGE_APE_SEG_SIG_MAGIC) { + sc->bge_mfw_flags &= ~ BGE_MFW_ON_APE; + return; + } + + /* Check if APE firmware is running. */ + apedata = APE_READ_4(sc, BGE_APE_FW_STATUS); + if ((apedata & BGE_APE_FW_STATUS_READY) == 0) { + device_printf(sc->bge_dev, "APE signature found " + "but FW status not ready! 0x%08x\n", apedata); + return; + } + + sc->bge_mfw_flags |= BGE_MFW_ON_APE; + + /* Fetch the APE firwmare type and version. */ + apedata = APE_READ_4(sc, BGE_APE_FW_VERSION); + features = APE_READ_4(sc, BGE_APE_FW_FEATURES); + if ((features & BGE_APE_FW_FEATURE_NCSI) != 0) { + sc->bge_mfw_flags |= BGE_MFW_TYPE_NCSI; + fwtype = "NCSI"; + } else if ((features & BGE_APE_FW_FEATURE_DASH) != 0) { + sc->bge_mfw_flags |= BGE_MFW_TYPE_DASH; + fwtype = "DASH"; + } else + fwtype = "UNKN"; + + /* Print the APE firmware version. */ + device_printf(sc->bge_dev, "APE FW version: %s v%d.%d.%d.%d\n", + fwtype, + (apedata & BGE_APE_FW_VERSION_MAJMSK) >> BGE_APE_FW_VERSION_MAJSFT, + (apedata & BGE_APE_FW_VERSION_MINMSK) >> BGE_APE_FW_VERSION_MINSFT, + (apedata & BGE_APE_FW_VERSION_REVMSK) >> BGE_APE_FW_VERSION_REVSFT, + (apedata & BGE_APE_FW_VERSION_BLDMSK)); +} + +static int +bge_ape_lock(struct bge_softc *sc, int locknum) +{ + uint32_t bit, gnt, req, status; + int i, off; + + if ((sc->bge_mfw_flags & BGE_MFW_ON_APE) == 0) + return (0); + + /* Lock request/grant registers have different bases. */ + if (sc->bge_asicrev == BGE_ASICREV_BCM5761) { + req = BGE_APE_LOCK_REQ; + gnt = BGE_APE_LOCK_GRANT; + } else { + req = BGE_APE_PER_LOCK_REQ; + gnt = BGE_APE_PER_LOCK_GRANT; + } + + off = 4 * locknum; + + switch (locknum) { + case BGE_APE_LOCK_GPIO: + /* Lock required when using GPIO. */ + if (sc->bge_asicrev == BGE_ASICREV_BCM5761) + return (0); + if (sc->bge_func_addr == 0) + bit = BGE_APE_LOCK_REQ_DRIVER0; + else + bit = (1 << sc->bge_func_addr); + break; + case BGE_APE_LOCK_GRC: + /* Lock required to reset the device. */ + if (sc->bge_func_addr == 0) + bit = BGE_APE_LOCK_REQ_DRIVER0; + else + bit = (1 << sc->bge_func_addr); + break; + case BGE_APE_LOCK_MEM: + /* Lock required when accessing certain APE memory. */ + if (sc->bge_func_addr == 0) + bit = BGE_APE_LOCK_REQ_DRIVER0; + else + bit = (1 << sc->bge_func_addr); + break; + case BGE_APE_LOCK_PHY0: + case BGE_APE_LOCK_PHY1: + case BGE_APE_LOCK_PHY2: + case BGE_APE_LOCK_PHY3: + /* Lock required when accessing PHYs. */ + bit = BGE_APE_LOCK_REQ_DRIVER0; + break; + default: + return (EINVAL); + } + + /* Request a lock. */ + APE_WRITE_4(sc, req + off, bit); + + /* Wait up to 1 second to acquire lock. */ + for (i = 0; i < 20000; i++) { + status = APE_READ_4(sc, gnt + off); + if (status == bit) + break; + DELAY(50); + } + + /* Handle any errors. */ + if (status != bit) { + device_printf(sc->bge_dev, "APE lock %d request failed! " + "request = 0x%04x[0x%04x], status = 0x%04x[0x%04x]\n", + locknum, req + off, bit & 0xFFFF, gnt + off, + status & 0xFFFF); + /* Revoke the lock request. */ + APE_WRITE_4(sc, gnt + off, bit); + return (EBUSY); + } + + return (0); +} + +static void +bge_ape_unlock(struct bge_softc *sc, int locknum) +{ + uint32_t bit, gnt; + int off; + + if ((sc->bge_mfw_flags & BGE_MFW_ON_APE) == 0) + return; + + if (sc->bge_asicrev == BGE_ASICREV_BCM5761) + gnt = BGE_APE_LOCK_GRANT; + else + gnt = BGE_APE_PER_LOCK_GRANT; + + off = 4 * locknum; + + switch (locknum) { + case BGE_APE_LOCK_GPIO: + if (sc->bge_asicrev == BGE_ASICREV_BCM5761) + return; + if (sc->bge_func_addr == 0) + bit = BGE_APE_LOCK_GRANT_DRIVER0; + else + bit = (1 << sc->bge_func_addr); + break; + case BGE_APE_LOCK_GRC: + if (sc->bge_func_addr == 0) + bit = BGE_APE_LOCK_GRANT_DRIVER0; + else + bit = (1 << sc->bge_func_addr); + break; + case BGE_APE_LOCK_MEM: + if (sc->bge_func_addr == 0) + bit = BGE_APE_LOCK_GRANT_DRIVER0; + else + bit = (1 << sc->bge_func_addr); + break; + case BGE_APE_LOCK_PHY0: + case BGE_APE_LOCK_PHY1: + case BGE_APE_LOCK_PHY2: + case BGE_APE_LOCK_PHY3: + bit = BGE_APE_LOCK_GRANT_DRIVER0; + break; + default: + return; + } + + APE_WRITE_4(sc, gnt + off, bit); +} + +/* + * Send an event to the APE firmware. + */ +static void +bge_ape_send_event(struct bge_softc *sc, uint32_t event) +{ + uint32_t apedata; + int i; + + /* NCSI does not support APE events. */ + if ((sc->bge_mfw_flags & BGE_MFW_ON_APE) == 0) + return; + + /* Wait up to 1ms for APE to service previous event. */ + for (i = 10; i > 0; i--) { + if (bge_ape_lock(sc, BGE_APE_LOCK_MEM) != 0) + break; + apedata = APE_READ_4(sc, BGE_APE_EVENT_STATUS); + if ((apedata & BGE_APE_EVENT_STATUS_EVENT_PENDING) == 0) { + APE_WRITE_4(sc, BGE_APE_EVENT_STATUS, event | + BGE_APE_EVENT_STATUS_EVENT_PENDING); + bge_ape_unlock(sc, BGE_APE_LOCK_MEM); + APE_WRITE_4(sc, BGE_APE_EVENT, BGE_APE_EVENT_1); + break; + } + bge_ape_unlock(sc, BGE_APE_LOCK_MEM); + DELAY(100); + } + if (i == 0) + device_printf(sc->bge_dev, "APE event 0x%08x send timed out\n", + event); +} + +static void +bge_ape_driver_state_change(struct bge_softc *sc, int kind) +{ + uint32_t apedata, event; + + if ((sc->bge_mfw_flags & BGE_MFW_ON_APE) == 0) + return; + + switch (kind) { + case BGE_RESET_START: + /* If this is the first load, clear the load counter. */ + apedata = APE_READ_4(sc, BGE_APE_HOST_SEG_SIG); + if (apedata != BGE_APE_HOST_SEG_SIG_MAGIC) + APE_WRITE_4(sc, BGE_APE_HOST_INIT_COUNT, 0); + else { + apedata = APE_READ_4(sc, BGE_APE_HOST_INIT_COUNT); + APE_WRITE_4(sc, BGE_APE_HOST_INIT_COUNT, ++apedata); + } + APE_WRITE_4(sc, BGE_APE_HOST_SEG_SIG, + BGE_APE_HOST_SEG_SIG_MAGIC); + APE_WRITE_4(sc, BGE_APE_HOST_SEG_LEN, + BGE_APE_HOST_SEG_LEN_MAGIC); + + /* Add some version info if bge(4) supports it. */ + APE_WRITE_4(sc, BGE_APE_HOST_DRIVER_ID, + BGE_APE_HOST_DRIVER_ID_MAGIC(1, 0)); + APE_WRITE_4(sc, BGE_APE_HOST_BEHAVIOR, + BGE_APE_HOST_BEHAV_NO_PHYLOCK); + APE_WRITE_4(sc, BGE_APE_HOST_HEARTBEAT_INT_MS, + BGE_APE_HOST_HEARTBEAT_INT_DISABLE); + APE_WRITE_4(sc, BGE_APE_HOST_DRVR_STATE, + BGE_APE_HOST_DRVR_STATE_START); + event = BGE_APE_EVENT_STATUS_STATE_START; + break; + case BGE_RESET_SHUTDOWN: + APE_WRITE_4(sc, BGE_APE_HOST_DRVR_STATE, + BGE_APE_HOST_DRVR_STATE_UNLOAD); + event = BGE_APE_EVENT_STATUS_STATE_UNLOAD; + break; + case BGE_RESET_SUSPEND: + event = BGE_APE_EVENT_STATUS_STATE_SUSPEND; + break; + default: + return; + } + + bge_ape_send_event(sc, event | BGE_APE_EVENT_STATUS_DRIVER_EVNT | + BGE_APE_EVENT_STATUS_STATE_CHNGE); +} + +/* * Map a single buffer address. */ @@ -806,6 +1127,9 @@ bge_miibus_readreg(device_t dev, int phy sc = device_get_softc(dev); + if (bge_ape_lock(sc, sc->bge_phy_ape_lock) != 0) + return (0); + /* Clear the autopoll bit if set, otherwise may trigger PCI errors. */ if ((sc->bge_mi_mode & BGE_MIMODE_AUTOPOLL) != 0) { CSR_WRITE_4(sc, BGE_MI_MODE, @@ -840,6 +1164,8 @@ bge_miibus_readreg(device_t dev, int phy DELAY(80); } + bge_ape_unlock(sc, sc->bge_phy_ape_lock); + if (val & BGE_MICOMM_READFAIL) return (0); @@ -858,6 +1184,9 @@ bge_miibus_writereg(device_t dev, int ph (reg == BRGPHY_MII_1000CTL || reg == BRGPHY_MII_AUXCTL)) return (0); + if (bge_ape_lock(sc, sc->bge_phy_ape_lock) != 0) + return (0); + /* Clear the autopoll bit if set, otherwise may trigger PCI errors. */ if ((sc->bge_mi_mode & BGE_MIMODE_AUTOPOLL) != 0) { CSR_WRITE_4(sc, BGE_MI_MODE, @@ -883,6 +1212,8 @@ bge_miibus_writereg(device_t dev, int ph DELAY(80); } + bge_ape_unlock(sc, sc->bge_phy_ape_lock); + if (i == BGE_TIMEOUT) device_printf(sc->bge_dev, "PHY write timed out (phy %d, reg %d, val 0x%04x)\n", @@ -1335,12 +1666,19 @@ bge_sig_pre_reset(struct bge_softc *sc, bge_writemem_ind(sc, BGE_SRAM_FW_DRV_STATE_MB, BGE_FW_DRV_STATE_START); break; - case BGE_RESET_STOP: + case BGE_RESET_SHUTDOWN: bge_writemem_ind(sc, BGE_SRAM_FW_DRV_STATE_MB, BGE_FW_DRV_STATE_UNLOAD); break; + case BGE_RESET_SUSPEND: + bge_writemem_ind(sc, BGE_SRAM_FW_DRV_STATE_MB, + BGE_FW_DRV_STATE_SUSPEND); + break; } } + + if (type == BGE_RESET_START || type == BGE_RESET_SUSPEND) + bge_ape_driver_state_change(sc, type); } static void @@ -1354,12 +1692,14 @@ bge_sig_post_reset(struct bge_softc *sc, BGE_FW_DRV_STATE_START_DONE); /* START DONE */ break; - case BGE_RESET_STOP: + case BGE_RESET_SHUTDOWN: bge_writemem_ind(sc, BGE_SRAM_FW_DRV_STATE_MB, BGE_FW_DRV_STATE_UNLOAD_DONE); break; } } + if (type == BGE_RESET_SHUTDOWN) + bge_ape_driver_state_change(sc, type); } static void @@ -1372,7 +1712,7 @@ bge_sig_legacy(struct bge_softc *sc, int bge_writemem_ind(sc, BGE_SRAM_FW_DRV_STATE_MB, BGE_FW_DRV_STATE_START); break; - case BGE_RESET_STOP: + case BGE_RESET_SHUTDOWN: bge_writemem_ind(sc, BGE_SRAM_FW_DRV_STATE_MB, BGE_FW_DRV_STATE_UNLOAD); break; @@ -1409,11 +1749,6 @@ bge_dma_swap_options(struct bge_softc *s #if BYTE_ORDER == BIG_ENDIAN dma_options |= BGE_MODECTL_BYTESWAP_NONFRAME; #endif - if ((sc)->bge_asicrev == BGE_ASICREV_BCM5720) - dma_options |= BGE_MODECTL_BYTESWAP_B2HRX_DATA | - BGE_MODECTL_WORDSWAP_B2HRX_DATA | BGE_MODECTL_B2HRX_ENABLE | - BGE_MODECTL_HTX2B_ENABLE; - return (dma_options); } @@ -1540,8 +1875,16 @@ bge_chipinit(struct bge_softc *sc) /* * Set up general mode register. */ - mode_ctl = bge_dma_swap_options(sc) | BGE_MODECTL_MAC_ATTN_INTR | - BGE_MODECTL_HOST_SEND_BDS | BGE_MODECTL_TX_NO_PHDR_CSUM; + mode_ctl = bge_dma_swap_options(sc); + if (sc->bge_asicrev == BGE_ASICREV_BCM5720) { + /* Retain Host-2-BMC settings written by APE firmware. */ + mode_ctl |= CSR_READ_4(sc, BGE_MODE_CTL) & + (BGE_MODECTL_BYTESWAP_B2HRX_DATA | + BGE_MODECTL_WORDSWAP_B2HRX_DATA | + BGE_MODECTL_B2HRX_ENABLE | BGE_MODECTL_HTX2B_ENABLE); + } + mode_ctl |= BGE_MODECTL_MAC_ATTN_INTR | BGE_MODECTL_HOST_SEND_BDS | + BGE_MODECTL_TX_NO_PHDR_CSUM; /* * BCM5701 B5 have a bug causing data corruption when using @@ -2045,6 +2388,10 @@ bge_blockinit(struct bge_softc *sc) else val |= BGE_PORTMODE_MII; + /* Allow APE to send/receive frames. */ + if ((sc->bge_mfw_flags & BGE_MFW_ON_APE) != 0) + val |= BGE_MACMODE_APE_RX_EN | BGE_MACMODE_APE_TX_EN; + CSR_WRITE_4(sc, BGE_MAC_MODE, val); DELAY(40); @@ -2866,9 +3213,9 @@ bge_attach(device_t dev) { struct ifnet *ifp; struct bge_softc *sc; - uint32_t hwcfg = 0, misccfg; + uint32_t hwcfg = 0, misccfg, pcistate; u_char eaddr[ETHER_ADDR_LEN]; - int capmask, error, f, msicount, phy_addr, reg, rid, trys; + int capmask, error, msicount, phy_addr, reg, rid, trys; sc = device_get_softc(dev); sc->bge_dev = dev; @@ -2887,12 +3234,13 @@ bge_attach(device_t dev) RF_ACTIVE); if (sc->bge_res == NULL) { - device_printf (sc->bge_dev, "couldn't map memory\n"); + device_printf (sc->bge_dev, "couldn't map BAR0 memory\n"); error = ENXIO; goto fail; } /* Save various chip information. */ + sc->bge_func_addr = pci_get_function(dev); sc->bge_chipid = pci_read_config(dev, BGE_PCI_MISC_CTL, 4) >> BGE_PCIMISCCTL_ASICREV_SHIFT; @@ -2939,25 +3287,32 @@ bge_attach(device_t dev) * BCM5719 | 1 | 8 | 2 | 9 | * BCM5720 | 1 | 8 | 2 | 9 | * + * | F2 Cu | F2 Sr | F3 Cu | F3 Sr | + * ---------+-------+-------+-------+-------+ + * BCM57XX | X | X | X | X | + * BCM5704 | X | X | X | X | + * BCM5717 | X | X | X | X | + * BCM5719 | 3 | 10 | 4 | 11 | + * BCM5720 | X | X | X | X | + * * Other addresses may respond but they are not * IEEE compliant PHYs and should be ignored. */ if (sc->bge_asicrev == BGE_ASICREV_BCM5717 || sc->bge_asicrev == BGE_ASICREV_BCM5719 || sc->bge_asicrev == BGE_ASICREV_BCM5720) { - f = pci_get_function(dev); - if (sc->bge_chipid == BGE_CHIPID_BCM5717_A0) { + if (sc->bge_chipid != BGE_CHIPID_BCM5717_A0) { if (CSR_READ_4(sc, BGE_SGDIG_STS) & BGE_SGDIGSTS_IS_SERDES) - phy_addr = f + 8; + phy_addr = sc->bge_func_addr + 8; else - phy_addr = f + 1; + phy_addr = sc->bge_func_addr + 1; } else { if (CSR_READ_4(sc, BGE_CPMU_PHY_STRAP) & BGE_CPMU_PHY_STRAP_IS_SERDES) - phy_addr = f + 8; + phy_addr = sc->bge_func_addr + 8; else - phy_addr = f + 1; + phy_addr = sc->bge_func_addr + 1; } } @@ -3020,6 +3375,39 @@ bge_attach(device_t dev) break; } + /* Identify chips with APE processor. */ + switch (sc->bge_asicrev) { + case BGE_ASICREV_BCM5717: + case BGE_ASICREV_BCM5719: + case BGE_ASICREV_BCM5720: + case BGE_ASICREV_BCM5761: + sc->bge_flags |= BGE_FLAG_APE; + break; + } + + /* Chips with APE need BAR2 access for APE registers/memory. */ + if ((sc->bge_flags & BGE_FLAG_APE) != 0) { + rid = PCIR_BAR(2); + sc->bge_res2 = bus_alloc_resource_any(dev, SYS_RES_MEMORY, &rid, + RF_ACTIVE); + if (sc->bge_res2 == NULL) { + device_printf (sc->bge_dev, + "couldn't map BAR2 memory\n"); + error = ENXIO; + goto fail; + } + + /* Enable APE register/memory access by host driver. */ + pcistate = pci_read_config(dev, BGE_PCI_PCISTATE, 4); + pcistate |= BGE_PCISTATE_ALLOW_APE_CTLSPC_WR | + BGE_PCISTATE_ALLOW_APE_SHMEM_WR | + BGE_PCISTATE_ALLOW_APE_PSPACE_WR; + pci_write_config(dev, BGE_PCI_PCISTATE, pcistate, 4); + + bge_ape_lock_init(sc); + bge_ape_read_fw_ver(sc); + } + /* Add SYSCTLs, requires the chipset family to be set. */ bge_add_sysctls(sc); @@ -3239,36 +3627,31 @@ bge_attach(device_t dev) bge_devinfo(sc); - /* Try to reset the chip. */ - if (bge_reset(sc)) { - device_printf(sc->bge_dev, "chip reset failed\n"); - error = ENXIO; - goto fail; - } - sc->bge_asf_mode = 0; - if (bge_allow_asf && (bge_readmem_ind(sc, BGE_SRAM_DATA_SIG) == - BGE_SRAM_DATA_SIG_MAGIC)) { - if (bge_readmem_ind(sc, BGE_SRAM_DATA_CFG) - & BGE_HWCFG_ASF) { - sc->bge_asf_mode |= ASF_ENABLE; - sc->bge_asf_mode |= ASF_STACKUP; - if (BGE_IS_575X_PLUS(sc)) - sc->bge_asf_mode |= ASF_NEW_HANDSHAKE; + /* No ASF if APE present. */ + if ((sc->bge_flags & BGE_FLAG_APE) == 0) { + if (bge_allow_asf && (bge_readmem_ind(sc, BGE_SRAM_DATA_SIG) == + BGE_SRAM_DATA_SIG_MAGIC)) { + if (bge_readmem_ind(sc, BGE_SRAM_DATA_CFG) & + BGE_HWCFG_ASF) { + sc->bge_asf_mode |= ASF_ENABLE; + sc->bge_asf_mode |= ASF_STACKUP; + if (BGE_IS_575X_PLUS(sc)) + sc->bge_asf_mode |= ASF_NEW_HANDSHAKE; + } } } - /* Try to reset the chip again the nice way. */ bge_stop_fw(sc); - bge_sig_pre_reset(sc, BGE_RESET_STOP); + bge_sig_pre_reset(sc, BGE_RESET_START); if (bge_reset(sc)) { device_printf(sc->bge_dev, "chip reset failed\n"); error = ENXIO; goto fail; } - bge_sig_legacy(sc, BGE_RESET_STOP); - bge_sig_post_reset(sc, BGE_RESET_STOP); + bge_sig_legacy(sc, BGE_RESET_START); + bge_sig_post_reset(sc, BGE_RESET_START); if (bge_chipinit(sc)) { device_printf(sc->bge_dev, "chip initialization failed\n"); @@ -3543,6 +3926,10 @@ bge_release_resources(struct bge_softc * bus_release_resource(dev, SYS_RES_MEMORY, PCIR_BAR(0), sc->bge_res); + if (sc->bge_res2 != NULL) + bus_release_resource(dev, SYS_RES_MEMORY, + PCIR_BAR(2), sc->bge_res2); + if (sc->bge_ifp != NULL) if_free(sc->bge_ifp); @@ -3564,6 +3951,8 @@ bge_reset(struct bge_softc *sc) dev = sc->bge_dev; mac_mode_mask = BGE_MACMODE_HALF_DUPLEX | BGE_MACMODE_PORTMODE; + if ((sc->bge_mfw_flags & BGE_MFW_ON_APE) != 0) + mac_mode_mask |= BGE_MACMODE_APE_RX_EN | BGE_MACMODE_APE_TX_EN; mac_mode = CSR_READ_4(sc, BGE_MAC_MODE) & mac_mode_mask; if (BGE_IS_575X_PLUS(sc) && !BGE_IS_5714_FAMILY(sc) && @@ -3575,6 +3964,9 @@ bge_reset(struct bge_softc *sc) } else write_op = bge_writereg_ind; + /* Take APE lock when performing reset. */ + bge_ape_lock(sc, BGE_APE_LOCK_GRC); + /* Save some important PCI state. */ cachesize = pci_read_config(dev, BGE_PCI_CACHESZ, 4); command = pci_read_config(dev, BGE_PCI_CMD, 4); @@ -3669,6 +4061,10 @@ bge_reset(struct bge_softc *sc) if (sc->bge_chipid == BGE_CHIPID_BCM5704_A0 && (sc->bge_flags & BGE_FLAG_PCIX) != 0) val |= BGE_PCISTATE_RETRY_SAME_DMA; + if ((sc->bge_mfw_flags & BGE_MFW_ON_APE) != 0) + val |= BGE_PCISTATE_ALLOW_APE_CTLSPC_WR | + BGE_PCISTATE_ALLOW_APE_SHMEM_WR | + BGE_PCISTATE_ALLOW_APE_PSPACE_WR; pci_write_config(dev, BGE_PCI_PCISTATE, val, 4); pci_write_config(dev, BGE_PCI_CACHESZ, cachesize, 4); pci_write_config(dev, BGE_PCI_CMD, command, 4); @@ -3718,6 +4114,8 @@ bge_reset(struct bge_softc *sc) CSR_WRITE_4(sc, BGE_MAC_MODE, val); DELAY(40); + bge_ape_unlock(sc, BGE_APE_LOCK_GRC); + if (sc->bge_asicrev == BGE_ASICREV_BCM5906) { for (i = 0; i < BGE_TIMEOUT; i++) { val = CSR_READ_4(sc, BGE_VCPU_STATUS); @@ -4290,6 +4688,8 @@ bge_tick(void *xsc) else bge_stats_update(sc); + /* XXX Add APE heartbeat check here? */ + if ((sc->bge_flags & BGE_FLAG_TBI) == 0) { mii = device_get_softc(sc->bge_miibus); /* @@ -5033,7 +5433,10 @@ bge_init_locked(struct bge_softc *sc) DELAY(100); /* Turn on receiver. */ - BGE_SETBIT(sc, BGE_RX_MODE, BGE_RXMODE_ENABLE); + mode = CSR_READ_4(sc, BGE_RX_MODE); + if (BGE_IS_5755_PLUS(sc)) + mode |= BGE_RXMODE_IPV6_ENABLE; + CSR_WRITE_4(sc,BGE_RX_MODE, mode | BGE_RXMODE_ENABLE); DELAY(10); /* @@ -5439,7 +5842,7 @@ bge_stop(struct bge_softc *sc) * Tell firmware we're shutting down. */ bge_stop_fw(sc); - bge_sig_pre_reset(sc, BGE_RESET_STOP); + bge_sig_pre_reset(sc, BGE_RESET_SHUTDOWN); /* * Disable all of the receiver blocks. @@ -5485,8 +5888,8 @@ bge_stop(struct bge_softc *sc) bge_stats_update_regs(sc); bge_reset(sc); - bge_sig_legacy(sc, BGE_RESET_STOP); - bge_sig_post_reset(sc, BGE_RESET_STOP); + bge_sig_legacy(sc, BGE_RESET_SHUTDOWN); + bge_sig_post_reset(sc, BGE_RESET_SHUTDOWN); /* * Keep the ASF firmware running if up. @@ -5528,7 +5931,6 @@ bge_shutdown(device_t dev) sc = device_get_softc(dev); BGE_LOCK(sc); bge_stop(sc); - bge_reset(sc); BGE_UNLOCK(sc); return (0); @@ -5704,7 +6106,11 @@ bge_add_sysctls(struct bge_softc *sc) SYSCTL_ADD_PROC(ctx, children, OID_AUTO, "reg_read", CTLTYPE_INT | CTLFLAG_RW, sc, 0, bge_sysctl_reg_read, "I", - "Register Read"); + "MAC Register Read"); + + SYSCTL_ADD_PROC(ctx, children, OID_AUTO, "ape_read", + CTLTYPE_INT | CTLFLAG_RW, sc, 0, bge_sysctl_ape_read, "I", + "APE Register Read"); SYSCTL_ADD_PROC(ctx, children, OID_AUTO, "mem_read", CTLTYPE_INT | CTLFLAG_RW, sc, 0, bge_sysctl_mem_read, "I", @@ -6103,6 +6509,28 @@ bge_sysctl_reg_read(SYSCTL_HANDLER_ARGS) } static int +bge_sysctl_ape_read(SYSCTL_HANDLER_ARGS) +{ + struct bge_softc *sc; + int error; + uint16_t result; + uint32_t val; + + result = -1; + error = sysctl_handle_int(oidp, &result, 0, req); + if (error || (req->newptr == NULL)) + return (error); + + if (result < 0x8000) { + sc = (struct bge_softc *)arg1; + val = APE_READ_4(sc, result); + printf("reg 0x%06X = 0x%08X\n", result, val); + } + + return (error); +} + +static int bge_sysctl_mem_read(SYSCTL_HANDLER_ARGS) { struct bge_softc *sc; Modified: head/sys/dev/bge/if_bgereg.h ============================================================================== --- head/sys/dev/bge/if_bgereg.h Thu Oct 11 06:07:48 2012 (r241437) +++ head/sys/dev/bge/if_bgereg.h Thu Oct 11 06:43:43 2012 (r241438) @@ -435,6 +435,9 @@ #define BGE_PCISTATE_FLATVIEW_MODE 0x00000100 #define BGE_PCISTATE_PCI_TGT_RETRY_MAX 0x00000E00 #define BGE_PCISTATE_RETRY_SAME_DMA 0x00002000 +#define BGE_PCISTATE_ALLOW_APE_CTLSPC_WR 0x00010000 +#define BGE_PCISTATE_ALLOW_APE_SHMEM_WR 0x00020000 +#define BGE_PCISTATE_ALLOW_APE_PSPACE_WR 0x00040000 /* * PCI Clock Control register -- note, this register is read only @@ -460,6 +463,8 @@ #define PCIM_CMD_INTxDIS 0x0400 #endif +/* BAR0 (MAC) Register Definitions */ + /* * High priority mailbox registers * Each mailbox is 64-bits wide, though we only use the @@ -742,6 +747,8 @@ #define BGE_MACMODE_TXDMA_ENB 0x00200000 #define BGE_MACMODE_RXDMA_ENB 0x00400000 #define BGE_MACMODE_FRMHDR_DMA_ENB 0x00800000 +#define BGE_MACMODE_APE_RX_EN 0x08000000 +#define BGE_MACMODE_APE_TX_EN 0x10000000 #define BGE_PORTMODE_NONE 0x00000000 #define BGE_PORTMODE_MII 0x00000004 @@ -829,6 +836,7 @@ #define BGE_RXMODE_RX_PROMISC 0x00000100 #define BGE_RXMODE_RX_NO_CRC_CHECK 0x00000200 #define BGE_RXMODE_RX_KEEP_VLAN_DIAG 0x00000400 +#define BGE_RXMODE_IPV6_ENABLE 0x01000000 /* Receive MAC status register */ #define BGE_RXSTAT_REMOTE_XOFFED 0x00000001 @@ -1578,6 +1586,22 @@ #define BGE_RDMA_LSO_CRPTEN_CTRL_BLEN_BD_4K 0x00030000 #define BGE_RDMA_LSO_CRPTEN_CTRL_BLEN_LSO_4K 0x000C0000 +/* BD Read DMA Mode register */ +#define BGE_RDMA_BD_MODE 0x4A00 +/* BD Read DMA Mode status register */ +#define BGE_RDMA_BD_STATUS 0x4A04 + +#define BGE_RDMA_BD_MODE_RESET 0x00000001 +#define BGE_RDMA_BD_MODE_ENABLE 0x00000002 + +/* Non-LSO Read DMA Mode register */ +#define BGE_RDMA_NON_LSO_MODE 0x4B00 +/* Non-LSO Read DMA Mode status register */ +#define BGE_RDMA_NON_LSO_STATUS 0x4B04 + +#define BGE_RDMA_NON_LSO_MODE_RESET 0x00000001 +#define BGE_RDMA_NON_LSO_MODE_ENABLE 0x00000002 + /* * Write DMA control registers */ @@ -2065,6 +2089,112 @@ #define BGE_MEMWIN_START 0x00008000 #define BGE_MEMWIN_END 0x0000FFFF +/* BAR1 (APE) Register Definitions */ + +#define BGE_APE_GPIO_MSG 0x0008 +#define BGE_APE_EVENT 0x000C +#define BGE_APE_LOCK_REQ 0x002C +#define BGE_APE_LOCK_GRANT 0x004C + +#define BGE_APE_GPIO_MSG_SHIFT 4 + +#define BGE_APE_EVENT_1 0x00000001 + +#define BGE_APE_LOCK_REQ_DRIVER0 0x00001000 + +#define BGE_APE_LOCK_GRANT_DRIVER0 0x00001000 + +/* APE Shared Memory block (writable by APE only) */ +#define BGE_APE_SEG_SIG 0x4000 +#define BGE_APE_FW_STATUS 0x400C +#define BGE_APE_FW_FEATURES 0x4010 +#define BGE_APE_FW_BEHAVIOR 0x4014 +#define BGE_APE_FW_VERSION 0x4018 +#define BGE_APE_FW_HEARTBEAT_INTERVAL 0x4024 +#define BGE_APE_FW_HEARTBEAT 0x4028 +#define BGE_APE_FW_ERROR_FLAGS 0x4074 + +#define BGE_APE_SEG_SIG_MAGIC 0x41504521 + +#define BGE_APE_FW_STATUS_READY 0x00000100 + +#define BGE_APE_FW_FEATURE_DASH 0x00000001 +#define BGE_APE_FW_FEATURE_NCSI 0x00000002 + +#define BGE_APE_FW_VERSION_MAJMSK 0xFF000000 +#define BGE_APE_FW_VERSION_MAJSFT 24 +#define BGE_APE_FW_VERSION_MINMSK 0x00FF0000 +#define BGE_APE_FW_VERSION_MINSFT 16 +#define BGE_APE_FW_VERSION_REVMSK 0x0000FF00 +#define BGE_APE_FW_VERSION_REVSFT 8 +#define BGE_APE_FW_VERSION_BLDMSK 0x000000FF + +/* Host Shared Memory block (writable by host only) */ +#define BGE_APE_HOST_SEG_SIG 0x4200 +#define BGE_APE_HOST_SEG_LEN 0x4204 +#define BGE_APE_HOST_INIT_COUNT 0x4208 +#define BGE_APE_HOST_DRIVER_ID 0x420C +#define BGE_APE_HOST_BEHAVIOR 0x4210 +#define BGE_APE_HOST_HEARTBEAT_INT_MS 0x4214 +#define BGE_APE_HOST_HEARTBEAT_COUNT 0x4218 +#define BGE_APE_HOST_DRVR_STATE 0x421C +#define BGE_APE_HOST_WOL_SPEED 0x4224 + +#define BGE_APE_HOST_SEG_SIG_MAGIC 0x484F5354 + +#define BGE_APE_HOST_SEG_LEN_MAGIC 0x00000020 + +#define BGE_APE_HOST_DRIVER_ID_FBSD 0xF6000000 +#define BGE_APE_HOST_DRIVER_ID_MAGIC(maj, min) \ + (BGE_APE_HOST_DRIVER_ID_FBSD | \ + ((maj) & 0xffd) << 16 | ((min) & 0xff) << 8) + +#define BGE_APE_HOST_BEHAV_NO_PHYLOCK 0x00000001 + +#define BGE_APE_HOST_HEARTBEAT_INT_DISABLE 0 +#define BGE_APE_HOST_HEARTBEAT_INT_5SEC 5000 + +#define BGE_APE_HOST_DRVR_STATE_START 0x00000001 +#define BGE_APE_HOST_DRVR_STATE_UNLOAD 0x00000002 +#define BGE_APE_HOST_DRVR_STATE_WOL 0x00000003 +#define BGE_APE_HOST_DRVR_STATE_SUSPEND 0x00000004 + +#define BGE_APE_HOST_WOL_SPEED_AUTO 0x00008000 + +#define BGE_APE_EVENT_STATUS 0x4300 + +#define BGE_APE_EVENT_STATUS_DRIVER_EVNT 0x00000010 +#define BGE_APE_EVENT_STATUS_STATE_CHNGE 0x00000500 +#define BGE_APE_EVENT_STATUS_STATE_START 0x00010000 +#define BGE_APE_EVENT_STATUS_STATE_UNLOAD 0x00020000 +#define BGE_APE_EVENT_STATUS_STATE_WOL 0x00030000 +#define BGE_APE_EVENT_STATUS_STATE_SUSPEND 0x00040000 +#define BGE_APE_EVENT_STATUS_EVENT_PENDING 0x80000000 + +#define BGE_APE_DEBUG_LOG 0x4E00 +#define BGE_APE_DEBUG_LOG_LEN 0x0100 + +#define BGE_APE_PER_LOCK_REQ 0x8400 +#define BGE_APE_PER_LOCK_GRANT 0x8420 + +#define BGE_APE_LOCK_PER_REQ_DRIVER0 0x00001000 +#define BGE_APE_LOCK_PER_REQ_DRIVER1 0x00000002 +#define BGE_APE_LOCK_PER_REQ_DRIVER2 0x00000004 +#define BGE_APE_LOCK_PER_REQ_DRIVER3 0x00000008 + +#define BGE_APE_PER_LOCK_GRANT_DRIVER0 0x00001000 +#define BGE_APE_PER_LOCK_GRANT_DRIVER1 0x00000002 +#define BGE_APE_PER_LOCK_GRANT_DRIVER2 0x00000004 +#define BGE_APE_PER_LOCK_GRANT_DRIVER3 0x00000008 + +/* APE Mutex Resources */ +#define BGE_APE_LOCK_PHY0 0 +#define BGE_APE_LOCK_GRC 1 +#define BGE_APE_LOCK_PHY1 2 +#define BGE_APE_LOCK_PHY2 3 +#define BGE_APE_LOCK_MEM 4 +#define BGE_APE_LOCK_PHY3 5 +#define BGE_APE_LOCK_GPIO 7 #define BGE_MEMWIN_READ(sc, x, val) \ do { \ @@ -2659,7 +2789,7 @@ struct bge_gib { #define BGE_INC(x, y) (x) = (x + 1) % y /* - * Register access macros. The Tigon always uses memory mapped register + * BAR0 MAC register access macros. The Tigon always uses memory mapped register * accesses and all registers must be accessed with 32 bit operations. */ @@ -2674,6 +2804,18 @@ struct bge_gib { #define BGE_CLRBIT(sc, reg, x) \ CSR_WRITE_4(sc, reg, (CSR_READ_4(sc, reg) & ~(x))) +/* BAR2 APE register access macros. */ +#define APE_WRITE_4(sc, reg, val) \ + bus_write_4(sc->bge_res2, reg, val) + +#define APE_READ_4(sc, reg) \ + bus_read_4(sc->bge_res2, reg) + +#define APE_SETBIT(sc, reg, x) \ + APE_WRITE_4(sc, reg, (APE_READ_4(sc, reg) | (x))) +#define APE_CLRBIT(sc, reg, x) \ + APE_WRITE_4(sc, reg, (APE_READ_4(sc, reg) & ~(x))) + #define PCI_SETBIT(dev, reg, x, s) \ pci_write_config(dev, reg, (pci_read_config(dev, reg, s) | (x)), s) #define PCI_CLRBIT(dev, reg, x, s) \ @@ -2790,7 +2932,8 @@ struct bge_softc { device_t bge_miibus; void *bge_intrhand; struct resource *bge_irq; - struct resource *bge_res; + struct resource *bge_res; /* MAC mapped I/O */ + struct resource *bge_res2; /* APE mapped I/O */ struct ifmedia bge_ifmedia; /* TBI media info */ int bge_expcap; int bge_expmrq; @@ -2804,6 +2947,7 @@ struct bge_softc { #define BGE_FLAG_MII_SERDES 0x00000010 #define BGE_FLAG_CPMU_PRESENT 0x00000020 #define BGE_FLAG_TAGGED_STATUS 0x00000040 +#define BGE_FLAG_APE 0x00000080 #define BGE_FLAG_MSI 0x00000100 #define BGE_FLAG_PCIX 0x00000200 #define BGE_FLAG_PCIE 0x00000400 @@ -2823,6 +2967,13 @@ struct bge_softc { *** DIFF OUTPUT TRUNCATED AT 1000 LINES *** From owner-svn-src-head@FreeBSD.ORG Thu Oct 11 07:39:52 2012 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id 2D046B60; Thu, 11 Oct 2012 07:39:52 +0000 (UTC) (envelope-from stefanf@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id EFEC78FC17; Thu, 11 Oct 2012 07:39:51 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id q9B7dp1Z081627; Thu, 11 Oct 2012 07:39:51 GMT (envelope-from stefanf@svn.freebsd.org) Received: (from stefanf@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q9B7dpjH081624; Thu, 11 Oct 2012 07:39:51 GMT (envelope-from stefanf@svn.freebsd.org) Message-Id: <201210110739.q9B7dpjH081624@svn.freebsd.org> From: Stefan Farfeleder Date: Thu, 11 Oct 2012 07:39:51 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r241439 - head/lib/libc/gen X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 11 Oct 2012 07:39:52 -0000 Author: stefanf Date: Thu Oct 11 07:39:51 2012 New Revision: 241439 URL: http://svn.freebsd.org/changeset/base/241439 Log: Apply some style. Checked with md5. Modified: head/lib/libc/gen/fstab.c Modified: head/lib/libc/gen/fstab.c ============================================================================== --- head/lib/libc/gen/fstab.c Thu Oct 11 06:43:43 2012 (r241438) +++ head/lib/libc/gen/fstab.c Thu Oct 11 07:39:51 2012 (r241439) @@ -76,7 +76,7 @@ setfstab(const char *file) } const char * -getfstab (void) +getfstab(void) { if (fsp_set) @@ -86,7 +86,7 @@ getfstab (void) } static void -fixfsfile() +fixfsfile(void) { static char buf[sizeof(_PATH_DEV) + MNAMELEN]; struct stat sb; @@ -108,7 +108,7 @@ fixfsfile() } static int -fstabscan() +fstabscan(void) { char *cp, *p; #define MAXLINELENGTH 1024 @@ -119,7 +119,7 @@ fstabscan() for (;;) { if (!(p = fgets(line, sizeof(line), _fs_fp))) - return(0); + return (0); /* OLD_STYLE_FSTAB */ ++LineNo; if (*line == '#' || *line == '\n') @@ -140,7 +140,7 @@ fstabscan() _fs_fstab.fs_freq = atoi(cp); if ((cp = strsep(&p, ":\n")) != NULL) { _fs_fstab.fs_passno = atoi(cp); - return(1); + return (1); } } } @@ -206,7 +206,7 @@ fstabscan() if (typexx) continue; if (cp != NULL) - return(1); + return (1); bad: /* no way to distinguish between EOF and syntax error */ error(EFTYPE); @@ -215,44 +215,45 @@ bad: /* no way to distinguish between E } struct fstab * -getfsent() +getfsent(void) { + if ((!_fs_fp && !setfsent()) || !fstabscan()) - return((struct fstab *)NULL); - return(&_fs_fstab); + return (NULL); + return (&_fs_fstab); } struct fstab * -getfsspec(name) - const char *name; +getfsspec(const char *name) { + if (setfsent()) while (fstabscan()) if (!strcmp(_fs_fstab.fs_spec, name)) - return(&_fs_fstab); - return((struct fstab *)NULL); + return (&_fs_fstab); + return (NULL); } struct fstab * -getfsfile(name) - const char *name; +getfsfile(const char *name) { + if (setfsent()) while (fstabscan()) if (!strcmp(_fs_fstab.fs_file, name)) - return(&_fs_fstab); - return((struct fstab *)NULL); + return (&_fs_fstab); + return (NULL); } -int -setfsent() +int +setfsent(void) { int fd; if (_fs_fp) { rewind(_fs_fp); LineNo = 0; - return(1); + return (1); } if (fsp_set == 0) { if (issetugid()) @@ -268,16 +269,17 @@ setfsent() _fs_fp = fdopen(fd, "r"); if (_fs_fp != NULL) { LineNo = 0; - return(1); + return (1); } error(errno); _close(fd); - return(0); + return (0); } void -endfsent() +endfsent(void) { + if (_fs_fp) { (void)fclose(_fs_fp); _fs_fp = NULL; @@ -287,8 +289,7 @@ endfsent() } static void -error(err) - int err; +error(int err) { char *p; char num[30]; From owner-svn-src-head@FreeBSD.ORG Thu Oct 11 07:54:30 2012 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id 97B33FE3; Thu, 11 Oct 2012 07:54:30 +0000 (UTC) (envelope-from stefanf@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 65F788FC0C; Thu, 11 Oct 2012 07:54:30 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id q9B7sUiR083533; Thu, 11 Oct 2012 07:54:30 GMT (envelope-from stefanf@svn.freebsd.org) Received: (from stefanf@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q9B7sUBD083530; Thu, 11 Oct 2012 07:54:30 GMT (envelope-from stefanf@svn.freebsd.org) Message-Id: <201210110754.q9B7sUBD083530@svn.freebsd.org> From: Stefan Farfeleder Date: Thu, 11 Oct 2012 07:54:30 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r241440 - in head: lib/libc/gen share/man/man5 X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 11 Oct 2012 07:54:30 -0000 Author: stefanf Date: Thu Oct 11 07:54:29 2012 New Revision: 241440 URL: http://svn.freebsd.org/changeset/base/241440 Log: Decode the first two fstab fields with strunvis(3). This allows having spaces in devices and mount paths, encoded as \s or \040. PR: bin/117687 Submitted by: Martin Kammerhofer Discussed on: arch Modified: head/lib/libc/gen/fstab.c head/share/man/man5/fstab.5 Modified: head/lib/libc/gen/fstab.c ============================================================================== --- head/lib/libc/gen/fstab.c Thu Oct 11 07:39:51 2012 (r241439) +++ head/lib/libc/gen/fstab.c Thu Oct 11 07:54:29 2012 (r241440) @@ -46,6 +46,7 @@ __FBSDID("$FreeBSD$"); #include #include #include +#include #include "un-namespace.h" static FILE *_fs_fp; @@ -149,11 +150,15 @@ fstabscan(void) /* OLD_STYLE_FSTAB */ while ((cp = strsep(&p, " \t\n")) != NULL && *cp == '\0') ; + if (strunvis(cp, cp) < 0) + goto bad; _fs_fstab.fs_spec = cp; if (!_fs_fstab.fs_spec || *_fs_fstab.fs_spec == '#') continue; while ((cp = strsep(&p, " \t\n")) != NULL && *cp == '\0') ; + if (strunvis(cp, cp) < 0) + goto bad; _fs_fstab.fs_file = cp; fixfsfile(); while ((cp = strsep(&p, " \t\n")) != NULL && *cp == '\0') Modified: head/share/man/man5/fstab.5 ============================================================================== --- head/share/man/man5/fstab.5 Thu Oct 11 07:39:51 2012 (r241439) +++ head/share/man/man5/fstab.5 Thu Oct 11 07:54:29 2012 (r241440) @@ -32,7 +32,7 @@ .\" @(#)fstab.5 8.1 (Berkeley) 6/5/93 .\" $FreeBSD$ .\" -.Dd June 7, 2011 +.Dd October 11, 2012 .Dt FSTAB 5 .Os .Sh NAME @@ -66,12 +66,20 @@ The first field, .Pq Fa fs_spec , describes the special device or remote file system to be mounted. +The contents are decoded by the +.Xr strunvis 3 +function. +This allows using spaces or tabs in the device name which would be +interpreted as field separators otherwise. .Pp The second field, .Pq Fa fs_file , describes the mount point for the file system. For swap partitions, this field should be specified as .Dq none . +The contents are decoded by the +.Xr strunvis 3 +function, as above. .Pp The third field, .Pq Fa fs_vfstype , @@ -338,6 +346,7 @@ resides in .Xr mount 8 , .Xr quotacheck 8 , .Xr quotaon 8 , +.Xr strunvis 3 , .Xr swapon 8 , .Xr umount 8 .Sh HISTORY From owner-svn-src-head@FreeBSD.ORG Thu Oct 11 08:18:28 2012 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id D695E68D; Thu, 11 Oct 2012 08:18:28 +0000 (UTC) (envelope-from stefanf@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id BEC238FC16; Thu, 11 Oct 2012 08:18:28 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id q9B8ISlg086765; Thu, 11 Oct 2012 08:18:28 GMT (envelope-from stefanf@svn.freebsd.org) Received: (from stefanf@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q9B8ISSE086763; Thu, 11 Oct 2012 08:18:28 GMT (envelope-from stefanf@svn.freebsd.org) Message-Id: <201210110818.q9B8ISSE086763@svn.freebsd.org> From: Stefan Farfeleder Date: Thu, 11 Oct 2012 08:18:28 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r241441 - head/lib/libc/gen X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 11 Oct 2012 08:18:28 -0000 Author: stefanf Date: Thu Oct 11 08:18:28 2012 New Revision: 241441 URL: http://svn.freebsd.org/changeset/base/241441 Log: Fix my last commit. Only call strunvis after properly checking the argument is not NULL. Modified: head/lib/libc/gen/fstab.c Modified: head/lib/libc/gen/fstab.c ============================================================================== --- head/lib/libc/gen/fstab.c Thu Oct 11 07:54:29 2012 (r241440) +++ head/lib/libc/gen/fstab.c Thu Oct 11 08:18:28 2012 (r241441) @@ -150,16 +150,18 @@ fstabscan(void) /* OLD_STYLE_FSTAB */ while ((cp = strsep(&p, " \t\n")) != NULL && *cp == '\0') ; - if (strunvis(cp, cp) < 0) - goto bad; _fs_fstab.fs_spec = cp; - if (!_fs_fstab.fs_spec || *_fs_fstab.fs_spec == '#') + if (_fs_fstab.fs_spec == NULL || *_fs_fstab.fs_spec == '#') continue; + if (strunvis(_fs_fstab.fs_spec, _fs_fstab.fs_spec) < 0) + goto bad; while ((cp = strsep(&p, " \t\n")) != NULL && *cp == '\0') ; - if (strunvis(cp, cp) < 0) - goto bad; _fs_fstab.fs_file = cp; + if (_fs_fstab.fs_file == NULL) + goto bad; + if (strunvis(_fs_fstab.fs_file, _fs_fstab.fs_file) < 0) + goto bad; fixfsfile(); while ((cp = strsep(&p, " \t\n")) != NULL && *cp == '\0') ; From owner-svn-src-head@FreeBSD.ORG Thu Oct 11 11:43:49 2012 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id 27E3F129; Thu, 11 Oct 2012 11:43:49 +0000 (UTC) (envelope-from pawel@dawidek.net) Received: from mail.dawidek.net (garage.dawidek.net [91.121.88.72]) by mx1.freebsd.org (Postfix) with ESMTP id D6DA78FC18; Thu, 11 Oct 2012 11:43:48 +0000 (UTC) Received: from localhost (dkz205.neoplus.adsl.tpnet.pl [83.24.29.205]) by mail.dawidek.net (Postfix) with ESMTPSA id B280C7A7; Thu, 11 Oct 2012 13:42:35 +0200 (CEST) Date: Thu, 11 Oct 2012 13:44:25 +0200 From: Pawel Jakub Dawidek To: Eitan Adler Subject: Re: svn commit: r241373 - head/lib/libc/stdlib Message-ID: <20121011114425.GA1562@garage.freebsd.pl> References: <201210091425.q99EPFS6020787@svn.freebsd.org> <507451DE.9060909@freebsd.org> <977E1107-46D4-476F-A04D-AEFD87D1DE53@FreeBSD.org> MIME-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha1; protocol="application/pgp-signature"; boundary="9jxsPFA5p3P2qPhR" Content-Disposition: inline In-Reply-To: X-OS: FreeBSD 10.0-CURRENT amd64 User-Agent: Mutt/1.5.21 (2010-09-15) Cc: mdf@freebsd.org, src-committers@freebsd.org, Andrey Chernov , svn-src-all@freebsd.org, David Chisnall , svn-src-head@freebsd.org X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 11 Oct 2012 11:43:49 -0000 --9jxsPFA5p3P2qPhR Content-Type: text/plain; charset=us-ascii Content-Disposition: inline Content-Transfer-Encoding: quoted-printable On Tue, Oct 09, 2012 at 01:51:05PM -0400, Eitan Adler wrote: > On 9 October 2012 13:27, wrote: > > The original behavior can be recovered by using inline assembly to > > fetch the value from a register into a local C variable; this would at > > least not rely on undefined behavior. But I agree it's of dubious > > value anyways. >=20 > I proposed this (with a patch). We want to move to not using > /dev/random and instead make a kernel system call directly. The patch > for this is not finished yet though. You should do something similar to: http://people.freebsd.org/~pjd/patches/libc_arc4random.c.patch --=20 Pawel Jakub Dawidek http://www.wheelsystems.com FreeBSD committer http://www.FreeBSD.org Am I Evil? Yes, I Am! http://tupytaj.pl --9jxsPFA5p3P2qPhR Content-Type: application/pgp-signature -----BEGIN PGP SIGNATURE----- Version: GnuPG v2.0.19 (FreeBSD) iEYEARECAAYFAlB2sRkACgkQForvXbEpPzSBnACgvG0Q0yfOpDozuqgbT3OPRV31 5YgAn2fdSXmd2XtAuNYBuIyosjEJE5Yr =mnYc -----END PGP SIGNATURE----- --9jxsPFA5p3P2qPhR-- From owner-svn-src-head@FreeBSD.ORG Thu Oct 11 13:15:17 2012 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id 21219886 for ; Thu, 11 Oct 2012 13:15:17 +0000 (UTC) (envelope-from ache@vniz.net) Received: from mail-lb0-f182.google.com (mail-lb0-f182.google.com [209.85.217.182]) by mx1.freebsd.org (Postfix) with ESMTP id 4B64D8FC1D for ; Thu, 11 Oct 2012 13:15:16 +0000 (UTC) Received: by mail-lb0-f182.google.com with SMTP id b5so1552063lbd.13 for ; Thu, 11 Oct 2012 06:15:15 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20120113; h=sender:message-id:disposition-notification-to:date:from:user-agent :mime-version:to:cc:subject:references:in-reply-to:openpgp :content-type:x-gm-message-state; bh=/KF1iq7M1MlAbCQBa/h5Q7LG9IJnijpsrt7SbcchZIs=; b=mYcmL5GZE1gX/zXhpW8rpcQLwh7T7puuQw4i8NWlJUzjedBBtQUJ/6aX7n27zHoh6M anXLMQ20PyxIgtVl+mDW7PVK9mh2t8uvzRwZbBdHEl1rYUmCgq51M87F0dzMcnAUO26Z yHBFCGGy7KyuDPeM0youko0yuHTWkrtoMeIdgbd4CrNIdIRTzA+X6nRctEe38uC/ObXi vVRAOktWkosV3CNsLgNeFoMnQC8V7iubMENVaIHh+g914TEd2PVWkCvmGRY6t05H2tng EYPNySYsYpbNZbjuA0qEWsztj+mMiVzAgrffXDTc/yhZVIA/msO5qYgsZqSVB1S+AfY8 wXVw== Received: by 10.152.148.8 with SMTP id to8mr860849lab.2.1349961315188; Thu, 11 Oct 2012 06:15:15 -0700 (PDT) Received: from [192.168.1.2] ([89.169.140.97]) by mx.google.com with ESMTPS id mq9sm1348197lab.0.2012.10.11.06.15.14 (version=SSLv3 cipher=OTHER); Thu, 11 Oct 2012 06:15:14 -0700 (PDT) Sender: "Chernov, Andrey" Message-ID: <5076C650.4040508@freebsd.org> Date: Thu, 11 Oct 2012 17:14:56 +0400 From: Andrey Chernov User-Agent: Mozilla/5.0 (Windows NT 6.1; WOW64; rv:15.0) Gecko/20120907 Thunderbird/15.0.1 MIME-Version: 1.0 To: Pawel Jakub Dawidek Subject: Re: svn commit: r241373 - head/lib/libc/stdlib References: <201210091425.q99EPFS6020787@svn.freebsd.org> <507451DE.9060909@freebsd.org> <977E1107-46D4-476F-A04D-AEFD87D1DE53@FreeBSD.org> <20121011114425.GA1562@garage.freebsd.pl> In-Reply-To: <20121011114425.GA1562@garage.freebsd.pl> OpenPGP: id=964474DD Content-Type: multipart/signed; micalg=pgp-sha1; protocol="application/pgp-signature"; boundary="------------enigEDB188CB1C8DFB9A7472C70D" X-Gm-Message-State: ALoCoQnl/B8eJoq9tjoMyymfHfyJaBoMPbuw+wHwA4/KpMqqkrWTECxHz/fNejIUOM8kWKjZZ+3B Cc: mdf@freebsd.org, src-committers@freebsd.org, Eitan Adler , svn-src-all@freebsd.org, David Chisnall , svn-src-head@freebsd.org X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 11 Oct 2012 13:15:17 -0000 This is an OpenPGP/MIME signed message (RFC 2440 and 3156) --------------enigEDB188CB1C8DFB9A7472C70D Content-Type: text/plain; charset=KOI8-R Content-Transfer-Encoding: quoted-printable On 11.10.2012 15:44, Pawel Jakub Dawidek wrote: > On Tue, Oct 09, 2012 at 01:51:05PM -0400, Eitan Adler wrote: >> On 9 October 2012 13:27, wrote: >>> The original behavior can be recovered by using inline assembly to >>> fetch the value from a register into a local C variable; this would a= t >>> least not rely on undefined behavior. But I agree it's of dubious >>> value anyways. >> >> I proposed this (with a patch). We want to move to not using >> /dev/random and instead make a kernel system call directly. The patch >> for this is not finished yet though. >=20 > You should do something similar to: >=20 > http://people.freebsd.org/~pjd/patches/libc_arc4random.c.patch >=20 Already half of year I told people of our serious problem with kernel's arc4 (used here in sysctl) - it have very weak initialization at the kernel start (only from processor clock) which is auto-fixed because of its periodic reseeds, but only at the next reseed which happens late. I post two patches (both working, one using atomic, another don't use it) which reseeds kernel's arc4 as fast as we have enough real entropy. NetBSD don't have this problem because of their different kernel's arc4 implementation. --------------enigEDB188CB1C8DFB9A7472C70D Content-Type: application/pgp-signature; name="signature.asc" Content-Description: OpenPGP digital signature Content-Disposition: attachment; filename="signature.asc" -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.4.12 (MingW32) iEYEARECAAYFAlB2xlkACgkQVg5YK5ZEdN1GTgCfQrBR2jQ7BaHPYWeO9AOC3cuv VGgAnR/pAsZeiS1G02DRWPeXiDgKMLvz =gZBy -----END PGP SIGNATURE----- --------------enigEDB188CB1C8DFB9A7472C70D-- From owner-svn-src-head@FreeBSD.ORG Thu Oct 11 15:21:08 2012 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id 63426455; Thu, 11 Oct 2012 15:21:08 +0000 (UTC) (envelope-from mav@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 4C48C8FC0C; Thu, 11 Oct 2012 15:21:08 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id q9BFL7bR043351; Thu, 11 Oct 2012 15:21:07 GMT (envelope-from mav@svn.freebsd.org) Received: (from mav@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q9BFL7v4043349; Thu, 11 Oct 2012 15:21:07 GMT (envelope-from mav@svn.freebsd.org) Message-Id: <201210111521.q9BFL7v4043349@svn.freebsd.org> From: Alexander Motin Date: Thu, 11 Oct 2012 15:21:07 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r241444 - head/sys/cam X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 11 Oct 2012 15:21:08 -0000 Author: mav Date: Thu Oct 11 15:21:07 2012 New Revision: 241444 URL: http://svn.freebsd.org/changeset/base/241444 Log: Increase device CCB queue array size by CAM_RL_VALUES - 1 (4) elements. It is required to store extra recovery requests in case of bus resets. On ATA/SATA this fixes assertion panics on HEAD with INVARIANTS enabled or possible memory corruptions otherwise if timeout/reset happens when device CCB queue is already full. Reported by: gibbs@ MFC after: 1 week Modified: head/sys/cam/cam_queue.c Modified: head/sys/cam/cam_queue.c ============================================================================== --- head/sys/cam/cam_queue.c Thu Oct 11 13:25:09 2012 (r241443) +++ head/sys/cam/cam_queue.c Thu Oct 11 15:21:07 2012 (r241444) @@ -314,7 +314,8 @@ cam_ccbq_resize(struct cam_ccbq *ccbq, i * same size once the outstanding entries have been processed. */ if (space_left < 0 - || camq_resize(&ccbq->queue, new_size) == CAM_REQ_CMP) { + || camq_resize(&ccbq->queue, new_size + (CAM_RL_VALUES - 1)) == + CAM_REQ_CMP) { ccbq->devq_openings += delta; ccbq->dev_openings += delta; return (CAM_REQ_CMP); @@ -327,7 +328,7 @@ int cam_ccbq_init(struct cam_ccbq *ccbq, int openings) { bzero(ccbq, sizeof(*ccbq)); - if (camq_init(&ccbq->queue, openings) != 0) { + if (camq_init(&ccbq->queue, openings + (CAM_RL_VALUES - 1)) != 0) { return (1); } ccbq->devq_openings = openings; From owner-svn-src-head@FreeBSD.ORG Thu Oct 11 15:24:00 2012 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id 66F7E629 for ; Thu, 11 Oct 2012 15:24:00 +0000 (UTC) (envelope-from peter@wemm.org) Received: from mail-la0-f54.google.com (mail-la0-f54.google.com [209.85.215.54]) by mx1.freebsd.org (Postfix) with ESMTP id CB5A48FC0A for ; Thu, 11 Oct 2012 15:23:59 +0000 (UTC) Received: by mail-la0-f54.google.com with SMTP id e12so1612264lag.13 for ; Thu, 11 Oct 2012 08:23:58 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=wemm.org; s=google; h=mime-version:in-reply-to:references:date:message-id:subject:from:to :cc:content-type; bh=4vd6n4BcpNlit11/tw6TciCNWvr7db8TVLObNR4D4k8=; b=marf6EFlhrzb/QqpGNhgbFCWa3uCa7nw44n+yvIumBb//P7R9j2HsjDvQQo0MYFSJS SmPYoTpz2vI5+DTv4oW0F1zNHqckAtFJggoKc6jl35I8NoGxW65OgACOGkIXrzz+z+cM RNUj7XT8BEVIV520NXk985uHaG5eKtbllfdcI= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20120113; h=mime-version:in-reply-to:references:date:message-id:subject:from:to :cc:content-type:x-gm-message-state; bh=4vd6n4BcpNlit11/tw6TciCNWvr7db8TVLObNR4D4k8=; b=nH2uxRo0FCmYaKunLi2oNWtJcY4PAFqf7ehWEGmdP22Xs3wRIpKLInBkXY8Rdfq81I qZUu5CPHzbnOOOgjJq1rvuVaSwbKnqoz9dUwJ9RLVgIKxYKI5glDdPp0yz1Oyi3I7Awd FGsTgFqsYy2jgX1VON48R/Xz3wzDXcWkPI3nrXsCNZ+kZ+c0uC/+Y9ISqlELLy7Oyc9d vnNpADWET7IlFIO4KyP2DbYNhlShEmdqZVTGlOv50B5csTXsx/ywipI37rYgzQ3D1Ipk h73rNnSYh5xKzh48maP4MjiSkRvk/WqS4rvQBf9Sg/BjJk3V1RXM9fu6K0+YwZf38g3e mM5g== MIME-Version: 1.0 Received: by 10.152.47.112 with SMTP id c16mr1086244lan.50.1349969037959; Thu, 11 Oct 2012 08:23:57 -0700 (PDT) Received: by 10.112.87.106 with HTTP; Thu, 11 Oct 2012 08:23:57 -0700 (PDT) In-Reply-To: <5076C650.4040508@freebsd.org> References: <201210091425.q99EPFS6020787@svn.freebsd.org> <507451DE.9060909@freebsd.org> <977E1107-46D4-476F-A04D-AEFD87D1DE53@FreeBSD.org> <20121011114425.GA1562@garage.freebsd.pl> <5076C650.4040508@freebsd.org> Date: Thu, 11 Oct 2012 08:23:57 -0700 Message-ID: Subject: Re: svn commit: r241373 - head/lib/libc/stdlib From: Peter Wemm To: Andrey Chernov Content-Type: text/plain; charset=ISO-8859-1 X-Gm-Message-State: ALoCoQkAGfM/RBNB2An4BWC/dmPK/rFmGZN4hJDw5dW3lK17SJuiVnqjE+rxm4beNmFIl62K7qxy Cc: mdf@freebsd.org, src-committers@freebsd.org, Pawel Jakub Dawidek , svn-src-all@freebsd.org, David Chisnall , svn-src-head@freebsd.org, Eitan Adler X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 11 Oct 2012 15:24:00 -0000 On Thu, Oct 11, 2012 at 6:14 AM, Andrey Chernov wrote: > On 11.10.2012 15:44, Pawel Jakub Dawidek wrote: >> On Tue, Oct 09, 2012 at 01:51:05PM -0400, Eitan Adler wrote: >>> On 9 October 2012 13:27, wrote: >>>> The original behavior can be recovered by using inline assembly to >>>> fetch the value from a register into a local C variable; this would at >>>> least not rely on undefined behavior. But I agree it's of dubious >>>> value anyways. >>> >>> I proposed this (with a patch). We want to move to not using >>> /dev/random and instead make a kernel system call directly. The patch >>> for this is not finished yet though. >> >> You should do something similar to: >> >> http://people.freebsd.org/~pjd/patches/libc_arc4random.c.patch >> > > Already half of year I told people of our serious problem with kernel's > arc4 (used here in sysctl) - it have very weak initialization at the > kernel start (only from processor clock) which is auto-fixed because of > its periodic reseeds, but only at the next reseed which happens late. I > post two patches (both working, one using atomic, another don't use it) > which reseeds kernel's arc4 as fast as we have enough real entropy. > NetBSD don't have this problem because of their different kernel's arc4 > implementation. How "late" is late? Since this was a userland patch, has it been reseeded by then? Regardless, this is getting way off topic from using an xor of an uninitialized userland variable and what the compiler optimizer might do with it. Of course that's assuming it is even a memory based stack. The sparc or ia64 register stack makes that xor even more dubious. -- Peter Wemm - peter@wemm.org; peter@FreeBSD.org; peter@yahoo-inc.com; KI6FJV "All of this is for nothing if we don't go to the stars" - JMS/B5 "If Java had true garbage collection, most programs would delete themselves upon execution." -- Robert Sewell From owner-svn-src-head@FreeBSD.ORG Thu Oct 11 15:40:59 2012 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id 4ADF77B for ; Thu, 11 Oct 2012 15:40:59 +0000 (UTC) (envelope-from ache@vniz.net) Received: from mail-lb0-f182.google.com (mail-lb0-f182.google.com [209.85.217.182]) by mx1.freebsd.org (Postfix) with ESMTP id 5A5458FC1B for ; Thu, 11 Oct 2012 15:40:58 +0000 (UTC) Received: by mail-lb0-f182.google.com with SMTP id b5so1705327lbd.13 for ; Thu, 11 Oct 2012 08:40:57 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20120113; h=sender:message-id:disposition-notification-to:date:from:user-agent :mime-version:to:cc:subject:references:in-reply-to:openpgp :content-type:content-transfer-encoding:x-gm-message-state; bh=tnLnh6RanL8ZxeLsyVgc9SDcpjVLwwTzLNlYeF+8Eio=; b=G0V05Xlm6nzp7+px4lg4Ren3HuMhJbveGYhWMcwa1E7oCA0yqyN/PM0KzVObF2LFhY 6SkAyunm2Q80ZvD3ofuk1y+YwXLYX+sR/hPvq3X+aoFskU1GSzfilWRILdH4iNs2N+T8 rvMBDeYYuZ+MnfULzhq+/S+WZCPrYr10jchw5CHRBskEplHI33h23cphuPKwBWR3ZlPO RE3ln2AiSlrvHxIPTLDhIdBqumzNJG4g5X8A8bIM0oqAyfEaZCwmW4hP/DVJf66RRH0a hhKMUo/M3WOk4PM2LU/ZGW2ciPLa1TCJITDd5CsT8gAlfh4Zgw9vdbC3YDaVDR5ExBF5 OZXg== Received: by 10.112.99.37 with SMTP id en5mr642211lbb.1.1349970057271; Thu, 11 Oct 2012 08:40:57 -0700 (PDT) Received: from [192.168.1.2] ([89.169.140.97]) by mx.google.com with ESMTPS id y10sm1529249lbg.4.2012.10.11.08.40.56 (version=SSLv3 cipher=OTHER); Thu, 11 Oct 2012 08:40:56 -0700 (PDT) Sender: "Chernov, Andrey" Message-ID: <5076E880.9010502@freebsd.org> Date: Thu, 11 Oct 2012 19:40:48 +0400 From: Andrey Chernov User-Agent: Mozilla/5.0 (Windows NT 6.1; WOW64; rv:15.0) Gecko/20120907 Thunderbird/15.0.1 MIME-Version: 1.0 To: Peter Wemm Subject: Re: svn commit: r241373 - head/lib/libc/stdlib References: <201210091425.q99EPFS6020787@svn.freebsd.org> <507451DE.9060909@freebsd.org> <977E1107-46D4-476F-A04D-AEFD87D1DE53@FreeBSD.org> <20121011114425.GA1562@garage.freebsd.pl> <5076C650.4040508@freebsd.org> In-Reply-To: OpenPGP: id=964474DD Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit X-Gm-Message-State: ALoCoQmDSqyeoDmKSIV3n7SoOnN7Nm6l/hTDEMJDD12+8vpEocymhUIEB4dt/P+z05T3+kFwxPyI Cc: mdf@freebsd.org, src-committers@freebsd.org, Pawel Jakub Dawidek , svn-src-all@freebsd.org, David Chisnall , svn-src-head@freebsd.org, Eitan Adler X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 11 Oct 2012 15:40:59 -0000 On 11.10.2012 19:23, Peter Wemm wrote: > On Thu, Oct 11, 2012 at 6:14 AM, Andrey Chernov wrote: >> On 11.10.2012 15:44, Pawel Jakub Dawidek wrote: >>> On Tue, Oct 09, 2012 at 01:51:05PM -0400, Eitan Adler wrote: >>>> On 9 October 2012 13:27, wrote: >>>>> The original behavior can be recovered by using inline assembly to >>>>> fetch the value from a register into a local C variable; this would at >>>>> least not rely on undefined behavior. But I agree it's of dubious >>>>> value anyways. >>>> >>>> I proposed this (with a patch). We want to move to not using >>>> /dev/random and instead make a kernel system call directly. The patch >>>> for this is not finished yet though. >>> >>> You should do something similar to: >>> >>> http://people.freebsd.org/~pjd/patches/libc_arc4random.c.patch >>> >> >> Already half of year I told people of our serious problem with kernel's >> arc4 (used here in sysctl) - it have very weak initialization at the >> kernel start (only from processor clock) which is auto-fixed because of >> its periodic reseeds, but only at the next reseed which happens late. I >> post two patches (both working, one using atomic, another don't use it) >> which reseeds kernel's arc4 as fast as we have enough real entropy. >> NetBSD don't have this problem because of their different kernel's arc4 >> implementation. > > How "late" is late? Since this was a userland patch, has it been > reseeded by then? See /sys/libkern/arc4random.c #define ARC4_RESEED_SECONDS 300 i.e. first 5 minutes at least it is very bad seeded and vulnerable. But we don't have guarantee to have enough entropy even after first 5 minutes, it very depends of entropy sources turned on the machine configuration at whole (diskless, etc). Moreover, arc4random(3) code have its own reseed happens after arc4_count = 1600000; (divided by 4) iterations which increases bad seeded bytes initially taken from kernel's arc4 until whole count will be exhausted which is _very_ long time (consider that typical application issue only several rare arc4random(3) calls and exits, left arc4_count not decreased globally at all). > Regardless, this is getting way off topic from using an xor of an > uninitialized userland variable and what the compiler optimizer might > do with it. > > Of course that's assuming it is even a memory based stack. The sparc > or ia64 register stack makes that xor even more dubious. I pass this subj to the people who knows clang compiler better to say for sure is it right to generate LLVM intermediate call void @srand(i32 undef) or not. Xoring the stack (or register) there is not essential step. From owner-svn-src-head@FreeBSD.ORG Thu Oct 11 16:15:19 2012 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id 9BA105F3; Thu, 11 Oct 2012 16:15:19 +0000 (UTC) (envelope-from melifaro@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 560A58FC08; Thu, 11 Oct 2012 16:15:19 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id q9BGFJTC049965; Thu, 11 Oct 2012 16:15:19 GMT (envelope-from melifaro@svn.freebsd.org) Received: (from melifaro@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q9BGFJ58049961; Thu, 11 Oct 2012 16:15:19 GMT (envelope-from melifaro@svn.freebsd.org) Message-Id: <201210111615.q9BGFJ58049961@svn.freebsd.org> From: "Alexander V. Chernikov" Date: Thu, 11 Oct 2012 16:15:19 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r241446 - head/sys/netgraph/netflow X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 11 Oct 2012 16:15:19 -0000 Author: melifaro Date: Thu Oct 11 16:15:18 2012 New Revision: 241446 URL: http://svn.freebsd.org/changeset/base/241446 Log: Add NG_NETFLOW_V9INFO_TYPE command to be able to request netflowv9-specific data. Submitted by: Dmitry Luhtionov MFC after: 2 weeks Modified: head/sys/netgraph/netflow/netflow_v9.c head/sys/netgraph/netflow/ng_netflow.c head/sys/netgraph/netflow/ng_netflow.h Modified: head/sys/netgraph/netflow/netflow_v9.c ============================================================================== --- head/sys/netgraph/netflow/netflow_v9.c Thu Oct 11 15:49:42 2012 (r241445) +++ head/sys/netgraph/netflow/netflow_v9.c Thu Oct 11 16:15:18 2012 (r241446) @@ -480,3 +480,14 @@ ng_netflow_v9_cache_flush(priv_p priv) for (i = 0; i < priv->flowsets_count; i++) free(priv->v9_flowsets[i], M_NETFLOW_GENERAL); } + +/* Get a snapshot of NetFlow v9 settings */ +void +ng_netflow_copyv9info(priv_p priv, struct ng_netflow_v9info *i) +{ + + i->templ_time = priv->templ_time; + i->templ_packets = priv->templ_packets; + i->mtu = priv->mtu; +} + Modified: head/sys/netgraph/netflow/ng_netflow.c ============================================================================== --- head/sys/netgraph/netflow/ng_netflow.c Thu Oct 11 15:49:42 2012 (r241445) +++ head/sys/netgraph/netflow/ng_netflow.c Thu Oct 11 16:15:18 2012 (r241446) @@ -138,6 +138,14 @@ static const struct ng_parse_type ng_net &ng_netflow_setmtu_type_fields }; +/* Parse type for struct ng_netflow_v9info */ +static const struct ng_parse_struct_field ng_netflow_v9info_type_fields[] + = NG_NETFLOW_V9INFO_TYPE; +static const struct ng_parse_type ng_netflow_v9info_type = { + &ng_parse_struct_type, + &ng_netflow_v9info_type_fields +}; + /* List of commands and how to convert arguments to/from ASCII */ static const struct ng_cmdlist ng_netflow_cmds[] = { { @@ -196,6 +204,13 @@ static const struct ng_cmdlist ng_netflo &ng_netflow_setmtu_type, NULL }, + { + NGM_NETFLOW_COOKIE, + NGM_NETFLOW_V9INFO, + "v9info", + NULL, + &ng_netflow_v9info_type + }, { 0 } }; @@ -526,6 +541,17 @@ ng_netflow_rcvmsg (node_p node, item_p i break; } + case NGM_NETFLOW_V9INFO: + { + struct ng_netflow_v9info *i; + + NG_MKRESPONSE(resp, msg, sizeof(struct ng_netflow_v9info), + M_NOWAIT); + i = (struct ng_netflow_v9info *)resp->data; + ng_netflow_copyv9info(priv, i); + + break; + } default: ERROUT(EINVAL); /* unknown command */ break; Modified: head/sys/netgraph/netflow/ng_netflow.h ============================================================================== --- head/sys/netgraph/netflow/ng_netflow.h Thu Oct 11 15:49:42 2012 (r241445) +++ head/sys/netgraph/netflow/ng_netflow.h Thu Oct 11 16:15:18 2012 (r241446) @@ -34,6 +34,7 @@ #define NG_NETFLOW_NODE_TYPE "netflow" #define NGM_NETFLOW_COOKIE 1309868867 +#define NGM_NETFLOW_V9_COOKIE 1349865386 #define NG_NETFLOW_MAXIFACES USHRT_MAX @@ -58,6 +59,7 @@ enum { NGM_NETFLOW_SETCONFIG = 7, /* set flow generation options */ NGM_NETFLOW_SETTEMPLATE = 8, /* set v9 flow template periodic */ NGM_NETFLOW_SETMTU = 9, /* set outgoing interface MTU */ + NGM_NETFLOW_V9INFO = 10|NGM_READONLY|NGM_HASREPLY, /* get v9 info */ }; /* This structure is returned by the NGM_NETFLOW_INFO message */ @@ -147,6 +149,13 @@ struct ngnf_show_header { uint32_t nentries; /* number of records in response */ }; +/* This structure is used in NGM_NETFLOW_V9INFO message */ +struct ng_netflow_v9info { + uint16_t templ_packets; /* v9 template packets */ + uint16_t templ_time; /* v9 template time */ + uint16_t mtu; /* v9 MTU */ +}; + /* XXXGL * Somewhere flow_rec6 is casted to flow_rec, and flow6_entry_data is * casted to flow_entry_data. After casting, fle->r.fib is accessed. @@ -347,6 +356,14 @@ struct flow6_entry { { NULL } \ } +/* Parse the v9info structure */ +#define NG_NETFLOW_V9INFO_TYPE { \ + { "v9 template packets", &ng_parse_uint16_type },\ + { "v9 template time", &ng_parse_uint16_type },\ + { "v9 MTU", &ng_parse_uint16_type },\ + { NULL } \ +} + /* Private hook data */ struct ng_netflow_iface { hook_p hook; /* NULL when disconnected */ @@ -422,6 +439,7 @@ struct netflow { fib_export_p *fib_data; /* array of pointers to per-fib data */ uint16_t maxfibs; /* number of allocated fibs */ + /* Netflow v9 configuration options */ /* * RFC 3954 clause 7.3 * "Both options MUST be configurable by the user on the Exporter." @@ -472,6 +490,7 @@ void ng_netflow_cache_init(priv_p); void ng_netflow_cache_flush(priv_p); int ng_netflow_fib_init(priv_p priv, int fib); void ng_netflow_copyinfo(priv_p, struct ng_netflow_info *); +void ng_netflow_copyv9info(priv_p, struct ng_netflow_v9info *); timeout_t ng_netflow_expire; int ng_netflow_flow_add(priv_p, fib_export_p, struct ip *, caddr_t, uint8_t, uint8_t, unsigned int); int ng_netflow_flow6_add(priv_p, fib_export_p, struct ip6_hdr *, caddr_t , uint8_t, uint8_t, unsigned int); From owner-svn-src-head@FreeBSD.ORG Thu Oct 11 18:41:33 2012 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id 1BAD187C; Thu, 11 Oct 2012 18:41:33 +0000 (UTC) (envelope-from emaste@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 04EFE8FC08; Thu, 11 Oct 2012 18:41:33 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id q9BIfWD6067499; Thu, 11 Oct 2012 18:41:32 GMT (envelope-from emaste@svn.freebsd.org) Received: (from emaste@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q9BIfWdk067497; Thu, 11 Oct 2012 18:41:32 GMT (envelope-from emaste@svn.freebsd.org) Message-Id: <201210111841.q9BIfWdk067497@svn.freebsd.org> From: Ed Maste Date: Thu, 11 Oct 2012 18:41:32 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r241451 - head/release X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 11 Oct 2012 18:41:33 -0000 Author: emaste Date: Thu Oct 11 18:41:32 2012 New Revision: 241451 URL: http://svn.freebsd.org/changeset/base/241451 Log: Exclude potential circular symlink when creating src tarball. Normal release builds are not affected by this but it can happen if using these release bits against a work tree. Sponsored by: ADARA Networks Modified: head/release/Makefile Modified: head/release/Makefile ============================================================================== --- head/release/Makefile Thu Oct 11 18:11:38 2012 (r241450) +++ head/release/Makefile Thu Oct 11 18:41:32 2012 (r241451) @@ -84,7 +84,7 @@ src.txz: mkdir -p ${DISTDIR}/usr ln -fs ${WORLDDIR} ${DISTDIR}/usr/src cd ${DISTDIR} && tar cLvJf ${.OBJDIR}/src.txz --exclude .svn \ - --exclude CVS usr/src + --exclude CVS --exclude @ usr/src ports.txz: mkdir -p ${DISTDIR}/usr From owner-svn-src-head@FreeBSD.ORG Thu Oct 11 19:50:47 2012 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id 6CE89E65 for ; Thu, 11 Oct 2012 19:50:47 +0000 (UTC) (envelope-from lists@eitanadler.com) Received: from mail-pa0-f54.google.com (mail-pa0-f54.google.com [209.85.220.54]) by mx1.freebsd.org (Postfix) with ESMTP id 269A98FC19 for ; Thu, 11 Oct 2012 19:50:46 +0000 (UTC) Received: by mail-pa0-f54.google.com with SMTP id bi1so2287784pad.13 for ; Thu, 11 Oct 2012 12:50:46 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=eitanadler.com; s=0xdeadbeef; h=mime-version:sender:in-reply-to:references:from:date :x-google-sender-auth:message-id:subject:to:cc:content-type; bh=CQukY16j5Omfr5zDK8/M8gSqNx2SiZfu9Ohz1cMAL0U=; b=HcsHCF58BbHpwyMVAzimflwCy2gd3zj4gBBkwLf1CB2MsaJ+eRIhos2rmiRonm0AJj 135huQCBTQre+v/N1B3Cp6FARMGg3wyozWBM5oRluxtXvUuX+auQLGvmqD5z3g+5kQj0 S8jmzQOQ+oWxZTd9gLXy0E2j+buO+QlSMDnZ0= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20120113; h=mime-version:sender:in-reply-to:references:from:date :x-google-sender-auth:message-id:subject:to:cc:content-type :x-gm-message-state; bh=CQukY16j5Omfr5zDK8/M8gSqNx2SiZfu9Ohz1cMAL0U=; b=fqQpe4zBJXw0CyapHBBRN8sOup8G65Sqin7h5VJ0YTZsLR88MyD5NGrWvFlHFCxMMA D2i20/s0WuP9apB36dMvQNhTIQ2mMSMTsGjX/sfmOIUo2QvA726vis/Z1WDmK+FYpO9u YJxk4XOOc2MqEZ2xB+WfYY/087Uyc7Q+D52j+e4IxfTnEQBKbDMwj9ZxUR1sIccmVW3n MeLgQkzCmXw1i5Bj0Vn4EqNvfGhZ6PJrdeLwBaobv/3q+7awdJgBd8y6zh6v/leVWF6N f9UaWTs6oT4+oEqfl/TqbRbC8wwDXcXh1coA570Gcp4YXsXUvRd97zECztyAp+zwX6sb HPyA== Received: by 10.66.90.65 with SMTP id bu1mr5070060pab.31.1349985046592; Thu, 11 Oct 2012 12:50:46 -0700 (PDT) MIME-Version: 1.0 Sender: lists@eitanadler.com Received: by 10.66.161.163 with HTTP; Thu, 11 Oct 2012 12:50:15 -0700 (PDT) In-Reply-To: <20121011114425.GA1562@garage.freebsd.pl> References: <201210091425.q99EPFS6020787@svn.freebsd.org> <507451DE.9060909@freebsd.org> <977E1107-46D4-476F-A04D-AEFD87D1DE53@FreeBSD.org> <20121011114425.GA1562@garage.freebsd.pl> From: Eitan Adler Date: Thu, 11 Oct 2012 15:50:15 -0400 X-Google-Sender-Auth: XsG1IbJ7nqzAkBU3iTqIeOVqixQ Message-ID: Subject: Re: svn commit: r241373 - head/lib/libc/stdlib To: Pawel Jakub Dawidek Content-Type: text/plain; charset=UTF-8 X-Gm-Message-State: ALoCoQkLpAoiB+I3sp2WOxsHHhdraa6g65YQnA1aVv3mOv52auUhHIM9K08FZKnfvVdiolwsL3si Cc: mdf@freebsd.org, src-committers@freebsd.org, Andrey Chernov , svn-src-all@freebsd.org, David Chisnall , svn-src-head@freebsd.org X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 11 Oct 2012 19:50:47 -0000 On 11 October 2012 07:44, Pawel Jakub Dawidek wrote: > On Tue, Oct 09, 2012 at 01:51:05PM -0400, Eitan Adler wrote: >> On 9 October 2012 13:27, wrote: >> > The original behavior can be recovered by using inline assembly to >> > fetch the value from a register into a local C variable; this would at >> > least not rely on undefined behavior. But I agree it's of dubious >> > value anyways. >> >> I proposed this (with a patch). We want to move to not using >> /dev/random and instead make a kernel system call directly. The patch >> for this is not finished yet though. > > You should do something similar to: > > http://people.freebsd.org/~pjd/patches/libc_arc4random.c.patch Yes, this is exactly the proposed "correct" fix. I haven't had time to properly write and test such a patch though, so I opted for this one in the meantime. FWIW, the man page *used* to contain the text The srandomdev() routine initializes a state array using the random(4) random number device which returns good random numbers, suitable for cryptographic use. which made this problem 'worse' as it mislead people into believing rand/random could be used for crpyto. des@ fixed this problem already -- Eitan Adler Source & Ports committer X11, Bugbusting teams From owner-svn-src-head@FreeBSD.ORG Thu Oct 11 19:57:12 2012 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id 9D986256; Thu, 11 Oct 2012 19:57:12 +0000 (UTC) (envelope-from mav@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 85E3A8FC08; Thu, 11 Oct 2012 19:57:12 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id q9BJvCqc077012; Thu, 11 Oct 2012 19:57:12 GMT (envelope-from mav@svn.freebsd.org) Received: (from mav@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q9BJvCjC077008; Thu, 11 Oct 2012 19:57:12 GMT (envelope-from mav@svn.freebsd.org) Message-Id: <201210111957.q9BJvCjC077008@svn.freebsd.org> From: Alexander Motin Date: Thu, 11 Oct 2012 19:57:12 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r241455 - in head/sys/cam: . ata scsi X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 11 Oct 2012 19:57:12 -0000 Author: mav Date: Thu Oct 11 19:57:11 2012 New Revision: 241455 URL: http://svn.freebsd.org/changeset/base/241455 Log: Don't duplicate path/ccb allocation code, use existing functions. Modified: head/sys/cam/ata/ata_xpt.c head/sys/cam/cam_xpt.c head/sys/cam/scsi/scsi_xpt.c Modified: head/sys/cam/ata/ata_xpt.c ============================================================================== --- head/sys/cam/ata/ata_xpt.c Thu Oct 11 19:39:54 2012 (r241454) +++ head/sys/cam/ata/ata_xpt.c Thu Oct 11 19:57:11 2012 (r241455) @@ -1462,29 +1462,20 @@ ata_scan_lun(struct cam_periph *periph, } if (request_ccb == NULL) { - request_ccb = malloc(sizeof(union ccb), M_CAMXPT, M_NOWAIT); + request_ccb = xpt_alloc_ccb_nowait(); if (request_ccb == NULL) { xpt_print(path, "xpt_scan_lun: can't allocate CCB, " "can't continue\n"); return; } - new_path = malloc(sizeof(*new_path), M_CAMXPT, M_NOWAIT); - if (new_path == NULL) { - xpt_print(path, "xpt_scan_lun: can't allocate path, " - "can't continue\n"); - free(request_ccb, M_CAMXPT); - return; - } - status = xpt_compile_path(new_path, xpt_periph, + status = xpt_create_path(&new_path, xpt_periph, path->bus->path_id, path->target->target_id, path->device->lun_id); - if (status != CAM_REQ_CMP) { - xpt_print(path, "xpt_scan_lun: can't compile path, " + xpt_print(path, "xpt_scan_lun: can't create path, " "can't continue\n"); - free(request_ccb, M_CAMXPT); - free(new_path, M_CAMXPT); + xpt_free_ccb(request_ccb); return; } xpt_setup_ccb(&request_ccb->ccb_h, new_path, CAM_PRIORITY_XPT); @@ -1524,9 +1515,9 @@ ata_scan_lun(struct cam_periph *periph, static void xptscandone(struct cam_periph *periph, union ccb *done_ccb) { - xpt_release_path(done_ccb->ccb_h.path); - free(done_ccb->ccb_h.path, M_CAMXPT); - free(done_ccb, M_CAMXPT); + + xpt_free_path(done_ccb->ccb_h.path); + xpt_free_ccb(done_ccb); } static struct cam_ed * Modified: head/sys/cam/cam_xpt.c ============================================================================== --- head/sys/cam/cam_xpt.c Thu Oct 11 19:39:54 2012 (r241454) +++ head/sys/cam/cam_xpt.c Thu Oct 11 19:57:11 2012 (r241455) @@ -3857,12 +3857,6 @@ xpt_bus_register(struct cam_sim *sim, de /* Couldn't satisfy request */ return (CAM_RESRC_UNAVAIL); } - path = (struct cam_path *)malloc(sizeof(*path), M_CAMXPT, M_NOWAIT); - if (path == NULL) { - free(new_bus, M_CAMXPT); - return (CAM_RESRC_UNAVAIL); - } - if (strcmp(sim->sim_name, "xpt") != 0) { sim->path_id = xptpathid(sim->sim_name, sim->unit_number, sim->bus_id); @@ -3896,7 +3890,7 @@ xpt_bus_register(struct cam_sim *sim, de */ new_bus->xport = &xport_default; - status = xpt_compile_path(path, /*periph*/NULL, sim->path_id, + status = xpt_create_path(&path, /*periph*/NULL, sim->path_id, CAM_TARGET_WILDCARD, CAM_LUN_WILDCARD); if (status != CAM_REQ_CMP) { xpt_release_bus(new_bus); Modified: head/sys/cam/scsi/scsi_xpt.c ============================================================================== --- head/sys/cam/scsi/scsi_xpt.c Thu Oct 11 19:39:54 2012 (r241454) +++ head/sys/cam/scsi/scsi_xpt.c Thu Oct 11 19:57:11 2012 (r241455) @@ -2243,29 +2243,20 @@ scsi_scan_lun(struct cam_periph *periph, } if (request_ccb == NULL) { - request_ccb = malloc(sizeof(union ccb), M_CAMXPT, M_NOWAIT); + request_ccb = xpt_alloc_ccb_nowait(); if (request_ccb == NULL) { xpt_print(path, "scsi_scan_lun: can't allocate CCB, " "can't continue\n"); return; } - new_path = malloc(sizeof(*new_path), M_CAMXPT, M_NOWAIT); - if (new_path == NULL) { - xpt_print(path, "scsi_scan_lun: can't allocate path, " - "can't continue\n"); - free(request_ccb, M_CAMXPT); - return; - } - status = xpt_compile_path(new_path, xpt_periph, + status = xpt_create_path(&new_path, xpt_periph, path->bus->path_id, path->target->target_id, path->device->lun_id); - if (status != CAM_REQ_CMP) { - xpt_print(path, "scsi_scan_lun: can't compile path, " + xpt_print(path, "scsi_scan_lun: can't create path, " "can't continue\n"); - free(request_ccb, M_CAMXPT); - free(new_path, M_CAMXPT); + xpt_free_ccb(request_ccb); return; } xpt_setup_ccb(&request_ccb->ccb_h, new_path, CAM_PRIORITY_XPT); @@ -2304,9 +2295,9 @@ scsi_scan_lun(struct cam_periph *periph, static void xptscandone(struct cam_periph *periph, union ccb *done_ccb) { - xpt_release_path(done_ccb->ccb_h.path); - free(done_ccb->ccb_h.path, M_CAMXPT); - free(done_ccb, M_CAMXPT); + + xpt_free_path(done_ccb->ccb_h.path); + xpt_free_ccb(done_ccb); } static struct cam_ed * From owner-svn-src-head@FreeBSD.ORG Thu Oct 11 20:14:12 2012 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id 1A2B573C; Thu, 11 Oct 2012 20:14:12 +0000 (UTC) (envelope-from mav@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 028378FC0A; Thu, 11 Oct 2012 20:14:12 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id q9BKEBfa079262; Thu, 11 Oct 2012 20:14:11 GMT (envelope-from mav@svn.freebsd.org) Received: (from mav@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q9BKEBZi079259; Thu, 11 Oct 2012 20:14:11 GMT (envelope-from mav@svn.freebsd.org) Message-Id: <201210112014.q9BKEBZi079259@svn.freebsd.org> From: Alexander Motin Date: Thu, 11 Oct 2012 20:14:11 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r241456 - head/sys/cam X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 11 Oct 2012 20:14:12 -0000 Author: mav Date: Thu Oct 11 20:14:11 2012 New Revision: 241456 URL: http://svn.freebsd.org/changeset/base/241456 Log: Use separate malloc buckets for CAM devices, CCBs and paths. This will make it easier to track down the source of any use after free problems. Submitted by: ken@ Modified: head/sys/cam/cam_xpt.c Modified: head/sys/cam/cam_xpt.c ============================================================================== --- head/sys/cam/cam_xpt.c Thu Oct 11 19:57:11 2012 (r241455) +++ head/sys/cam/cam_xpt.c Thu Oct 11 20:14:11 2012 (r241456) @@ -78,6 +78,9 @@ __FBSDID("$FreeBSD$"); /* Datastructures internal to the xpt layer */ MALLOC_DEFINE(M_CAMXPT, "CAM XPT", "CAM XPT buffers"); +MALLOC_DEFINE(M_CAMDEV, "CAM DEV", "CAM devices"); +MALLOC_DEFINE(M_CAMCCB, "CAM CCB", "CAM CCBs"); +MALLOC_DEFINE(M_CAMPATH, "CAM path", "CAM paths"); /* Object for defering XPT actions to a taskqueue */ struct xpt_task { @@ -3397,7 +3400,7 @@ xpt_create_path(struct cam_path **new_pa struct cam_path *path; cam_status status; - path = (struct cam_path *)malloc(sizeof(*path), M_CAMXPT, M_NOWAIT); + path = (struct cam_path *)malloc(sizeof(*path), M_CAMPATH, M_NOWAIT); if (path == NULL) { status = CAM_RESRC_UNAVAIL; @@ -3405,7 +3408,7 @@ xpt_create_path(struct cam_path **new_pa } status = xpt_compile_path(path, perph, path_id, target_id, lun_id); if (status != CAM_REQ_CMP) { - free(path, M_CAMXPT); + free(path, M_CAMPATH); path = NULL; } *new_path_ptr = path; @@ -3422,7 +3425,7 @@ xpt_create_path_unlocked(struct cam_path cam_status status; int need_unlock = 0; - path = (struct cam_path *)malloc(sizeof(*path), M_CAMXPT, M_WAITOK); + path = (struct cam_path *)malloc(sizeof(*path), M_CAMPATH, M_WAITOK); if (path_id != CAM_BUS_WILDCARD) { bus = xpt_find_bus(path_id); @@ -3437,7 +3440,7 @@ xpt_create_path_unlocked(struct cam_path xpt_release_bus(bus); } if (status != CAM_REQ_CMP) { - free(path, M_CAMXPT); + free(path, M_CAMPATH); path = NULL; } *new_path_ptr = path; @@ -3540,7 +3543,7 @@ xpt_free_path(struct cam_path *path) CAM_DEBUG(path, CAM_DEBUG_TRACE, ("xpt_free_path\n")); xpt_release_path(path); - free(path, M_CAMXPT); + free(path, M_CAMPATH); } void @@ -4377,7 +4380,7 @@ xpt_alloc_ccb() { union ccb *new_ccb; - new_ccb = malloc(sizeof(*new_ccb), M_CAMXPT, M_ZERO|M_WAITOK); + new_ccb = malloc(sizeof(*new_ccb), M_CAMCCB, M_ZERO|M_WAITOK); return (new_ccb); } @@ -4386,14 +4389,14 @@ xpt_alloc_ccb_nowait() { union ccb *new_ccb; - new_ccb = malloc(sizeof(*new_ccb), M_CAMXPT, M_ZERO|M_NOWAIT); + new_ccb = malloc(sizeof(*new_ccb), M_CAMCCB, M_ZERO|M_NOWAIT); return (new_ccb); } void xpt_free_ccb(union ccb *free_ccb) { - free(free_ccb, M_CAMXPT); + free(free_ccb, M_CAMCCB); } @@ -4545,7 +4548,7 @@ xpt_alloc_device(struct cam_eb *bus, str device = NULL; } else { device = (struct cam_ed *)malloc(sizeof(*device), - M_CAMXPT, M_NOWAIT|M_ZERO); + M_CAMDEV, M_NOWAIT|M_ZERO); } if (device != NULL) { @@ -4558,13 +4561,13 @@ xpt_alloc_device(struct cam_eb *bus, str device->sim = bus->sim; /* Initialize our queues */ if (camq_init(&device->drvq, 0) != 0) { - free(device, M_CAMXPT); + free(device, M_CAMDEV); return (NULL); } if (cam_ccbq_init(&device->ccbq, bus->sim->max_dev_openings) != 0) { camq_fini(&device->drvq); - free(device, M_CAMXPT); + free(device, M_CAMDEV); return (NULL); } SLIST_INIT(&device->asyncs); @@ -4628,7 +4631,7 @@ xpt_release_device(struct cam_ed *device free(device->serial_num, M_CAMXPT); xpt_release_target(device->target); - free(device, M_CAMXPT); + free(device, M_CAMDEV); } else device->refcount--; } From owner-svn-src-head@FreeBSD.ORG Thu Oct 11 20:46:05 2012 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id 96EF6D6A; Thu, 11 Oct 2012 20:46:05 +0000 (UTC) (envelope-from peter@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 803838FC16; Thu, 11 Oct 2012 20:46:05 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id q9BKk5F2083254; Thu, 11 Oct 2012 20:46:05 GMT (envelope-from peter@svn.freebsd.org) Received: (from peter@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q9BKk5H7083252; Thu, 11 Oct 2012 20:46:05 GMT (envelope-from peter@svn.freebsd.org) Message-Id: <201210112046.q9BKk5H7083252@svn.freebsd.org> From: Peter Wemm Date: Thu, 11 Oct 2012 20:46:05 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r241457 - head/etc/sendmail X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 11 Oct 2012 20:46:05 -0000 Author: peter Date: Thu Oct 11 20:46:04 2012 New Revision: 241457 URL: http://svn.freebsd.org/changeset/base/241457 Log: Point freebsd.org cluster machines to mx1 for their smarthost. Modified: head/etc/sendmail/freefall.mc Modified: head/etc/sendmail/freefall.mc ============================================================================== --- head/etc/sendmail/freefall.mc Thu Oct 11 20:14:11 2012 (r241456) +++ head/etc/sendmail/freefall.mc Thu Oct 11 20:46:04 2012 (r241457) @@ -43,5 +43,5 @@ divert(0)dnl VERSIONID(`$FreeBSD$') OSTYPE(freebsd6) -FEATURE(nullclient, hub.$m) +FEATURE(nullclient, mx1.$m) MASQUERADE_AS(FreeBSD.org) From owner-svn-src-head@FreeBSD.ORG Thu Oct 11 21:19:43 2012 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id 6C227FDD; Thu, 11 Oct 2012 21:19:43 +0000 (UTC) (envelope-from ray@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 549BF8FC0C; Thu, 11 Oct 2012 21:19:43 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id q9BLJhKr087600; Thu, 11 Oct 2012 21:19:43 GMT (envelope-from ray@svn.freebsd.org) Received: (from ray@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q9BLJhmi087598; Thu, 11 Oct 2012 21:19:43 GMT (envelope-from ray@svn.freebsd.org) Message-Id: <201210112119.q9BLJhmi087598@svn.freebsd.org> From: Aleksandr Rybalko Date: Thu, 11 Oct 2012 21:19:43 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r241463 - head/sys/dev/etherswitch/arswitch X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 11 Oct 2012 21:19:43 -0000 Author: ray Date: Thu Oct 11 21:19:42 2012 New Revision: 241463 URL: http://svn.freebsd.org/changeset/base/241463 Log: Fix tiypo. Submitted by: Luiz Otavio O Souza Approved by: adrian (mentor) Modified: head/sys/dev/etherswitch/arswitch/arswitchvar.h Modified: head/sys/dev/etherswitch/arswitch/arswitchvar.h ============================================================================== --- head/sys/dev/etherswitch/arswitch/arswitchvar.h Thu Oct 11 21:15:54 2012 (r241462) +++ head/sys/dev/etherswitch/arswitch/arswitchvar.h Thu Oct 11 21:19:42 2012 (r241463) @@ -70,7 +70,7 @@ struct arswitch_softc { #define ARSWITCH_UNLOCK(_sc) \ mtx_unlock(&(_sc)->sc_mtx) #define ARSWITCH_LOCK_ASSERT(_sc, _what) \ - mtx_assert(&(_s)c->sc_mtx, (_what)) + mtx_assert(&(_sc)->sc_mtx, (_what)) #define ARSWITCH_TRYLOCK(_sc) \ mtx_trylock(&(_sc)->sc_mtx) From owner-svn-src-head@FreeBSD.ORG Thu Oct 11 21:24:08 2012 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id 88B1B20D; Thu, 11 Oct 2012 21:24:08 +0000 (UTC) (envelope-from emaste@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 71C218FC0A; Thu, 11 Oct 2012 21:24:08 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id q9BLO83r088419; Thu, 11 Oct 2012 21:24:08 GMT (envelope-from emaste@svn.freebsd.org) Received: (from emaste@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q9BLO80Y088417; Thu, 11 Oct 2012 21:24:08 GMT (envelope-from emaste@svn.freebsd.org) Message-Id: <201210112124.q9BLO80Y088417@svn.freebsd.org> From: Ed Maste Date: Thu, 11 Oct 2012 21:24:08 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r241464 - head/tools/tools/netmap X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 11 Oct 2012 21:24:08 -0000 Author: emaste Date: Thu Oct 11 21:24:07 2012 New Revision: 241464 URL: http://svn.freebsd.org/changeset/base/241464 Log: Make local function static. Modified: head/tools/tools/netmap/pcap.c Modified: head/tools/tools/netmap/pcap.c ============================================================================== --- head/tools/tools/netmap/pcap.c Thu Oct 11 21:19:42 2012 (r241463) +++ head/tools/tools/netmap/pcap.c Thu Oct 11 21:24:07 2012 (r241464) @@ -49,7 +49,7 @@ int verbose = 0; __FUNCTION__, __LINE__, ##__VA_ARGS__); \ } while (0) -inline void prefetch (const void *x) +static inline void prefetch (const void *x) { __asm volatile("prefetcht0 %0" :: "m" (*(const unsigned long *)x)); } From owner-svn-src-head@FreeBSD.ORG Thu Oct 11 23:03:43 2012 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id 18912B8A; Thu, 11 Oct 2012 23:03:43 +0000 (UTC) (envelope-from grehan@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 01C508FC0A; Thu, 11 Oct 2012 23:03:43 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id q9BN3gen000622; Thu, 11 Oct 2012 23:03:42 GMT (envelope-from grehan@svn.freebsd.org) Received: (from grehan@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q9BN3gpb000620; Thu, 11 Oct 2012 23:03:42 GMT (envelope-from grehan@svn.freebsd.org) Message-Id: <201210112303.q9BN3gpb000620@svn.freebsd.org> From: Peter Grehan Date: Thu, 11 Oct 2012 23:03:42 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r241469 - head/sys/dev/virtio X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 11 Oct 2012 23:03:43 -0000 Author: grehan Date: Thu Oct 11 23:03:42 2012 New Revision: 241469 URL: http://svn.freebsd.org/changeset/base/241469 Log: Patch from Bryan to fix a virtqueue issue: virtqueue: Fix non-indirect virtqueues We really must walk the entire descriptor chain in order to append the to be free'd chain to the existing free chain. Submitted by: Bryan Venteicher (bryanv@daemoninthecloset.org) Reported by: cognet Modified: head/sys/dev/virtio/virtqueue.c Modified: head/sys/dev/virtio/virtqueue.c ============================================================================== --- head/sys/dev/virtio/virtqueue.c Thu Oct 11 23:02:35 2012 (r241468) +++ head/sys/dev/virtio/virtqueue.c Thu Oct 11 23:03:42 2012 (r241469) @@ -780,8 +780,8 @@ vq_ring_free_chain(struct virtqueue *vq, VQ_RING_ASSERT_CHAIN_TERM(vq); vq->vq_free_cnt += dxp->ndescs; + dxp->ndescs--; -#ifdef INVARIANTS if ((dp->flags & VRING_DESC_F_INDIRECT) == 0) { while (dp->flags & VRING_DESC_F_NEXT) { VQ_RING_ASSERT_VALID_IDX(vq, dp->next); @@ -789,10 +789,9 @@ vq_ring_free_chain(struct virtqueue *vq, dxp->ndescs--; } } - VQASSERT(vq, dxp->ndescs == 1, + + VQASSERT(vq, dxp->ndescs == 0, "failed to free entire desc chain, remaining: %d", dxp->ndescs); -#endif - dxp->ndescs = 0; /* * We must append the existing free chain, if any, to the end of From owner-svn-src-head@FreeBSD.ORG Thu Oct 11 23:41:18 2012 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id C16E3274; Thu, 11 Oct 2012 23:41:18 +0000 (UTC) (envelope-from grehan@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id A70088FC14; Thu, 11 Oct 2012 23:41:18 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id q9BNfISv005019; Thu, 11 Oct 2012 23:41:18 GMT (envelope-from grehan@svn.freebsd.org) Received: (from grehan@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q9BNfIss005013; Thu, 11 Oct 2012 23:41:18 GMT (envelope-from grehan@svn.freebsd.org) Message-Id: <201210112341.q9BNfIss005013@svn.freebsd.org> From: Peter Grehan Date: Thu, 11 Oct 2012 23:41:18 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r241470 - in head: share/man/man4 sys/dev/virtio sys/dev/virtio/scsi sys/modules/virtio sys/modules/virtio/scsi X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 11 Oct 2012 23:41:18 -0000 Author: grehan Date: Thu Oct 11 23:41:18 2012 New Revision: 241470 URL: http://svn.freebsd.org/changeset/base/241470 Log: Virtio SCSI driver Submitted by: Bryan Venteicher bryanv at daemoninthecloset dot org Reviewed by: grehan Added: head/share/man/man4/virtio_scsi.4 (contents, props changed) head/sys/dev/virtio/scsi/ head/sys/dev/virtio/scsi/virtio_scsi.c (contents, props changed) head/sys/dev/virtio/scsi/virtio_scsi.h (contents, props changed) head/sys/dev/virtio/scsi/virtio_scsivar.h (contents, props changed) head/sys/modules/virtio/scsi/ head/sys/modules/virtio/scsi/Makefile (contents, props changed) Modified: head/share/man/man4/Makefile head/share/man/man4/virtio.4 head/sys/dev/virtio/virtio.c head/sys/dev/virtio/virtio.h head/sys/modules/virtio/Makefile Modified: head/share/man/man4/Makefile ============================================================================== --- head/share/man/man4/Makefile Thu Oct 11 23:03:42 2012 (r241469) +++ head/share/man/man4/Makefile Thu Oct 11 23:41:18 2012 (r241470) @@ -531,6 +531,7 @@ MAN= aac.4 \ ${_virtio.4} \ ${_virtio_balloon.4} \ ${_virtio_blk.4} \ + ${_virtio_scsi.4} \ vkbd.4 \ vlan.4 \ vpo.4 \ @@ -768,6 +769,7 @@ _nxge.4= nxge.4 _virtio.4= virtio.4 _virtio_balloon.4=virtio_balloon.4 _virtio_blk.4= virtio_blk.4 +_virtio_scsi.4= virtio_scsi.4 _vtnet.4= vtnet.4 _vxge.4= vxge.4 _padlock.4= padlock.4 Modified: head/share/man/man4/virtio.4 ============================================================================== --- head/share/man/man4/virtio.4 Thu Oct 11 23:03:42 2012 (r241469) +++ head/share/man/man4/virtio.4 Thu Oct 11 23:41:18 2012 (r241470) @@ -72,6 +72,10 @@ device driver. An emulated disk controller is provided by the .Xr virtio_blk 4 device driver. +.It Nm SCSI +An emulated SCSI HBA is provided by the +.Xr virtio_scsi 4 +device driver. .It Nm Balloon A pseudo-device to allow the VM to release memory back to the hypervisor is provided by the @@ -81,6 +85,7 @@ device driver. .Sh SEE ALSO .Xr virtio_balloon 4 , .Xr virtio_blk 4 , +.Xr virtio_scsi 4 , .Xr vtnet 4 .Sh HISTORY Support for VirtIO first appeared in Added: head/share/man/man4/virtio_scsi.4 ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ head/share/man/man4/virtio_scsi.4 Thu Oct 11 23:41:18 2012 (r241470) @@ -0,0 +1,92 @@ +.\" Copyright (c) 2012 Bryan Venteicher +.\" All rights reserved. +.\" +.\" Redistribution and use in source and binary forms, with or without +.\" modification, are permitted provided that the following conditions +.\" are met: +.\" 1. Redistributions of source code must retain the above copyright +.\" notice, this list of conditions and the following disclaimer. +.\" 2. Redistributions in binary form must reproduce the above copyright +.\" notice, this list of conditions and the following disclaimer in the +.\" documentation and/or other materials provided with the distribution. +.\" +.\" THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND +.\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE +.\" ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE +.\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL +.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS +.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) +.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT +.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY +.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF +.\" SUCH DAMAGE. +.\" +.\" $FreeBSD$ +.\" +.Dd June 24, 2012 +.Dt VIRTIO_SCSI 4 +.Os +.Sh NAME +.Nm virtio_scsi +.Nd VirtIO SCSI driver +.Sh SYNOPSIS +To compile this driver into the kernel, +place the following lines in your +kernel configuration file: +.Bd -ragged -offset indent +.Cd "device virtio_scsi" +.Ed +.Pp +Alternatively, to load the driver as a +module at boot time, place the following line in +.Xr loader.conf 5 : +.Bd -literal -offset indent +virtio_scsi_load="YES" +.Ed +.Sh DESCRIPTION +The +.Nm +device driver provides support for VirtIO SCSI devices. +.Sh LOADER TUNABLES +Tunables can be set at the +.Xr loader 8 +prompt before booting the kernel or stored in +.Xr loader.conf 5 . +.Bl -tag -width "xxxxxx" +.It Va hw.vtscsi.bus_reset_disable +In the initial QEMU release with VirtIO SCSI support, in-flight +operations were not aborted when stopping the device, rendering +bus reset ineffective. This tunable disables attempts to issue +reset bus commands. The default value is 1. +.El +.Sh DEBUGGING +To enable debugging prints from the +.Nm +driver, set the +.Bd -literal -offset indent +hw.vtscsi.X.debug_level +.Ed +.Pp +variable, where X is the adapter number, either in +.Xr loader.conf 5 +or via +.Xr sysctl 8 . +The following bits have the described effects: +.Bl -tag -width 6n -offset indent +.It 0x01 +Enable informational prints. +.It 0x02 +Enable prints for driver errors. +.It 0x04 +Enable tracing prints. +.El +.Sh SEE ALSO +.Xr virtio 4 +.Sh HISTORY +The +.Nm +driver was written by +.An Bryan Venteicher Aq bryanv@daemoninthecloset.org . +It first appeared in +.Fx 10.0 . Added: head/sys/dev/virtio/scsi/virtio_scsi.c ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ head/sys/dev/virtio/scsi/virtio_scsi.c Thu Oct 11 23:41:18 2012 (r241470) @@ -0,0 +1,2367 @@ +/*- + * Copyright (c) 2012, Bryan Venteicher + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice unmodified, this list of conditions, and the following + * disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR + * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES + * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. + * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, + * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT + * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, + * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY + * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF + * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ + +/* Driver for VirtIO SCSI devices. */ + +#include +__FBSDID("$FreeBSD$"); + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#include + +#include +#include +#include +#include + +#include +#include +#include +#include +#include +#include +#include +#include + +#include +#include +#include +#include + +#include "virtio_if.h" + +static int vtscsi_modevent(module_t, int, void *); + +static int vtscsi_probe(device_t); +static int vtscsi_attach(device_t); +static int vtscsi_detach(device_t); +static int vtscsi_suspend(device_t); +static int vtscsi_resume(device_t); + +static void vtscsi_negotiate_features(struct vtscsi_softc *); +static int vtscsi_maximum_segments(struct vtscsi_softc *, int); +static int vtscsi_alloc_virtqueues(struct vtscsi_softc *); +static void vtscsi_write_device_config(struct vtscsi_softc *); +static int vtscsi_reinit(struct vtscsi_softc *); + +static int vtscsi_alloc_cam(struct vtscsi_softc *); +static int vtscsi_register_cam(struct vtscsi_softc *); +static void vtscsi_free_cam(struct vtscsi_softc *); +static void vtscsi_cam_async(void *, uint32_t, struct cam_path *, void *); +static int vtscsi_register_async(struct vtscsi_softc *); +static void vtscsi_deregister_async(struct vtscsi_softc *); +static void vtscsi_cam_action(struct cam_sim *, union ccb *); +static void vtscsi_cam_poll(struct cam_sim *); + +static void vtscsi_cam_scsi_io(struct vtscsi_softc *, struct cam_sim *, + union ccb *); +static void vtscsi_cam_get_tran_settings(struct vtscsi_softc *, + union ccb *); +static void vtscsi_cam_reset_bus(struct vtscsi_softc *, union ccb *); +static void vtscsi_cam_reset_dev(struct vtscsi_softc *, union ccb *); +static void vtscsi_cam_abort(struct vtscsi_softc *, union ccb *); +static void vtscsi_cam_path_inquiry(struct vtscsi_softc *, + struct cam_sim *, union ccb *); + +static int vtscsi_sg_append_scsi_buf(struct vtscsi_softc *, + struct sglist *, struct ccb_scsiio *); +static int vtscsi_fill_scsi_cmd_sglist(struct vtscsi_softc *, + struct vtscsi_request *, int *, int *); +static int vtscsi_execute_scsi_cmd(struct vtscsi_softc *, + struct vtscsi_request *); +static int vtscsi_start_scsi_cmd(struct vtscsi_softc *, union ccb *); +static void vtscsi_complete_abort_timedout_scsi_cmd(struct vtscsi_softc *, + struct vtscsi_request *); +static int vtscsi_abort_timedout_scsi_cmd(struct vtscsi_softc *, + struct vtscsi_request *); +static void vtscsi_timedout_scsi_cmd(void *); +static cam_status vtscsi_scsi_cmd_cam_status(struct virtio_scsi_cmd_resp *); +static cam_status vtscsi_complete_scsi_cmd_response(struct vtscsi_softc *, + struct ccb_scsiio *, struct virtio_scsi_cmd_resp *); +static void vtscsi_complete_scsi_cmd(struct vtscsi_softc *, + struct vtscsi_request *); + +static void vtscsi_poll_ctrl_req(struct vtscsi_softc *, + struct vtscsi_request *); +static int vtscsi_execute_ctrl_req(struct vtscsi_softc *, + struct vtscsi_request *, struct sglist *, int, int, int); +static void vtscsi_complete_abort_task_cmd(struct vtscsi_softc *c, + struct vtscsi_request *); +static int vtscsi_execute_abort_task_cmd(struct vtscsi_softc *, + struct vtscsi_request *); +static int vtscsi_execute_reset_dev_cmd(struct vtscsi_softc *, + struct vtscsi_request *); + +static void vtscsi_get_request_lun(uint8_t lun[], target_id_t *, lun_id_t *); +static void vtscsi_set_request_lun(struct ccb_hdr *, uint8_t []); +static void vtscsi_init_scsi_cmd_req(struct ccb_scsiio *, + struct virtio_scsi_cmd_req *); +static void vtscsi_init_ctrl_tmf_req(struct ccb_hdr *, uint32_t, + uintptr_t, struct virtio_scsi_ctrl_tmf_req *); + +static void vtscsi_freeze_simq(struct vtscsi_softc *, int); +static int vtscsi_thaw_simq(struct vtscsi_softc *, int); + +static void vtscsi_announce(struct vtscsi_softc *, uint32_t, target_id_t, + lun_id_t); +static void vtscsi_execute_rescan(struct vtscsi_softc *, target_id_t, + lun_id_t); +static void vtscsi_execute_rescan_bus(struct vtscsi_softc *); + +static void vtscsi_handle_event(struct vtscsi_softc *, + struct virtio_scsi_event *); +static int vtscsi_enqueue_event_buf(struct vtscsi_softc *, + struct virtio_scsi_event *); +static int vtscsi_init_event_vq(struct vtscsi_softc *); +static void vtscsi_reinit_event_vq(struct vtscsi_softc *); +static void vtscsi_drain_event_vq(struct vtscsi_softc *); + +static void vtscsi_complete_vqs_locked(struct vtscsi_softc *); +static void vtscsi_complete_vqs(struct vtscsi_softc *); +static void vtscsi_drain_vqs(struct vtscsi_softc *); +static void vtscsi_cancel_request(struct vtscsi_softc *, + struct vtscsi_request *); +static void vtscsi_drain_vq(struct vtscsi_softc *, struct virtqueue *); +static void vtscsi_stop(struct vtscsi_softc *); +static int vtscsi_reset_bus(struct vtscsi_softc *); + +static void vtscsi_init_request(struct vtscsi_softc *, + struct vtscsi_request *); +static int vtscsi_alloc_requests(struct vtscsi_softc *); +static void vtscsi_free_requests(struct vtscsi_softc *); +static void vtscsi_enqueue_request(struct vtscsi_softc *, + struct vtscsi_request *); +static struct vtscsi_request * vtscsi_dequeue_request(struct vtscsi_softc *); + +static void vtscsi_complete_request(struct vtscsi_request *); +static void vtscsi_complete_vq(struct vtscsi_softc *, struct virtqueue *); +static void vtscsi_control_vq_task(void *, int); +static void vtscsi_event_vq_task(void *, int); +static void vtscsi_request_vq_task(void *, int); + +static int vtscsi_control_vq_intr(void *); +static int vtscsi_event_vq_intr(void *); +static int vtscsi_request_vq_intr(void *); +static void vtscsi_disable_vqs_intr(struct vtscsi_softc *); +static void vtscsi_enable_vqs_intr(struct vtscsi_softc *); + +static void vtscsi_get_tunables(struct vtscsi_softc *); +static void vtscsi_add_sysctl(struct vtscsi_softc *); + +static void vtscsi_printf_req(struct vtscsi_request *, const char *, + const char *, ...); + +/* Global tunables. */ +/* + * The current QEMU VirtIO SCSI implementation does not cancel in-flight + * IO during virtio_stop(). So in-flight requests still complete after the + * device reset. We would have to wait for all the in-flight IO to complete, + * which defeats the typical purpose of a bus reset. We could simulate the + * bus reset with either I_T_NEXUS_RESET of all the targets, or with + * LOGICAL_UNIT_RESET of all the LUNs (assuming there is space in the + * control virtqueue). But this isn't very useful if things really go off + * the rails, so default to disabled for now. + */ +static int vtscsi_bus_reset_disable = 1; +TUNABLE_INT("hw.vtscsi.bus_reset_disable", &vtscsi_bus_reset_disable); + +static struct virtio_feature_desc vtscsi_feature_desc[] = { + { VIRTIO_SCSI_F_INOUT, "InOut" }, + { VIRTIO_SCSI_F_HOTPLUG, "Hotplug" }, + + { 0, NULL } +}; + +static device_method_t vtscsi_methods[] = { + /* Device methods. */ + DEVMETHOD(device_probe, vtscsi_probe), + DEVMETHOD(device_attach, vtscsi_attach), + DEVMETHOD(device_detach, vtscsi_detach), + DEVMETHOD(device_suspend, vtscsi_suspend), + DEVMETHOD(device_resume, vtscsi_resume), + + DEVMETHOD_END +}; + +static driver_t vtscsi_driver = { + "vtscsi", + vtscsi_methods, + sizeof(struct vtscsi_softc) +}; +static devclass_t vtscsi_devclass; + +DRIVER_MODULE(virtio_scsi, virtio_pci, vtscsi_driver, vtscsi_devclass, + vtscsi_modevent, 0); +MODULE_VERSION(virtio_scsi, 1); +MODULE_DEPEND(virtio_scsi, virtio, 1, 1, 1); +MODULE_DEPEND(virtio_scsi, cam, 1, 1, 1); + +static int +vtscsi_modevent(module_t mod, int type, void *unused) +{ + int error; + + switch (type) { + case MOD_LOAD: + case MOD_QUIESCE: + case MOD_UNLOAD: + case MOD_SHUTDOWN: + error = 0; + break; + default: + error = EOPNOTSUPP; + break; + } + + return (error); +} + +static int +vtscsi_probe(device_t dev) +{ + + if (virtio_get_device_type(dev) != VIRTIO_ID_SCSI) + return (ENXIO); + + device_set_desc(dev, "VirtIO SCSI Adapter"); + + return (BUS_PROBE_DEFAULT); +} + +static int +vtscsi_attach(device_t dev) +{ + struct vtscsi_softc *sc; + struct virtio_scsi_config scsicfg; + int error; + + sc = device_get_softc(dev); + sc->vtscsi_dev = dev; + + VTSCSI_LOCK_INIT(sc, device_get_nameunit(dev)); + TAILQ_INIT(&sc->vtscsi_req_free); + + vtscsi_get_tunables(sc); + vtscsi_add_sysctl(sc); + + virtio_set_feature_desc(dev, vtscsi_feature_desc); + vtscsi_negotiate_features(sc); + + if (virtio_with_feature(dev, VIRTIO_RING_F_INDIRECT_DESC)) + sc->vtscsi_flags |= VTSCSI_FLAG_INDIRECT; + if (virtio_with_feature(dev, VIRTIO_SCSI_F_INOUT)) + sc->vtscsi_flags |= VTSCSI_FLAG_BIDIRECTIONAL; + if (virtio_with_feature(dev, VIRTIO_SCSI_F_HOTPLUG)) + sc->vtscsi_flags |= VTSCSI_FLAG_HOTPLUG; + + virtio_read_device_config(dev, 0, &scsicfg, + sizeof(struct virtio_scsi_config)); + + sc->vtscsi_max_channel = scsicfg.max_channel; + sc->vtscsi_max_target = scsicfg.max_target; + sc->vtscsi_max_lun = scsicfg.max_lun; + sc->vtscsi_event_buf_size = scsicfg.event_info_size; + + vtscsi_write_device_config(sc); + + sc->vtscsi_max_nsegs = vtscsi_maximum_segments(sc, scsicfg.seg_max); + sc->vtscsi_sglist = sglist_alloc(sc->vtscsi_max_nsegs, M_NOWAIT); + if (sc->vtscsi_sglist == NULL) { + error = ENOMEM; + device_printf(dev, "cannot allocate sglist\n"); + goto fail; + } + + error = vtscsi_alloc_virtqueues(sc); + if (error) { + device_printf(dev, "cannot allocate virtqueues\n"); + goto fail; + } + + error = vtscsi_init_event_vq(sc); + if (error) { + device_printf(dev, "cannot populate the eventvq\n"); + goto fail; + } + + error = vtscsi_alloc_requests(sc); + if (error) { + device_printf(dev, "cannot allocate requests\n"); + goto fail; + } + + error = vtscsi_alloc_cam(sc); + if (error) { + device_printf(dev, "cannot allocate CAM structures\n"); + goto fail; + } + + TASK_INIT(&sc->vtscsi_control_intr_task, 0, + vtscsi_control_vq_task, sc); + TASK_INIT(&sc->vtscsi_event_intr_task, 0, + vtscsi_event_vq_task, sc); + TASK_INIT(&sc->vtscsi_request_intr_task, 0, + vtscsi_request_vq_task, sc); + + sc->vtscsi_tq = taskqueue_create_fast("vtscsi_taskq", M_NOWAIT, + taskqueue_thread_enqueue, &sc->vtscsi_tq); + if (sc->vtscsi_tq == NULL) { + error = ENOMEM; + device_printf(dev, "cannot allocate taskqueue\n"); + goto fail; + } + error = taskqueue_start_threads(&sc->vtscsi_tq, 1, PI_DISK, "%s taskq", + device_get_nameunit(dev)); + if (error) { + device_printf(dev, "cannot start taskqueue threads\n"); + goto fail; + } + + error = virtio_setup_intr(dev, INTR_TYPE_CAM); + if (error) { + device_printf(dev, "cannot setup virtqueue interrupts\n"); + goto fail; + } + + vtscsi_enable_vqs_intr(sc); + + /* + * Register with CAM after interrupts are enabled so we will get + * notified of the probe responses. + */ + error = vtscsi_register_cam(sc); + if (error) { + device_printf(dev, "cannot register with CAM\n"); + goto fail; + } + +fail: + if (error) + vtscsi_detach(dev); + + return (error); +} + +static int +vtscsi_detach(device_t dev) +{ + struct vtscsi_softc *sc; + + sc = device_get_softc(dev); + + VTSCSI_LOCK(sc); + sc->vtscsi_flags |= VTSCSI_FLAG_DETACH; + if (device_is_attached(dev)) + vtscsi_stop(sc); + VTSCSI_UNLOCK(sc); + + if (sc->vtscsi_tq != NULL) { + taskqueue_drain(sc->vtscsi_tq, &sc->vtscsi_control_intr_task); + taskqueue_drain(sc->vtscsi_tq, &sc->vtscsi_event_intr_task); + taskqueue_drain(sc->vtscsi_tq, &sc->vtscsi_request_intr_task); + taskqueue_free(sc->vtscsi_tq); + sc->vtscsi_tq = NULL; + } + + vtscsi_complete_vqs(sc); + vtscsi_drain_vqs(sc); + + vtscsi_free_cam(sc); + vtscsi_free_requests(sc); + + if (sc->vtscsi_sglist != NULL) { + sglist_free(sc->vtscsi_sglist); + sc->vtscsi_sglist = NULL; + } + + VTSCSI_LOCK_DESTROY(sc); + + return (0); +} + +static int +vtscsi_suspend(device_t dev) +{ + + return (0); +} + +static int +vtscsi_resume(device_t dev) +{ + + return (0); +} + +static void +vtscsi_negotiate_features(struct vtscsi_softc *sc) +{ + device_t dev; + uint64_t features; + + dev = sc->vtscsi_dev; + features = virtio_negotiate_features(dev, VTSCSI_FEATURES); + sc->vtscsi_features = features; +} + +static int +vtscsi_maximum_segments(struct vtscsi_softc *sc, int seg_max) +{ + int nsegs; + + nsegs = VTSCSI_MIN_SEGMENTS; + + if (seg_max > 0) { + nsegs += MIN(seg_max, MAXPHYS / PAGE_SIZE + 1); + if (sc->vtscsi_flags & VTSCSI_FLAG_INDIRECT) + nsegs = MIN(nsegs, VIRTIO_MAX_INDIRECT); + } else + nsegs += 1; + + return (nsegs); +} + +static int +vtscsi_alloc_virtqueues(struct vtscsi_softc *sc) +{ + device_t dev; + struct vq_alloc_info vq_info[3]; + int nvqs; + + dev = sc->vtscsi_dev; + nvqs = 3; + + VQ_ALLOC_INFO_INIT(&vq_info[0], 0, vtscsi_control_vq_intr, sc, + &sc->vtscsi_control_vq, "%s control", device_get_nameunit(dev)); + + VQ_ALLOC_INFO_INIT(&vq_info[1], 0, vtscsi_event_vq_intr, sc, + &sc->vtscsi_event_vq, "%s event", device_get_nameunit(dev)); + + VQ_ALLOC_INFO_INIT(&vq_info[2], sc->vtscsi_max_nsegs, + vtscsi_request_vq_intr, sc, &sc->vtscsi_request_vq, + "%s request", device_get_nameunit(dev)); + + return (virtio_alloc_virtqueues(dev, 0, nvqs, vq_info)); +} + +static void +vtscsi_write_device_config(struct vtscsi_softc *sc) +{ + + virtio_write_dev_config_4(sc->vtscsi_dev, + offsetof(struct virtio_scsi_config, sense_size), + VIRTIO_SCSI_SENSE_SIZE); + + /* + * This is the size in the virtio_scsi_cmd_req structure. Note + * this value (32) is larger than the maximum CAM CDB size (16). + */ + virtio_write_dev_config_4(sc->vtscsi_dev, + offsetof(struct virtio_scsi_config, cdb_size), + VIRTIO_SCSI_CDB_SIZE); +} + +static int +vtscsi_reinit(struct vtscsi_softc *sc) +{ + device_t dev; + int error; + + dev = sc->vtscsi_dev; + + error = virtio_reinit(dev, sc->vtscsi_features); + if (error == 0) { + vtscsi_write_device_config(sc); + vtscsi_reinit_event_vq(sc); + virtio_reinit_complete(dev); + + vtscsi_enable_vqs_intr(sc); + } + + vtscsi_dprintf(sc, VTSCSI_TRACE, "error=%d\n", error); + + return (error); +} + +static int +vtscsi_alloc_cam(struct vtscsi_softc *sc) +{ + device_t dev; + struct cam_devq *devq; + int openings; + + dev = sc->vtscsi_dev; + openings = sc->vtscsi_nrequests - VTSCSI_RESERVED_REQUESTS; + + devq = cam_simq_alloc(openings); + if (devq == NULL) { + device_printf(dev, "cannot allocate SIM queue\n"); + return (ENOMEM); + } + + sc->vtscsi_sim = cam_sim_alloc(vtscsi_cam_action, vtscsi_cam_poll, + "vtscsi", sc, device_get_unit(dev), VTSCSI_MTX(sc), 1, + openings, devq); + if (sc->vtscsi_sim == NULL) { + cam_simq_free(devq); + device_printf(dev, "cannot allocate SIM\n"); + return (ENOMEM); + } + + return (0); +} + +static int +vtscsi_register_cam(struct vtscsi_softc *sc) +{ + device_t dev; + int registered, error; + + dev = sc->vtscsi_dev; + registered = 0; + + VTSCSI_LOCK(sc); + + if (xpt_bus_register(sc->vtscsi_sim, dev, 0) != CAM_SUCCESS) { + error = ENOMEM; + device_printf(dev, "cannot register XPT bus\n"); + goto fail; + } + + registered = 1; + + if (xpt_create_path(&sc->vtscsi_path, NULL, + cam_sim_path(sc->vtscsi_sim), CAM_TARGET_WILDCARD, + CAM_LUN_WILDCARD) != CAM_REQ_CMP) { + error = ENOMEM; + device_printf(dev, "cannot create bus path\n"); + goto fail; + } + + VTSCSI_UNLOCK(sc); + + /* + * The async register apparently needs to be done without + * the lock held, otherwise it can recurse on the lock. + */ + if (vtscsi_register_async(sc) != CAM_REQ_CMP) { + error = EIO; + device_printf(dev, "cannot register async callback\n"); + VTSCSI_LOCK(sc); + goto fail; + } + + return (0); + +fail: + if (sc->vtscsi_path != NULL) { + xpt_free_path(sc->vtscsi_path); + sc->vtscsi_path = NULL; + } + + if (registered != 0) + xpt_bus_deregister(cam_sim_path(sc->vtscsi_sim)); + + VTSCSI_UNLOCK(sc); + + return (error); +} + +static void +vtscsi_free_cam(struct vtscsi_softc *sc) +{ + + VTSCSI_LOCK(sc); + + if (sc->vtscsi_path != NULL) { + vtscsi_deregister_async(sc); + + xpt_free_path(sc->vtscsi_path); + sc->vtscsi_path = NULL; + + xpt_bus_deregister(cam_sim_path(sc->vtscsi_sim)); + } + + if (sc->vtscsi_sim != NULL) { + cam_sim_free(sc->vtscsi_sim, 1); + sc->vtscsi_sim = NULL; + } + + VTSCSI_UNLOCK(sc); +} + +static void +vtscsi_cam_async(void *cb_arg, uint32_t code, struct cam_path *path, void *arg) +{ + struct cam_sim *sim; + struct vtscsi_softc *sc; + + sim = cb_arg; + sc = cam_sim_softc(sim); + + vtscsi_dprintf(sc, VTSCSI_TRACE, "code=%u\n", code); + + /* + * TODO Once QEMU supports event reporting, we should + * (un)subscribe to events here. + */ + switch (code) { + case AC_FOUND_DEVICE: + break; + case AC_LOST_DEVICE: + break; + } +} + +static int +vtscsi_register_async(struct vtscsi_softc *sc) +{ + struct ccb_setasync csa; + + VTSCSI_LOCK_NOTOWNED(sc); + + xpt_setup_ccb(&csa.ccb_h, sc->vtscsi_path, 5); + csa.ccb_h.func_code = XPT_SASYNC_CB; + csa.event_enable = AC_LOST_DEVICE | AC_FOUND_DEVICE; + csa.callback = vtscsi_cam_async; + csa.callback_arg = sc->vtscsi_sim; + + xpt_action((union ccb *) &csa); + + return (csa.ccb_h.status); +} + +static void +vtscsi_deregister_async(struct vtscsi_softc *sc) +{ + struct ccb_setasync csa; + + xpt_setup_ccb(&csa.ccb_h, sc->vtscsi_path, 5); + csa.ccb_h.func_code = XPT_SASYNC_CB; + csa.event_enable = 0; + csa.callback = vtscsi_cam_async; + csa.callback_arg = sc->vtscsi_sim; + + xpt_action((union ccb *) &csa); +} + +static void +vtscsi_cam_action(struct cam_sim *sim, union ccb *ccb) +{ + struct vtscsi_softc *sc; + struct ccb_hdr *ccbh; + + sc = cam_sim_softc(sim); + ccbh = &ccb->ccb_h; + + VTSCSI_LOCK_OWNED(sc); + + if (sc->vtscsi_flags & VTSCSI_FLAG_DETACH) { + /* + * The VTSCSI_MTX is briefly dropped between setting + * VTSCSI_FLAG_DETACH and deregistering with CAM, so + * drop any CCBs that come in during that window. + */ + ccbh->status = CAM_NO_HBA; + xpt_done(ccb); + return; + } + + switch (ccbh->func_code) { + case XPT_SCSI_IO: + vtscsi_cam_scsi_io(sc, sim, ccb); + break; + + case XPT_SET_TRAN_SETTINGS: + ccbh->status = CAM_FUNC_NOTAVAIL; + xpt_done(ccb); + break; + + case XPT_GET_TRAN_SETTINGS: + vtscsi_cam_get_tran_settings(sc, ccb); + break; + + case XPT_RESET_BUS: + vtscsi_cam_reset_bus(sc, ccb); + break; + + case XPT_RESET_DEV: + vtscsi_cam_reset_dev(sc, ccb); + break; + + case XPT_ABORT: + vtscsi_cam_abort(sc, ccb); + break; + + case XPT_CALC_GEOMETRY: + cam_calc_geometry(&ccb->ccg, 1); + xpt_done(ccb); + break; + + case XPT_PATH_INQ: + vtscsi_cam_path_inquiry(sc, sim, ccb); + break; + + default: + vtscsi_dprintf(sc, VTSCSI_ERROR, + "invalid ccb=%p func=%#x\n", ccb, ccbh->func_code); + + ccbh->status = CAM_REQ_INVALID; + xpt_done(ccb); + break; + } +} + +static void +vtscsi_cam_poll(struct cam_sim *sim) +{ + struct vtscsi_softc *sc; + + sc = cam_sim_softc(sim); + + vtscsi_complete_vqs_locked(sc); +} + +static void +vtscsi_cam_scsi_io(struct vtscsi_softc *sc, struct cam_sim *sim, + union ccb *ccb) +{ + struct ccb_hdr *ccbh; + struct ccb_scsiio *csio; + int error; + + ccbh = &ccb->ccb_h; + csio = &ccb->csio; + + if (csio->cdb_len > VIRTIO_SCSI_CDB_SIZE) { + error = EINVAL; + ccbh->status = CAM_REQ_INVALID; + goto done; + } + + if ((ccbh->flags & CAM_DIR_MASK) == CAM_DIR_BOTH && + (sc->vtscsi_flags & VTSCSI_FLAG_BIDIRECTIONAL) == 0) { + error = EINVAL; + ccbh->status = CAM_REQ_INVALID; + goto done; + } + + error = vtscsi_start_scsi_cmd(sc, ccb); + +done: + if (error) { + vtscsi_dprintf(sc, VTSCSI_ERROR, + "error=%d ccb=%p status=%#x\n", error, ccb, ccbh->status); + xpt_done(ccb); + } +} + +static void +vtscsi_cam_get_tran_settings(struct vtscsi_softc *sc, union ccb *ccb) +{ + struct ccb_trans_settings *cts; + struct ccb_trans_settings_scsi *scsi; + + cts = &ccb->cts; + scsi = &cts->proto_specific.scsi; + + cts->protocol = PROTO_SCSI; + cts->protocol_version = SCSI_REV_SPC3; + cts->transport = XPORT_SAS; + cts->transport_version = 0; + + scsi->valid = CTS_SCSI_VALID_TQ; + scsi->flags = CTS_SCSI_FLAGS_TAG_ENB; + + ccb->ccb_h.status = CAM_REQ_CMP; + xpt_done(ccb); +} + +static void +vtscsi_cam_reset_bus(struct vtscsi_softc *sc, union ccb *ccb) +{ + int error; + + error = vtscsi_reset_bus(sc); + if (error == 0) + ccb->ccb_h.status = CAM_REQ_CMP; + else + ccb->ccb_h.status = CAM_REQ_CMP_ERR; + + vtscsi_dprintf(sc, VTSCSI_TRACE, "error=%d ccb=%p status=%#x\n", + error, ccb, ccb->ccb_h.status); + + xpt_done(ccb); +} + +static void +vtscsi_cam_reset_dev(struct vtscsi_softc *sc, union ccb *ccb) +{ + struct ccb_hdr *ccbh; + struct vtscsi_request *req; + int error; + + ccbh = &ccb->ccb_h; + + req = vtscsi_dequeue_request(sc); + if (req == NULL) { + error = EAGAIN; + vtscsi_freeze_simq(sc, VTSCSI_REQUEST); + goto fail; + } + + req->vsr_ccb = ccb; + + error = vtscsi_execute_reset_dev_cmd(sc, req); + if (error == 0) + return; + + vtscsi_enqueue_request(sc, req); + +fail: + vtscsi_dprintf(sc, VTSCSI_ERROR, "error=%d req=%p ccb=%p\n", + error, req, ccb); + + if (error == EAGAIN) + ccbh->status = CAM_RESRC_UNAVAIL; *** DIFF OUTPUT TRUNCATED AT 1000 LINES *** From owner-svn-src-head@FreeBSD.ORG Fri Oct 12 01:31:03 2012 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id 780C2D4D; Fri, 12 Oct 2012 01:31:03 +0000 (UTC) (envelope-from kevlo@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 5F9458FC08; Fri, 12 Oct 2012 01:31:03 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id q9C1V32c018801; Fri, 12 Oct 2012 01:31:03 GMT (envelope-from kevlo@svn.freebsd.org) Received: (from kevlo@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q9C1V3jM018799; Fri, 12 Oct 2012 01:31:03 GMT (envelope-from kevlo@svn.freebsd.org) Message-Id: <201210120131.q9C1V3jM018799@svn.freebsd.org> From: Kevin Lo Date: Fri, 12 Oct 2012 01:31:03 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r241471 - head/share/man/man9 X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 12 Oct 2012 01:31:03 -0000 Author: kevlo Date: Fri Oct 12 01:31:02 2012 New Revision: 241471 URL: http://svn.freebsd.org/changeset/base/241471 Log: Since the moduledata structure member priv is a void pointer, using NULL instead of 0 when dealing with pointers. Modified: head/share/man/man9/module.9 Modified: head/share/man/man9/module.9 ============================================================================== --- head/share/man/man9/module.9 Thu Oct 11 23:41:18 2012 (r241470) +++ head/share/man/man9/module.9 Fri Oct 12 01:31:02 2012 (r241471) @@ -99,7 +99,7 @@ static int foo_handler(module_t mod, int static moduledata_t mod_data= { "foo", foo_handler, - 0 + NULL }; MODULE_VERSION(foo, 1); From owner-svn-src-head@FreeBSD.ORG Fri Oct 12 03:24:40 2012 Return-Path: Delivered-To: svn-src-head@FreeBSD.org Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id 5CC52659; Fri, 12 Oct 2012 03:24:40 +0000 (UTC) (envelope-from kevlo@FreeBSD.org) Received: from ns.kevlo.org (kevlo.org [220.128.136.52]) by mx1.freebsd.org (Postfix) with ESMTP id 3006D8FC0A; Fri, 12 Oct 2012 03:24:39 +0000 (UTC) Received: from srg.kevlo.org (git.kevlo.org [220.128.136.52]) by ns.kevlo.org (8.14.5/8.14.5) with ESMTP id q9C3Oa36004846; Fri, 12 Oct 2012 11:24:36 +0800 (CST) (envelope-from kevlo@FreeBSD.org) Message-ID: <50778D75.7060009@FreeBSD.org> Date: Fri, 12 Oct 2012 11:24:37 +0800 From: Kevin Lo User-Agent: Mozilla/5.0 (X11; FreeBSD amd64; rv:15.0) Gecko/20121009 Thunderbird/15.0.1 MIME-Version: 1.0 To: Eitan Adler Subject: Re: Re: svn commit: r241373 - head/lib/libc/stdlib References: <201210091425.q99EPFS6020787@svn.freebsd.org> <507451DE.9060909@freebsd.org> <977E1107-46D4-476F-A04D-AEFD87D1DE53@FreeBSD.org> <20121011114425.GA1562@garage.freebsd.pl> In-Reply-To: Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit Cc: mdf@FreeBSD.org, src-committers@FreeBSD.org, Andrey Chernov , svn-src-all@FreeBSD.org, David Chisnall , svn-src-head@FreeBSD.org, Pawel Jakub Dawidek X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 12 Oct 2012 03:24:40 -0000 On 2012/10/12 03:50, Eitan Adler wrote: > On 11 October 2012 07:44, Pawel Jakub Dawidek wrote: >> On Tue, Oct 09, 2012 at 01:51:05PM -0400, Eitan Adler wrote: >>> On 9 October 2012 13:27, wrote: >>>> The original behavior can be recovered by using inline assembly to >>>> fetch the value from a register into a local C variable; this would at >>>> least not rely on undefined behavior. But I agree it's of dubious >>>> value anyways. >>> I proposed this (with a patch). We want to move to not using >>> /dev/random and instead make a kernel system call directly. The patch >>> for this is not finished yet though. >> You should do something similar to: >> >> http://people.freebsd.org/~pjd/patches/libc_arc4random.c.patch > Yes, this is exactly the proposed "correct" fix. I haven't had time to > properly write and test such a patch though, so I opted for this one > in the meantime. > > FWIW, the man page *used* to contain the text > > The srandomdev() routine initializes a state array using the random(4) > random number device which returns good random numbers, suitable for > cryptographic use. > > which made this problem 'worse' as it mislead people into believing > rand/random could be used for crpyto. > > des@ fixed this problem already As you may already know, this issue was pointed out by Xi Wang in his paper "Undefined Behavior: Who Moved My Code?" at APSYS 2012 conference: http://apsys2012.kaist.ac.kr/media/papers/apsys2012-final42.pdf The bottom line is don't use uninitialized memory as a source of entropy :-) Kevin From owner-svn-src-head@FreeBSD.ORG Fri Oct 12 04:55:31 2012 Return-Path: Delivered-To: svn-src-head@FreeBSD.org Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id CD221374; Fri, 12 Oct 2012 04:55:31 +0000 (UTC) (envelope-from glebius@FreeBSD.org) Received: from cell.glebius.int.ru (glebius.int.ru [81.19.64.117]) by mx1.freebsd.org (Postfix) with ESMTP id 443768FC12; Fri, 12 Oct 2012 04:55:31 +0000 (UTC) Received: from cell.glebius.int.ru (localhost [127.0.0.1]) by cell.glebius.int.ru (8.14.5/8.14.5) with ESMTP id q9C4tU6U098645; Fri, 12 Oct 2012 08:55:30 +0400 (MSK) (envelope-from glebius@FreeBSD.org) Received: (from glebius@localhost) by cell.glebius.int.ru (8.14.5/8.14.5/Submit) id q9C4tU4t098644; Fri, 12 Oct 2012 08:55:30 +0400 (MSK) (envelope-from glebius@FreeBSD.org) X-Authentication-Warning: cell.glebius.int.ru: glebius set sender to glebius@FreeBSD.org using -f Date: Fri, 12 Oct 2012 08:55:30 +0400 From: Gleb Smirnoff To: Kevin Lo Subject: Re: svn commit: r241471 - head/share/man/man9 Message-ID: <20121012045530.GK89655@FreeBSD.org> References: <201210120131.q9C1V3jM018799@svn.freebsd.org> MIME-Version: 1.0 Content-Type: text/plain; charset=koi8-r Content-Disposition: inline In-Reply-To: <201210120131.q9C1V3jM018799@svn.freebsd.org> User-Agent: Mutt/1.5.21 (2010-09-15) Cc: svn-src-head@FreeBSD.org, svn-src-all@FreeBSD.org, src-committers@FreeBSD.org X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 12 Oct 2012 04:55:31 -0000 On Fri, Oct 12, 2012 at 01:31:03AM +0000, Kevin Lo wrote: K> Author: kevlo K> Date: Fri Oct 12 01:31:02 2012 K> New Revision: 241471 K> URL: http://svn.freebsd.org/changeset/base/241471 K> K> Log: K> Since the moduledata structure member priv is a void pointer, using K> NULL instead of 0 when dealing with pointers. K> K> Modified: K> head/share/man/man9/module.9 K> K> Modified: head/share/man/man9/module.9 K> ============================================================================== K> --- head/share/man/man9/module.9 Thu Oct 11 23:41:18 2012 (r241470) K> +++ head/share/man/man9/module.9 Fri Oct 12 01:31:02 2012 (r241471) K> @@ -99,7 +99,7 @@ static int foo_handler(module_t mod, int K> static moduledata_t mod_data= { K> "foo", K> foo_handler, K> - 0 K> + NULL K> }; K> K> MODULE_VERSION(foo, 1); I think we should provide C99 sparse initializers for structures in all manpages in section 9, as well as use only such initializers in any new code added to tree. -- Totus tuus, Glebius. From owner-svn-src-head@FreeBSD.ORG Fri Oct 12 06:16:52 2012 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id 8D6116AB; Fri, 12 Oct 2012 06:16:52 +0000 (UTC) (envelope-from joel@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 753EB8FC0A; Fri, 12 Oct 2012 06:16:52 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id q9C6Gq2V052736; Fri, 12 Oct 2012 06:16:52 GMT (envelope-from joel@svn.freebsd.org) Received: (from joel@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q9C6GqCi052733; Fri, 12 Oct 2012 06:16:52 GMT (envelope-from joel@svn.freebsd.org) Message-Id: <201210120616.q9C6GqCi052733@svn.freebsd.org> From: Joel Dahl Date: Fri, 12 Oct 2012 06:16:52 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r241479 - head/share/man/man4 X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 12 Oct 2012 06:16:52 -0000 Author: joel (doc committer) Date: Fri Oct 12 06:16:51 2012 New Revision: 241479 URL: http://svn.freebsd.org/changeset/base/241479 Log: Remove whitespace. Modified: head/share/man/man4/nvd.4 head/share/man/man4/nvme.4 Modified: head/share/man/man4/nvd.4 ============================================================================== --- head/share/man/man4/nvd.4 Fri Oct 12 03:09:59 2012 (r241478) +++ head/share/man/man4/nvd.4 Fri Oct 12 06:16:51 2012 (r241479) @@ -64,7 +64,7 @@ driver for notification of existing NVMe I/O commands. .Sh SEE ALSO .Xr nvme 4 , -.Xr nvmecontrol 8 , +.Xr nvmecontrol 8 , .Xr disk 9 . .Sh AUTHORS .An -nosplit @@ -85,7 +85,6 @@ The following areas of development and t .Bl -bullet .It testing on i386 -.It +.It command timeout error handling .El - Modified: head/share/man/man4/nvme.4 ============================================================================== --- head/share/man/man4/nvme.4 Fri Oct 12 03:09:59 2012 (r241478) +++ head/share/man/man4/nvme.4 Fri Oct 12 06:16:51 2012 (r241479) @@ -152,7 +152,7 @@ and completion queues to the console. The .Nm driver was developed by Intel and originally written by -.An Jim Harris Aq jimharris@FreeBSD.org , +.An Jim Harris Aq jimharris@FreeBSD.org , with contributions from Joe Golio at EMC. .Pp This man page was written by From owner-svn-src-head@FreeBSD.ORG Fri Oct 12 09:24:24 2012 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id D23ABBCD; Fri, 12 Oct 2012 09:24:24 +0000 (UTC) (envelope-from glebius@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id A23B88FC12; Fri, 12 Oct 2012 09:24:24 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id q9C9OObR076099; Fri, 12 Oct 2012 09:24:24 GMT (envelope-from glebius@svn.freebsd.org) Received: (from glebius@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q9C9OOQj076094; Fri, 12 Oct 2012 09:24:24 GMT (envelope-from glebius@svn.freebsd.org) Message-Id: <201210120924.q9C9OOQj076094@svn.freebsd.org> From: Gleb Smirnoff Date: Fri, 12 Oct 2012 09:24:24 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r241480 - head/sys/netinet X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 12 Oct 2012 09:24:24 -0000 Author: glebius Date: Fri Oct 12 09:24:24 2012 New Revision: 241480 URL: http://svn.freebsd.org/changeset/base/241480 Log: In ip_stripoptions(): - Remove unused argument and incorrect comment. - Fixup ip_len after stripping. Modified: head/sys/netinet/ip_options.c head/sys/netinet/ip_options.h head/sys/netinet/tcp_input.c head/sys/netinet/udp_usrreq.c Modified: head/sys/netinet/ip_options.c ============================================================================== --- head/sys/netinet/ip_options.c Fri Oct 12 06:16:51 2012 (r241479) +++ head/sys/netinet/ip_options.c Fri Oct 12 09:24:24 2012 (r241480) @@ -453,14 +453,10 @@ ip_srcroute(struct mbuf *m0) } /* - * Strip out IP options, at higher level protocol in the kernel. Second - * argument is buffer to which options will be moved, and return value is - * their length. - * - * XXX should be deleted; last arg currently ignored. + * Strip out IP options, at higher level protocol in the kernel. */ void -ip_stripoptions(struct mbuf *m, struct mbuf *mopt) +ip_stripoptions(struct mbuf *m) { int i; struct ip *ip = mtod(m, struct ip *); @@ -476,6 +472,7 @@ ip_stripoptions(struct mbuf *m, struct m m->m_pkthdr.len -= olen; ip->ip_v = IPVERSION; ip->ip_hl = sizeof(struct ip) >> 2; + ip->ip_len -= olen; } /* Modified: head/sys/netinet/ip_options.h ============================================================================== --- head/sys/netinet/ip_options.h Fri Oct 12 06:16:51 2012 (r241479) +++ head/sys/netinet/ip_options.h Fri Oct 12 09:24:24 2012 (r241480) @@ -54,7 +54,7 @@ int ip_dooptions(struct mbuf *, int); struct mbuf *ip_insertoptions(struct mbuf *, struct mbuf *, int *); int ip_optcopy(struct ip *, struct ip *); int ip_pcbopts(struct inpcb *, int, struct mbuf *); -void ip_stripoptions(struct mbuf *, struct mbuf *); +void ip_stripoptions(struct mbuf *); struct mbuf *ip_srcroute(struct mbuf *); #endif /* !_NETINET_IP_OPTIONS_H_ */ Modified: head/sys/netinet/tcp_input.c ============================================================================== --- head/sys/netinet/tcp_input.c Fri Oct 12 06:16:51 2012 (r241479) +++ head/sys/netinet/tcp_input.c Fri Oct 12 09:24:24 2012 (r241480) @@ -632,7 +632,7 @@ tcp_input(struct mbuf *m, int off0) * Note: IP leaves IP header in first mbuf. */ if (off0 > sizeof (struct ip)) { - ip_stripoptions(m, (struct mbuf *)0); + ip_stripoptions(m); off0 = sizeof(struct ip); } if (m->m_len < sizeof (struct tcpiphdr)) { Modified: head/sys/netinet/udp_usrreq.c ============================================================================== --- head/sys/netinet/udp_usrreq.c Fri Oct 12 06:16:51 2012 (r241479) +++ head/sys/netinet/udp_usrreq.c Fri Oct 12 09:24:24 2012 (r241480) @@ -354,7 +354,7 @@ udp_input(struct mbuf *m, int off) * check the checksum with options still present. */ if (iphlen > sizeof (struct ip)) { - ip_stripoptions(m, (struct mbuf *)0); + ip_stripoptions(m); iphlen = sizeof(struct ip); } From owner-svn-src-head@FreeBSD.ORG Fri Oct 12 09:32:39 2012 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id 12B65F14; Fri, 12 Oct 2012 09:32:39 +0000 (UTC) (envelope-from glebius@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id F0C7C8FC0C; Fri, 12 Oct 2012 09:32:38 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id q9C9WcBf077029; Fri, 12 Oct 2012 09:32:38 GMT (envelope-from glebius@svn.freebsd.org) Received: (from glebius@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q9C9WcpF077027; Fri, 12 Oct 2012 09:32:38 GMT (envelope-from glebius@svn.freebsd.org) Message-Id: <201210120932.q9C9WcpF077027@svn.freebsd.org> From: Gleb Smirnoff Date: Fri, 12 Oct 2012 09:32:38 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r241481 - head/sys/netinet X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 12 Oct 2012 09:32:39 -0000 Author: glebius Date: Fri Oct 12 09:32:38 2012 New Revision: 241481 URL: http://svn.freebsd.org/changeset/base/241481 Log: Revert fixup of ip_len from r241480. Now stack isn't yet ready for that change. Modified: head/sys/netinet/ip_options.c Modified: head/sys/netinet/ip_options.c ============================================================================== --- head/sys/netinet/ip_options.c Fri Oct 12 09:24:24 2012 (r241480) +++ head/sys/netinet/ip_options.c Fri Oct 12 09:32:38 2012 (r241481) @@ -472,7 +472,6 @@ ip_stripoptions(struct mbuf *m) m->m_pkthdr.len -= olen; ip->ip_v = IPVERSION; ip->ip_hl = sizeof(struct ip) >> 2; - ip->ip_len -= olen; } /* From owner-svn-src-head@FreeBSD.ORG Fri Oct 12 12:27:31 2012 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id 632EC90A; Fri, 12 Oct 2012 12:27:31 +0000 (UTC) (envelope-from glebius@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 4BED78FC0A; Fri, 12 Oct 2012 12:27:31 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id q9CCRV2I002172; Fri, 12 Oct 2012 12:27:31 GMT (envelope-from glebius@svn.freebsd.org) Received: (from glebius@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q9CCRVng002170; Fri, 12 Oct 2012 12:27:31 GMT (envelope-from glebius@svn.freebsd.org) Message-Id: <201210121227.q9CCRVng002170@svn.freebsd.org> From: Gleb Smirnoff Date: Fri, 12 Oct 2012 12:27:31 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r241482 - head/share/man/man4 X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 12 Oct 2012 12:27:31 -0000 Author: glebius Date: Fri Oct 12 12:27:30 2012 New Revision: 241482 URL: http://svn.freebsd.org/changeset/base/241482 Log: Be more explicit on how "intact" incoming packets in raw sockets are. Modified: head/share/man/man4/ip.4 Modified: head/share/man/man4/ip.4 ============================================================================== --- head/share/man/man4/ip.4 Fri Oct 12 09:32:38 2012 (r241481) +++ head/share/man/man4/ip.4 Fri Oct 12 12:27:30 2012 (r241482) @@ -32,7 +32,7 @@ .\" @(#)ip.4 8.2 (Berkeley) 11/30/93 .\" $FreeBSD$ .\" -.Dd September 20, 2012 +.Dd Ocotber 12, 2012 .Dt IP 4 .Os .Sh NAME @@ -761,7 +761,11 @@ unless the option has been set. Incoming packets are received with .Tn IP -header and options intact. +header and options intact, except for +.Va ip_len +and +.Va ip_off +fields converted to host byte order. .Pp .Dv IP_HDRINCL indicates the complete IP header is included with the data From owner-svn-src-head@FreeBSD.ORG Fri Oct 12 14:51:06 2012 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id C08108E5; Fri, 12 Oct 2012 14:51:06 +0000 (UTC) (envelope-from mdf356@gmail.com) Received: from mail-pb0-f54.google.com (mail-pb0-f54.google.com [209.85.160.54]) by mx1.freebsd.org (Postfix) with ESMTP id 772188FC14; Fri, 12 Oct 2012 14:51:06 +0000 (UTC) Received: by mail-pb0-f54.google.com with SMTP id rp8so3244098pbb.13 for ; Fri, 12 Oct 2012 07:51:06 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:sender:in-reply-to:references:date :x-google-sender-auth:message-id:subject:from:to:cc:content-type; bh=9a4egDtGJEbp5m1TvEVhGm0w/7Dca2MQpMxA5naD7AA=; b=gUKZ19uSwEdzKMvqyEqNlO+v3Q8zEdc73hiA1Vf0jqfPN1y0hOwE/idHbHkZek/Uz6 AUf8+Tlni6TRo22E4MtXgVVk0omd2qZCZo1fo1nO5/C6SFA4RXabsRGk7KtzccW/jLyI R778U+HL+RRA98Qi+zr9p1BjjyYE8Oftve9Mz/NpX4CBPtoncXROGBeZJ9t3Tmdgtu10 iYdt0RV/JX9ZnnPu2zheq/Kxu9reYhIi7sXgtnC1eXVC0Q5fAZvgPuTS6O56wqj/oI8q 7scVUl0r3FjDxXXAbfY+h/b70t1tfQShTuyLnaVtV6OQV81rp2oZmQFcdgemtZPWtS10 2kYw== MIME-Version: 1.0 Received: by 10.68.233.196 with SMTP id ty4mr14099235pbc.23.1350053465831; Fri, 12 Oct 2012 07:51:05 -0700 (PDT) Sender: mdf356@gmail.com Received: by 10.68.223.105 with HTTP; Fri, 12 Oct 2012 07:51:05 -0700 (PDT) In-Reply-To: <20121012045530.GK89655@FreeBSD.org> References: <201210120131.q9C1V3jM018799@svn.freebsd.org> <20121012045530.GK89655@FreeBSD.org> Date: Fri, 12 Oct 2012 07:51:05 -0700 X-Google-Sender-Auth: v6STCyl-zo_ptqhjfXOK8qOjl_k Message-ID: Subject: Re: svn commit: r241471 - head/share/man/man9 From: mdf@FreeBSD.org To: Gleb Smirnoff Content-Type: text/plain; charset=ISO-8859-1 Cc: svn-src-head@freebsd.org, Kevin Lo , svn-src-all@freebsd.org, src-committers@freebsd.org X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 12 Oct 2012 14:51:06 -0000 On Thu, Oct 11, 2012 at 9:55 PM, Gleb Smirnoff wrote: > On Fri, Oct 12, 2012 at 01:31:03AM +0000, Kevin Lo wrote: > K> Author: kevlo > K> Date: Fri Oct 12 01:31:02 2012 > K> New Revision: 241471 > K> URL: http://svn.freebsd.org/changeset/base/241471 > K> > K> Log: > K> Since the moduledata structure member priv is a void pointer, using > K> NULL instead of 0 when dealing with pointers. > K> > K> Modified: > K> head/share/man/man9/module.9 > K> > K> Modified: head/share/man/man9/module.9 > K> ============================================================================== > K> --- head/share/man/man9/module.9 Thu Oct 11 23:41:18 2012 (r241470) > K> +++ head/share/man/man9/module.9 Fri Oct 12 01:31:02 2012 (r241471) > K> @@ -99,7 +99,7 @@ static int foo_handler(module_t mod, int > K> static moduledata_t mod_data= { > K> "foo", > K> foo_handler, > K> - 0 > K> + NULL > K> }; > K> > K> MODULE_VERSION(foo, 1); > > I think we should provide C99 sparse initializers for structures in > all manpages in section 9, as well as use only such initializers in any new > code added to tree. For man pages and .c files, that'd be fine. But since it's still possible to build C++ kernel modules, header files can't do this since named initializers don't have the same syntax in C++ (unless they fixed this in C++11?) Thanks, matthew From owner-svn-src-head@FreeBSD.ORG Fri Oct 12 15:03:29 2012 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id 8B45FC98; Fri, 12 Oct 2012 15:03:29 +0000 (UTC) (envelope-from emaste@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 736928FC08; Fri, 12 Oct 2012 15:03:29 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id q9CF3TPj024589; Fri, 12 Oct 2012 15:03:29 GMT (envelope-from emaste@svn.freebsd.org) Received: (from emaste@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q9CF3TaZ024587; Fri, 12 Oct 2012 15:03:29 GMT (envelope-from emaste@svn.freebsd.org) Message-Id: <201210121503.q9CF3TaZ024587@svn.freebsd.org> From: Ed Maste Date: Fri, 12 Oct 2012 15:03:29 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r241484 - head/usr.bin/w X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 12 Oct 2012 15:03:29 -0000 Author: emaste Date: Fri Oct 12 15:03:28 2012 New Revision: 241484 URL: http://svn.freebsd.org/changeset/base/241484 Log: Use CLOCK_UPTIME to get the uptime. Modified: head/usr.bin/w/w.c Modified: head/usr.bin/w/w.c ============================================================================== --- head/usr.bin/w/w.c Fri Oct 12 13:17:19 2012 (r241483) +++ head/usr.bin/w/w.c Fri Oct 12 15:03:28 2012 (r241484) @@ -447,7 +447,7 @@ pr_header(time_t *nowp, int nusers) /* * Print how long system has been up. */ - if (clock_gettime(CLOCK_MONOTONIC, &tp) != -1) { + if (clock_gettime(CLOCK_UPTIME, &tp) != -1) { uptime = tp.tv_sec; if (uptime > 60) uptime += 30; From owner-svn-src-head@FreeBSD.ORG Fri Oct 12 17:18:25 2012 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id DA47A702; Fri, 12 Oct 2012 17:18:24 +0000 (UTC) (envelope-from mav@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id C2BAF8FC0A; Fri, 12 Oct 2012 17:18:24 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id q9CHIOLG044133; Fri, 12 Oct 2012 17:18:24 GMT (envelope-from mav@svn.freebsd.org) Received: (from mav@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q9CHIOmV044128; Fri, 12 Oct 2012 17:18:24 GMT (envelope-from mav@svn.freebsd.org) Message-Id: <201210121718.q9CHIOmV044128@svn.freebsd.org> From: Alexander Motin Date: Fri, 12 Oct 2012 17:18:24 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r241485 - in head/sys/cam: . ata scsi X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 12 Oct 2012 17:18:25 -0000 Author: mav Date: Fri Oct 12 17:18:24 2012 New Revision: 241485 URL: http://svn.freebsd.org/changeset/base/241485 Log: Protect xpt_getattr() calls with the SIM lock and assert that. Submitted by: ken@ (earlier version) Modified: head/sys/cam/ata/ata_da.c head/sys/cam/cam_xpt.c head/sys/cam/scsi/scsi_da.c head/sys/cam/scsi/scsi_pass.c Modified: head/sys/cam/ata/ata_da.c ============================================================================== --- head/sys/cam/ata/ata_da.c Fri Oct 12 15:03:28 2012 (r241484) +++ head/sys/cam/ata/ata_da.c Fri Oct 12 17:18:24 2012 (r241485) @@ -914,17 +914,17 @@ adasysctlinit(void *context, int pending static int adagetattr(struct bio *bp) { - int ret = -1; + int ret; struct cam_periph *periph; - if (bp->bio_disk == NULL || bp->bio_disk->d_drv1 == NULL) - return ENXIO; periph = (struct cam_periph *)bp->bio_disk->d_drv1; - if (periph->path == NULL) - return ENXIO; + if (periph == NULL) + return (ENXIO); + cam_periph_lock(periph); ret = xpt_getattr(bp->bio_data, bp->bio_length, bp->bio_attribute, periph->path); + cam_periph_unlock(periph); if (ret == 0) bp->bio_completed = bp->bio_length; return ret; Modified: head/sys/cam/cam_xpt.c ============================================================================== --- head/sys/cam/cam_xpt.c Fri Oct 12 15:03:28 2012 (r241484) +++ head/sys/cam/cam_xpt.c Fri Oct 12 17:18:24 2012 (r241485) @@ -1111,6 +1111,8 @@ xpt_getattr(char *buf, size_t len, const int ret = -1; struct ccb_dev_advinfo cdai; + mtx_assert(path->bus->sim->mtx, MA_OWNED); + memset(&cdai, 0, sizeof(cdai)); xpt_setup_ccb(&cdai.ccb_h, path, CAM_PRIORITY_NORMAL); cdai.ccb_h.func_code = XPT_DEV_ADVINFO; Modified: head/sys/cam/scsi/scsi_da.c ============================================================================== --- head/sys/cam/scsi/scsi_da.c Fri Oct 12 15:03:28 2012 (r241484) +++ head/sys/cam/scsi/scsi_da.c Fri Oct 12 17:18:24 2012 (r241485) @@ -1211,17 +1211,17 @@ dadump(void *arg, void *virtual, vm_offs static int dagetattr(struct bio *bp) { - int ret = -1; + int ret; struct cam_periph *periph; - if (bp->bio_disk == NULL || bp->bio_disk->d_drv1 == NULL) - return ENXIO; periph = (struct cam_periph *)bp->bio_disk->d_drv1; - if (periph->path == NULL) - return ENXIO; + if (periph == NULL) + return (ENXIO); + cam_periph_lock(periph); ret = xpt_getattr(bp->bio_data, bp->bio_length, bp->bio_attribute, periph->path); + cam_periph_unlock(periph); if (ret == 0) bp->bio_completed = bp->bio_length; return ret; Modified: head/sys/cam/scsi/scsi_pass.c ============================================================================== --- head/sys/cam/scsi/scsi_pass.c Fri Oct 12 15:03:28 2012 (r241484) +++ head/sys/cam/scsi/scsi_pass.c Fri Oct 12 17:18:24 2012 (r241485) @@ -212,27 +212,26 @@ pass_add_physpath(void *context, int pen */ periph = context; softc = periph->softc; + physpath = malloc(MAXPATHLEN, M_DEVBUF, M_WAITOK); cam_periph_lock(periph); if (periph->flags & CAM_PERIPH_INVALID) { cam_periph_unlock(periph); - return; + goto out; } - cam_periph_unlock(periph); - physpath = malloc(MAXPATHLEN, M_DEVBUF, M_WAITOK); if (xpt_getattr(physpath, MAXPATHLEN, "GEOM::physpath", periph->path) == 0 && strlen(physpath) != 0) { + cam_periph_unlock(periph); make_dev_physpath_alias(MAKEDEV_WAITOK, &softc->alias_dev, softc->dev, softc->alias_dev, physpath); + cam_periph_lock(periph); } - free(physpath, M_DEVBUF); /* * Now that we've made our alias, we no longer have to have a * reference to the device. */ - cam_periph_lock(periph); if ((softc->flags & PASS_FLAG_INITIAL_PHYSPATH) == 0) { softc->flags |= PASS_FLAG_INITIAL_PHYSPATH; cam_periph_unlock(periph); @@ -240,6 +239,9 @@ pass_add_physpath(void *context, int pen } else cam_periph_unlock(periph); + +out: + free(physpath, M_DEVBUF); } static void From owner-svn-src-head@FreeBSD.ORG Fri Oct 12 18:21:32 2012 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id 233FD2AA; Fri, 12 Oct 2012 18:21:32 +0000 (UTC) (envelope-from mav@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id E6CB48FC16; Fri, 12 Oct 2012 18:21:31 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id q9CILVOR053196; Fri, 12 Oct 2012 18:21:31 GMT (envelope-from mav@svn.freebsd.org) Received: (from mav@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q9CILV5T053194; Fri, 12 Oct 2012 18:21:31 GMT (envelope-from mav@svn.freebsd.org) Message-Id: <201210121821.q9CILV5T053194@svn.freebsd.org> From: Alexander Motin Date: Fri, 12 Oct 2012 18:21:31 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r241488 - head/sys/cam/scsi X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 12 Oct 2012 18:21:32 -0000 Author: mav Date: Fri Oct 12 18:21:31 2012 New Revision: 241488 URL: http://svn.freebsd.org/changeset/base/241488 Log: Get SIM lock in several places while calling CAM functions. This fixes several use-after-free panics on systems with SAS enclosures. Submitted by: ken@, mav@ Modified: head/sys/cam/scsi/scsi_enc_ses.c Modified: head/sys/cam/scsi/scsi_enc_ses.c ============================================================================== --- head/sys/cam/scsi/scsi_enc_ses.c Fri Oct 12 18:14:54 2012 (r241487) +++ head/sys/cam/scsi/scsi_enc_ses.c Fri Oct 12 18:21:31 2012 (r241488) @@ -886,6 +886,7 @@ ses_path_iter_devid_callback(enc_softc_t struct device_match_result *device_match; struct device_match_pattern *device_pattern; ses_path_iter_args_t *args; + struct cam_sim *sim; args = (ses_path_iter_args_t *)arg; match_pattern.type = DEV_MATCH_DEVICE; @@ -920,14 +921,18 @@ ses_path_iter_devid_callback(enc_softc_t return; device_match = &match_result.result.device_result; - if (xpt_create_path(&cdm.ccb_h.path, /*periph*/NULL, - device_match->path_id, - device_match->target_id, - device_match->target_lun) != CAM_REQ_CMP) + if (xpt_create_path_unlocked(&cdm.ccb_h.path, /*periph*/NULL, + device_match->path_id, + device_match->target_id, + device_match->target_lun) != CAM_REQ_CMP) return; args->callback(enc, elem, cdm.ccb_h.path, args->callback_arg); + + sim = xpt_path_sim(cdm.ccb_h.path); + CAM_SIM_LOCK(sim); xpt_free_path(cdm.ccb_h.path); + CAM_SIM_UNLOCK(sim); } /** @@ -999,7 +1004,7 @@ ses_setphyspath_callback(enc_softc_t *en args = (ses_setphyspath_callback_args_t *)arg; old_physpath = malloc(MAXPATHLEN, M_SCSIENC, M_WAITOK|M_ZERO); - + cam_periph_lock(enc->periph); xpt_setup_ccb(&cdai.ccb_h, path, CAM_PRIORITY_NORMAL); cdai.ccb_h.func_code = XPT_DEV_ADVINFO; cdai.buftype = CDAI_TYPE_PHYS_PATH; @@ -1024,6 +1029,7 @@ ses_setphyspath_callback(enc_softc_t *en if (cdai.ccb_h.status == CAM_REQ_CMP) args->num_set++; } + cam_periph_unlock(enc->periph); free(old_physpath, M_SCSIENC); } @@ -1063,9 +1069,11 @@ ses_set_physpath(enc_softc_t *enc, enc_e ret = ENOMEM; goto out; } + cam_periph_lock(enc->periph); xpt_action((union ccb *)&cdai); if ((cdai.ccb_h.status & CAM_DEV_QFRZN) != 0) cam_release_devq(cdai.ccb_h.path, 0, 0, 0, FALSE); + cam_periph_unlock(enc->periph); if (cdai.ccb_h.status != CAM_REQ_CMP) goto out; From owner-svn-src-head@FreeBSD.ORG Fri Oct 12 19:53:14 2012 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id 263565D1; Fri, 12 Oct 2012 19:53:14 +0000 (UTC) (envelope-from glebius@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id E96678FC0C; Fri, 12 Oct 2012 19:53:13 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id q9CJrDKC065944; Fri, 12 Oct 2012 19:53:13 GMT (envelope-from glebius@svn.freebsd.org) Received: (from glebius@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q9CJrD77065942; Fri, 12 Oct 2012 19:53:13 GMT (envelope-from glebius@svn.freebsd.org) Message-Id: <201210121953.q9CJrD77065942@svn.freebsd.org> From: Gleb Smirnoff Date: Fri, 12 Oct 2012 19:53:13 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r241491 - head/share/man/man4 X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 12 Oct 2012 19:53:14 -0000 Author: glebius Date: Fri Oct 12 19:53:13 2012 New Revision: 241491 URL: http://svn.freebsd.org/changeset/base/241491 Log: Fix type in last commit. Submitted by: brueffer Modified: head/share/man/man4/ip.4 Modified: head/share/man/man4/ip.4 ============================================================================== --- head/share/man/man4/ip.4 Fri Oct 12 18:49:07 2012 (r241490) +++ head/share/man/man4/ip.4 Fri Oct 12 19:53:13 2012 (r241491) @@ -32,7 +32,7 @@ .\" @(#)ip.4 8.2 (Berkeley) 11/30/93 .\" $FreeBSD$ .\" -.Dd Ocotber 12, 2012 +.Dd October 12, 2012 .Dt IP 4 .Os .Sh NAME From owner-svn-src-head@FreeBSD.ORG Fri Oct 12 21:31:45 2012 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id 98E58DC4; Fri, 12 Oct 2012 21:31:45 +0000 (UTC) (envelope-from jhb@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 7FF7A8FC0C; Fri, 12 Oct 2012 21:31:45 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id q9CLVjjP079361; Fri, 12 Oct 2012 21:31:45 GMT (envelope-from jhb@svn.freebsd.org) Received: (from jhb@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q9CLVjEQ079353; Fri, 12 Oct 2012 21:31:45 GMT (envelope-from jhb@svn.freebsd.org) Message-Id: <201210122131.q9CLVjEQ079353@svn.freebsd.org> From: John Baldwin Date: Fri, 12 Oct 2012 21:31:45 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r241492 - head/sys/dev/advansys X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 12 Oct 2012 21:31:45 -0000 Author: jhb Date: Fri Oct 12 21:31:44 2012 New Revision: 241492 URL: http://svn.freebsd.org/changeset/base/241492 Log: Add locking to adv(4) driver and mark it MPSAFE. - Disable the support for the second channel on twin-channel EISA cards as the current incarnation can't possibly work correctly (it hasn't worked since switching to new-bus where new-bus allocates the softc). If anyone bothers to test this again it can be fixed properly and brought back. - Use device_printf() and device_get_nameunit() instead of adv_name(). - Remove use of explicit bus space handles and tags. - Use PCI bus accessors and helper routines rather than accessing config registers directly. - Handle failures from adv_attach(). Tested by: no one (hope it works) Modified: head/sys/dev/advansys/adv_eisa.c head/sys/dev/advansys/adv_isa.c head/sys/dev/advansys/adv_pci.c head/sys/dev/advansys/advansys.c head/sys/dev/advansys/advansys.h head/sys/dev/advansys/advlib.c head/sys/dev/advansys/advlib.h Modified: head/sys/dev/advansys/adv_eisa.c ============================================================================== --- head/sys/dev/advansys/adv_eisa.c Fri Oct 12 19:53:13 2012 (r241491) +++ head/sys/dev/advansys/adv_eisa.c Fri Oct 12 21:31:44 2012 (r241492) @@ -131,17 +131,27 @@ adv_eisa_probe(device_t dev) return 0; } +/* + * The adv_b stuff to handle twin-channel cards will not work in its current + * incarnation. It tries to reuse the same softc since adv_alloc() doesn't + * actually allocate a softc. It also tries to reuse the same unit number + * for both sims. This can be re-enabled if someone fixes it properly. + */ static int adv_eisa_attach(device_t dev) { struct adv_softc *adv; +#if 0 struct adv_softc *adv_b; +#endif struct resource *io; struct resource *irq; int rid, error; void *ih; +#if 0 adv_b = NULL; +#endif rid = 0; io = bus_alloc_resource_any(dev, SYS_RES_IOPORT, &rid, RF_ACTIVE); @@ -162,8 +172,8 @@ adv_eisa_attach(device_t dev) switch (eisa_get_id(dev) & ~0xF) { case EISA_DEVICE_ID_ADVANSYS_750: - adv_b = adv_alloc(dev, rman_get_bustag(io), - rman_get_bushandle(io) + ADV_EISA_OFFSET_CHAN2); +#if 0 + adv_b = adv_alloc(dev, io, ADV_EISA_OFFSET_CHAN2); if (adv_b == NULL) goto bad; @@ -183,26 +193,28 @@ adv_eisa_attach(device_t dev) /* nsegments */ ~0, /* maxsegsz */ ADV_EISA_MAX_DMA_COUNT, /* flags */ 0, - /* lockfunc */ busdma_lock_mutex, - /* lockarg */ &Giant, + /* lockfunc */ NULL, + /* lockarg */ NULL, &adv_b->parent_dmat); if (error != 0) { - printf("%s: Could not allocate DMA tag - error %d\n", - adv_name(adv_b), error); + device_printf(dev, "Could not allocate DMA tag - error %d\n", + error); adv_free(adv_b); goto bad; } adv_b->init_level++; +#endif /* FALLTHROUGH */ case EISA_DEVICE_ID_ADVANSYS_740: - adv = adv_alloc(dev, rman_get_bustag(io), - rman_get_bushandle(io) + ADV_EISA_OFFSET_CHAN1); + adv = adv_alloc(dev, io, ADV_EISA_OFFSET_CHAN1); if (adv == NULL) { +#if 0 if (adv_b != NULL) adv_free(adv_b); +#endif goto bad; } @@ -222,13 +234,13 @@ adv_eisa_attach(device_t dev) /* nsegments */ ~0, /* maxsegsz */ ADV_EISA_MAX_DMA_COUNT, /* flags */ 0, - /* lockfunc */ busdma_lock_mutex, - /* lockarg */ &Giant, + /* lockfunc */ NULL, + /* lockarg */ NULL, &adv->parent_dmat); if (error != 0) { - printf("%s: Could not allocate DMA tag - error %d\n", - adv_name(adv), error); + device_printf(dev, "Could not allocate DMA tag - error %d\n", + error); adv_free(adv); goto bad; } @@ -244,7 +256,7 @@ adv_eisa_attach(device_t dev) if (overrun_buf == NULL) { /* Need to allocate our overrun buffer */ if (bus_dma_tag_create( - /* parent */ adv->parent_dmat, + /* parent */ bus_get_dma_tag(dev), /* alignment */ 8, /* boundary */ 0, /* lowaddr */ ADV_EISA_MAX_DMA_ADDR, @@ -255,8 +267,8 @@ adv_eisa_attach(device_t dev) /* nsegments */ 1, /* maxsegsz */ BUS_SPACE_MAXSIZE_32BIT, /* flags */ 0, - /* lockfunc */ busdma_lock_mutex, - /* lockarg */ &Giant, + /* lockfunc */ NULL, + /* lockarg */ NULL, &overrun_dmat) != 0) { adv_free(adv); goto bad; @@ -292,14 +304,17 @@ adv_eisa_attach(device_t dev) if (adv_init(adv) != 0) { adv_free(adv); +#if 0 if (adv_b != NULL) adv_free(adv_b); - return(-1); +#endif + goto bad; } adv->max_dma_count = ADV_EISA_MAX_DMA_COUNT; adv->max_dma_addr = ADV_EISA_MAX_DMA_ADDR; +#if 0 if (adv_b != NULL) { /* * Stop the chip. @@ -317,24 +332,33 @@ adv_eisa_attach(device_t dev) adv_b->max_dma_addr = ADV_EISA_MAX_DMA_ADDR; } } +#endif /* * Enable our interrupt handler. */ - bus_setup_intr(dev, irq, INTR_TYPE_CAM|INTR_ENTROPY, NULL, adv_intr, - adv, &ih); + if (bus_setup_intr(dev, irq, INTR_TYPE_CAM|INTR_ENTROPY|INTR_MPSAFE, NULL, + adv_intr, adv, &ih) != 0) { + adv_free(adv); + goto bad; + } - /* Attach sub-devices - always succeeds */ - adv_attach(adv); + /* Attach sub-devices */ + if (adv_attach(adv) != 0) { + adv_free(adv); + goto bad; + } +#if 0 if (adv_b != NULL) adv_attach(adv_b); +#endif return 0; bad: bus_release_resource(dev, SYS_RES_IOPORT, 0, io); bus_release_resource(dev, SYS_RES_IRQ, 0, irq); - return -1; + return ENXIO; } static device_method_t adv_eisa_methods[] = { Modified: head/sys/dev/advansys/adv_isa.c ============================================================================== --- head/sys/dev/advansys/adv_isa.c Fri Oct 12 19:53:13 2012 (r241491) +++ head/sys/dev/advansys/adv_isa.c Fri Oct 12 21:31:44 2012 (r241492) @@ -135,12 +135,13 @@ adv_isa_probe(device_t dev) if ((port_index > max_port_index) || (iobase != adv_isa_ioports[port_index])) { if (bootverbose) - printf("adv%d: Invalid baseport of 0x%lx specified. " - "Nearest valid baseport is 0x%x. Failing " - "probe.\n", device_get_unit(dev), iobase, - (port_index <= max_port_index) ? - adv_isa_ioports[port_index] : - adv_isa_ioports[max_port_index]); + device_printf(dev, + "Invalid baseport of 0x%lx specified. " + "Nearest valid baseport is 0x%x. Failing " + "probe.\n", iobase, + (port_index <= max_port_index) ? + adv_isa_ioports[port_index] : + adv_isa_ioports[max_port_index]); return ENXIO; } max_port_index = port_index; @@ -169,8 +170,7 @@ adv_isa_probe(device_t dev) if (iores == NULL) continue; - if (adv_find_signature(rman_get_bustag(iores), - rman_get_bushandle(iores)) == 0) { + if (adv_find_signature(iores) == 0) { bus_release_resource(dev, SYS_RES_IOPORT, 0, iores); continue; } @@ -179,8 +179,7 @@ adv_isa_probe(device_t dev) * Got one. Now allocate our softc * and see if we can initialize the card. */ - adv = adv_alloc(dev, rman_get_bustag(iores), - rman_get_bushandle(iores)); + adv = adv_alloc(dev, iores, 0); if (adv == NULL) { bus_release_resource(dev, SYS_RES_IOPORT, 0, iores); break; @@ -238,13 +237,13 @@ adv_isa_probe(device_t dev) /* nsegments */ ~0, /* maxsegsz */ maxsegsz, /* flags */ 0, - /* lockfunc */ busdma_lock_mutex, - /* lockarg */ &Giant, + /* lockfunc */ NULL, + /* lockarg */ NULL, &adv->parent_dmat); if (error != 0) { - printf("%s: Could not allocate DMA tag - error %d\n", - adv_name(adv), error); + device_printf(dev, + "Could not allocate DMA tag - error %d\n", error); adv_free(adv); bus_release_resource(dev, SYS_RES_IOPORT, 0, iores); break; @@ -335,8 +334,11 @@ adv_isa_probe(device_t dev) irqres = bus_alloc_resource_any(dev, SYS_RES_IRQ, &rid, RF_ACTIVE); if (irqres == NULL || - bus_setup_intr(dev, irqres, INTR_TYPE_CAM|INTR_ENTROPY, - NULL, adv_intr, adv, &ih)) { + bus_setup_intr(dev, irqres, INTR_TYPE_CAM|INTR_ENTROPY| + INTR_MPSAFE, NULL, adv_intr, adv, &ih) != 0) { + if (irqres != NULL) + bus_release_resource(dev, SYS_RES_IRQ, rid, + irqres); bus_dmamap_unload(overrun_dmat, overrun_dmamap); bus_dmamem_free(overrun_dmat, overrun_buf, overrun_dmamap); Modified: head/sys/dev/advansys/adv_pci.c ============================================================================== --- head/sys/dev/advansys/adv_pci.c Fri Oct 12 19:53:13 2012 (r241491) +++ head/sys/dev/advansys/adv_pci.c Fri Oct 12 21:31:44 2012 (r241492) @@ -138,7 +138,6 @@ adv_pci_attach(device_t dev) { struct adv_softc *adv; u_int32_t id; - u_int32_t command; int error, rid, irqrid; void *ih; struct resource *iores, *irqres; @@ -146,19 +145,8 @@ adv_pci_attach(device_t dev) /* * Determine the chip version. */ - id = pci_read_config(dev, PCIR_DEVVENDOR, /*bytes*/4); - command = pci_read_config(dev, PCIR_COMMAND, /*bytes*/1); - - /* - * These cards do not allow memory mapped accesses, so we must - * ensure that I/O accesses are available or we won't be able - * to talk to them. - */ - if ((command & (PCIM_CMD_PORTEN|PCIM_CMD_BUSMASTEREN)) - != (PCIM_CMD_PORTEN|PCIM_CMD_BUSMASTEREN)) { - command |= PCIM_CMD_PORTEN|PCIM_CMD_BUSMASTEREN; - pci_write_config(dev, PCIR_COMMAND, command, /*bytes*/1); - } + id = pci_get_devid(dev); + pci_enable_busmaster(dev); /* * Early chips can't handle non-zero latency timer settings. @@ -174,13 +162,12 @@ adv_pci_attach(device_t dev) if (iores == NULL) return ENXIO; - if (adv_find_signature(rman_get_bustag(iores), - rman_get_bushandle(iores)) == 0) { + if (adv_find_signature(iores) == 0) { bus_release_resource(dev, SYS_RES_IOPORT, rid, iores); return ENXIO; } - adv = adv_alloc(dev, rman_get_bustag(iores), rman_get_bushandle(iores)); + adv = adv_alloc(dev, iores, 0); if (adv == NULL) { bus_release_resource(dev, SYS_RES_IOPORT, rid, iores); return ENXIO; @@ -199,13 +186,13 @@ adv_pci_attach(device_t dev) /* nsegments */ ~0, /* maxsegsz */ ADV_PCI_MAX_DMA_COUNT, /* flags */ 0, - /* lockfunc */ busdma_lock_mutex, - /* lockarg */ &Giant, + /* lockfunc */ NULL, + /* lockarg */ NULL, &adv->parent_dmat); if (error != 0) { - printf("%s: Could not allocate DMA tag - error %d\n", - adv_name(adv), error); + device_printf(dev, "Could not allocate DMA tag - error %d\n", + error); adv_free(adv); bus_release_resource(dev, SYS_RES_IOPORT, rid, iores); return ENXIO; @@ -227,8 +214,8 @@ adv_pci_attach(device_t dev) /* nsegments */ 1, /* maxsegsz */ BUS_SPACE_MAXSIZE_32BIT, /* flags */ 0, - /* lockfunc */ busdma_lock_mutex, - /* lockarg */ &Giant, + /* lockfunc */ NULL, + /* lockarg */ NULL, &overrun_dmat) != 0) { bus_dma_tag_destroy(adv->parent_dmat); adv_free(adv); @@ -308,14 +295,22 @@ adv_pci_attach(device_t dev) irqres = bus_alloc_resource_any(dev, SYS_RES_IRQ, &irqrid, RF_SHAREABLE | RF_ACTIVE); if (irqres == NULL || - bus_setup_intr(dev, irqres, INTR_TYPE_CAM|INTR_ENTROPY, NULL, - adv_intr, adv, &ih)) { + bus_setup_intr(dev, irqres, INTR_TYPE_CAM|INTR_ENTROPY|INTR_MPSAFE, + NULL, adv_intr, adv, &ih) != 0) { + if (irqres != NULL) + bus_release_resource(dev, SYS_RES_IRQ, irqrid, irqres); adv_free(adv); bus_release_resource(dev, SYS_RES_IOPORT, rid, iores); return ENXIO; } - adv_attach(adv); + if (adv_attach(adv) != 0) { + bus_teardown_intr(dev, irqres, ih); + bus_release_resource(dev, SYS_RES_IRQ, irqrid, irqres); + adv_free(adv); + bus_release_resource(dev, SYS_RES_IOPORT, rid, iores); + return ENXIO; + } return 0; } Modified: head/sys/dev/advansys/advansys.c ============================================================================== --- head/sys/dev/advansys/advansys.c Fri Oct 12 19:53:13 2012 (r241491) +++ head/sys/dev/advansys/advansys.c Fri Oct 12 21:31:44 2012 (r241492) @@ -49,6 +49,7 @@ __FBSDID("$FreeBSD$"); #include +#include #include #include #include @@ -79,6 +80,7 @@ __FBSDID("$FreeBSD$"); static void adv_action(struct cam_sim *sim, union ccb *ccb); static void adv_execute_ccb(void *arg, bus_dma_segment_t *dm_segs, int nsegments, int error); +static void adv_intr_locked(struct adv_softc *adv); static void adv_poll(struct cam_sim *sim); static void adv_run_doneq(struct adv_softc *adv); static struct adv_ccb_info * @@ -97,15 +99,14 @@ static __inline struct adv_ccb_info * adv_get_ccb_info(struct adv_softc *adv) { struct adv_ccb_info *cinfo; - int opri; - opri = splcam(); + if (!dumping) + mtx_assert(&adv->lock, MA_OWNED); if ((cinfo = SLIST_FIRST(&adv->free_ccb_infos)) != NULL) { SLIST_REMOVE_HEAD(&adv->free_ccb_infos, links); } else { cinfo = adv_alloc_ccb_info(adv); } - splx(opri); return (cinfo); } @@ -113,12 +114,11 @@ adv_get_ccb_info(struct adv_softc *adv) static __inline void adv_free_ccb_info(struct adv_softc *adv, struct adv_ccb_info *cinfo) { - int opri; - opri = splcam(); + if (!dumping) + mtx_assert(&adv->lock, MA_OWNED); cinfo->state = ACCB_FREE; SLIST_INSERT_HEAD(&adv->free_ccb_infos, cinfo, links); - splx(opri); } static __inline void @@ -139,6 +139,9 @@ adv_clear_state(struct adv_softc *adv, u static void adv_clear_state_really(struct adv_softc *adv, union ccb* ccb) { + + if (!dumping) + mtx_assert(&adv->lock, MA_OWNED); if ((adv->state & ADV_BUSDMA_BLOCK_CLEARED) != 0) adv->state &= ~(ADV_BUSDMA_BLOCK_CLEARED|ADV_BUSDMA_BLOCK); if ((adv->state & ADV_RESOURCE_SHORTAGE) != 0) { @@ -164,13 +167,14 @@ adv_clear_state_really(struct adv_softc */ ccb_h = LIST_FIRST(&adv->pending_ccbs); while (ccb_h != NULL) { - ccb_h->timeout_ch = - timeout(adv_timeout, (caddr_t)ccb_h, - (ccb_h->timeout * hz) / 1000); + cinfo = ccb_h->ccb_cinfo_ptr; + callout_reset(&cinfo->timer, + ccb_h->timeout * hz / 1000, adv_timeout, + ccb_h); ccb_h = LIST_NEXT(ccb_h, sim_links.le); } adv->state &= ~ADV_IN_TIMEOUT; - printf("%s: No longer in timeout\n", adv_name(adv)); + device_printf(adv->dev, "No longer in timeout\n"); } } if (adv->state == 0) @@ -186,15 +190,6 @@ adv_map(void *arg, bus_dma_segment_t *se *physaddr = segs->ds_addr; } -char * -adv_name(struct adv_softc *adv) -{ - static char name[10]; - - snprintf(name, sizeof(name), "adv%d", adv->unit); - return (name); -} - static void adv_action(struct cam_sim *sim, union ccb *ccb) { @@ -203,6 +198,7 @@ adv_action(struct cam_sim *sim, union cc CAM_DEBUG(ccb->ccb_h.path, CAM_DEBUG_TRACE, ("adv_action\n")); adv = (struct adv_softc *)cam_sim_softc(sim); + mtx_assert(&adv->lock, MA_OWNED); switch (ccb->ccb_h.func_code) { /* Common cases first */ @@ -229,10 +225,8 @@ adv_action(struct cam_sim *sim, union cc * to a single buffer */ if ((ccb_h->flags & CAM_DATA_PHYS) == 0) { - int s; int error; - s = splsoftvm(); error = bus_dmamap_load(adv->buffer_dmat, cinfo->dmamap, @@ -250,7 +244,6 @@ adv_action(struct cam_sim *sim, union cc adv_set_state(adv, ADV_BUSDMA_BLOCK); } - splx(s); } else { struct bus_dma_segment seg; @@ -299,7 +292,6 @@ adv_action(struct cam_sim *sim, union cc target_bit_vector targ_mask; struct adv_transinfo *tconf; u_int update_type; - int s; cts = &ccb->cts; targ_mask = ADV_TID_TO_TARGET_MASK(cts->ccb_h.target_id); @@ -320,7 +312,6 @@ adv_action(struct cam_sim *sim, union cc break; } - s = splcam(); scsi = &cts->proto_specific.scsi; spi = &cts->xport_specific.spi; if ((update_type & ADV_TRANS_GOAL) != 0) { @@ -387,7 +378,6 @@ adv_action(struct cam_sim *sim, union cc spi->sync_offset, update_type); } - splx(s); ccb->ccb_h.status = CAM_REQ_CMP; xpt_done(ccb); break; @@ -400,7 +390,6 @@ adv_action(struct cam_sim *sim, union cc struct ccb_trans_settings *cts; struct adv_transinfo *tconf; target_bit_vector target_mask; - int s; cts = &ccb->cts; target_mask = ADV_TID_TO_TARGET_MASK(cts->ccb_h.target_id); @@ -416,7 +405,6 @@ adv_action(struct cam_sim *sim, union cc scsi->flags &= ~CTS_SCSI_FLAGS_TAG_ENB; spi->flags &= ~CTS_SPI_FLAGS_DISC_ENB; - s = splcam(); if (cts->type == CTS_TYPE_CURRENT_SETTINGS) { tconf = &adv->tinfo[cts->ccb_h.target_id].current; if ((adv->disc_enable & target_mask) != 0) @@ -432,7 +420,6 @@ adv_action(struct cam_sim *sim, union cc } spi->sync_period = tconf->period; spi->sync_offset = tconf->offset; - splx(s); spi->bus_width = MSG_EXT_WDTR_BUS_8_BIT; spi->valid = CTS_SPI_VALID_SYNC_RATE | CTS_SPI_VALID_SYNC_OFFSET @@ -454,13 +441,10 @@ adv_action(struct cam_sim *sim, union cc } case XPT_RESET_BUS: /* Reset the specified SCSI bus */ { - int s; - s = splcam(); adv_stop_execution(adv); adv_reset_bus(adv, /*initiate_reset*/TRUE); adv_start_execution(adv); - splx(s); ccb->ccb_h.status = CAM_REQ_CMP; xpt_done(ccb); @@ -521,13 +505,14 @@ adv_execute_ccb(void *arg, bus_dma_segme struct adv_ccb_info *cinfo; struct adv_scsi_q scsiq; struct adv_sg_head sghead; - int s; csio = (struct ccb_scsiio *)arg; ccb_h = &csio->ccb_h; sim = xpt_path_sim(ccb_h->path); adv = (struct adv_softc *)cam_sim_softc(sim); cinfo = (struct adv_ccb_info *)csio->ccb_h.ccb_cinfo_ptr; + if (!dumping) + mtx_assert(&adv->lock, MA_OWNED); /* * Setup our done routine to release the simq on @@ -596,8 +581,6 @@ adv_execute_ccb(void *arg, bus_dma_segme scsiq.sg_head = NULL; } - s = splcam(); - /* * Last time we need to check if this SCB needs to * be aborted. @@ -608,7 +591,6 @@ adv_execute_ccb(void *arg, bus_dma_segme adv_clear_state(adv, (union ccb *)csio); adv_free_ccb_info(adv, cinfo); xpt_done((union ccb *)csio); - splx(s); return; } @@ -621,16 +603,14 @@ adv_execute_ccb(void *arg, bus_dma_segme adv_clear_state(adv, (union ccb *)csio); adv_free_ccb_info(adv, cinfo); xpt_done((union ccb *)csio); - splx(s); return; } cinfo->state |= ACCB_ACTIVE; ccb_h->status |= CAM_SIM_QUEUED; LIST_INSERT_HEAD(&adv->pending_ccbs, ccb_h, sim_links.le); /* Schedule our timeout */ - ccb_h->timeout_ch = - timeout(adv_timeout, csio, (ccb_h->timeout * hz)/1000); - splx(s); + callout_reset(&cinfo->timer, ccb_h->timeout * hz /1000, adv_timeout, + csio); } static struct adv_ccb_info * @@ -641,11 +621,12 @@ adv_alloc_ccb_info(struct adv_softc *adv cinfo = &adv->ccb_infos[adv->ccb_infos_allocated]; cinfo->state = ACCB_FREE; + callout_init_mtx(&cinfo->timer, &adv->lock, 0); error = bus_dmamap_create(adv->buffer_dmat, /*flags*/0, &cinfo->dmamap); if (error != 0) { - printf("%s: Unable to allocate CCB info " - "dmamap - error %d\n", adv_name(adv), error); + device_printf(adv->dev, "Unable to allocate CCB info " + "dmamap - error %d\n", error); return (NULL); } adv->ccb_infos_allocated++; @@ -655,28 +636,28 @@ adv_alloc_ccb_info(struct adv_softc *adv static void adv_destroy_ccb_info(struct adv_softc *adv, struct adv_ccb_info *cinfo) { + + callout_drain(&cinfo->timer); bus_dmamap_destroy(adv->buffer_dmat, cinfo->dmamap); } void adv_timeout(void *arg) { - int s; union ccb *ccb; struct adv_softc *adv; - struct adv_ccb_info *cinfo; + struct adv_ccb_info *cinfo, *cinfo2; ccb = (union ccb *)arg; adv = (struct adv_softc *)xpt_path_sim(ccb->ccb_h.path)->softc; cinfo = (struct adv_ccb_info *)ccb->ccb_h.ccb_cinfo_ptr; + mtx_assert(&adv->lock, MA_OWNED); xpt_print_path(ccb->ccb_h.path); printf("Timed out\n"); - s = splcam(); /* Have we been taken care of already?? */ if (cinfo == NULL || cinfo->state == ACCB_FREE) { - splx(s); return; } @@ -702,7 +683,8 @@ adv_timeout(void *arg) ccb_h = LIST_FIRST(&adv->pending_ccbs); while (ccb_h != NULL) { - untimeout(adv_timeout, ccb_h, ccb_h->timeout_ch); + cinfo2 = ccb_h->ccb_cinfo_ptr; + callout_stop(&cinfo2->timer); ccb_h = LIST_NEXT(ccb_h, sim_links.le); } @@ -713,8 +695,7 @@ adv_timeout(void *arg) adv_abort_ccb(adv, ccb->ccb_h.target_id, ccb->ccb_h.target_lun, ccb, CAM_CMD_TIMEOUT, /*queued_only*/FALSE); - ccb->ccb_h.timeout_ch = - timeout(adv_timeout, ccb, 2 * hz); + callout_reset(&cinfo->timer, 2 * hz, adv_timeout, ccb); } else { /* Our attempt to perform an abort failed, go for a reset */ xpt_print_path(ccb->ccb_h.path); @@ -724,11 +705,10 @@ adv_timeout(void *arg) adv_reset_bus(adv, /*initiate_reset*/TRUE); } adv_start_execution(adv); - splx(s); } struct adv_softc * -adv_alloc(device_t dev, bus_space_tag_t tag, bus_space_handle_t bsh) +adv_alloc(device_t dev, struct resource *res, long offset) { struct adv_softc *adv = device_get_softc(dev); @@ -738,9 +718,9 @@ adv_alloc(device_t dev, bus_space_tag_t LIST_INIT(&adv->pending_ccbs); SLIST_INIT(&adv->free_ccb_infos); adv->dev = dev; - adv->unit = device_get_unit(dev); - adv->tag = tag; - adv->bsh = bsh; + adv->res = res; + adv->reg_off = offset; + mtx_init(&adv->lock, "adv", NULL, MTX_DEF); return(adv); } @@ -773,6 +753,7 @@ adv_free(struct adv_softc *adv) if (adv->ccb_infos != NULL) free(adv->ccb_infos, M_DEVBUF); case 0: + mtx_destroy(&adv->lock); break; } } @@ -786,6 +767,7 @@ adv_init(struct adv_softc *adv) u_int16_t config_lsw; u_int16_t config_msw; + mtx_lock(&adv->lock); adv_lib_init(adv); /* @@ -794,14 +776,16 @@ adv_init(struct adv_softc *adv) adv_write_lram_16(adv, ADV_HALTCODE_W, 0x00FE); adv_stop_execution(adv); if (adv_stop_chip(adv) == 0 || adv_is_chip_halted(adv) == 0) { - printf("adv%d: Unable to halt adapter. Initialization" - "failed\n", adv->unit); + mtx_unlock(&adv->lock); + device_printf(adv->dev, + "Unable to halt adapter. Initialization failed\n"); return (1); } ADV_OUTW(adv, ADV_REG_PROG_COUNTER, ADV_MCODE_START_ADDR); if (ADV_INW(adv, ADV_REG_PROG_COUNTER) != ADV_MCODE_START_ADDR) { - printf("adv%d: Unable to set program counter. Initialization" - "failed\n", adv->unit); + mtx_unlock(&adv->lock); + device_printf(adv->dev, + "Unable to set program counter. Initialization failed\n"); return (1); } @@ -876,8 +860,8 @@ adv_init(struct adv_softc *adv) } else { u_int8_t sync_data; - printf("adv%d: Warning EEPROM Checksum mismatch. " - "Using default device parameters\n", adv->unit); + device_printf(adv->dev, "Warning EEPROM Checksum mismatch. " + "Using default device parameters\n"); /* Set reasonable defaults since we can't read the EEPROM */ adv->isa_dma_speed = /*ADV_DEF_ISA_DMA_SPEED*/1; @@ -940,13 +924,15 @@ adv_init(struct adv_softc *adv) * to be 100% correct. */ if (adv_set_eeprom_config(adv, &eeprom_config) != 0) - printf("%s: WARNING! Failure writing to EEPROM.\n", - adv_name(adv)); + device_printf(adv->dev, + "WARNING! Failure writing to EEPROM.\n"); #endif adv_set_chip_scsiid(adv, adv->scsi_id); - if (adv_init_lram_and_mcode(adv)) + if (adv_init_lram_and_mcode(adv)) { + mtx_unlock(&adv->lock); return (1); + } adv->disc_enable = adv->user_disc_enable; @@ -969,10 +955,12 @@ adv_init(struct adv_softc *adv) } adv_write_lram_8(adv, ADVV_USE_TAGGED_QNG_B, TARGET_BIT_VECTOR_SET); adv_write_lram_8(adv, ADVV_CAN_TAGGED_QNG_B, TARGET_BIT_VECTOR_SET); - printf("adv%d: AdvanSys %s Host Adapter, SCSI ID %d, queue depth %d\n", - adv->unit, (adv->type & ADV_ULTRA) && (max_sync == 0) - ? "Ultra SCSI" : "SCSI", - adv->scsi_id, adv->max_openings); + device_printf(adv->dev, + "AdvanSys %s Host Adapter, SCSI ID %d, queue depth %d\n", + (adv->type & ADV_ULTRA) && (max_sync == 0) + ? "Ultra SCSI" : "SCSI", + adv->scsi_id, adv->max_openings); + mtx_unlock(&adv->lock); return (0); } @@ -980,14 +968,24 @@ void adv_intr(void *arg) { struct adv_softc *adv; + + adv = arg; + mtx_lock(&adv->lock); + adv_intr_locked(adv); + mtx_unlock(&adv->lock); +} + +void +adv_intr_locked(struct adv_softc *adv) +{ u_int16_t chipstat; u_int16_t saved_ram_addr; u_int8_t ctrl_reg; u_int8_t saved_ctrl_reg; u_int8_t host_flag; - adv = (struct adv_softc *)arg; - + if (!dumping) + mtx_assert(&adv->lock, MA_OWNED); chipstat = ADV_INW(adv, ADV_CHIP_STATUS); /* Is it for us? */ @@ -1000,7 +998,7 @@ adv_intr(void *arg) ADV_CC_TEST)); if ((chipstat & (ADV_CSW_SCSI_RESET_LATCH|ADV_CSW_SCSI_RESET_ACTIVE))) { - printf("Detected Bus Reset\n"); + device_printf(adv->dev, "Detected Bus Reset\n"); adv_reset_bus(adv, /*initiate_reset*/FALSE); return; } @@ -1128,9 +1126,11 @@ adv_done(struct adv_softc *adv, union cc { struct adv_ccb_info *cinfo; + if (!dumping) + mtx_assert(&adv->lock, MA_OWNED); cinfo = (struct adv_ccb_info *)ccb->ccb_h.ccb_cinfo_ptr; LIST_REMOVE(&ccb->ccb_h, sim_links.le); - untimeout(adv_timeout, ccb, ccb->ccb_h.timeout_ch); + callout_stop(&cinfo->timer); if ((ccb->ccb_h.flags & CAM_DIR_MASK) != CAM_DIR_NONE) { bus_dmasync_op_t op; @@ -1239,7 +1239,7 @@ adv_done(struct adv_softc *adv, union cc case QHSTA_M_MICRO_CODE_ERROR_HALT: default: panic("%s: Unhandled Host status error %x", - adv_name(adv), host_stat); + device_get_nameunit(adv->dev), host_stat); /* NOTREACHED */ } break; @@ -1280,7 +1280,8 @@ adv_done(struct adv_softc *adv, union cc static void adv_poll(struct cam_sim *sim) { - adv_intr(cam_sim_softc(sim)); + + adv_intr_locked(cam_sim_softc(sim)); } /* @@ -1350,7 +1351,7 @@ adv_attach(adv) /* maxsegsz */ BUS_SPACE_MAXSIZE_32BIT, /* flags */ BUS_DMA_ALLOCNOW, /* lockfunc */ busdma_lock_mutex, - /* lockarg */ &Giant, + /* lockarg */ &adv->lock, &adv->buffer_dmat) != 0) { return (ENXIO); } @@ -1371,7 +1372,7 @@ adv_attach(adv) /* maxsegsz */ BUS_SPACE_MAXSIZE_32BIT, /* flags */ 0, /* lockfunc */ busdma_lock_mutex, - /* lockarg */ &Giant, + /* lockarg */ &adv->lock, &adv->sense_dmat) != 0) { return (ENXIO); } @@ -1398,8 +1399,8 @@ adv_attach(adv) * Fire up the chip */ if (adv_start_chip(adv) != 1) { - printf("adv%d: Unable to start on board processor. Aborting.\n", - adv->unit); + device_printf(adv->dev, + "Unable to start on board processor. Aborting.\n"); return (ENXIO); } @@ -1413,8 +1414,8 @@ adv_attach(adv) /* * Construct our SIM entry. */ - adv->sim = cam_sim_alloc(adv_action, adv_poll, "adv", adv, adv->unit, - &Giant, 1, adv->max_openings, devq); + adv->sim = cam_sim_alloc(adv_action, adv_poll, "adv", adv, + device_get_unit(adv->dev), &adv->lock, 1, adv->max_openings, devq); if (adv->sim == NULL) return (ENOMEM); @@ -1423,8 +1424,10 @@ adv_attach(adv) * * XXX Twin Channel EISA Cards??? */ + mtx_lock(&adv->lock); if (xpt_bus_register(adv->sim, adv->dev, 0) != CAM_SUCCESS) { cam_sim_free(adv->sim, /*free devq*/TRUE); + mtx_unlock(&adv->lock); return (ENXIO); } @@ -1433,6 +1436,7 @@ adv_attach(adv) != CAM_REQ_CMP) { xpt_bus_deregister(cam_sim_path(adv->sim)); cam_sim_free(adv->sim, /*free devq*/TRUE); + mtx_unlock(&adv->lock); return (ENXIO); } @@ -1442,6 +1446,7 @@ adv_attach(adv) csa.callback = advasync; csa.callback_arg = adv; xpt_action((union ccb *)&csa); + mtx_unlock(&adv->lock); return (0); } MODULE_DEPEND(adv, cam, 1, 1, 1); Modified: head/sys/dev/advansys/advansys.h ============================================================================== --- head/sys/dev/advansys/advansys.h Fri Oct 12 19:53:13 2012 (r241491) +++ head/sys/dev/advansys/advansys.h Fri Oct 12 21:31:44 2012 (r241492) @@ -38,9 +38,7 @@ #include -struct adv_softc * adv_alloc(device_t dev, bus_space_tag_t tag, - bus_space_handle_t bsh); -char * adv_name(struct adv_softc *adv); +struct adv_softc * adv_alloc(device_t dev, struct resource *res, long offset); void adv_map(void *arg, bus_dma_segment_t *segs, int nseg, int error); void adv_free(struct adv_softc *adv); @@ -50,6 +48,6 @@ int adv_attach(struct adv_softc *adv); void adv_done(struct adv_softc *adv, union ccb* ccb, u_int done_stat, u_int host_stat, u_int scsi_stat, u_int q_no); -timeout_t adv_timeout; +void adv_timeout(void *arg); #endif /* _ADVANSYS_H_ */ Modified: head/sys/dev/advansys/advlib.c ============================================================================== --- head/sys/dev/advansys/advlib.c Fri Oct 12 19:53:13 2012 (r241491) +++ head/sys/dev/advansys/advlib.c Fri Oct 12 21:31:44 2012 (r241492) @@ -45,7 +45,10 @@ __FBSDID("$FreeBSD$"); #include +#include +#include #include +#include #include #include @@ -298,6 +301,7 @@ advasync(void *callback_arg, u_int32_t c struct adv_softc *adv; adv = (struct adv_softc *)callback_arg; + mtx_assert(&adv->lock, MA_OWNED); switch (code) { case AC_FOUND_DEVICE: { @@ -460,12 +464,12 @@ adv_write_lram_16(struct adv_softc *adv, * found, 0 otherwise. */ int -adv_find_signature(bus_space_tag_t tag, bus_space_handle_t bsh) +adv_find_signature(struct resource *res) { u_int16_t signature; - if (bus_space_read_1(tag, bsh, ADV_SIGNATURE_BYTE) == ADV_1000_ID1B) { - signature = bus_space_read_2(tag, bsh, ADV_SIGNATURE_WORD); + if (bus_read_1(res, ADV_SIGNATURE_BYTE) == ADV_1000_ID1B) { + signature = bus_read_2(res, ADV_SIGNATURE_WORD); if ((signature == ADV_1000_ID0W) || (signature == ADV_1000_ID0W_FIX)) return (1); @@ -594,8 +598,8 @@ adv_init_lram_and_mcode(struct adv_softc retval = adv_load_microcode(adv, 0, (u_int16_t *)adv_mcode, adv_mcode_size); if (retval != adv_mcode_chksum) { - printf("adv%d: Microcode download failed checksum!\n", - adv->unit); + device_printf(adv->dev, + "Microcode download failed checksum!\n"); return (1); } @@ -692,6 +696,8 @@ adv_execute_scsi_queue(struct adv_softc u_int8_t sg_entry_cnt_minus_one; u_int8_t tid_no; + if (!dumping) + mtx_assert(&adv->lock, MA_OWNED); scsiq->q1.q_no = 0; retval = 1; /* Default to error case */ target_ix = scsiq->q2.target_ix; @@ -938,6 +944,8 @@ adv_isr_chip_halted(struct adv_softc *ad u_int8_t q_cntl; u_int8_t tid_no; + if (!dumping) + mtx_assert(&adv->lock, MA_OWNED); int_halt_code = adv_read_lram_16(adv, ADVV_HALTCODE_W); halt_qp = adv_read_lram_8(adv, ADVV_CURCDB_B); halt_q_addr = ADV_QNO_TO_QADDR(halt_qp); @@ -966,6 +974,7 @@ adv_isr_chip_halted(struct adv_softc *ad target_mask, tid_no); } else if (int_halt_code == ADV_HALT_CHK_CONDITION) { struct adv_target_transinfo* tinfo; + struct adv_ccb_info *cinfo; union ccb *ccb; u_int32_t cinfo_index; u_int8_t tag_code; @@ -1008,6 +1017,7 @@ adv_isr_chip_halted(struct adv_softc *ad */ cinfo_index = adv_read_lram_32(adv, halt_q_addr + ADV_SCSIQ_D_CINFO_IDX); + cinfo = &adv->ccb_infos[cinfo_index]; ccb = adv->ccb_infos[cinfo_index].ccb; *** DIFF OUTPUT TRUNCATED AT 1000 LINES *** From owner-svn-src-head@FreeBSD.ORG Fri Oct 12 21:48:22 2012 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id 55BE335E; Fri, 12 Oct 2012 21:48:22 +0000 (UTC) (envelope-from np@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 3EECD8FC18; Fri, 12 Oct 2012 21:48:22 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id q9CLmM8P081639; Fri, 12 Oct 2012 21:48:22 GMT (envelope-from np@svn.freebsd.org) Received: (from np@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q9CLmLfh081636; Fri, 12 Oct 2012 21:48:21 GMT (envelope-from np@svn.freebsd.org) Message-Id: <201210122148.q9CLmLfh081636@svn.freebsd.org> From: Navdeep Parhar Date: Fri, 12 Oct 2012 21:48:21 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r241493 - head/sys/dev/cxgbe X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 12 Oct 2012 21:48:22 -0000 Author: np Date: Fri Oct 12 21:48:21 2012 New Revision: 241493 URL: http://svn.freebsd.org/changeset/base/241493 Log: Use global knob in the TP_PARA_REG3 register to disable congestion drops if the user has chosen this behaviour. MFC after: 3 days Modified: head/sys/dev/cxgbe/t4_main.c head/sys/dev/cxgbe/t4_sge.c Modified: head/sys/dev/cxgbe/t4_main.c ============================================================================== --- head/sys/dev/cxgbe/t4_main.c Fri Oct 12 21:31:44 2012 (r241492) +++ head/sys/dev/cxgbe/t4_main.c Fri Oct 12 21:48:21 2012 (r241493) @@ -527,10 +527,6 @@ t4_attach(device_t dev) t4_write_reg(sc, A_ULP_RX_TDDP_PSZ, V_HPZ0(0) | V_HPZ1(2) | V_HPZ2(4) | V_HPZ3(6)); t4_set_reg_field(sc, A_ULP_RX_CTL, F_TDDPTAGTCB, F_TDDPTAGTCB); - t4_set_reg_field(sc, A_TP_PARA_REG3, F_TUNNELCNGDROP0 | - F_TUNNELCNGDROP1 | F_TUNNELCNGDROP2 | F_TUNNELCNGDROP3, - F_TUNNELCNGDROP0 | F_TUNNELCNGDROP1 | F_TUNNELCNGDROP2 | - F_TUNNELCNGDROP3); t4_set_reg_field(sc, A_TP_PARA_REG5, V_INDICATESIZE(M_INDICATESIZE) | F_REARMDDPOFFSET | F_RESETDDPOFFSET, Modified: head/sys/dev/cxgbe/t4_sge.c ============================================================================== --- head/sys/dev/cxgbe/t4_sge.c Fri Oct 12 21:31:44 2012 (r241492) +++ head/sys/dev/cxgbe/t4_sge.c Fri Oct 12 21:48:21 2012 (r241493) @@ -319,6 +319,12 @@ t4_sge_init(struct adapter *sc) t4_write_reg(sc, A_SGE_TIMER_VALUE_4_AND_5, V_TIMERVALUE4(us_to_core_ticks(sc, intr_timer[4])) | V_TIMERVALUE5(us_to_core_ticks(sc, intr_timer[5]))); + + if (cong_drop == 0) { + t4_set_reg_field(sc, A_TP_PARA_REG3, F_TUNNELCNGDROP0 | + F_TUNNELCNGDROP1 | F_TUNNELCNGDROP2 | + F_TUNNELCNGDROP3, 0); + } } v = t4_read_reg(sc, A_SGE_CONTROL); From owner-svn-src-head@FreeBSD.ORG Fri Oct 12 21:58:22 2012 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id 4931B7A8; Fri, 12 Oct 2012 21:58:22 +0000 (UTC) (envelope-from np@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 323478FC14; Fri, 12 Oct 2012 21:58:22 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id q9CLwMXZ083138; Fri, 12 Oct 2012 21:58:22 GMT (envelope-from np@svn.freebsd.org) Received: (from np@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q9CLwMkx083136; Fri, 12 Oct 2012 21:58:22 GMT (envelope-from np@svn.freebsd.org) Message-Id: <201210122158.q9CLwMkx083136@svn.freebsd.org> From: Navdeep Parhar Date: Fri, 12 Oct 2012 21:58:21 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r241494 - head/sys/dev/cxgbe X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 12 Oct 2012 21:58:22 -0000 Author: np Date: Fri Oct 12 21:58:21 2012 New Revision: 241494 URL: http://svn.freebsd.org/changeset/base/241494 Log: Temporary fix for kern/172364. PR: kern/172364 MFC after: 3 days Modified: head/sys/dev/cxgbe/t4_main.c Modified: head/sys/dev/cxgbe/t4_main.c ============================================================================== --- head/sys/dev/cxgbe/t4_main.c Fri Oct 12 21:48:21 2012 (r241493) +++ head/sys/dev/cxgbe/t4_main.c Fri Oct 12 21:58:21 2012 (r241494) @@ -2992,7 +2992,7 @@ cxgbe_vlan_config(void *arg, struct ifne { struct ifnet *vlan; - if (arg != ifp) + if (arg != ifp || ifp->if_type != IFT_ETHER) return; vlan = VLAN_DEVAT(ifp, vid); From owner-svn-src-head@FreeBSD.ORG Fri Oct 12 22:06:07 2012 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id 131FDADC; Fri, 12 Oct 2012 22:06:07 +0000 (UTC) (envelope-from mav@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id EF5398FC14; Fri, 12 Oct 2012 22:06:06 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id q9CM66f0084297; Fri, 12 Oct 2012 22:06:06 GMT (envelope-from mav@svn.freebsd.org) Received: (from mav@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q9CM66aM084295; Fri, 12 Oct 2012 22:06:06 GMT (envelope-from mav@svn.freebsd.org) Message-Id: <201210122206.q9CM66aM084295@svn.freebsd.org> From: Alexander Motin Date: Fri, 12 Oct 2012 22:06:06 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r241495 - head/sys/dev/virtio/scsi X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 12 Oct 2012 22:06:07 -0000 Author: mav Date: Fri Oct 12 22:06:06 2012 New Revision: 241495 URL: http://svn.freebsd.org/changeset/base/241495 Log: Fix build with PAE enabled. I doubt any code uses CAM_SCATTER_VALID or CAM_DATA_PHYS, or they ever correctly worked, but make this build at least. Modified: head/sys/dev/virtio/scsi/virtio_scsi.c Modified: head/sys/dev/virtio/scsi/virtio_scsi.c ============================================================================== --- head/sys/dev/virtio/scsi/virtio_scsi.c Fri Oct 12 21:58:21 2012 (r241494) +++ head/sys/dev/virtio/scsi/virtio_scsi.c Fri Oct 12 22:06:06 2012 (r241495) @@ -971,7 +971,8 @@ vtscsi_sg_append_scsi_buf(struct vtscsi_ csio->data_ptr, csio->dxfer_len); else error = sglist_append_phys(sg, - (vm_paddr_t) csio->data_ptr, csio->dxfer_len); + (vm_paddr_t)(vm_offset_t) csio->data_ptr, + csio->dxfer_len); } else { for (i = 0; i < csio->sglist_cnt && error == 0; i++) { @@ -979,7 +980,8 @@ vtscsi_sg_append_scsi_buf(struct vtscsi_ if ((ccbh->flags & CAM_SG_LIST_PHYS) == 0) error = sglist_append(sg, - (void *) dseg->ds_addr, dseg->ds_len); + (void *)(vm_offset_t) dseg->ds_addr, + dseg->ds_len); else error = sglist_append_phys(sg, (vm_paddr_t) dseg->ds_addr, dseg->ds_len); From owner-svn-src-head@FreeBSD.ORG Fri Oct 12 22:08:47 2012 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id 757FECAC; Fri, 12 Oct 2012 22:08:47 +0000 (UTC) (envelope-from grehan@freebsd.org) Received: from alto.onthenet.com.au (alto.OntheNet.com.au [203.13.68.12]) by mx1.freebsd.org (Postfix) with ESMTP id D129C8FC0A; Fri, 12 Oct 2012 22:08:46 +0000 (UTC) Received: from dommail.onthenet.com.au (dommail.OntheNet.com.au [203.13.70.57]) by alto.onthenet.com.au (Postfix) with ESMTPS id 943B511DD3; Sat, 13 Oct 2012 08:08:39 +1000 (EST) Received: from brycem-pc.hq.netapp.com (pos-ext.netapp.com [198.95.226.40]) by dommail.onthenet.com.au (MOS 4.2.4-GA) with ESMTP id BHB09255 (AUTH peterg@ptree32.com.au); Sat, 13 Oct 2012 08:08:37 +1000 Message-ID: <507894E1.1030802@freebsd.org> Date: Fri, 12 Oct 2012 16:08:33 -0600 From: Peter Grehan User-Agent: Mozilla/5.0 (Macintosh; U; Intel Mac OS X 10.6; en-US; rv:1.9.2.28) Gecko/20120306 Thunderbird/3.1.20 MIME-Version: 1.0 To: Alexander Motin Subject: Re: svn commit: r241495 - head/sys/dev/virtio/scsi References: <201210122206.q9CM66aM084295@svn.freebsd.org> In-Reply-To: <201210122206.q9CM66aM084295@svn.freebsd.org> Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit X-Junkmail-Info: SPF_SOFTFAIL X-Junkmail-Status: score=6/51, host=dommail.onthenet.com.au Cc: svn-src-head@freebsd.org, svn-src-all@freebsd.org, src-committers@freebsd.org X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 12 Oct 2012 22:08:47 -0000 > Fix build with PAE enabled. I doubt any code uses CAM_SCATTER_VALID or > CAM_DATA_PHYS, or they ever correctly worked, but make this build at least. Doh, didn't test build with PAE - I will next time. Thanks for the fix ! later, Peter. From owner-svn-src-head@FreeBSD.ORG Fri Oct 12 22:48:34 2012 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id 16BF3916; Fri, 12 Oct 2012 22:48:34 +0000 (UTC) (envelope-from n_hibma@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id F19728FC12; Fri, 12 Oct 2012 22:48:33 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id q9CMmXRf090089; Fri, 12 Oct 2012 22:48:33 GMT (envelope-from n_hibma@svn.freebsd.org) Received: (from n_hibma@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q9CMmXHq090087; Fri, 12 Oct 2012 22:48:33 GMT (envelope-from n_hibma@svn.freebsd.org) Message-Id: <201210122248.q9CMmXHq090087@svn.freebsd.org> From: Nick Hibma Date: Fri, 12 Oct 2012 22:48:33 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r241496 - head/usr.sbin/ppp X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 12 Oct 2012 22:48:34 -0000 Author: n_hibma Date: Fri Oct 12 22:48:33 2012 New Revision: 241496 URL: http://svn.freebsd.org/changeset/base/241496 Log: Some 3G modems return the wrong signature in echo packets and make it impossible to use LQR/ECHO. They return want_magic instead. With this change it is now possible to use enable lqr set lqrperiod 5 enable echo set echoperiod 5 in your ppp.conf file. MFC after: 3 days Modified: head/usr.sbin/ppp/lqr.c Modified: head/usr.sbin/ppp/lqr.c ============================================================================== --- head/usr.sbin/ppp/lqr.c Fri Oct 12 22:06:06 2012 (r241495) +++ head/usr.sbin/ppp/lqr.c Fri Oct 12 22:48:33 2012 (r241496) @@ -108,7 +108,8 @@ lqr_RecvEcho(struct fsm *fp, struct mbuf * die as a result. */ } - if (lqr.signature == SIGNATURE) { + if (lqr.signature == SIGNATURE + || lqr.signature == lcp->want_magic) { /* some implementations return the wrong magic */ /* careful not to update lqm.echo.seq_recv with older values */ if ((hdlc->lqm.echo.seq_recv > (u_int32_t)0 - 5 && lqr.sequence < 5) || (hdlc->lqm.echo.seq_recv <= (u_int32_t)0 - 5 && From owner-svn-src-head@FreeBSD.ORG Fri Oct 12 23:26:01 2012 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id 39FA641C; Fri, 12 Oct 2012 23:26:01 +0000 (UTC) (envelope-from alc@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 2120D8FC08; Fri, 12 Oct 2012 23:26:01 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id q9CNQ1Ru095254; Fri, 12 Oct 2012 23:26:01 GMT (envelope-from alc@svn.freebsd.org) Received: (from alc@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q9CNQ0cD095249; Fri, 12 Oct 2012 23:26:01 GMT (envelope-from alc@svn.freebsd.org) Message-Id: <201210122326.q9CNQ0cD095249@svn.freebsd.org> From: Alan Cox Date: Fri, 12 Oct 2012 23:26:00 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r241498 - head/sys/i386/xen X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 12 Oct 2012 23:26:01 -0000 Author: alc Date: Fri Oct 12 23:26:00 2012 New Revision: 241498 URL: http://svn.freebsd.org/changeset/base/241498 Log: Replace all uses of the vm page queues lock by a new R/W lock. Unfortunately, this lock cannot be defined as static under Xen because it is (ab)used to serialize queued page table changes. Tested by: sbruno Modified: head/sys/i386/xen/mp_machdep.c head/sys/i386/xen/pmap.c head/sys/i386/xen/xen_machdep.c Modified: head/sys/i386/xen/mp_machdep.c ============================================================================== --- head/sys/i386/xen/mp_machdep.c Fri Oct 12 23:12:19 2012 (r241497) +++ head/sys/i386/xen/mp_machdep.c Fri Oct 12 23:26:00 2012 (r241498) @@ -64,6 +64,7 @@ __FBSDID("$FreeBSD$"); #include #include #include +#include #include #include #include @@ -804,6 +805,7 @@ smp_trap_init(trap_info_t *trap_ctxt) } } +extern struct rwlock pvh_global_lock; extern int nkpt; static void cpu_initialize_context(unsigned int cpu) @@ -862,7 +864,7 @@ cpu_initialize_context(unsigned int cpu) xen_pgdpt_pin(VM_PAGE_TO_MACH(m[NPGPTD + 1])); - vm_page_lock_queues(); + rw_wlock(&pvh_global_lock); for (i = 0; i < 4; i++) { int pdir = (PTDPTDI + i) / NPDEPG; int curoffset = (PTDPTDI + i) % NPDEPG; @@ -872,7 +874,7 @@ cpu_initialize_context(unsigned int cpu) ma[i]); } PT_UPDATES_FLUSH(); - vm_page_unlock_queues(); + rw_wunlock(&pvh_global_lock); memset(&ctxt, 0, sizeof(ctxt)); ctxt.flags = VGCF_IN_KERNEL; Modified: head/sys/i386/xen/pmap.c ============================================================================== --- head/sys/i386/xen/pmap.c Fri Oct 12 23:12:19 2012 (r241497) +++ head/sys/i386/xen/pmap.c Fri Oct 12 23:26:00 2012 (r241498) @@ -111,6 +111,7 @@ __FBSDID("$FreeBSD$"); #include #include #include +#include #include #include #include @@ -220,6 +221,13 @@ static SYSCTL_NODE(_vm, OID_AUTO, pmap, static int pat_works; /* Is page attribute table sane? */ /* + * This lock is defined as static in other pmap implementations. It cannot, + * however, be defined as static here, because it is (ab)used to serialize + * queued page table changes in other sources files. + */ +struct rwlock pvh_global_lock; + +/* * Data for the pv entry allocation mechanism */ static TAILQ_HEAD(pch, pv_chunk) pv_chunks = TAILQ_HEAD_INITIALIZER(pv_chunks); @@ -380,6 +388,12 @@ pmap_bootstrap(vm_paddr_t firstaddr) #endif CPU_FILL(&kernel_pmap->pm_active); /* don't allow deactivation */ TAILQ_INIT(&kernel_pmap->pm_pvchunk); + + /* + * Initialize the global pv list lock. + */ + rw_init_flags(&pvh_global_lock, "pmap pv global", RW_RECURSE); + LIST_INIT(&allpmaps); mtx_init(&allpmaps_lock, "allpmaps", NULL, MTX_SPIN); mtx_lock_spin(&allpmaps_lock); @@ -979,9 +993,9 @@ pmap_pte_release(pt_entry_t *pte) if ((pt_entry_t *)((vm_offset_t)pte & ~PAGE_MASK) == PADDR2) { CTR1(KTR_PMAP, "pmap_pte_release: pte=0x%jx", *PMAP2); - vm_page_lock_queues(); + rw_wlock(&pvh_global_lock); PT_SET_VA(PMAP2, 0, TRUE); - vm_page_unlock_queues(); + rw_wunlock(&pvh_global_lock); mtx_unlock(&PMAP2mutex); } } @@ -1001,7 +1015,7 @@ invlcaddr(void *caddr) * scans are across different pmaps. It is very wasteful * to do an entire invltlb for checking a single mapping. * - * If the given pmap is not the current pmap, vm_page_queue_mtx + * If the given pmap is not the current pmap, pvh_global_lock * must be held and curthread pinned to a CPU. */ static pt_entry_t * @@ -1017,7 +1031,7 @@ pmap_pte_quick(pmap_t pmap, vm_offset_t /* are we current address space or kernel? */ if (pmap_is_current(pmap)) return (vtopte(va)); - mtx_assert(&vm_page_queue_mtx, MA_OWNED); + rw_assert(&pvh_global_lock, RA_WLOCKED); KASSERT(curthread->td_pinned > 0, ("curthread not pinned")); newpf = *pde & PG_FRAME; if ((*PMAP1 & PG_FRAME) != newpf) { @@ -1299,7 +1313,7 @@ pmap_qremove(vm_offset_t sva, int count) CTR2(KTR_PMAP, "pmap_qremove: sva=0x%x count=%d", sva, count); va = sva; - vm_page_lock_queues(); + rw_wlock(&pvh_global_lock); critical_enter(); while (count-- > 0) { pmap_kremove(va); @@ -1308,7 +1322,7 @@ pmap_qremove(vm_offset_t sva, int count) PT_UPDATES_FLUSH(); pmap_invalidate_range(kernel_pmap, sva, va); critical_exit(); - vm_page_unlock_queues(); + rw_wunlock(&pvh_global_lock); } /*************************************************** @@ -1511,7 +1525,7 @@ pmap_pinit(pmap_t pmap) #ifdef PAE PT_SET_MA(pmap->pm_pdpt, *vtopte((vm_offset_t)pmap->pm_pdpt) & ~PG_RW); #endif - vm_page_lock_queues(); + rw_wlock(&pvh_global_lock); xen_flush_queue(); xen_pgdpt_pin(VM_PAGE_TO_MACH(ptdpg[NPGPTD])); for (i = 0; i < NPGPTD; i++) { @@ -1519,7 +1533,7 @@ pmap_pinit(pmap_t pmap) PT_SET_VA_MA(&pmap->pm_pdir[PTDPTDI + i], ma | PG_V | PG_A, FALSE); } xen_flush_queue(); - vm_page_unlock_queues(); + rw_wunlock(&pvh_global_lock); CPU_ZERO(&pmap->pm_active); TAILQ_INIT(&pmap->pm_pvchunk); bzero(&pmap->pm_stats, sizeof pmap->pm_stats); @@ -1551,9 +1565,9 @@ _pmap_allocpte(pmap_t pmap, u_int ptepin VM_ALLOC_WIRED | VM_ALLOC_ZERO)) == NULL) { if (flags & M_WAITOK) { PMAP_UNLOCK(pmap); - vm_page_unlock_queues(); + rw_wunlock(&pvh_global_lock); VM_WAIT; - vm_page_lock_queues(); + rw_wlock(&pvh_global_lock); PMAP_LOCK(pmap); } @@ -1884,14 +1898,14 @@ pmap_growkernel(vm_offset_t addr) pmap_zero_page(nkpg); ptppaddr = VM_PAGE_TO_PHYS(nkpg); newpdir = (pd_entry_t) (ptppaddr | PG_V | PG_RW | PG_A | PG_M); - vm_page_lock_queues(); + rw_wlock(&pvh_global_lock); PD_SET_VA(kernel_pmap, (kernel_vm_end >> PDRSHIFT), newpdir, TRUE); mtx_lock_spin(&allpmaps_lock); LIST_FOREACH(pmap, &allpmaps, pm_list) PD_SET_VA(pmap, (kernel_vm_end >> PDRSHIFT), newpdir, TRUE); mtx_unlock_spin(&allpmaps_lock); - vm_page_unlock_queues(); + rw_wunlock(&pvh_global_lock); kernel_vm_end = (kernel_vm_end + NBPDR) & ~PDRMASK; if (kernel_vm_end - 1 >= kernel_map->max_offset) { @@ -2094,7 +2108,7 @@ free_pv_entry(pmap_t pmap, pv_entry_t pv struct pv_chunk *pc; int idx, field, bit; - mtx_assert(&vm_page_queue_mtx, MA_OWNED); + rw_assert(&pvh_global_lock, RA_WLOCKED); PMAP_LOCK_ASSERT(pmap, MA_OWNED); PV_STAT(pv_entry_frees++); PV_STAT(pv_entry_spare++); @@ -2154,7 +2168,7 @@ get_pv_entry(pmap_t pmap, boolean_t try) vm_page_t m; PMAP_LOCK_ASSERT(pmap, MA_OWNED); - mtx_assert(&vm_page_queue_mtx, MA_OWNED); + rw_assert(&pvh_global_lock, RA_WLOCKED); PV_STAT(pv_entry_allocs++); pv_entry_count++; if (pv_entry_count > pv_entry_high_water) @@ -2224,7 +2238,7 @@ pmap_pvh_remove(struct md_page *pvh, pma { pv_entry_t pv; - mtx_assert(&vm_page_queue_mtx, MA_OWNED); + rw_assert(&pvh_global_lock, RA_WLOCKED); TAILQ_FOREACH(pv, &pvh->pv_list, pv_list) { if (pmap == PV_PMAP(pv) && va == pv->pv_va) { TAILQ_REMOVE(&pvh->pv_list, pv, pv_list); @@ -2248,7 +2262,7 @@ static void pmap_remove_entry(pmap_t pmap, vm_page_t m, vm_offset_t va) { - mtx_assert(&vm_page_queue_mtx, MA_OWNED); + rw_assert(&pvh_global_lock, RA_WLOCKED); pmap_pvh_free(&m->md, pmap, va); if (TAILQ_EMPTY(&m->md.pv_list)) vm_page_aflag_clear(m, PGA_WRITEABLE); @@ -2263,7 +2277,7 @@ pmap_try_insert_pv_entry(pmap_t pmap, vm pv_entry_t pv; PMAP_LOCK_ASSERT(pmap, MA_OWNED); - mtx_assert(&vm_page_queue_mtx, MA_OWNED); + rw_assert(&pvh_global_lock, RA_WLOCKED); if (pv_entry_count < pv_entry_high_water && (pv = get_pv_entry(pmap, TRUE)) != NULL) { pv->pv_va = va; @@ -2285,7 +2299,7 @@ pmap_remove_pte(pmap_t pmap, pt_entry_t CTR3(KTR_PMAP, "pmap_remove_pte: pmap=%p *ptq=0x%x va=0x%x", pmap, (u_long)*ptq, va); - mtx_assert(&vm_page_queue_mtx, MA_OWNED); + rw_assert(&pvh_global_lock, RA_WLOCKED); PMAP_LOCK_ASSERT(pmap, MA_OWNED); oldpte = *ptq; PT_SET_VA_MA(ptq, 0, TRUE); @@ -2322,7 +2336,7 @@ pmap_remove_page(pmap_t pmap, vm_offset_ CTR2(KTR_PMAP, "pmap_remove_page: pmap=%p va=0x%x", pmap, va); - mtx_assert(&vm_page_queue_mtx, MA_OWNED); + rw_assert(&pvh_global_lock, RA_WLOCKED); KASSERT(curthread->td_pinned > 0, ("curthread not pinned")); PMAP_LOCK_ASSERT(pmap, MA_OWNED); if ((pte = pmap_pte_quick(pmap, va)) == NULL || (*pte & PG_V) == 0) @@ -2360,7 +2374,7 @@ pmap_remove(pmap_t pmap, vm_offset_t sva anyvalid = 0; - vm_page_lock_queues(); + rw_wlock(&pvh_global_lock); sched_pin(); PMAP_LOCK(pmap); @@ -2437,7 +2451,7 @@ out: if (anyvalid) pmap_invalidate_all(pmap); sched_unpin(); - vm_page_unlock_queues(); + rw_wunlock(&pvh_global_lock); PMAP_UNLOCK(pmap); pmap_free_zero_pages(free); } @@ -2466,7 +2480,7 @@ pmap_remove_all(vm_page_t m) KASSERT((m->oflags & VPO_UNMANAGED) == 0, ("pmap_remove_all: page %p is not managed", m)); free = NULL; - vm_page_lock_queues(); + rw_wlock(&pvh_global_lock); sched_pin(); while ((pv = TAILQ_FIRST(&m->md.pv_list)) != NULL) { pmap = PV_PMAP(pv); @@ -2498,7 +2512,7 @@ pmap_remove_all(vm_page_t m) if (*PMAP1) PT_SET_MA(PADDR1, 0); sched_unpin(); - vm_page_unlock_queues(); + rw_wunlock(&pvh_global_lock); pmap_free_zero_pages(free); } @@ -2533,7 +2547,7 @@ pmap_protect(pmap_t pmap, vm_offset_t sv anychanged = 0; - vm_page_lock_queues(); + rw_wlock(&pvh_global_lock); sched_pin(); PMAP_LOCK(pmap); for (; sva < eva; sva = pdnxt) { @@ -2617,7 +2631,7 @@ retry: if (anychanged) pmap_invalidate_all(pmap); sched_unpin(); - vm_page_unlock_queues(); + rw_wunlock(&pvh_global_lock); PMAP_UNLOCK(pmap); } @@ -2658,7 +2672,7 @@ pmap_enter(pmap_t pmap, vm_offset_t va, mpte = NULL; - vm_page_lock_queues(); + rw_wlock(&pvh_global_lock); PMAP_LOCK(pmap); sched_pin(); @@ -2831,7 +2845,7 @@ validate: if (*PMAP1) PT_SET_VA_MA(PMAP1, 0, TRUE); sched_unpin(); - vm_page_unlock_queues(); + rw_wunlock(&pvh_global_lock); PMAP_UNLOCK(pmap); } @@ -2861,7 +2875,7 @@ pmap_enter_object(pmap_t pmap, vm_offset psize = atop(end - start); mpte = NULL; m = m_start; - vm_page_lock_queues(); + rw_wlock(&pvh_global_lock); PMAP_LOCK(pmap); while (m != NULL && (diff = m->pindex - m_start->pindex) < psize) { mpte = pmap_enter_quick_locked(&mclp, &count, pmap, start + ptoa(diff), m, @@ -2878,7 +2892,7 @@ pmap_enter_object(pmap_t pmap, vm_offset error = HYPERVISOR_multicall(mcl, count); KASSERT(error == 0, ("bad multicall %d", error)); } - vm_page_unlock_queues(); + rw_wunlock(&pvh_global_lock); PMAP_UNLOCK(pmap); } @@ -2901,12 +2915,12 @@ pmap_enter_quick(pmap_t pmap, vm_offset_ CTR4(KTR_PMAP, "pmap_enter_quick: pmap=%p va=0x%x m=%p prot=0x%x", pmap, va, m, prot); - vm_page_lock_queues(); + rw_wlock(&pvh_global_lock); PMAP_LOCK(pmap); (void)pmap_enter_quick_locked(&mclp, &count, pmap, va, m, prot, NULL); if (count) HYPERVISOR_multicall(&mcl, count); - vm_page_unlock_queues(); + rw_wunlock(&pvh_global_lock); PMAP_UNLOCK(pmap); } @@ -2952,7 +2966,7 @@ pmap_enter_quick_locked(multicall_entry_ KASSERT(va < kmi.clean_sva || va >= kmi.clean_eva || (m->oflags & VPO_UNMANAGED) != 0, ("pmap_enter_quick_locked: managed mapping within the clean submap")); - mtx_assert(&vm_page_queue_mtx, MA_OWNED); + rw_assert(&pvh_global_lock, RA_WLOCKED); PMAP_LOCK_ASSERT(pmap, MA_OWNED); /* @@ -3168,7 +3182,7 @@ pmap_change_wiring(pmap_t pmap, vm_offse { pt_entry_t *pte; - vm_page_lock_queues(); + rw_wlock(&pvh_global_lock); PMAP_LOCK(pmap); pte = pmap_pte(pmap, va); @@ -3186,7 +3200,7 @@ pmap_change_wiring(pmap_t pmap, vm_offse */ pmap_pte_release(pte); PMAP_UNLOCK(pmap); - vm_page_unlock_queues(); + rw_wunlock(&pvh_global_lock); } @@ -3225,7 +3239,7 @@ pmap_copy(pmap_t dst_pmap, pmap_t src_pm mtx_lock(&createdelete_lock); #endif - vm_page_lock_queues(); + rw_wlock(&pvh_global_lock); if (dst_pmap < src_pmap) { PMAP_LOCK(dst_pmap); PMAP_LOCK(src_pmap); @@ -3315,7 +3329,7 @@ pmap_copy(pmap_t dst_pmap, pmap_t src_pm out: PT_UPDATES_FLUSH(); sched_unpin(); - vm_page_unlock_queues(); + rw_wunlock(&pvh_global_lock); PMAP_UNLOCK(src_pmap); PMAP_UNLOCK(dst_pmap); @@ -3451,7 +3465,7 @@ pmap_page_exists_quick(pmap_t pmap, vm_p KASSERT((m->oflags & VPO_UNMANAGED) == 0, ("pmap_page_exists_quick: page %p is not managed", m)); rv = FALSE; - vm_page_lock_queues(); + rw_wlock(&pvh_global_lock); TAILQ_FOREACH(pv, &m->md.pv_list, pv_list) { if (PV_PMAP(pv) == pmap) { rv = TRUE; @@ -3461,7 +3475,7 @@ pmap_page_exists_quick(pmap_t pmap, vm_p if (loops >= 16) break; } - vm_page_unlock_queues(); + rw_wunlock(&pvh_global_lock); return (rv); } @@ -3482,7 +3496,7 @@ pmap_page_wired_mappings(vm_page_t m) count = 0; if ((m->oflags & VPO_UNMANAGED) != 0) return (count); - vm_page_lock_queues(); + rw_wlock(&pvh_global_lock); sched_pin(); TAILQ_FOREACH(pv, &m->md.pv_list, pv_list) { pmap = PV_PMAP(pv); @@ -3493,7 +3507,7 @@ pmap_page_wired_mappings(vm_page_t m) PMAP_UNLOCK(pmap); } sched_unpin(); - vm_page_unlock_queues(); + rw_wunlock(&pvh_global_lock); return (count); } @@ -3535,7 +3549,7 @@ pmap_remove_pages(pmap_t pmap) printf("warning: pmap_remove_pages called with non-current pmap\n"); return; } - vm_page_lock_queues(); + rw_wlock(&pvh_global_lock); KASSERT(pmap_is_current(pmap), ("removing pages from non-current pmap")); PMAP_LOCK(pmap); sched_pin(); @@ -3615,7 +3629,7 @@ pmap_remove_pages(pmap_t pmap) sched_unpin(); pmap_invalidate_all(pmap); - vm_page_unlock_queues(); + rw_wunlock(&pvh_global_lock); PMAP_UNLOCK(pmap); pmap_free_zero_pages(free); } @@ -3647,7 +3661,7 @@ pmap_is_modified(vm_page_t m) if ((m->oflags & VPO_BUSY) == 0 && (m->aflags & PGA_WRITEABLE) == 0) return (rv); - vm_page_lock_queues(); + rw_wlock(&pvh_global_lock); sched_pin(); TAILQ_FOREACH(pv, &m->md.pv_list, pv_list) { pmap = PV_PMAP(pv); @@ -3661,7 +3675,7 @@ pmap_is_modified(vm_page_t m) if (*PMAP1) PT_SET_MA(PADDR1, 0); sched_unpin(); - vm_page_unlock_queues(); + rw_wunlock(&pvh_global_lock); return (rv); } @@ -3708,7 +3722,7 @@ pmap_is_referenced(vm_page_t m) KASSERT((m->oflags & VPO_UNMANAGED) == 0, ("pmap_is_referenced: page %p is not managed", m)); rv = FALSE; - vm_page_lock_queues(); + rw_wlock(&pvh_global_lock); sched_pin(); TAILQ_FOREACH(pv, &m->md.pv_list, pv_list) { pmap = PV_PMAP(pv); @@ -3722,7 +3736,7 @@ pmap_is_referenced(vm_page_t m) if (*PMAP1) PT_SET_MA(PADDR1, 0); sched_unpin(); - vm_page_unlock_queues(); + rw_wunlock(&pvh_global_lock); return (rv); } @@ -3733,9 +3747,9 @@ pmap_map_readonly(pmap_t pmap, vm_offset for (i = 0; i < npages; i++) { pt_entry_t *pte; pte = pmap_pte(pmap, (vm_offset_t)(va + i*PAGE_SIZE)); - vm_page_lock_queues(); + rw_wlock(&pvh_global_lock); pte_store(pte, xpmap_mtop(*pte & ~(PG_RW|PG_M))); - vm_page_unlock_queues(); + rw_wunlock(&pvh_global_lock); PMAP_MARK_PRIV(xpmap_mtop(*pte)); pmap_pte_release(pte); } @@ -3749,9 +3763,9 @@ pmap_map_readwrite(pmap_t pmap, vm_offse pt_entry_t *pte; pte = pmap_pte(pmap, (vm_offset_t)(va + i*PAGE_SIZE)); PMAP_MARK_UNPRIV(xpmap_mtop(*pte)); - vm_page_lock_queues(); + rw_wlock(&pvh_global_lock); pte_store(pte, xpmap_mtop(*pte) | (PG_RW|PG_M)); - vm_page_unlock_queues(); + rw_wunlock(&pvh_global_lock); pmap_pte_release(pte); } } @@ -3778,7 +3792,7 @@ pmap_remove_write(vm_page_t m) if ((m->oflags & VPO_BUSY) == 0 && (m->aflags & PGA_WRITEABLE) == 0) return; - vm_page_lock_queues(); + rw_wlock(&pvh_global_lock); sched_pin(); TAILQ_FOREACH(pv, &m->md.pv_list, pv_list) { pmap = PV_PMAP(pv); @@ -3809,7 +3823,7 @@ retry: if (*PMAP1) PT_SET_MA(PADDR1, 0); sched_unpin(); - vm_page_unlock_queues(); + rw_wunlock(&pvh_global_lock); } /* @@ -3834,7 +3848,7 @@ pmap_ts_referenced(vm_page_t m) KASSERT((m->oflags & VPO_UNMANAGED) == 0, ("pmap_ts_referenced: page %p is not managed", m)); - vm_page_lock_queues(); + rw_wlock(&pvh_global_lock); sched_pin(); if ((pv = TAILQ_FIRST(&m->md.pv_list)) != NULL) { pvf = pv; @@ -3859,7 +3873,7 @@ pmap_ts_referenced(vm_page_t m) if (*PMAP1) PT_SET_MA(PADDR1, 0); sched_unpin(); - vm_page_unlock_queues(); + rw_wunlock(&pvh_global_lock); return (rtval); } @@ -3886,7 +3900,7 @@ pmap_clear_modify(vm_page_t m) */ if ((m->aflags & PGA_WRITEABLE) == 0) return; - vm_page_lock_queues(); + rw_wlock(&pvh_global_lock); sched_pin(); TAILQ_FOREACH(pv, &m->md.pv_list, pv_list) { pmap = PV_PMAP(pv); @@ -3904,7 +3918,7 @@ pmap_clear_modify(vm_page_t m) PMAP_UNLOCK(pmap); } sched_unpin(); - vm_page_unlock_queues(); + rw_wunlock(&pvh_global_lock); } /* @@ -3921,7 +3935,7 @@ pmap_clear_reference(vm_page_t m) KASSERT((m->oflags & VPO_UNMANAGED) == 0, ("pmap_clear_reference: page %p is not managed", m)); - vm_page_lock_queues(); + rw_wlock(&pvh_global_lock); sched_pin(); TAILQ_FOREACH(pv, &m->md.pv_list, pv_list) { pmap = PV_PMAP(pv); @@ -3939,7 +3953,7 @@ pmap_clear_reference(vm_page_t m) PMAP_UNLOCK(pmap); } sched_unpin(); - vm_page_unlock_queues(); + rw_wunlock(&pvh_global_lock); } /* Modified: head/sys/i386/xen/xen_machdep.c ============================================================================== --- head/sys/i386/xen/xen_machdep.c Fri Oct 12 23:12:19 2012 (r241497) +++ head/sys/i386/xen/xen_machdep.c Fri Oct 12 23:26:00 2012 (r241498) @@ -44,6 +44,7 @@ __FBSDID("$FreeBSD$"); #include #include #include +#include #include #include @@ -428,13 +429,15 @@ _xen_machphys_update(vm_paddr_t mfn, vm_ critical_exit(); } +extern struct rwlock pvh_global_lock; + void _xen_queue_pt_update(vm_paddr_t ptr, vm_paddr_t val, char *file, int line) { SET_VCPU(); if (__predict_true(gdtset)) - mtx_assert(&vm_page_queue_mtx, MA_OWNED); + rw_assert(&pvh_global_lock, RA_WLOCKED); KASSERT((ptr & 7) == 0, ("misaligned update")); From owner-svn-src-head@FreeBSD.ORG Sat Oct 13 03:56:34 2012 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id A3EF35EA; Sat, 13 Oct 2012 03:56:34 +0000 (UTC) (envelope-from dteske@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 82AC28FC08; Sat, 13 Oct 2012 03:56:34 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id q9D3uYdl033830; Sat, 13 Oct 2012 03:56:34 GMT (envelope-from dteske@svn.freebsd.org) Received: (from dteske@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q9D3uY9Y033828; Sat, 13 Oct 2012 03:56:34 GMT (envelope-from dteske@svn.freebsd.org) Message-Id: <201210130356.q9D3uY9Y033828@svn.freebsd.org> From: Devin Teske Date: Sat, 13 Oct 2012 03:56:34 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r241499 - head/usr.sbin/bsdconfig/dot X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 13 Oct 2012 03:56:34 -0000 Author: dteske Date: Sat Oct 13 03:56:33 2012 New Revision: 241499 URL: http://svn.freebsd.org/changeset/base/241499 Log: SVN r240684 broke the ability of the dot module to map include dependencies. Teach the dot module about the new location these includes moved to (as part of r240684) and clean things up a bit. Reviewed by: adrian (co-mentor) Approved by: adrian (co-mentor) Modified: head/usr.sbin/bsdconfig/dot/dot Modified: head/usr.sbin/bsdconfig/dot/dot ============================================================================== --- head/usr.sbin/bsdconfig/dot/dot Fri Oct 12 23:26:00 2012 (r241498) +++ head/usr.sbin/bsdconfig/dot/dot Sat Oct 13 03:56:33 2012 (r241499) @@ -229,6 +229,11 @@ done # [Optionally] Calculate list of include files # if [ "$SHOW_INCLUDES" ]; then + print_includes_awk=' + BEGIN { regex = "^f_include \\$BSDCFG_SHARE/" } + ( $0 ~ regex ) { sub(regex, ""); print } + ' # END-QUOTE + # # Build list of files in which to search for includes # @@ -249,17 +254,8 @@ if [ "$SHOW_INCLUDES" ]; then include_file_list= for file in $file_list; do include_file_list="$include_file_list $( - awk -v file="$file" -v item="${file%%/*}" ' - BEGIN { regex = "^f_include \\$BSDCFG_LIBE/" } - ( $0 ~ regex "include/" ) { - sub(regex, "") - print - } - ( $0 ~ regex "\\$APP_DIR/include/" ) { - sub(regex "\\$APP_DIR", item) - print - } - ' $file + awk -v file="$file" -v item="${file%%/*}" \ + "$print_includes_awk" $file )" done @@ -277,17 +273,8 @@ if [ "$SHOW_INCLUDES" ]; then # for file in $include_file_list; do include_file_list="$include_file_list $( - awk -v file="$file" -v item="${file%%/*}" ' - BEGIN { regex = "^f_include \\$BSDCFG_LIBE/" } - ( $0 ~ regex "include/" ) { - sub(regex, "") - print - } - ( $0 ~ regex "\\$APP_DIR/include/" ) { - sub(regex "\\$APP_DIR", item) - print - } - ' $file + awk -v file="$file" -v item="${file%%/*}" \ + "$print_includes_awk" $BSDCFG_SHARE/$file )" done @@ -431,7 +418,7 @@ if [ "$SHOW_INCLUDES" ]; then printf '\t\tconstraint = false;\n' for include_file in $include_file_list; do print_node "$include_file" \ - "label = \"${include_file#*include/}\"" + "label = \"${include_file##*/}\"" done end_nodelist fi @@ -444,6 +431,7 @@ if [ "$SHOW_INCLUDES" ]; then shape=oval color=black fillcolor=white style=filled edge_color=grey begin_nodelist "$shape" "$color" "$fillcolor" "$style" print_node edge "style = dashed" "color = $edge_color" + print_node edge "label = \"\\T\"" "fontsize = 9" file_list=$( for file in \ $BSDCONFIG \ @@ -452,6 +440,8 @@ if [ "$SHOW_INCLUDES" ]; then $cmd_program_list \ $include_file_list \ ; do + [ -f "$BSDCFG_SHARE/$file" ] && + echo $BSDCFG_SHARE/$file [ -e "$file" ] && echo $file done | sort -u ) @@ -460,31 +450,17 @@ if [ "$SHOW_INCLUDES" ]; then grep -qlI f_include $file || continue awk \ - -v file="$file" \ - -v item="${file%%/*}" \ + -v file="${file#$BSDCFG_SHARE/}" \ -v bsdconfig="$BSDCONFIG" \ ' - BEGIN { regex = "^f_include \\$BSDCFG_LIBE/" } - ( $0 ~ regex "include/" ) { + BEGIN { regex = "^f_include \\$BSDCFG_SHARE/" } + ( $0 ~ regex ) { sub(regex, "") if ( file == bsdconfig ) sub(".*/", "", file) printf "\t\t\"%s\" -> \"%s\";\n", $0, file } - ( $0 ~ regex "\\$APP_DIR/include/" ) { - sub(regex "\\$APP_DIR", item) - if ( file == bsdconfig ) sub(".*/", "", file) - printf "\t\t\"%s\" -> \"%s\";\n", $0, file - } ' $file - done | sort | awk ' - BEGIN { found = 0 } - { - # If already found or no-match... just spew - if ( found ) { print; next } - if ( $0 !~ /^[[:space:]]*"include\// ) { print; next } - printf "\t\tedge [ label = \"\\T\", fontsize = 9 ];\n" - print; found = 1 - }' + done | sort end_nodelist fi @@ -554,14 +530,58 @@ printf '\t\tlabel = "bsdconfig(8)";\n' printf '\t\ttooltip = "bsdconfig(8)";\n' print_node "bsdconfig" if [ "$SHOW_INCLUDES" ]; then - printf '\t\tsubgraph "cluster_bsdconfig_includes" {\n' + printf '\t\tsubgraph "cluster_includes" {\n' printf '\t\t\tbgcolor = "%s";\n' "$bgcolor_includes" printf '\t\t\tlabel = "%s";\n' "$msg_includes" + for include_file in $include_file_list; do - case "$include_file" in - include/*) printf '\t\t\t"%s";\n' "$include_file";; - esac - done + echo $include_file + done | awk -v bgcolor="$bgcolor_bsdconfig" ' + BEGIN { created = 0 } + function end_subgraph() { printf "\t\t\t};\n" } + ( $0 !~ "/" ) { + if ( ! created ) + { + printf "\t\t\tsubgraph \"%s\" {\n", + "cluster_bsdconfig_includes" + printf "\t\t\t\tbgcolor = \"%s\";\n", bgcolor + printf "\t\t\t\tlabel = \"bsdconfig\";\n" + created++ + } + printf "\t\t\t\t\"%s\";\n", $1 + } + END { created && end_subgraph() }' + + for include_file in $include_file_list; do + echo $include_file + done | awk ' + BEGIN { created = 0 } + function end_subgraph() { printf "\t\t\t};\n" } + ( $0 ~ "/" ) { + include_dir_tmp = $1 + sub("/[^/]*$", "", include_dir_tmp) + gsub(/[^[:alnum:]_]/, "_", include_dir_tmp) + + if ( created && include_dir != include_dir_tmp ) + { + end_subgraph() + created = 0 + } + + if ( ! created ) + { + include_dir = include_dir_tmp + printf "\t\t\tsubgraph \"cluster_%s_includes\" {\n", + include_dir + printf "\t\t\t\tbgcolor = \"white\";\n" + printf "\t\t\t\tlabel = \"%s\";\n", include_dir + created++ + } + + printf "\t\t\t\t\"%s\";\n", $1 + } + END { created && end_subgraph() }' + printf '\t\t};\n' fi end_nodelist From owner-svn-src-head@FreeBSD.ORG Sat Oct 13 06:27:35 2012 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id 29B23C50; Sat, 13 Oct 2012 06:27:35 +0000 (UTC) (envelope-from adrian@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 1200F8FC08; Sat, 13 Oct 2012 06:27:35 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id q9D6RY90054559; Sat, 13 Oct 2012 06:27:34 GMT (envelope-from adrian@svn.freebsd.org) Received: (from adrian@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q9D6RYgB054557; Sat, 13 Oct 2012 06:27:34 GMT (envelope-from adrian@svn.freebsd.org) Message-Id: <201210130627.q9D6RYgB054557@svn.freebsd.org> From: Adrian Chadd Date: Sat, 13 Oct 2012 06:27:34 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r241500 - head/sys/dev/ath X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 13 Oct 2012 06:27:35 -0000 Author: adrian Date: Sat Oct 13 06:27:34 2012 New Revision: 241500 URL: http://svn.freebsd.org/changeset/base/241500 Log: Fix the non-TDMA build. Modified: head/sys/dev/ath/if_ath_tx.c Modified: head/sys/dev/ath/if_ath_tx.c ============================================================================== --- head/sys/dev/ath/if_ath_tx.c Sat Oct 13 03:56:33 2012 (r241499) +++ head/sys/dev/ath/if_ath_tx.c Sat Oct 13 06:27:34 2012 (r241500) @@ -809,12 +809,11 @@ ath_tx_handoff_hw(struct ath_softc *sc, } #else ATH_TXQ_INSERT_TAIL(txq, bf, bf_list); - ATH_KTR(sc, ATH_KTR_TX, 4, - "ath_tx_handoff: non-tdma: txq=%u, add bf=%p, qbusy=%d, " + ATH_KTR(sc, ATH_KTR_TX, 3, + "ath_tx_handoff: non-tdma: txq=%u, add bf=%p " "depth=%d", txq->axq_qnum, bf, - qbusy, txq->axq_depth); if (txq->axq_link == NULL) { ath_hal_puttxbuf(ah, txq->axq_qnum, bf->bf_daddr); From owner-svn-src-head@FreeBSD.ORG Sat Oct 13 09:25:30 2012 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id 62527E1D; Sat, 13 Oct 2012 09:25:30 +0000 (UTC) (envelope-from melifaro@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 4A5F58FC16; Sat, 13 Oct 2012 09:25:30 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id q9D9PUlG082988; Sat, 13 Oct 2012 09:25:30 GMT (envelope-from melifaro@svn.freebsd.org) Received: (from melifaro@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q9D9PUWu082985; Sat, 13 Oct 2012 09:25:30 GMT (envelope-from melifaro@svn.freebsd.org) Message-Id: <201210130925.q9D9PUWu082985@svn.freebsd.org> From: "Alexander V. Chernikov" Date: Sat, 13 Oct 2012 09:25:30 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r241501 - head/share/man/man4 X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 13 Oct 2012 09:25:30 -0000 Author: melifaro Date: Sat Oct 13 09:25:29 2012 New Revision: 241501 URL: http://svn.freebsd.org/changeset/base/241501 Log: Add forgotten documentation for new NGM_NETFLOW_V9INFO message. Submitted by: Dmitry Luhtionov MFC with: r241446 Modified: head/share/man/man4/ng_netflow.4 Modified: head/share/man/man4/ng_netflow.4 ============================================================================== --- head/share/man/man4/ng_netflow.4 Sat Oct 13 06:27:34 2012 (r241500) +++ head/share/man/man4/ng_netflow.4 Sat Oct 13 09:25:29 2012 (r241501) @@ -257,6 +257,9 @@ not directly from See also .Sx BUGS section. +.It Dv NGM_NETFLOW_V9INFO +Returns some NetFlow v9 related values in a +.Vt "struct ng_netflow_v9info" . .El .Sh ASCII CONTROL MESSAGES Most binary control messages have an From owner-svn-src-head@FreeBSD.ORG Sat Oct 13 09:31:01 2012 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id E6CD0FFC; Sat, 13 Oct 2012 09:31:01 +0000 (UTC) (envelope-from melifaro@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id B4C098FC0A; Sat, 13 Oct 2012 09:31:01 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id q9D9V15q083830; Sat, 13 Oct 2012 09:31:01 GMT (envelope-from melifaro@svn.freebsd.org) Received: (from melifaro@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q9D9V1AQ083827; Sat, 13 Oct 2012 09:31:01 GMT (envelope-from melifaro@svn.freebsd.org) Message-Id: <201210130931.q9D9V1AQ083827@svn.freebsd.org> From: "Alexander V. Chernikov" Date: Sat, 13 Oct 2012 09:31:01 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r241502 - in head/sys: netinet netinet6 X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 13 Oct 2012 09:31:02 -0000 Author: melifaro Date: Sat Oct 13 09:31:01 2012 New Revision: 241502 URL: http://svn.freebsd.org/changeset/base/241502 Log: Cleanup documentation: cloning route support has been removed in r186119. MFC after: 2 weeks Modified: head/sys/netinet/in_rmx.c head/sys/netinet6/in6_rmx.c Modified: head/sys/netinet/in_rmx.c ============================================================================== --- head/sys/netinet/in_rmx.c Sat Oct 13 09:25:29 2012 (r241501) +++ head/sys/netinet/in_rmx.c Sat Oct 13 09:31:01 2012 (r241502) @@ -27,19 +27,6 @@ * SUCH DAMAGE. */ -/* - * This code does two things necessary for the enhanced TCP metrics to - * function in a useful manner: - * 1) It marks all non-host routes as `cloning', thus ensuring that - * every actual reference to such a route actually gets turned - * into a reference to a host route to the specific destination - * requested. - * 2) When such routes lose all their references, it arranges for them - * to be deleted in some random collection of circumstances, so that - * a large quantity of stale routing data is not kept in kernel memory - * indefinitely. See in_rtqtimo() below for the exact mechanism. - */ - #include __FBSDID("$FreeBSD$"); Modified: head/sys/netinet6/in6_rmx.c ============================================================================== --- head/sys/netinet6/in6_rmx.c Sat Oct 13 09:25:29 2012 (r241501) +++ head/sys/netinet6/in6_rmx.c Sat Oct 13 09:31:01 2012 (r241502) @@ -59,19 +59,6 @@ * */ -/* - * This code does two things necessary for the enhanced TCP metrics to - * function in a useful manner: - * 1) It marks all non-host routes as `cloning', thus ensuring that - * every actual reference to such a route actually gets turned - * into a reference to a host route to the specific destination - * requested. - * 2) When such routes lose all their references, it arranges for them - * to be deleted in some random collection of circumstances, so that - * a large quantity of stale routing data is not kept in kernel memory - * indefinitely. See in6_rtqtimo() below for the exact mechanism. - */ - #include __FBSDID("$FreeBSD$"); From owner-svn-src-head@FreeBSD.ORG Sat Oct 13 10:18:37 2012 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id 49AD7770; Sat, 13 Oct 2012 10:18:37 +0000 (UTC) (envelope-from mav@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 18F718FC14; Sat, 13 Oct 2012 10:18:37 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id q9DAIaL5091887; Sat, 13 Oct 2012 10:18:36 GMT (envelope-from mav@svn.freebsd.org) Received: (from mav@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q9DAIarq091884; Sat, 13 Oct 2012 10:18:36 GMT (envelope-from mav@svn.freebsd.org) Message-Id: <201210131018.q9DAIarq091884@svn.freebsd.org> From: Alexander Motin Date: Sat, 13 Oct 2012 10:18:36 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r241503 - in head/sys/cam: . scsi X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 13 Oct 2012 10:18:37 -0000 Author: mav Date: Sat Oct 13 10:18:36 2012 New Revision: 241503 URL: http://svn.freebsd.org/changeset/base/241503 Log: XPT_DEV_MATCH is probably the only xpt_action() method that is called without holding SIM lock. It really doesn't need that lock, but adding it removes that specific exception, allowing to assert locking there later. Submitted by: ken@ (earlier version) Modified: head/sys/cam/cam_xpt.c head/sys/cam/scsi/scsi_enc_ses.c Modified: head/sys/cam/cam_xpt.c ============================================================================== --- head/sys/cam/cam_xpt.c Sat Oct 13 09:31:01 2012 (r241502) +++ head/sys/cam/cam_xpt.c Sat Oct 13 10:18:36 2012 (r241503) @@ -582,7 +582,9 @@ xptioctl(struct cdev *dev, u_long cmd, c /* * This is an immediate CCB, we can send it on directly. */ + CAM_SIM_LOCK(xpt_path_sim(xpt_periph->path)); xpt_action(inccb); + CAM_SIM_UNLOCK(xpt_path_sim(xpt_periph->path)); /* * Map the buffers back into user space. @@ -2818,6 +2820,11 @@ xpt_action_default(union ccb *start_ccb) position_type = CAM_DEV_POS_PDRV; } + /* + * Note that we drop the SIM lock here, because the EDT + * traversal code needs to do its own locking. + */ + CAM_SIM_UNLOCK(xpt_path_sim(cdm->ccb_h.path)); switch(position_type & CAM_DEV_POS_TYPEMASK) { case CAM_DEV_POS_EDT: xptedtmatch(cdm); @@ -2829,6 +2836,7 @@ xpt_action_default(union ccb *start_ccb) cdm->status = CAM_DEV_MATCH_ERROR; break; } + CAM_SIM_LOCK(xpt_path_sim(cdm->ccb_h.path)); if (cdm->status == CAM_DEV_MATCH_ERROR) start_ccb->ccb_h.status = CAM_REQ_CMP_ERR; Modified: head/sys/cam/scsi/scsi_enc_ses.c ============================================================================== --- head/sys/cam/scsi/scsi_enc_ses.c Sat Oct 13 09:31:01 2012 (r241502) +++ head/sys/cam/scsi/scsi_enc_ses.c Sat Oct 13 10:18:36 2012 (r241503) @@ -899,9 +899,10 @@ ses_path_iter_devid_callback(enc_softc_t device_pattern->data.devid_pat.id_len); memset(&cdm, 0, sizeof(cdm)); - if (xpt_create_path(&cdm.ccb_h.path, /*periph*/NULL, CAM_XPT_PATH_ID, - CAM_TARGET_WILDCARD, - CAM_LUN_WILDCARD) != CAM_REQ_CMP) + if (xpt_create_path_unlocked(&cdm.ccb_h.path, /*periph*/NULL, + CAM_XPT_PATH_ID, + CAM_TARGET_WILDCARD, + CAM_LUN_WILDCARD) != CAM_REQ_CMP) return; cdm.ccb_h.func_code = XPT_DEV_MATCH; @@ -911,8 +912,11 @@ ses_path_iter_devid_callback(enc_softc_t cdm.match_buf_len = sizeof(match_result); cdm.matches = &match_result; + sim = xpt_path_sim(cdm.ccb_h.path); + CAM_SIM_LOCK(sim); xpt_action((union ccb *)&cdm); xpt_free_path(cdm.ccb_h.path); + CAM_SIM_UNLOCK(sim); if ((cdm.ccb_h.status & CAM_STATUS_MASK) != CAM_REQ_CMP || (cdm.status != CAM_DEV_MATCH_LAST From owner-svn-src-head@FreeBSD.ORG Sat Oct 13 11:23:17 2012 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id 5DD88725; Sat, 13 Oct 2012 11:23:17 +0000 (UTC) (envelope-from mav@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 2D59B8FC0C; Sat, 13 Oct 2012 11:23:17 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id q9DBNHGA001656; Sat, 13 Oct 2012 11:23:17 GMT (envelope-from mav@svn.freebsd.org) Received: (from mav@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q9DBNGjK001654; Sat, 13 Oct 2012 11:23:16 GMT (envelope-from mav@svn.freebsd.org) Message-Id: <201210131123.q9DBNGjK001654@svn.freebsd.org> From: Alexander Motin Date: Sat, 13 Oct 2012 11:23:16 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r241504 - head/sys/cam X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 13 Oct 2012 11:23:17 -0000 Author: mav Date: Sat Oct 13 11:23:16 2012 New Revision: 241504 URL: http://svn.freebsd.org/changeset/base/241504 Log: Fix XPT_DEBUG paths operations locking: - Extend the lock to cover xpt_path_release() for the new path. - While xpt_action() is called while holding right SIM lock for the new bus, the old path release may require different SIM lock. So we have to temporary drop the new lock and get the old one. Modified: head/sys/cam/cam_xpt.c Modified: head/sys/cam/cam_xpt.c ============================================================================== --- head/sys/cam/cam_xpt.c Sat Oct 13 10:18:36 2012 (r241503) +++ head/sys/cam/cam_xpt.c Sat Oct 13 11:23:16 2012 (r241504) @@ -533,9 +533,9 @@ xptioctl(struct cdev *dev, u_long cmd, c xpt_merge_ccb(&ccb, inccb); ccb.ccb_h.cbfcnp = xptdone; xpt_action(&ccb); - CAM_SIM_UNLOCK(bus->sim); bcopy(&ccb, inccb, sizeof(union ccb)); xpt_free_path(ccb.ccb_h.path); + CAM_SIM_UNLOCK(bus->sim); break; } @@ -2989,34 +2989,42 @@ xpt_action_default(union ccb *start_ccb) break; } case XPT_DEBUG: { + struct cam_path *oldpath; + struct cam_sim *oldsim; + /* Check that all request bits are supported. */ if (start_ccb->cdbg.flags & ~(CAM_DEBUG_COMPILE)) { start_ccb->ccb_h.status = CAM_FUNC_NOTAVAIL; break; } - cam_dflags = start_ccb->cdbg.flags; + cam_dflags = CAM_DEBUG_NONE; if (cam_dpath != NULL) { - xpt_free_path(cam_dpath); + /* To release the old path we must hold proper lock. */ + oldpath = cam_dpath; cam_dpath = NULL; + oldsim = xpt_path_sim(oldpath); + CAM_SIM_UNLOCK(xpt_path_sim(start_ccb->ccb_h.path)); + CAM_SIM_LOCK(oldsim); + xpt_free_path(oldpath); + CAM_SIM_UNLOCK(oldsim); + CAM_SIM_LOCK(xpt_path_sim(start_ccb->ccb_h.path)); } - if (cam_dflags != CAM_DEBUG_NONE) { + if (start_ccb->cdbg.flags != CAM_DEBUG_NONE) { if (xpt_create_path(&cam_dpath, xpt_periph, start_ccb->ccb_h.path_id, start_ccb->ccb_h.target_id, start_ccb->ccb_h.target_lun) != CAM_REQ_CMP) { start_ccb->ccb_h.status = CAM_RESRC_UNAVAIL; - cam_dflags = CAM_DEBUG_NONE; } else { + cam_dflags = start_ccb->cdbg.flags; start_ccb->ccb_h.status = CAM_REQ_CMP; xpt_print(cam_dpath, "debugging flags now %x\n", cam_dflags); } - } else { - cam_dpath = NULL; + } else start_ccb->ccb_h.status = CAM_REQ_CMP; - } break; } case XPT_FREEZE_QUEUE: From owner-svn-src-head@FreeBSD.ORG Sat Oct 13 13:54:49 2012 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id 9F8C2934; Sat, 13 Oct 2012 13:54:49 +0000 (UTC) (envelope-from pawel@dawidek.net) Received: from mail.dawidek.net (garage.dawidek.net [91.121.88.72]) by mx1.freebsd.org (Postfix) with ESMTP id E063C8FC0A; Sat, 13 Oct 2012 13:54:48 +0000 (UTC) Received: from localhost (89-73-195-149.dynamic.chello.pl [89.73.195.149]) by mail.dawidek.net (Postfix) with ESMTPSA id 142ABED2; Sat, 13 Oct 2012 15:53:28 +0200 (CEST) Date: Sat, 13 Oct 2012 15:55:18 +0200 From: Pawel Jakub Dawidek To: Alan Cox Subject: Re: svn commit: r241498 - head/sys/i386/xen Message-ID: <20121013135518.GC1383@garage.freebsd.pl> References: <201210122326.q9CNQ0cD095249@svn.freebsd.org> MIME-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha1; protocol="application/pgp-signature"; boundary="GPJrCs/72TxItFYR" Content-Disposition: inline In-Reply-To: <201210122326.q9CNQ0cD095249@svn.freebsd.org> X-OS: FreeBSD 10.0-CURRENT amd64 User-Agent: Mutt/1.5.21 (2010-09-15) Cc: svn-src-head@freebsd.org, svn-src-all@freebsd.org, src-committers@freebsd.org X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 13 Oct 2012 13:54:49 -0000 --GPJrCs/72TxItFYR Content-Type: text/plain; charset=us-ascii Content-Disposition: inline Content-Transfer-Encoding: quoted-printable On Fri, Oct 12, 2012 at 11:26:00PM +0000, Alan Cox wrote: > Author: alc > Date: Fri Oct 12 23:26:00 2012 > New Revision: 241498 > URL: http://svn.freebsd.org/changeset/base/241498 >=20 > Log: > Replace all uses of the vm page queues lock by a new R/W lock. > Unfortunately, this lock cannot be defined as static under Xen because = it > is (ab)used to serialize queued page table changes. I couldn't help but notice that this lock is always write-locked, but I guess this is going to change at some point? > Tested by: sbruno >=20 > Modified: > head/sys/i386/xen/mp_machdep.c > head/sys/i386/xen/pmap.c > head/sys/i386/xen/xen_machdep.c >=20 > Modified: head/sys/i386/xen/mp_machdep.c > =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D > --- head/sys/i386/xen/mp_machdep.c Fri Oct 12 23:12:19 2012 (r241497) > +++ head/sys/i386/xen/mp_machdep.c Fri Oct 12 23:26:00 2012 (r241498) > @@ -64,6 +64,7 @@ __FBSDID("$FreeBSD$"); > #include > #include > #include > +#include > #include > #include > #include > @@ -804,6 +805,7 @@ smp_trap_init(trap_info_t *trap_ctxt) > } > } > =20 > +extern struct rwlock pvh_global_lock; > extern int nkpt; > static void > cpu_initialize_context(unsigned int cpu) > @@ -862,7 +864,7 @@ cpu_initialize_context(unsigned int cpu) > =20 > =20 > xen_pgdpt_pin(VM_PAGE_TO_MACH(m[NPGPTD + 1])); > - vm_page_lock_queues(); > + rw_wlock(&pvh_global_lock); > for (i =3D 0; i < 4; i++) { > int pdir =3D (PTDPTDI + i) / NPDEPG; > int curoffset =3D (PTDPTDI + i) % NPDEPG; > @@ -872,7 +874,7 @@ cpu_initialize_context(unsigned int cpu) > ma[i]); > } > PT_UPDATES_FLUSH(); > - vm_page_unlock_queues(); > + rw_wunlock(&pvh_global_lock); > =09 > memset(&ctxt, 0, sizeof(ctxt)); > ctxt.flags =3D VGCF_IN_KERNEL; >=20 > Modified: head/sys/i386/xen/pmap.c > =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D > --- head/sys/i386/xen/pmap.c Fri Oct 12 23:12:19 2012 (r241497) > +++ head/sys/i386/xen/pmap.c Fri Oct 12 23:26:00 2012 (r241498) > @@ -111,6 +111,7 @@ __FBSDID("$FreeBSD$"); > #include > #include > #include > +#include > #include > #include > #include > @@ -220,6 +221,13 @@ static SYSCTL_NODE(_vm, OID_AUTO, pmap,=20 > static int pat_works; /* Is page attribute table sane? */ > =20 > /* > + * This lock is defined as static in other pmap implementations. It can= not, > + * however, be defined as static here, because it is (ab)used to seriali= ze > + * queued page table changes in other sources files. > + */ > +struct rwlock pvh_global_lock; > + > +/* > * Data for the pv entry allocation mechanism > */ > static TAILQ_HEAD(pch, pv_chunk) pv_chunks =3D TAILQ_HEAD_INITIALIZER(pv= _chunks); > @@ -380,6 +388,12 @@ pmap_bootstrap(vm_paddr_t firstaddr) > #endif > CPU_FILL(&kernel_pmap->pm_active); /* don't allow deactivation */ > TAILQ_INIT(&kernel_pmap->pm_pvchunk); > + > + /* > + * Initialize the global pv list lock. > + */ > + rw_init_flags(&pvh_global_lock, "pmap pv global", RW_RECURSE); > + > LIST_INIT(&allpmaps); > mtx_init(&allpmaps_lock, "allpmaps", NULL, MTX_SPIN); > mtx_lock_spin(&allpmaps_lock); > @@ -979,9 +993,9 @@ pmap_pte_release(pt_entry_t *pte) > if ((pt_entry_t *)((vm_offset_t)pte & ~PAGE_MASK) =3D=3D PADDR2) { > CTR1(KTR_PMAP, "pmap_pte_release: pte=3D0x%jx", > *PMAP2); > - vm_page_lock_queues(); > + rw_wlock(&pvh_global_lock); > PT_SET_VA(PMAP2, 0, TRUE); > - vm_page_unlock_queues(); > + rw_wunlock(&pvh_global_lock); > mtx_unlock(&PMAP2mutex); > } > } > @@ -1001,7 +1015,7 @@ invlcaddr(void *caddr) > * scans are across different pmaps. It is very wasteful > * to do an entire invltlb for checking a single mapping. > * > - * If the given pmap is not the current pmap, vm_page_queue_mtx > + * If the given pmap is not the current pmap, pvh_global_lock > * must be held and curthread pinned to a CPU. > */ > static pt_entry_t * > @@ -1017,7 +1031,7 @@ pmap_pte_quick(pmap_t pmap, vm_offset_t=20 > /* are we current address space or kernel? */ > if (pmap_is_current(pmap)) > return (vtopte(va)); > - mtx_assert(&vm_page_queue_mtx, MA_OWNED); > + rw_assert(&pvh_global_lock, RA_WLOCKED); > KASSERT(curthread->td_pinned > 0, ("curthread not pinned")); > newpf =3D *pde & PG_FRAME; > if ((*PMAP1 & PG_FRAME) !=3D newpf) { > @@ -1299,7 +1313,7 @@ pmap_qremove(vm_offset_t sva, int count) > =20 > CTR2(KTR_PMAP, "pmap_qremove: sva=3D0x%x count=3D%d", sva, count); > va =3D sva; > - vm_page_lock_queues(); > + rw_wlock(&pvh_global_lock); > critical_enter(); > while (count-- > 0) { > pmap_kremove(va); > @@ -1308,7 +1322,7 @@ pmap_qremove(vm_offset_t sva, int count) > PT_UPDATES_FLUSH(); > pmap_invalidate_range(kernel_pmap, sva, va); > critical_exit(); > - vm_page_unlock_queues(); > + rw_wunlock(&pvh_global_lock); > } > =20 > /*************************************************** > @@ -1511,7 +1525,7 @@ pmap_pinit(pmap_t pmap) > #ifdef PAE=09 > PT_SET_MA(pmap->pm_pdpt, *vtopte((vm_offset_t)pmap->pm_pdpt) & ~PG_RW); > #endif > - vm_page_lock_queues(); > + rw_wlock(&pvh_global_lock); > xen_flush_queue(); > xen_pgdpt_pin(VM_PAGE_TO_MACH(ptdpg[NPGPTD])); > for (i =3D 0; i < NPGPTD; i++) { > @@ -1519,7 +1533,7 @@ pmap_pinit(pmap_t pmap) > PT_SET_VA_MA(&pmap->pm_pdir[PTDPTDI + i], ma | PG_V | PG_A, FALSE); > } > xen_flush_queue(); > - vm_page_unlock_queues(); > + rw_wunlock(&pvh_global_lock); > CPU_ZERO(&pmap->pm_active); > TAILQ_INIT(&pmap->pm_pvchunk); > bzero(&pmap->pm_stats, sizeof pmap->pm_stats); > @@ -1551,9 +1565,9 @@ _pmap_allocpte(pmap_t pmap, u_int ptepin > VM_ALLOC_WIRED | VM_ALLOC_ZERO)) =3D=3D NULL) { > if (flags & M_WAITOK) { > PMAP_UNLOCK(pmap); > - vm_page_unlock_queues(); > + rw_wunlock(&pvh_global_lock); > VM_WAIT; > - vm_page_lock_queues(); > + rw_wlock(&pvh_global_lock); > PMAP_LOCK(pmap); > } > =20 > @@ -1884,14 +1898,14 @@ pmap_growkernel(vm_offset_t addr) > pmap_zero_page(nkpg); > ptppaddr =3D VM_PAGE_TO_PHYS(nkpg); > newpdir =3D (pd_entry_t) (ptppaddr | PG_V | PG_RW | PG_A | PG_M); > - vm_page_lock_queues(); > + rw_wlock(&pvh_global_lock); > PD_SET_VA(kernel_pmap, (kernel_vm_end >> PDRSHIFT), newpdir, TRUE); > mtx_lock_spin(&allpmaps_lock); > LIST_FOREACH(pmap, &allpmaps, pm_list) > PD_SET_VA(pmap, (kernel_vm_end >> PDRSHIFT), newpdir, TRUE); > =20 > mtx_unlock_spin(&allpmaps_lock); > - vm_page_unlock_queues(); > + rw_wunlock(&pvh_global_lock); > =20 > kernel_vm_end =3D (kernel_vm_end + NBPDR) & ~PDRMASK; > if (kernel_vm_end - 1 >=3D kernel_map->max_offset) { > @@ -2094,7 +2108,7 @@ free_pv_entry(pmap_t pmap, pv_entry_t pv > struct pv_chunk *pc; > int idx, field, bit; > =20 > - mtx_assert(&vm_page_queue_mtx, MA_OWNED); > + rw_assert(&pvh_global_lock, RA_WLOCKED); > PMAP_LOCK_ASSERT(pmap, MA_OWNED); > PV_STAT(pv_entry_frees++); > PV_STAT(pv_entry_spare++); > @@ -2154,7 +2168,7 @@ get_pv_entry(pmap_t pmap, boolean_t try) > vm_page_t m; > =20 > PMAP_LOCK_ASSERT(pmap, MA_OWNED); > - mtx_assert(&vm_page_queue_mtx, MA_OWNED); > + rw_assert(&pvh_global_lock, RA_WLOCKED); > PV_STAT(pv_entry_allocs++); > pv_entry_count++; > if (pv_entry_count > pv_entry_high_water) > @@ -2224,7 +2238,7 @@ pmap_pvh_remove(struct md_page *pvh, pma > { > pv_entry_t pv; > =20 > - mtx_assert(&vm_page_queue_mtx, MA_OWNED); > + rw_assert(&pvh_global_lock, RA_WLOCKED); > TAILQ_FOREACH(pv, &pvh->pv_list, pv_list) { > if (pmap =3D=3D PV_PMAP(pv) && va =3D=3D pv->pv_va) { > TAILQ_REMOVE(&pvh->pv_list, pv, pv_list); > @@ -2248,7 +2262,7 @@ static void > pmap_remove_entry(pmap_t pmap, vm_page_t m, vm_offset_t va) > { > =20 > - mtx_assert(&vm_page_queue_mtx, MA_OWNED); > + rw_assert(&pvh_global_lock, RA_WLOCKED); > pmap_pvh_free(&m->md, pmap, va); > if (TAILQ_EMPTY(&m->md.pv_list)) > vm_page_aflag_clear(m, PGA_WRITEABLE); > @@ -2263,7 +2277,7 @@ pmap_try_insert_pv_entry(pmap_t pmap, vm > pv_entry_t pv; > =20 > PMAP_LOCK_ASSERT(pmap, MA_OWNED); > - mtx_assert(&vm_page_queue_mtx, MA_OWNED); > + rw_assert(&pvh_global_lock, RA_WLOCKED); > if (pv_entry_count < pv_entry_high_water &&=20 > (pv =3D get_pv_entry(pmap, TRUE)) !=3D NULL) { > pv->pv_va =3D va; > @@ -2285,7 +2299,7 @@ pmap_remove_pte(pmap_t pmap, pt_entry_t=20 > CTR3(KTR_PMAP, "pmap_remove_pte: pmap=3D%p *ptq=3D0x%x va=3D0x%x", > pmap, (u_long)*ptq, va); > =09 > - mtx_assert(&vm_page_queue_mtx, MA_OWNED); > + rw_assert(&pvh_global_lock, RA_WLOCKED); > PMAP_LOCK_ASSERT(pmap, MA_OWNED); > oldpte =3D *ptq; > PT_SET_VA_MA(ptq, 0, TRUE); > @@ -2322,7 +2336,7 @@ pmap_remove_page(pmap_t pmap, vm_offset_ > CTR2(KTR_PMAP, "pmap_remove_page: pmap=3D%p va=3D0x%x", > pmap, va); > =09 > - mtx_assert(&vm_page_queue_mtx, MA_OWNED); > + rw_assert(&pvh_global_lock, RA_WLOCKED); > KASSERT(curthread->td_pinned > 0, ("curthread not pinned")); > PMAP_LOCK_ASSERT(pmap, MA_OWNED); > if ((pte =3D pmap_pte_quick(pmap, va)) =3D=3D NULL || (*pte & PG_V) =3D= =3D 0) > @@ -2360,7 +2374,7 @@ pmap_remove(pmap_t pmap, vm_offset_t sva > =20 > anyvalid =3D 0; > =20 > - vm_page_lock_queues(); > + rw_wlock(&pvh_global_lock); > sched_pin(); > PMAP_LOCK(pmap); > =20 > @@ -2437,7 +2451,7 @@ out: > if (anyvalid) > pmap_invalidate_all(pmap); > sched_unpin(); > - vm_page_unlock_queues(); > + rw_wunlock(&pvh_global_lock); > PMAP_UNLOCK(pmap); > pmap_free_zero_pages(free); > } > @@ -2466,7 +2480,7 @@ pmap_remove_all(vm_page_t m) > KASSERT((m->oflags & VPO_UNMANAGED) =3D=3D 0, > ("pmap_remove_all: page %p is not managed", m)); > free =3D NULL; > - vm_page_lock_queues(); > + rw_wlock(&pvh_global_lock); > sched_pin(); > while ((pv =3D TAILQ_FIRST(&m->md.pv_list)) !=3D NULL) { > pmap =3D PV_PMAP(pv); > @@ -2498,7 +2512,7 @@ pmap_remove_all(vm_page_t m) > if (*PMAP1) > PT_SET_MA(PADDR1, 0); > sched_unpin(); > - vm_page_unlock_queues(); > + rw_wunlock(&pvh_global_lock); > pmap_free_zero_pages(free); > } > =20 > @@ -2533,7 +2547,7 @@ pmap_protect(pmap_t pmap, vm_offset_t sv > =20 > anychanged =3D 0; > =20 > - vm_page_lock_queues(); > + rw_wlock(&pvh_global_lock); > sched_pin(); > PMAP_LOCK(pmap); > for (; sva < eva; sva =3D pdnxt) { > @@ -2617,7 +2631,7 @@ retry: > if (anychanged) > pmap_invalidate_all(pmap); > sched_unpin(); > - vm_page_unlock_queues(); > + rw_wunlock(&pvh_global_lock); > PMAP_UNLOCK(pmap); > } > =20 > @@ -2658,7 +2672,7 @@ pmap_enter(pmap_t pmap, vm_offset_t va,=20 > =20 > mpte =3D NULL; > =20 > - vm_page_lock_queues(); > + rw_wlock(&pvh_global_lock); > PMAP_LOCK(pmap); > sched_pin(); > =20 > @@ -2831,7 +2845,7 @@ validate: > if (*PMAP1) > PT_SET_VA_MA(PMAP1, 0, TRUE); > sched_unpin(); > - vm_page_unlock_queues(); > + rw_wunlock(&pvh_global_lock); > PMAP_UNLOCK(pmap); > } > =20 > @@ -2861,7 +2875,7 @@ pmap_enter_object(pmap_t pmap, vm_offset > psize =3D atop(end - start); > mpte =3D NULL; > m =3D m_start; > - vm_page_lock_queues(); > + rw_wlock(&pvh_global_lock); > PMAP_LOCK(pmap); > while (m !=3D NULL && (diff =3D m->pindex - m_start->pindex) < psize) { > mpte =3D pmap_enter_quick_locked(&mclp, &count, pmap, start + ptoa(dif= f), m, > @@ -2878,7 +2892,7 @@ pmap_enter_object(pmap_t pmap, vm_offset > error =3D HYPERVISOR_multicall(mcl, count); > KASSERT(error =3D=3D 0, ("bad multicall %d", error)); > } > - vm_page_unlock_queues(); > + rw_wunlock(&pvh_global_lock); > PMAP_UNLOCK(pmap); > } > =20 > @@ -2901,12 +2915,12 @@ pmap_enter_quick(pmap_t pmap, vm_offset_ > CTR4(KTR_PMAP, "pmap_enter_quick: pmap=3D%p va=3D0x%x m=3D%p prot=3D0x%= x", > pmap, va, m, prot); > =09 > - vm_page_lock_queues(); > + rw_wlock(&pvh_global_lock); > PMAP_LOCK(pmap); > (void)pmap_enter_quick_locked(&mclp, &count, pmap, va, m, prot, NULL); > if (count) > HYPERVISOR_multicall(&mcl, count); > - vm_page_unlock_queues(); > + rw_wunlock(&pvh_global_lock); > PMAP_UNLOCK(pmap); > } > =20 > @@ -2952,7 +2966,7 @@ pmap_enter_quick_locked(multicall_entry_ > KASSERT(va < kmi.clean_sva || va >=3D kmi.clean_eva || > (m->oflags & VPO_UNMANAGED) !=3D 0, > ("pmap_enter_quick_locked: managed mapping within the clean submap"= )); > - mtx_assert(&vm_page_queue_mtx, MA_OWNED); > + rw_assert(&pvh_global_lock, RA_WLOCKED); > PMAP_LOCK_ASSERT(pmap, MA_OWNED); > =20 > /* > @@ -3168,7 +3182,7 @@ pmap_change_wiring(pmap_t pmap, vm_offse > { > pt_entry_t *pte; > =20 > - vm_page_lock_queues(); > + rw_wlock(&pvh_global_lock); > PMAP_LOCK(pmap); > pte =3D pmap_pte(pmap, va); > =20 > @@ -3186,7 +3200,7 @@ pmap_change_wiring(pmap_t pmap, vm_offse > */ > pmap_pte_release(pte); > PMAP_UNLOCK(pmap); > - vm_page_unlock_queues(); > + rw_wunlock(&pvh_global_lock); > } > =20 > =20 > @@ -3225,7 +3239,7 @@ pmap_copy(pmap_t dst_pmap, pmap_t src_pm > mtx_lock(&createdelete_lock); > #endif > =20 > - vm_page_lock_queues(); > + rw_wlock(&pvh_global_lock); > if (dst_pmap < src_pmap) { > PMAP_LOCK(dst_pmap); > PMAP_LOCK(src_pmap); > @@ -3315,7 +3329,7 @@ pmap_copy(pmap_t dst_pmap, pmap_t src_pm > out: > PT_UPDATES_FLUSH(); > sched_unpin(); > - vm_page_unlock_queues(); > + rw_wunlock(&pvh_global_lock); > PMAP_UNLOCK(src_pmap); > PMAP_UNLOCK(dst_pmap); > =20 > @@ -3451,7 +3465,7 @@ pmap_page_exists_quick(pmap_t pmap, vm_p > KASSERT((m->oflags & VPO_UNMANAGED) =3D=3D 0, > ("pmap_page_exists_quick: page %p is not managed", m)); > rv =3D FALSE; > - vm_page_lock_queues(); > + rw_wlock(&pvh_global_lock); > TAILQ_FOREACH(pv, &m->md.pv_list, pv_list) { > if (PV_PMAP(pv) =3D=3D pmap) { > rv =3D TRUE; > @@ -3461,7 +3475,7 @@ pmap_page_exists_quick(pmap_t pmap, vm_p > if (loops >=3D 16) > break; > } > - vm_page_unlock_queues(); > + rw_wunlock(&pvh_global_lock); > return (rv); > } > =20 > @@ -3482,7 +3496,7 @@ pmap_page_wired_mappings(vm_page_t m) > count =3D 0; > if ((m->oflags & VPO_UNMANAGED) !=3D 0) > return (count); > - vm_page_lock_queues(); > + rw_wlock(&pvh_global_lock); > sched_pin(); > TAILQ_FOREACH(pv, &m->md.pv_list, pv_list) { > pmap =3D PV_PMAP(pv); > @@ -3493,7 +3507,7 @@ pmap_page_wired_mappings(vm_page_t m) > PMAP_UNLOCK(pmap); > } > sched_unpin(); > - vm_page_unlock_queues(); > + rw_wunlock(&pvh_global_lock); > return (count); > } > =20 > @@ -3535,7 +3549,7 @@ pmap_remove_pages(pmap_t pmap) > printf("warning: pmap_remove_pages called with non-current pmap\n"); > return; > } > - vm_page_lock_queues(); > + rw_wlock(&pvh_global_lock); > KASSERT(pmap_is_current(pmap), ("removing pages from non-current pmap")= ); > PMAP_LOCK(pmap); > sched_pin(); > @@ -3615,7 +3629,7 @@ pmap_remove_pages(pmap_t pmap) > =20 > sched_unpin(); > pmap_invalidate_all(pmap); > - vm_page_unlock_queues(); > + rw_wunlock(&pvh_global_lock); > PMAP_UNLOCK(pmap); > pmap_free_zero_pages(free); > } > @@ -3647,7 +3661,7 @@ pmap_is_modified(vm_page_t m) > if ((m->oflags & VPO_BUSY) =3D=3D 0 && > (m->aflags & PGA_WRITEABLE) =3D=3D 0) > return (rv); > - vm_page_lock_queues(); > + rw_wlock(&pvh_global_lock); > sched_pin(); > TAILQ_FOREACH(pv, &m->md.pv_list, pv_list) { > pmap =3D PV_PMAP(pv); > @@ -3661,7 +3675,7 @@ pmap_is_modified(vm_page_t m) > if (*PMAP1) > PT_SET_MA(PADDR1, 0); > sched_unpin(); > - vm_page_unlock_queues(); > + rw_wunlock(&pvh_global_lock); > return (rv); > } > =20 > @@ -3708,7 +3722,7 @@ pmap_is_referenced(vm_page_t m) > KASSERT((m->oflags & VPO_UNMANAGED) =3D=3D 0, > ("pmap_is_referenced: page %p is not managed", m)); > rv =3D FALSE; > - vm_page_lock_queues(); > + rw_wlock(&pvh_global_lock); > sched_pin(); > TAILQ_FOREACH(pv, &m->md.pv_list, pv_list) { > pmap =3D PV_PMAP(pv); > @@ -3722,7 +3736,7 @@ pmap_is_referenced(vm_page_t m) > if (*PMAP1) > PT_SET_MA(PADDR1, 0); > sched_unpin(); > - vm_page_unlock_queues(); > + rw_wunlock(&pvh_global_lock); > return (rv); > } > =20 > @@ -3733,9 +3747,9 @@ pmap_map_readonly(pmap_t pmap, vm_offset > for (i =3D 0; i < npages; i++) { > pt_entry_t *pte; > pte =3D pmap_pte(pmap, (vm_offset_t)(va + i*PAGE_SIZE)); > - vm_page_lock_queues(); > + rw_wlock(&pvh_global_lock); > pte_store(pte, xpmap_mtop(*pte & ~(PG_RW|PG_M))); > - vm_page_unlock_queues(); > + rw_wunlock(&pvh_global_lock); > PMAP_MARK_PRIV(xpmap_mtop(*pte)); > pmap_pte_release(pte); > } > @@ -3749,9 +3763,9 @@ pmap_map_readwrite(pmap_t pmap, vm_offse > pt_entry_t *pte; > pte =3D pmap_pte(pmap, (vm_offset_t)(va + i*PAGE_SIZE)); > PMAP_MARK_UNPRIV(xpmap_mtop(*pte)); > - vm_page_lock_queues(); > + rw_wlock(&pvh_global_lock); > pte_store(pte, xpmap_mtop(*pte) | (PG_RW|PG_M)); > - vm_page_unlock_queues(); > + rw_wunlock(&pvh_global_lock); > pmap_pte_release(pte); > } > } > @@ -3778,7 +3792,7 @@ pmap_remove_write(vm_page_t m) > if ((m->oflags & VPO_BUSY) =3D=3D 0 && > (m->aflags & PGA_WRITEABLE) =3D=3D 0) > return; > - vm_page_lock_queues(); > + rw_wlock(&pvh_global_lock); > sched_pin(); > TAILQ_FOREACH(pv, &m->md.pv_list, pv_list) { > pmap =3D PV_PMAP(pv); > @@ -3809,7 +3823,7 @@ retry: > if (*PMAP1) > PT_SET_MA(PADDR1, 0); > sched_unpin(); > - vm_page_unlock_queues(); > + rw_wunlock(&pvh_global_lock); > } > =20 > /* > @@ -3834,7 +3848,7 @@ pmap_ts_referenced(vm_page_t m) > =20 > KASSERT((m->oflags & VPO_UNMANAGED) =3D=3D 0, > ("pmap_ts_referenced: page %p is not managed", m)); > - vm_page_lock_queues(); > + rw_wlock(&pvh_global_lock); > sched_pin(); > if ((pv =3D TAILQ_FIRST(&m->md.pv_list)) !=3D NULL) { > pvf =3D pv; > @@ -3859,7 +3873,7 @@ pmap_ts_referenced(vm_page_t m) > if (*PMAP1) > PT_SET_MA(PADDR1, 0); > sched_unpin(); > - vm_page_unlock_queues(); > + rw_wunlock(&pvh_global_lock); > return (rtval); > } > =20 > @@ -3886,7 +3900,7 @@ pmap_clear_modify(vm_page_t m) > */ > if ((m->aflags & PGA_WRITEABLE) =3D=3D 0) > return; > - vm_page_lock_queues(); > + rw_wlock(&pvh_global_lock); > sched_pin(); > TAILQ_FOREACH(pv, &m->md.pv_list, pv_list) { > pmap =3D PV_PMAP(pv); > @@ -3904,7 +3918,7 @@ pmap_clear_modify(vm_page_t m) > PMAP_UNLOCK(pmap); > } > sched_unpin(); > - vm_page_unlock_queues(); > + rw_wunlock(&pvh_global_lock); > } > =20 > /* > @@ -3921,7 +3935,7 @@ pmap_clear_reference(vm_page_t m) > =20 > KASSERT((m->oflags & VPO_UNMANAGED) =3D=3D 0, > ("pmap_clear_reference: page %p is not managed", m)); > - vm_page_lock_queues(); > + rw_wlock(&pvh_global_lock); > sched_pin(); > TAILQ_FOREACH(pv, &m->md.pv_list, pv_list) { > pmap =3D PV_PMAP(pv); > @@ -3939,7 +3953,7 @@ pmap_clear_reference(vm_page_t m) > PMAP_UNLOCK(pmap); > } > sched_unpin(); > - vm_page_unlock_queues(); > + rw_wunlock(&pvh_global_lock); > } > =20 > /* >=20 > Modified: head/sys/i386/xen/xen_machdep.c > =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D > --- head/sys/i386/xen/xen_machdep.c Fri Oct 12 23:12:19 2012 (r241497) > +++ head/sys/i386/xen/xen_machdep.c Fri Oct 12 23:26:00 2012 (r241498) > @@ -44,6 +44,7 @@ __FBSDID("$FreeBSD$"); > #include > #include > #include > +#include > #include > =20 > #include > @@ -428,13 +429,15 @@ _xen_machphys_update(vm_paddr_t mfn, vm_ > critical_exit(); > } > =20 > +extern struct rwlock pvh_global_lock; > + > void > _xen_queue_pt_update(vm_paddr_t ptr, vm_paddr_t val, char *file, int lin= e) > { > SET_VCPU(); > =20 > if (__predict_true(gdtset))=09 > - mtx_assert(&vm_page_queue_mtx, MA_OWNED); > + rw_assert(&pvh_global_lock, RA_WLOCKED); > =20 > KASSERT((ptr & 7) =3D=3D 0, ("misaligned update")); > =09 --=20 Pawel Jakub Dawidek http://www.wheelsystems.com FreeBSD committer http://www.FreeBSD.org Am I Evil? Yes, I Am! http://tupytaj.pl --GPJrCs/72TxItFYR Content-Type: application/pgp-signature -----BEGIN PGP SIGNATURE----- Version: GnuPG v2.0.19 (FreeBSD) iEYEARECAAYFAlB5csYACgkQForvXbEpPzSZCwCeP1SoVY8sYPVkYeBk7l/t1j2G Z6wAn0x6PGnN+tkRsrYvSBhN9ORdtLnF =5zhD -----END PGP SIGNATURE----- --GPJrCs/72TxItFYR-- From owner-svn-src-head@FreeBSD.ORG Sat Oct 13 14:45:43 2012 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id 2FDF3333; Sat, 13 Oct 2012 14:45:43 +0000 (UTC) (envelope-from ume@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 1802C8FC08; Sat, 13 Oct 2012 14:45:43 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id q9DEjgVr038489; Sat, 13 Oct 2012 14:45:42 GMT (envelope-from ume@svn.freebsd.org) Received: (from ume@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q9DEjg0m038486; Sat, 13 Oct 2012 14:45:42 GMT (envelope-from ume@svn.freebsd.org) Message-Id: <201210131445.q9DEjg0m038486@svn.freebsd.org> From: Hajimu UMEMOTO Date: Sat, 13 Oct 2012 14:45:42 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r241507 - head/etc/periodic/daily X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 13 Oct 2012 14:45:43 -0000 Author: ume Date: Sat Oct 13 14:45:42 2012 New Revision: 241507 URL: http://svn.freebsd.org/changeset/base/241507 Log: Make a command for pkg_info changeable like pkg_version in /etc/periodic/weekly/400.status-pkg to be friendly with pkgng. MFC after: 1 week Modified: head/etc/periodic/daily/490.status-pkg-changes Modified: head/etc/periodic/daily/490.status-pkg-changes ============================================================================== --- head/etc/periodic/daily/490.status-pkg-changes Sat Oct 13 13:00:51 2012 (r241506) +++ head/etc/periodic/daily/490.status-pkg-changes Sat Oct 13 14:45:42 2012 (r241507) @@ -23,7 +23,7 @@ case "$daily_status_pkg_changes_enable" if [ -f $bak/pkg_info.bak ]; then mv -f $bak/pkg_info.bak $bak/pkg_info.bak2 fi - /usr/sbin/pkg_info > $bak/pkg_info.bak + ${pkg_info:-/usr/sbin/pkg_info} > $bak/pkg_info.bak cmp -sz $bak/pkg_info.bak $bak/pkg_info.bak2 if [ $? -eq 1 ]; then From owner-svn-src-head@FreeBSD.ORG Sat Oct 13 17:29:38 2012 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id E8CBDA7A; Sat, 13 Oct 2012 17:29:38 +0000 (UTC) (envelope-from alc@rice.edu) Received: from mh1.mail.rice.edu (mh1.mail.rice.edu [128.42.201.20]) by mx1.freebsd.org (Postfix) with ESMTP id B53E88FC14; Sat, 13 Oct 2012 17:29:38 +0000 (UTC) Received: from mh1.mail.rice.edu (localhost.localdomain [127.0.0.1]) by mh1.mail.rice.edu (Postfix) with ESMTP id 847EB461960; Sat, 13 Oct 2012 12:29:32 -0500 (CDT) Received: from mh1.mail.rice.edu (localhost.localdomain [127.0.0.1]) by mh1.mail.rice.edu (Postfix) with ESMTP id 81CE2461935; Sat, 13 Oct 2012 12:29:32 -0500 (CDT) X-Virus-Scanned: by amavis-2.7.0 at mh1.mail.rice.edu, auth channel Received: from mh1.mail.rice.edu ([127.0.0.1]) by mh1.mail.rice.edu (mh1.mail.rice.edu [127.0.0.1]) (amavis, port 10026) with ESMTP id 11yV__VzZh52; Sat, 13 Oct 2012 12:29:32 -0500 (CDT) Received: from adsl-216-63-78-18.dsl.hstntx.swbell.net (adsl-216-63-78-18.dsl.hstntx.swbell.net [216.63.78.18]) (using TLSv1 with cipher RC4-MD5 (128/128 bits)) (No client certificate requested) (Authenticated sender: alc) by mh1.mail.rice.edu (Postfix) with ESMTPSA id 8FAE1460F94; Sat, 13 Oct 2012 12:29:31 -0500 (CDT) Message-ID: <5079A4FA.20005@rice.edu> Date: Sat, 13 Oct 2012 12:29:30 -0500 From: Alan Cox User-Agent: Mozilla/5.0 (X11; FreeBSD i386; rv:8.0) Gecko/20111113 Thunderbird/8.0 MIME-Version: 1.0 To: Pawel Jakub Dawidek Subject: Re: svn commit: r241498 - head/sys/i386/xen References: <201210122326.q9CNQ0cD095249@svn.freebsd.org> <20121013135518.GC1383@garage.freebsd.pl> In-Reply-To: <20121013135518.GC1383@garage.freebsd.pl> Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit Cc: Alan Cox , svn-src-head@freebsd.org, svn-src-all@freebsd.org, src-committers@freebsd.org X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 13 Oct 2012 17:29:39 -0000 On 10/13/2012 08:55, Pawel Jakub Dawidek wrote: > On Fri, Oct 12, 2012 at 11:26:00PM +0000, Alan Cox wrote: >> Author: alc >> Date: Fri Oct 12 23:26:00 2012 >> New Revision: 241498 >> URL: http://svn.freebsd.org/changeset/base/241498 >> >> Log: >> Replace all uses of the vm page queues lock by a new R/W lock. >> Unfortunately, this lock cannot be defined as static under Xen because it >> is (ab)used to serialize queued page table changes. > I couldn't help but notice that this lock is always write-locked, but I > guess this is going to change at some point? Yes, take a look at the amd64 pmap in HEAD and 9-STABLE (post 9.1) to see how the use of this lock changes to support fine-grained locking on the PV lists. However, my near term objective is really elsewhere. I want to create separate locks on the active and inactive page queues in the machine-independent layer. To do this, I first need to eliminate any use of the existing vm_page_queue_mtx from every pmap in the tree. >> Tested by: sbruno >> >> Modified: >> head/sys/i386/xen/mp_machdep.c >> head/sys/i386/xen/pmap.c >> head/sys/i386/xen/xen_machdep.c >> >> Modified: head/sys/i386/xen/mp_machdep.c >> ============================================================================== >> --- head/sys/i386/xen/mp_machdep.c Fri Oct 12 23:12:19 2012 (r241497) >> +++ head/sys/i386/xen/mp_machdep.c Fri Oct 12 23:26:00 2012 (r241498) >> @@ -64,6 +64,7 @@ __FBSDID("$FreeBSD$"); >> #include >> #include >> #include >> +#include >> #include >> #include >> #include >> @@ -804,6 +805,7 @@ smp_trap_init(trap_info_t *trap_ctxt) >> } >> } >> >> +extern struct rwlock pvh_global_lock; >> extern int nkpt; >> static void >> cpu_initialize_context(unsigned int cpu) >> @@ -862,7 +864,7 @@ cpu_initialize_context(unsigned int cpu) >> >> >> xen_pgdpt_pin(VM_PAGE_TO_MACH(m[NPGPTD + 1])); >> - vm_page_lock_queues(); >> + rw_wlock(&pvh_global_lock); >> for (i = 0; i< 4; i++) { >> int pdir = (PTDPTDI + i) / NPDEPG; >> int curoffset = (PTDPTDI + i) % NPDEPG; >> @@ -872,7 +874,7 @@ cpu_initialize_context(unsigned int cpu) >> ma[i]); >> } >> PT_UPDATES_FLUSH(); >> - vm_page_unlock_queues(); >> + rw_wunlock(&pvh_global_lock); >> >> memset(&ctxt, 0, sizeof(ctxt)); >> ctxt.flags = VGCF_IN_KERNEL; >> >> Modified: head/sys/i386/xen/pmap.c >> ============================================================================== >> --- head/sys/i386/xen/pmap.c Fri Oct 12 23:12:19 2012 (r241497) >> +++ head/sys/i386/xen/pmap.c Fri Oct 12 23:26:00 2012 (r241498) >> @@ -111,6 +111,7 @@ __FBSDID("$FreeBSD$"); >> #include >> #include >> #include >> +#include >> #include >> #include >> #include >> @@ -220,6 +221,13 @@ static SYSCTL_NODE(_vm, OID_AUTO, pmap, >> static int pat_works; /* Is page attribute table sane? */ >> >> /* >> + * This lock is defined as static in other pmap implementations. It cannot, >> + * however, be defined as static here, because it is (ab)used to serialize >> + * queued page table changes in other sources files. >> + */ >> +struct rwlock pvh_global_lock; >> + >> +/* >> * Data for the pv entry allocation mechanism >> */ >> static TAILQ_HEAD(pch, pv_chunk) pv_chunks = TAILQ_HEAD_INITIALIZER(pv_chunks); >> @@ -380,6 +388,12 @@ pmap_bootstrap(vm_paddr_t firstaddr) >> #endif >> CPU_FILL(&kernel_pmap->pm_active); /* don't allow deactivation */ >> TAILQ_INIT(&kernel_pmap->pm_pvchunk); >> + >> + /* >> + * Initialize the global pv list lock. >> + */ >> + rw_init_flags(&pvh_global_lock, "pmap pv global", RW_RECURSE); >> + >> LIST_INIT(&allpmaps); >> mtx_init(&allpmaps_lock, "allpmaps", NULL, MTX_SPIN); >> mtx_lock_spin(&allpmaps_lock); >> @@ -979,9 +993,9 @@ pmap_pte_release(pt_entry_t *pte) >> if ((pt_entry_t *)((vm_offset_t)pte& ~PAGE_MASK) == PADDR2) { >> CTR1(KTR_PMAP, "pmap_pte_release: pte=0x%jx", >> *PMAP2); >> - vm_page_lock_queues(); >> + rw_wlock(&pvh_global_lock); >> PT_SET_VA(PMAP2, 0, TRUE); >> - vm_page_unlock_queues(); >> + rw_wunlock(&pvh_global_lock); >> mtx_unlock(&PMAP2mutex); >> } >> } >> @@ -1001,7 +1015,7 @@ invlcaddr(void *caddr) >> * scans are across different pmaps. It is very wasteful >> * to do an entire invltlb for checking a single mapping. >> * >> - * If the given pmap is not the current pmap, vm_page_queue_mtx >> + * If the given pmap is not the current pmap, pvh_global_lock >> * must be held and curthread pinned to a CPU. >> */ >> static pt_entry_t * >> @@ -1017,7 +1031,7 @@ pmap_pte_quick(pmap_t pmap, vm_offset_t >> /* are we current address space or kernel? */ >> if (pmap_is_current(pmap)) >> return (vtopte(va)); >> - mtx_assert(& , MA_OWNED); >> + rw_assert(&pvh_global_lock, RA_WLOCKED); >> KASSERT(curthread->td_pinned> 0, ("curthread not pinned")); >> newpf = *pde& PG_FRAME; >> if ((*PMAP1& PG_FRAME) != newpf) { >> @@ -1299,7 +1313,7 @@ pmap_qremove(vm_offset_t sva, int count) >> >> CTR2(KTR_PMAP, "pmap_qremove: sva=0x%x count=%d", sva, count); >> va = sva; >> - vm_page_lock_queues(); >> + rw_wlock(&pvh_global_lock); >> critical_enter(); >> while (count--> 0) { >> pmap_kremove(va); >> @@ -1308,7 +1322,7 @@ pmap_qremove(vm_offset_t sva, int count) >> PT_UPDATES_FLUSH(); >> pmap_invalidate_range(kernel_pmap, sva, va); >> critical_exit(); >> - vm_page_unlock_queues(); >> + rw_wunlock(&pvh_global_lock); >> } >> >> /*************************************************** >> @@ -1511,7 +1525,7 @@ pmap_pinit(pmap_t pmap) >> #ifdef PAE >> PT_SET_MA(pmap->pm_pdpt, *vtopte((vm_offset_t)pmap->pm_pdpt)& ~PG_RW); >> #endif >> - vm_page_lock_queues(); >> + rw_wlock(&pvh_global_lock); >> xen_flush_queue(); >> xen_pgdpt_pin(VM_PAGE_TO_MACH(ptdpg[NPGPTD])); >> for (i = 0; i< NPGPTD; i++) { >> @@ -1519,7 +1533,7 @@ pmap_pinit(pmap_t pmap) >> PT_SET_VA_MA(&pmap->pm_pdir[PTDPTDI + i], ma | PG_V | PG_A, FALSE); >> } >> xen_flush_queue(); >> - vm_page_unlock_queues(); >> + rw_wunlock(&pvh_global_lock); >> CPU_ZERO(&pmap->pm_active); >> TAILQ_INIT(&pmap->pm_pvchunk); >> bzero(&pmap->pm_stats, sizeof pmap->pm_stats); >> @@ -1551,9 +1565,9 @@ _pmap_allocpte(pmap_t pmap, u_int ptepin >> VM_ALLOC_WIRED | VM_ALLOC_ZERO)) == NULL) { >> if (flags& M_WAITOK) { >> PMAP_UNLOCK(pmap); >> - vm_page_unlock_queues(); >> + rw_wunlock(&pvh_global_lock); >> VM_WAIT; >> - vm_page_lock_queues(); >> + rw_wlock(&pvh_global_lock); >> PMAP_LOCK(pmap); >> } >> >> @@ -1884,14 +1898,14 @@ pmap_growkernel(vm_offset_t addr) >> pmap_zero_page(nkpg); >> ptppaddr = VM_PAGE_TO_PHYS(nkpg); >> newpdir = (pd_entry_t) (ptppaddr | PG_V | PG_RW | PG_A | PG_M); >> - vm_page_lock_queues(); >> + rw_wlock(&pvh_global_lock); >> PD_SET_VA(kernel_pmap, (kernel_vm_end>> PDRSHIFT), newpdir, TRUE); >> mtx_lock_spin(&allpmaps_lock); >> LIST_FOREACH(pmap,&allpmaps, pm_list) >> PD_SET_VA(pmap, (kernel_vm_end>> PDRSHIFT), newpdir, TRUE); >> >> mtx_unlock_spin(&allpmaps_lock); >> - vm_page_unlock_queues(); >> + rw_wunlock(&pvh_global_lock); >> >> kernel_vm_end = (kernel_vm_end + NBPDR)& ~PDRMASK; >> if (kernel_vm_end - 1>= kernel_map->max_offset) { >> @@ -2094,7 +2108,7 @@ free_pv_entry(pmap_t pmap, pv_entry_t pv >> struct pv_chunk *pc; >> int idx, field, bit; >> >> - mtx_assert(&vm_page_queue_mtx, MA_OWNED); >> + rw_assert(&pvh_global_lock, RA_WLOCKED); >> PMAP_LOCK_ASSERT(pmap, MA_OWNED); >> PV_STAT(pv_entry_frees++); >> PV_STAT(pv_entry_spare++); >> @@ -2154,7 +2168,7 @@ get_pv_entry(pmap_t pmap, boolean_t try) >> vm_page_t m; >> >> PMAP_LOCK_ASSERT(pmap, MA_OWNED); >> - mtx_assert(&vm_page_queue_mtx, MA_OWNED); >> + rw_assert(&pvh_global_lock, RA_WLOCKED); >> PV_STAT(pv_entry_allocs++); >> pv_entry_count++; >> if (pv_entry_count> pv_entry_high_water) >> @@ -2224,7 +2238,7 @@ pmap_pvh_remove(struct md_page *pvh, pma >> { >> pv_entry_t pv; >> >> - mtx_assert(&vm_page_queue_mtx, MA_OWNED); >> + rw_assert(&pvh_global_lock, RA_WLOCKED); >> TAILQ_FOREACH(pv,&pvh->pv_list, pv_list) { >> if (pmap == PV_PMAP(pv)&& va == pv->pv_va) { >> TAILQ_REMOVE(&pvh->pv_list, pv, pv_list); >> @@ -2248,7 +2262,7 @@ static void >> pmap_remove_entry(pmap_t pmap, vm_page_t m, vm_offset_t va) >> { >> >> - mtx_assert(&vm_page_queue_mtx, MA_OWNED); >> + rw_assert(&pvh_global_lock, RA_WLOCKED); >> pmap_pvh_free(&m->md, pmap, va); >> if (TAILQ_EMPTY(&m->md.pv_list)) >> vm_page_aflag_clear(m, PGA_WRITEABLE); >> @@ -2263,7 +2277,7 @@ pmap_try_insert_pv_entry(pmap_t pmap, vm >> pv_entry_t pv; >> >> PMAP_LOCK_ASSERT(pmap, MA_OWNED); >> - mtx_assert(&vm_page_queue_mtx, MA_OWNED); >> + rw_assert(&pvh_global_lock, RA_WLOCKED); >> if (pv_entry_count< pv_entry_high_water&& >> (pv = get_pv_entry(pmap, TRUE)) != NULL) { >> pv->pv_va = va; >> @@ -2285,7 +2299,7 @@ pmap_remove_pte(pmap_t pmap, pt_entry_t >> CTR3(KTR_PMAP, "pmap_remove_pte: pmap=%p *ptq=0x%x va=0x%x", >> pmap, (u_long)*ptq, va); >> >> - mtx_assert(&vm_page_queue_mtx, MA_OWNED); >> + rw_assert(&pvh_global_lock, RA_WLOCKED); >> PMAP_LOCK_ASSERT(pmap, MA_OWNED); >> oldpte = *ptq; >> PT_SET_VA_MA(ptq, 0, TRUE); >> @@ -2322,7 +2336,7 @@ pmap_remove_page(pmap_t pmap, vm_offset_ >> CTR2(KTR_PMAP, "pmap_remove_page: pmap=%p va=0x%x", >> pmap, va); >> >> - mtx_assert(&vm_page_queue_mtx, MA_OWNED); >> + rw_assert(&pvh_global_lock, RA_WLOCKED); >> KASSERT(curthread->td_pinned> 0, ("curthread not pinned")); >> PMAP_LOCK_ASSERT(pmap, MA_OWNED); >> if ((pte = pmap_pte_quick(pmap, va)) == NULL || (*pte& PG_V) == 0) >> @@ -2360,7 +2374,7 @@ pmap_remove(pmap_t pmap, vm_offset_t sva >> >> anyvalid = 0; >> >> - vm_page_lock_queues(); >> + rw_wlock(&pvh_global_lock); >> sched_pin(); >> PMAP_LOCK(pmap); >> >> @@ -2437,7 +2451,7 @@ out: >> if (anyvalid) >> pmap_invalidate_all(pmap); >> sched_unpin(); >> - vm_page_unlock_queues(); >> + rw_wunlock(&pvh_global_lock); >> PMAP_UNLOCK(pmap); >> pmap_free_zero_pages(free); >> } >> @@ -2466,7 +2480,7 @@ pmap_remove_all(vm_page_t m) >> KASSERT((m->oflags& VPO_UNMANAGED) == 0, >> ("pmap_remove_all: page %p is not managed", m)); >> free = NULL; >> - vm_page_lock_queues(); >> + rw_wlock(&pvh_global_lock); >> sched_pin(); >> while ((pv = TAILQ_FIRST(&m->md.pv_list)) != NULL) { >> pmap = PV_PMAP(pv); >> @@ -2498,7 +2512,7 @@ pmap_remove_all(vm_page_t m) >> if (*PMAP1) >> PT_SET_MA(PADDR1, 0); >> sched_unpin(); >> - vm_page_unlock_queues(); >> + rw_wunlock(&pvh_global_lock); >> pmap_free_zero_pages(free); >> } >> >> @@ -2533,7 +2547,7 @@ pmap_protect(pmap_t pmap, vm_offset_t sv >> >> anychanged = 0; >> >> - vm_page_lock_queues(); >> + rw_wlock(&pvh_global_lock); >> sched_pin(); >> PMAP_LOCK(pmap); >> for (; sva< eva; sva = pdnxt) { >> @@ -2617,7 +2631,7 @@ retry: >> if (anychanged) >> pmap_invalidate_all(pmap); >> sched_unpin(); >> - vm_page_unlock_queues(); >> + rw_wunlock(&pvh_global_lock); >> PMAP_UNLOCK(pmap); >> } >> >> @@ -2658,7 +2672,7 @@ pmap_enter(pmap_t pmap, vm_offset_t va, >> >> mpte = NULL; >> >> - vm_page_lock_queues(); >> + rw_wlock(&pvh_global_lock); >> PMAP_LOCK(pmap); >> sched_pin(); >> >> @@ -2831,7 +2845,7 @@ validate: >> if (*PMAP1) >> PT_SET_VA_MA(PMAP1, 0, TRUE); >> sched_unpin(); >> - vm_page_unlock_queues(); >> + rw_wunlock(&pvh_global_lock); >> PMAP_UNLOCK(pmap); >> } >> >> @@ -2861,7 +2875,7 @@ pmap_enter_object(pmap_t pmap, vm_offset >> psize = atop(end - start); >> mpte = NULL; >> m = m_start; >> - vm_page_lock_queues(); >> + rw_wlock(&pvh_global_lock); >> PMAP_LOCK(pmap); >> while (m != NULL&& (diff = m->pindex - m_start->pindex)< psize) { >> mpte = pmap_enter_quick_locked(&mclp,&count, pmap, start + ptoa(diff), m, >> @@ -2878,7 +2892,7 @@ pmap_enter_object(pmap_t pmap, vm_offset >> error = HYPERVISOR_multicall(mcl, count); >> KASSERT(error == 0, ("bad multicall %d", error)); >> } >> - vm_page_unlock_queues(); >> + rw_wunlock(&pvh_global_lock); >> PMAP_UNLOCK(pmap); >> } >> >> @@ -2901,12 +2915,12 @@ pmap_enter_quick(pmap_t pmap, vm_offset_ >> CTR4(KTR_PMAP, "pmap_enter_quick: pmap=%p va=0x%x m=%p prot=0x%x", >> pmap, va, m, prot); >> >> - vm_page_lock_queues(); >> + rw_wlock(&pvh_global_lock); >> PMAP_LOCK(pmap); >> (void)pmap_enter_quick_locked(&mclp,&count, pmap, va, m, prot, NULL); >> if (count) >> HYPERVISOR_multicall(&mcl, count); >> - vm_page_unlock_queues(); >> + rw_wunlock(&pvh_global_lock); >> PMAP_UNLOCK(pmap); >> } >> >> @@ -2952,7 +2966,7 @@ pmap_enter_quick_locked(multicall_entry_ >> KASSERT(va< kmi.clean_sva || va>= kmi.clean_eva || >> (m->oflags& VPO_UNMANAGED) != 0, >> ("pmap_enter_quick_locked: managed mapping within the clean submap")); >> - mtx_assert(&vm_page_queue_mtx, MA_OWNED); >> + rw_assert(&pvh_global_lock, RA_WLOCKED); >> PMAP_LOCK_ASSERT(pmap, MA_OWNED); >> >> /* >> @@ -3168,7 +3182,7 @@ pmap_change_wiring(pmap_t pmap, vm_offse >> { >> pt_entry_t *pte; >> >> - vm_page_lock_queues(); >> + rw_wlock(&pvh_global_lock); >> PMAP_LOCK(pmap); >> pte = pmap_pte(pmap, va); >> >> @@ -3186,7 +3200,7 @@ pmap_change_wiring(pmap_t pmap, vm_offse >> */ >> pmap_pte_release(pte); >> PMAP_UNLOCK(pmap); >> - vm_page_unlock_queues(); >> + rw_wunlock(&pvh_global_lock); >> } >> >> >> @@ -3225,7 +3239,7 @@ pmap_copy(pmap_t dst_pmap, pmap_t src_pm >> mtx_lock(&createdelete_lock); >> #endif >> >> - vm_page_lock_queues(); >> + rw_wlock(&pvh_global_lock); >> if (dst_pmap< src_pmap) { >> PMAP_LOCK(dst_pmap); >> PMAP_LOCK(src_pmap); >> @@ -3315,7 +3329,7 @@ pmap_copy(pmap_t dst_pmap, pmap_t src_pm >> out: >> PT_UPDATES_FLUSH(); >> sched_unpin(); >> - vm_page_unlock_queues(); >> + rw_wunlock(&pvh_global_lock); >> PMAP_UNLOCK(src_pmap); >> PMAP_UNLOCK(dst_pmap); >> >> @@ -3451,7 +3465,7 @@ pmap_page_exists_quick(pmap_t pmap, vm_p >> KASSERT((m->oflags& VPO_UNMANAGED) == 0, >> ("pmap_page_exists_quick: page %p is not managed", m)); >> rv = FALSE; >> - vm_page_lock_queues(); >> + rw_wlock(&pvh_global_lock); >> TAILQ_FOREACH(pv,&m->md.pv_list, pv_list) { >> if (PV_PMAP(pv) == pmap) { >> rv = TRUE; >> @@ -3461,7 +3475,7 @@ pmap_page_exists_quick(pmap_t pmap, vm_p >> if (loops>= 16) >> break; >> } >> - vm_page_unlock_queues(); >> + rw_wunlock(&pvh_global_lock); >> return (rv); >> } >> >> @@ -3482,7 +3496,7 @@ pmap_page_wired_mappings(vm_page_t m) >> count = 0; >> if ((m->oflags& VPO_UNMANAGED) != 0) >> return (count); >> - vm_page_lock_queues(); >> + rw_wlock(&pvh_global_lock); >> sched_pin(); >> TAILQ_FOREACH(pv,&m->md.pv_list, pv_list) { >> pmap = PV_PMAP(pv); >> @@ -3493,7 +3507,7 @@ pmap_page_wired_mappings(vm_page_t m) >> PMAP_UNLOCK(pmap); >> } >> sched_unpin(); >> - vm_page_unlock_queues(); >> + rw_wunlock(&pvh_global_lock); >> return (count); >> } >> >> @@ -3535,7 +3549,7 @@ pmap_remove_pages(pmap_t pmap) >> printf("warning: pmap_remove_pages called with non-current pmap\n"); >> return; >> } >> - vm_page_lock_queues(); >> + rw_wlock(&pvh_global_lock); >> KASSERT(pmap_is_current(pmap), ("removing pages from non-current pmap")); >> PMAP_LOCK(pmap); >> sched_pin(); >> @@ -3615,7 +3629,7 @@ pmap_remove_pages(pmap_t pmap) >> >> sched_unpin(); >> pmap_invalidate_all(pmap); >> - vm_page_unlock_queues(); >> + rw_wunlock(&pvh_global_lock); >> PMAP_UNLOCK(pmap); >> pmap_free_zero_pages(free); >> } >> @@ -3647,7 +3661,7 @@ pmap_is_modified(vm_page_t m) >> if ((m->oflags& VPO_BUSY) == 0&& >> (m->aflags& PGA_WRITEABLE) == 0) >> return (rv); >> - vm_page_lock_queues(); >> + rw_wlock(&pvh_global_lock); >> sched_pin(); >> TAILQ_FOREACH(pv,&m->md.pv_list, pv_list) { >> pmap = PV_PMAP(pv); >> @@ -3661,7 +3675,7 @@ pmap_is_modified(vm_page_t m) >> if (*PMAP1) >> PT_SET_MA(PADDR1, 0); >> sched_unpin(); >> - vm_page_unlock_queues(); >> + rw_wunlock(&pvh_global_lock); >> return (rv); >> } >> >> @@ -3708,7 +3722,7 @@ pmap_is_referenced(vm_page_t m) >> KASSERT((m->oflags& VPO_UNMANAGED) == 0, >> ("pmap_is_referenced: page %p is not managed", m)); >> rv = FALSE; >> - vm_page_lock_queues(); >> + rw_wlock(&pvh_global_lock); >> sched_pin(); >> TAILQ_FOREACH(pv,&m->md.pv_list, pv_list) { >> pmap = PV_PMAP(pv); >> @@ -3722,7 +3736,7 @@ pmap_is_referenced(vm_page_t m) >> if (*PMAP1) >> PT_SET_MA(PADDR1, 0); >> sched_unpin(); >> - vm_page_unlock_queues(); >> + rw_wunlock(&pvh_global_lock); >> return (rv); >> } >> >> @@ -3733,9 +3747,9 @@ pmap_map_readonly(pmap_t pmap, vm_offset >> for (i = 0; i< npages; i++) { >> pt_entry_t *pte; >> pte = pmap_pte(pmap, (vm_offset_t)(va + i*PAGE_SIZE)); >> - vm_page_lock_queues(); >> + rw_wlock(&pvh_global_lock); >> pte_store(pte, xpmap_mtop(*pte& ~(PG_RW|PG_M))); >> - vm_page_unlock_queues(); >> + rw_wunlock(&pvh_global_lock); >> PMAP_MARK_PRIV(xpmap_mtop(*pte)); >> pmap_pte_release(pte); >> } >> @@ -3749,9 +3763,9 @@ pmap_map_readwrite(pmap_t pmap, vm_offse >> pt_entry_t *pte; >> pte = pmap_pte(pmap, (vm_offset_t)(va + i*PAGE_SIZE)); >> PMAP_MARK_UNPRIV(xpmap_mtop(*pte)); >> - vm_page_lock_queues(); >> + rw_wlock(&pvh_global_lock); >> pte_store(pte, xpmap_mtop(*pte) | (PG_RW|PG_M)); >> - vm_page_unlock_queues(); >> + rw_wunlock(&pvh_global_lock); >> pmap_pte_release(pte); >> } >> } >> @@ -3778,7 +3792,7 @@ pmap_remove_write(vm_page_t m) >> if ((m->oflags& VPO_BUSY) == 0&& >> (m->aflags& PGA_WRITEABLE) == 0) >> return; >> - vm_page_lock_queues(); >> + rw_wlock(&pvh_global_lock); >> sched_pin(); >> TAILQ_FOREACH(pv,&m->md.pv_list, pv_list) { >> pmap = PV_PMAP(pv); >> @@ -3809,7 +3823,7 @@ retry: >> if (*PMAP1) >> PT_SET_MA(PADDR1, 0); >> sched_unpin(); >> - vm_page_unlock_queues(); >> + rw_wunlock(&pvh_global_lock); >> } >> >> /* >> @@ -3834,7 +3848,7 @@ pmap_ts_referenced(vm_page_t m) >> >> KASSERT((m->oflags& VPO_UNMANAGED) == 0, >> ("pmap_ts_referenced: page %p is not managed", m)); >> - vm_page_lock_queues(); >> + rw_wlock(&pvh_global_lock); >> sched_pin(); >> if ((pv = TAILQ_FIRST(&m->md.pv_list)) != NULL) { >> pvf = pv; >> @@ -3859,7 +3873,7 @@ pmap_ts_referenced(vm_page_t m) >> if (*PMAP1) >> PT_SET_MA(PADDR1, 0); >> sched_unpin(); >> - vm_page_unlock_queues(); >> + rw_wunlock(&pvh_global_lock); >> return (rtval); >> } >> >> @@ -3886,7 +3900,7 @@ pmap_clear_modify(vm_page_t m) >> */ >> if ((m->aflags& PGA_WRITEABLE) == 0) >> return; >> - vm_page_lock_queues(); >> + rw_wlock(&pvh_global_lock); >> sched_pin(); >> TAILQ_FOREACH(pv,&m->md.pv_list, pv_list) { >> pmap = PV_PMAP(pv); >> @@ -3904,7 +3918,7 @@ pmap_clear_modify(vm_page_t m) >> PMAP_UNLOCK(pmap); >> } >> sched_unpin(); >> - vm_page_unlock_queues(); >> + rw_wunlock(&pvh_global_lock); >> } >> >> /* >> @@ -3921,7 +3935,7 @@ pmap_clear_reference(vm_page_t m) >> >> KASSERT((m->oflags& VPO_UNMANAGED) == 0, >> ("pmap_clear_reference: page %p is not managed", m)); >> - vm_page_lock_queues(); >> + rw_wlock(&pvh_global_lock); >> sched_pin(); >> TAILQ_FOREACH(pv,&m->md.pv_list, pv_list) { >> pmap = PV_PMAP(pv); >> @@ -3939,7 +3953,7 @@ pmap_clear_reference(vm_page_t m) >> PMAP_UNLOCK(pmap); >> } >> sched_unpin(); >> - vm_page_unlock_queues(); >> + rw_wunlock(&pvh_global_lock); >> } >> >> /* >> >> Modified: head/sys/i386/xen/xen_machdep.c >> ============================================================================== >> --- head/sys/i386/xen/xen_machdep.c Fri Oct 12 23:12:19 2012 (r241497) >> +++ head/sys/i386/xen/xen_machdep.c Fri Oct 12 23:26:00 2012 (r241498) >> @@ -44,6 +44,7 @@ __FBSDID("$FreeBSD$"); >> #include >> #include >> #include >> +#include >> #include >> >> #include >> @@ -428,13 +429,15 @@ _xen_machphys_update(vm_paddr_t mfn, vm_ >> critical_exit(); >> } >> >> +extern struct rwlock pvh_global_lock; >> + >> void >> _xen_queue_pt_update(vm_paddr_t ptr, vm_paddr_t val, char *file, int line) >> { >> SET_VCPU(); >> >> if (__predict_true(gdtset)) >> - mtx_assert(&vm_page_queue_mtx, MA_OWNED); >> + rw_assert(&pvh_global_lock, RA_WLOCKED); >> >> KASSERT((ptr& 7) == 0, ("misaligned update")); >> From owner-svn-src-head@FreeBSD.ORG Sat Oct 13 17:55:07 2012 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id BDC80193; Sat, 13 Oct 2012 17:55:07 +0000 (UTC) (envelope-from mav@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 8DFC98FC14; Sat, 13 Oct 2012 17:55:07 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id q9DHt7Z8074670; Sat, 13 Oct 2012 17:55:07 GMT (envelope-from mav@svn.freebsd.org) Received: (from mav@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q9DHt7TA074668; Sat, 13 Oct 2012 17:55:07 GMT (envelope-from mav@svn.freebsd.org) Message-Id: <201210131755.q9DHt7TA074668@svn.freebsd.org> From: Alexander Motin Date: Sat, 13 Oct 2012 17:55:07 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r241508 - head/sys/cam/ctl X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 13 Oct 2012 17:55:07 -0000 Author: mav Date: Sat Oct 13 17:55:06 2012 New Revision: 241508 URL: http://svn.freebsd.org/changeset/base/241508 Log: Extend SIM lock coverage during the bus registration process. Modified: head/sys/cam/ctl/ctl_frontend_cam_sim.c Modified: head/sys/cam/ctl/ctl_frontend_cam_sim.c ============================================================================== --- head/sys/cam/ctl/ctl_frontend_cam_sim.c Sat Oct 13 14:45:42 2012 (r241507) +++ head/sys/cam/ctl/ctl_frontend_cam_sim.c Sat Oct 13 17:55:06 2012 (r241508) @@ -175,8 +175,8 @@ cfcs_init(void) if (retval != 0) { printf("%s: ctl_frontend_register() failed with error %d!\n", __func__, retval); - retval = 1; - goto bailout; + mtx_destroy(&softc->lock); + return (1); } /* @@ -207,7 +207,7 @@ cfcs_init(void) softc->wwpn = fe->wwpn; } - + mtx_lock(&softc->lock); softc->devq = cam_simq_alloc(fe->num_requested_ctl_io); if (softc->devq == NULL) { printf("%s: error allocating devq\n", __func__); @@ -224,9 +224,7 @@ cfcs_init(void) goto bailout; } - mtx_lock(&softc->lock); if (xpt_bus_register(softc->sim, NULL, 0) != CAM_SUCCESS) { - mtx_unlock(&softc->lock); printf("%s: error registering SIM\n", __func__); retval = ENOMEM; goto bailout; @@ -236,15 +234,12 @@ cfcs_init(void) cam_sim_path(softc->sim), CAM_TARGET_WILDCARD, CAM_LUN_WILDCARD) != CAM_REQ_CMP) { - mtx_unlock(&softc->lock); printf("%s: error creating path\n", __func__); xpt_bus_deregister(cam_sim_path(softc->sim)); retval = 1; goto bailout; } - mtx_unlock(&softc->lock); - xpt_setup_ccb(&csa.ccb_h, softc->path, /*priority*/ 5); csa.ccb_h.func_code = XPT_SASYNC_CB; csa.event_enable = AC_LOST_DEVICE; @@ -252,6 +247,8 @@ cfcs_init(void) csa.callback_arg = softc->sim; xpt_action((union ccb *)&csa); + mtx_unlock(&softc->lock); + return (retval); bailout: @@ -259,6 +256,8 @@ bailout: cam_sim_free(softc->sim, /*free_devq*/ TRUE); else if (softc->devq) cam_simq_free(softc->devq); + mtx_unlock(&softc->lock); + mtx_destroy(&softc->lock); return (retval); } From owner-svn-src-head@FreeBSD.ORG Sat Oct 13 18:11:51 2012 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id 2DC3B9E5; Sat, 13 Oct 2012 18:11:51 +0000 (UTC) (envelope-from mav@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 170388FC12; Sat, 13 Oct 2012 18:11:51 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id q9DIBo3S077457; Sat, 13 Oct 2012 18:11:50 GMT (envelope-from mav@svn.freebsd.org) Received: (from mav@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q9DIBon5077455; Sat, 13 Oct 2012 18:11:50 GMT (envelope-from mav@svn.freebsd.org) Message-Id: <201210131811.q9DIBon5077455@svn.freebsd.org> From: Alexander Motin Date: Sat, 13 Oct 2012 18:11:50 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r241509 - head/sys/cam X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 13 Oct 2012 18:11:51 -0000 Author: mav Date: Sat Oct 13 18:11:50 2012 New Revision: 241509 URL: http://svn.freebsd.org/changeset/base/241509 Log: Use xpt_create_path_unlocked() for initial debug path compilation because we are not holding respective SIM lock. Modified: head/sys/cam/cam_xpt.c Modified: head/sys/cam/cam_xpt.c ============================================================================== --- head/sys/cam/cam_xpt.c Sat Oct 13 17:55:06 2012 (r241508) +++ head/sys/cam/cam_xpt.c Sat Oct 13 18:11:50 2012 (r241509) @@ -4797,12 +4797,7 @@ xpt_config(void *arg) /* Setup debugging path */ if (cam_dflags != CAM_DEBUG_NONE) { - /* - * Locking is specifically omitted here. No SIMs have - * registered yet, so xpt_create_path will only be searching - * empty lists of targets and devices. - */ - if (xpt_create_path(&cam_dpath, xpt_periph, + if (xpt_create_path_unlocked(&cam_dpath, xpt_periph, CAM_DEBUG_BUS, CAM_DEBUG_TARGET, CAM_DEBUG_LUN) != CAM_REQ_CMP) { printf("xpt_config: xpt_create_path() failed for debug" From owner-svn-src-head@FreeBSD.ORG Sat Oct 13 18:24:53 2012 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id 6FD6AFBE; Sat, 13 Oct 2012 18:24:53 +0000 (UTC) (envelope-from mav@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 589B58FC1B; Sat, 13 Oct 2012 18:24:53 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id q9DIOrNN079530; Sat, 13 Oct 2012 18:24:53 GMT (envelope-from mav@svn.freebsd.org) Received: (from mav@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q9DIOrVg079528; Sat, 13 Oct 2012 18:24:53 GMT (envelope-from mav@svn.freebsd.org) Message-Id: <201210131824.q9DIOrVg079528@svn.freebsd.org> From: Alexander Motin Date: Sat, 13 Oct 2012 18:24:53 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r241510 - head/sys/cam X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 13 Oct 2012 18:24:53 -0000 Author: mav Date: Sat Oct 13 18:24:52 2012 New Revision: 241510 URL: http://svn.freebsd.org/changeset/base/241510 Log: Don't exclude XPT SIM from locking in xpt_create_path_unlocked(). We don't want xpt periph, device, target or bus disappeared because of incorrect reference counting. Modified: head/sys/cam/cam_xpt.c Modified: head/sys/cam/cam_xpt.c ============================================================================== --- head/sys/cam/cam_xpt.c Sat Oct 13 18:11:50 2012 (r241509) +++ head/sys/cam/cam_xpt.c Sat Oct 13 18:24:52 2012 (r241510) @@ -3441,19 +3441,14 @@ xpt_create_path_unlocked(struct cam_path struct cam_path *path; struct cam_eb *bus = NULL; cam_status status; - int need_unlock = 0; path = (struct cam_path *)malloc(sizeof(*path), M_CAMPATH, M_WAITOK); - if (path_id != CAM_BUS_WILDCARD) { - bus = xpt_find_bus(path_id); - if (bus != NULL) { - need_unlock = 1; - CAM_SIM_LOCK(bus->sim); - } - } + bus = xpt_find_bus(path_id); + if (bus != NULL) + CAM_SIM_LOCK(bus->sim); status = xpt_compile_path(path, periph, path_id, target_id, lun_id); - if (need_unlock) { + if (bus != NULL) { CAM_SIM_UNLOCK(bus->sim); xpt_release_bus(bus); } From owner-svn-src-head@FreeBSD.ORG Sat Oct 13 18:40:39 2012 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id C76B0A83; Sat, 13 Oct 2012 18:40:39 +0000 (UTC) (envelope-from gabor@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 95C478FC0C; Sat, 13 Oct 2012 18:40:39 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id q9DIedTd082240; Sat, 13 Oct 2012 18:40:39 GMT (envelope-from gabor@svn.freebsd.org) Received: (from gabor@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q9DIedeg082236; Sat, 13 Oct 2012 18:40:39 GMT (envelope-from gabor@svn.freebsd.org) Message-Id: <201210131840.q9DIedeg082236@svn.freebsd.org> From: Gabor Kovesdan Date: Sat, 13 Oct 2012 18:40:39 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r241511 - in head: . contrib/gnu-sort gnu/usr.bin gnu/usr.bin/sort tools/build/options usr.bin/sort X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 13 Oct 2012 18:40:39 -0000 Author: gabor Date: Sat Oct 13 18:40:39 2012 New Revision: 241511 URL: http://svn.freebsd.org/changeset/base/241511 Log: - Remove GNU sort and the WITH_GNU_SORT knob Deleted: head/contrib/gnu-sort/ head/gnu/usr.bin/sort/ head/tools/build/options/WITH_GNU_SORT Modified: head/UPDATING head/gnu/usr.bin/Makefile head/usr.bin/sort/Makefile Modified: head/UPDATING ============================================================================== --- head/UPDATING Sat Oct 13 18:24:52 2012 (r241510) +++ head/UPDATING Sat Oct 13 18:40:39 2012 (r241511) @@ -24,6 +24,12 @@ NOTE TO PEOPLE WHO THINK THAT FreeBSD 10 disable the most expensive debugging functionality run "ln -s 'abort:false,junk:false' /etc/malloc.conf".) +20121013: + The GNU sort(1) program has been removed since the BSD-licensed + sort(1) has been the default for quite some time and no serious + problems have been reported. The corresponding WITH_GNU_SORT + knob has als gone. + 20121006: The pfil(9) API/ABI for AF_INET family has been changed. Packet filtering modules: pf(4), ipfw(4), ipfilter(4) need to be recompiled Modified: head/gnu/usr.bin/Makefile ============================================================================== --- head/gnu/usr.bin/Makefile Sat Oct 13 18:24:52 2012 (r241510) +++ head/gnu/usr.bin/Makefile Sat Oct 13 18:40:39 2012 (r241511) @@ -17,7 +17,6 @@ SUBDIR= ${_binutils} \ ${_rcs} \ sdiff \ send-pr \ - sort \ ${_texinfo} .if ${MK_CXX} != "no" Modified: head/usr.bin/sort/Makefile ============================================================================== --- head/usr.bin/sort/Makefile Sat Oct 13 18:24:52 2012 (r241510) +++ head/usr.bin/sort/Makefile Sat Oct 13 18:40:39 2012 (r241511) @@ -2,15 +2,7 @@ .include -.if ${MK_GNU_SORT} != "yes" PROG= sort -.else -PROG= bsdsort -CLEANFILES+= bsdsort.1 - -bsdsort.1: sort.1 - cp ${.ALLSRC} ${.TARGET} -.endif SRCS= bwstring.c coll.c file.c mem.c radixsort.c sort.c vsort.c From owner-svn-src-head@FreeBSD.ORG Sat Oct 13 18:46:47 2012 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id 86503E00; Sat, 13 Oct 2012 18:46:47 +0000 (UTC) (envelope-from alc@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 55E578FC0A; Sat, 13 Oct 2012 18:46:47 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id q9DIklAA083650; Sat, 13 Oct 2012 18:46:47 GMT (envelope-from alc@svn.freebsd.org) Received: (from alc@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q9DIklla083645; Sat, 13 Oct 2012 18:46:47 GMT (envelope-from alc@svn.freebsd.org) Message-Id: <201210131846.q9DIklla083645@svn.freebsd.org> From: Alan Cox Date: Sat, 13 Oct 2012 18:46:47 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r241512 - head/sys/vm X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 13 Oct 2012 18:46:47 -0000 Author: alc Date: Sat Oct 13 18:46:46 2012 New Revision: 241512 URL: http://svn.freebsd.org/changeset/base/241512 Log: Eliminate the conditional for releasing the page queues lock in vm_page_sleep(). vm_page_sleep() is no longer called with this lock held. Eliminate assertions that the page queues lock is NOT held. These assertions won't translate well to having distinct locks on the active and inactive page queues, and they really aren't that useful. MFC after: 3 weeks Modified: head/sys/vm/vm_object.c head/sys/vm/vm_page.c head/sys/vm/vm_pageout.c Modified: head/sys/vm/vm_object.c ============================================================================== --- head/sys/vm/vm_object.c Sat Oct 13 18:40:39 2012 (r241511) +++ head/sys/vm/vm_object.c Sat Oct 13 18:46:46 2012 (r241512) @@ -820,7 +820,6 @@ vm_object_page_clean(vm_object_t object, int curgeneration, n, pagerflags; boolean_t clearobjflags, eio, res; - mtx_assert(&vm_page_queue_mtx, MA_NOTOWNED); VM_OBJECT_LOCK_ASSERT(object, MA_OWNED); KASSERT(object->type == OBJT_VNODE, ("Not a vnode object")); if ((object->flags & OBJ_MIGHTBEDIRTY) == 0 || @@ -906,7 +905,6 @@ vm_object_page_collect_flush(vm_object_t vm_page_t ma[vm_pageout_page_count], p_first, tp; int count, i, mreq, runlen; - mtx_assert(&vm_page_queue_mtx, MA_NOTOWNED); vm_page_lock_assert(p, MA_NOTOWNED); VM_OBJECT_LOCK_ASSERT(object, MA_OWNED); Modified: head/sys/vm/vm_page.c ============================================================================== --- head/sys/vm/vm_page.c Sat Oct 13 18:40:39 2012 (r241511) +++ head/sys/vm/vm_page.c Sat Oct 13 18:46:46 2012 (r241512) @@ -736,7 +736,7 @@ vm_page_readahead_finish(vm_page_t m) /* * vm_page_sleep: * - * Sleep and release the page and page queues locks. + * Sleep and release the page lock. * * The object containing the given page must be locked. */ @@ -745,8 +745,6 @@ vm_page_sleep(vm_page_t m, const char *m { VM_OBJECT_LOCK_ASSERT(m->object, MA_OWNED); - if (mtx_owned(&vm_page_queue_mtx)) - vm_page_unlock_queues(); if (mtx_owned(vm_page_lockptr(m))) vm_page_unlock(m); @@ -2933,7 +2931,6 @@ vm_page_cowfault(vm_page_t m) vm_object_t object; vm_pindex_t pindex; - mtx_assert(&vm_page_queue_mtx, MA_NOTOWNED); vm_page_lock_assert(m, MA_OWNED); object = m->object; VM_OBJECT_LOCK_ASSERT(object, MA_OWNED); Modified: head/sys/vm/vm_pageout.c ============================================================================== --- head/sys/vm/vm_pageout.c Sat Oct 13 18:40:39 2012 (r241511) +++ head/sys/vm/vm_pageout.c Sat Oct 13 18:46:46 2012 (r241512) @@ -476,7 +476,6 @@ vm_pageout_flush(vm_page_t *mc, int coun int i, runlen; VM_OBJECT_LOCK_ASSERT(object, MA_OWNED); - mtx_assert(&vm_page_queue_mtx, MA_NOTOWNED); /* * Initiate I/O. Bump the vm_page_t->busy counter and From owner-svn-src-head@FreeBSD.ORG Sat Oct 13 19:29:08 2012 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id B3CCFF69; Sat, 13 Oct 2012 19:29:08 +0000 (UTC) (envelope-from gabor@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 83CF08FC1B; Sat, 13 Oct 2012 19:29:08 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id q9DJT8eH091430; Sat, 13 Oct 2012 19:29:08 GMT (envelope-from gabor@svn.freebsd.org) Received: (from gabor@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q9DJT85B091428; Sat, 13 Oct 2012 19:29:08 GMT (envelope-from gabor@svn.freebsd.org) Message-Id: <201210131929.q9DJT85B091428@svn.freebsd.org> From: Gabor Kovesdan Date: Sat, 13 Oct 2012 19:29:08 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r241513 - head/share/mk X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 13 Oct 2012 19:29:08 -0000 Author: gabor Date: Sat Oct 13 19:29:07 2012 New Revision: 241513 URL: http://svn.freebsd.org/changeset/base/241513 Log: - Remove WITH_GNU_SORT support Modified: head/share/mk/bsd.own.mk Modified: head/share/mk/bsd.own.mk ============================================================================== --- head/share/mk/bsd.own.mk Sat Oct 13 18:46:46 2012 (r241512) +++ head/share/mk/bsd.own.mk Sat Oct 13 19:29:07 2012 (r241513) @@ -428,7 +428,6 @@ __DEFAULT_NO_OPTIONS = \ CLANG_EXTRAS \ CLANG_IS_CC \ CTF \ - GNU_SORT \ HESIOD \ ICONV \ IDEA \ From owner-svn-src-head@FreeBSD.ORG Sat Oct 13 19:29:38 2012 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id A8D6F154; Sat, 13 Oct 2012 19:29:38 +0000 (UTC) (envelope-from gabor@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 926808FC17; Sat, 13 Oct 2012 19:29:38 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id q9DJTcUL091543; Sat, 13 Oct 2012 19:29:38 GMT (envelope-from gabor@svn.freebsd.org) Received: (from gabor@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q9DJTcW9091541; Sat, 13 Oct 2012 19:29:38 GMT (envelope-from gabor@svn.freebsd.org) Message-Id: <201210131929.q9DJTcW9091541@svn.freebsd.org> From: Gabor Kovesdan Date: Sat, 13 Oct 2012 19:29:38 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r241514 - head/share/man/man5 X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 13 Oct 2012 19:29:38 -0000 Author: gabor Date: Sat Oct 13 19:29:38 2012 New Revision: 241514 URL: http://svn.freebsd.org/changeset/base/241514 Log: - Regen after GNU sort removal Modified: head/share/man/man5/src.conf.5 Modified: head/share/man/man5/src.conf.5 ============================================================================== --- head/share/man/man5/src.conf.5 Sat Oct 13 19:29:07 2012 (r241513) +++ head/share/man/man5/src.conf.5 Sat Oct 13 19:29:38 2012 (r241514) @@ -1,7 +1,7 @@ .\" DO NOT EDIT-- this file is automatically generated. .\" from FreeBSD: head/tools/build/options/makeman 236279 2012-05-30 02:37:20Z gjb .\" $FreeBSD$ -.Dd October 6, 2012 +.Dd October 13, 2012 .Dt SRC.CONF 5 .Os .Sh NAME @@ -449,9 +449,6 @@ When set, it also enforces the following .It .Va WITHOUT_GNU_SUPPORT .El -.It Va WITH_GNU_SORT -.\" from FreeBSD: head/tools/build/options/WITH_GNU_SORT 237629 2012-06-27 05:59:01Z gabor -Install GNU-licensed sort as 'sort' instead of BSD sort. .It Va WITHOUT_GNU_SUPPORT .\" from FreeBSD: head/tools/build/options/WITHOUT_GNU_SUPPORT 156932 2006-03-21 07:50:50Z ru Set to build some programs without optional GNU support. From owner-svn-src-head@FreeBSD.ORG Sat Oct 13 19:37:59 2012 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id 443534BB; Sat, 13 Oct 2012 19:37:59 +0000 (UTC) (envelope-from gabor@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 2D5F18FC18; Sat, 13 Oct 2012 19:37:59 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id q9DJbx5K092908; Sat, 13 Oct 2012 19:37:59 GMT (envelope-from gabor@svn.freebsd.org) Received: (from gabor@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q9DJbwqW092906; Sat, 13 Oct 2012 19:37:58 GMT (envelope-from gabor@svn.freebsd.org) Message-Id: <201210131937.q9DJbwqW092906@svn.freebsd.org> From: Gabor Kovesdan Date: Sat, 13 Oct 2012 19:37:58 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r241515 - head X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 13 Oct 2012 19:37:59 -0000 Author: gabor Date: Sat Oct 13 19:37:58 2012 New Revision: 241515 URL: http://svn.freebsd.org/changeset/base/241515 Log: - Fix typo Spotted by: glebius Modified: head/UPDATING Modified: head/UPDATING ============================================================================== --- head/UPDATING Sat Oct 13 19:29:38 2012 (r241514) +++ head/UPDATING Sat Oct 13 19:37:58 2012 (r241515) @@ -28,7 +28,7 @@ NOTE TO PEOPLE WHO THINK THAT FreeBSD 10 The GNU sort(1) program has been removed since the BSD-licensed sort(1) has been the default for quite some time and no serious problems have been reported. The corresponding WITH_GNU_SORT - knob has als gone. + knob has also gone. 20121006: The pfil(9) API/ABI for AF_INET family has been changed. Packet From owner-svn-src-head@FreeBSD.ORG Sat Oct 13 19:53:12 2012 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id 1BC95805; Sat, 13 Oct 2012 19:53:12 +0000 (UTC) (envelope-from kargl@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id DFEFE8FC0A; Sat, 13 Oct 2012 19:53:11 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id q9DJrBEC096284; Sat, 13 Oct 2012 19:53:11 GMT (envelope-from kargl@svn.freebsd.org) Received: (from kargl@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q9DJrBi0096282; Sat, 13 Oct 2012 19:53:11 GMT (envelope-from kargl@svn.freebsd.org) Message-Id: <201210131953.q9DJrBi0096282@svn.freebsd.org> From: Steve Kargl Date: Sat, 13 Oct 2012 19:53:11 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r241516 - head/lib/msun/ld80 X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 13 Oct 2012 19:53:12 -0000 Author: kargl Date: Sat Oct 13 19:53:11 2012 New Revision: 241516 URL: http://svn.freebsd.org/changeset/base/241516 Log: * Update the comment that explains the choice of values in the table and the requirement on trailing zero bits. * Remove the __aligned() compiler directives as these were found to have a negative effect on the produced code. Submitted by: bde Approved by: das (mentor) Modified: head/lib/msun/ld80/s_expl.c Modified: head/lib/msun/ld80/s_expl.c ============================================================================== --- head/lib/msun/ld80/s_expl.c Sat Oct 13 19:37:58 2012 (r241515) +++ head/lib/msun/ld80/s_expl.c Sat Oct 13 19:53:11 2012 (r241516) @@ -64,7 +64,7 @@ o_threshold = LD80C(0xb17217f7d1cf79ab, /* log(2**(-16381-64-1)) rounded towards zero: */ u_threshold = LD80C(0xb21dfe7f09e2baa9, 13, -11399.4985314888605581L); -static const double __aligned(64) +static const double /* * ln2/INTERVALS = L1+L2 (hi+lo decomposition for multiplication). L1 must * have at least 22 (= log2(|LDBL_MIN_EXP-extras|) + log2(INTERVALS)) lowest @@ -86,17 +86,18 @@ P6 = 1.3888891738560272e-3; /* 0x16c1 /* * 2^(i/INTERVALS) for i in [0,INTERVALS] is represented by two values where - * the first 53 bits of the significand is stored in hi and the next 53 - * bits are in lo. Tang's paper states that the trailing 6 bits of hi should + * the first 53 bits of the significand are stored in hi and the next 53 + * bits are in lo. Tang's paper states that the trailing 6 bits of hi must * be zero for his algorithm in both single and double precision, because * the table is re-used in the implementation of expm1() where a floating - * point addition involving hi must be exact. The conversion of a 53-bit - * double into a 64-bit long double gives 11 trailing bit, which are zero. + * point addition involving hi must be exact. Here hi is double, so + * converting it to long double gives 11 trailing zero bits. */ static const struct { double hi; double lo; -} s[INTERVALS] __aligned(16) = { +/* XXX should rename 's'. */ +} s[INTERVALS] = { 0x1p+0, 0x0p+0, 0x1.0163da9fb3335p+0, 0x1.b61299ab8cdb7p-54, 0x1.02c9a3e778060p+0, 0x1.dcdef95949ef4p-53, From owner-svn-src-head@FreeBSD.ORG Sat Oct 13 20:19:43 2012 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id B73E6D93; Sat, 13 Oct 2012 20:19:43 +0000 (UTC) (envelope-from alc@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 950DB8FC08; Sat, 13 Oct 2012 20:19:43 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id q9DKJhW2000751; Sat, 13 Oct 2012 20:19:43 GMT (envelope-from alc@svn.freebsd.org) Received: (from alc@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q9DKJh3e000747; Sat, 13 Oct 2012 20:19:43 GMT (envelope-from alc@svn.freebsd.org) Message-Id: <201210132019.q9DKJh3e000747@svn.freebsd.org> From: Alan Cox Date: Sat, 13 Oct 2012 20:19:43 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r241517 - head/sys/vm X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 13 Oct 2012 20:19:43 -0000 Author: alc Date: Sat Oct 13 20:19:43 2012 New Revision: 241517 URL: http://svn.freebsd.org/changeset/base/241517 Log: Move vm_page_requeue() to the only file that uses it. MFC after: 3 weeks Modified: head/sys/vm/vm_page.c head/sys/vm/vm_page.h head/sys/vm/vm_pageout.c Modified: head/sys/vm/vm_page.c ============================================================================== --- head/sys/vm/vm_page.c Sat Oct 13 19:53:11 2012 (r241516) +++ head/sys/vm/vm_page.c Sat Oct 13 20:19:43 2012 (r241517) @@ -1868,28 +1868,6 @@ vm_waitpfault(void) } /* - * vm_page_requeue: - * - * Move the given page to the tail of its present page queue. - * - * The page queues must be locked. - */ -void -vm_page_requeue(vm_page_t m) -{ - struct vpgqueues *vpq; - int queue; - - mtx_assert(&vm_page_queue_mtx, MA_OWNED); - queue = m->queue; - KASSERT(queue != PQ_NONE, - ("vm_page_requeue: page %p is not queued", m)); - vpq = &vm_page_queues[queue]; - TAILQ_REMOVE(&vpq->pl, m, pageq); - TAILQ_INSERT_TAIL(&vpq->pl, m, pageq); -} - -/* * vm_page_queue_remove: * * Remove the given page from the specified queue. Modified: head/sys/vm/vm_page.h ============================================================================== --- head/sys/vm/vm_page.h Sat Oct 13 19:53:11 2012 (r241516) +++ head/sys/vm/vm_page.h Sat Oct 13 20:19:43 2012 (r241517) @@ -392,7 +392,6 @@ void vm_page_readahead_finish(vm_page_t void vm_page_reference(vm_page_t m); void vm_page_remove (vm_page_t); void vm_page_rename (vm_page_t, vm_object_t, vm_pindex_t); -void vm_page_requeue(vm_page_t m); void vm_page_set_valid_range(vm_page_t m, int base, int size); void vm_page_sleep(vm_page_t m, const char *msg); vm_page_t vm_page_splay(vm_pindex_t, vm_page_t); Modified: head/sys/vm/vm_pageout.c ============================================================================== --- head/sys/vm/vm_pageout.c Sat Oct 13 19:53:11 2012 (r241516) +++ head/sys/vm/vm_pageout.c Sat Oct 13 20:19:43 2012 (r241517) @@ -218,6 +218,7 @@ static void vm_req_vmdaemon(int req); #endif static boolean_t vm_pageout_page_lock(vm_page_t, vm_page_t *); static void vm_pageout_page_stats(void); +static void vm_pageout_requeue(vm_page_t m); /* * Initialize a dummy page for marking the caller's place in the specified @@ -749,7 +750,7 @@ vm_pageout_object_deactivate_pages(pmap_ vm_page_deactivate(p); } else { vm_page_lock_queues(); - vm_page_requeue(p); + vm_pageout_requeue(p); vm_page_unlock_queues(); } } else { @@ -758,7 +759,7 @@ vm_pageout_object_deactivate_pages(pmap_ ACT_ADVANCE) p->act_count += ACT_ADVANCE; vm_page_lock_queues(); - vm_page_requeue(p); + vm_pageout_requeue(p); vm_page_unlock_queues(); } } else if (p->queue == PQ_INACTIVE) @@ -855,6 +856,26 @@ vm_pageout_map_deactivate_pages(map, des #endif /* !defined(NO_SWAPPING) */ /* + * vm_pageout_requeue: + * + * Move the specified page to the tail of its present page queue. + * + * The page queues must be locked. + */ +static void +vm_pageout_requeue(vm_page_t m) +{ + struct vpgqueues *vpq; + + mtx_assert(&vm_page_queue_mtx, MA_OWNED); + KASSERT(m->queue != PQ_NONE, + ("vm_pageout_requeue: page %p is not queued", m)); + vpq = &vm_page_queues[m->queue]; + TAILQ_REMOVE(&vpq->pl, m, pageq); + TAILQ_INSERT_TAIL(&vpq->pl, m, pageq); +} + +/* * vm_pageout_scan does the dirty work for the pageout daemon. */ static void @@ -1097,7 +1118,7 @@ vm_pageout_scan(int pass) m->flags |= PG_WINATCFLS; vm_page_lock_queues(); queues_locked = TRUE; - vm_page_requeue(m); + vm_pageout_requeue(m); } else if (maxlaunder > 0) { /* * We always want to try to flush some dirty pages if @@ -1128,7 +1149,7 @@ vm_pageout_scan(int pass) vm_page_unlock(m); VM_OBJECT_UNLOCK(object); queues_locked = TRUE; - vm_page_requeue(m); + vm_pageout_requeue(m); goto relock_queues; } @@ -1216,7 +1237,7 @@ vm_pageout_scan(int pass) */ if (m->hold_count) { vm_page_unlock(m); - vm_page_requeue(m); + vm_pageout_requeue(m); if (object->flags & OBJ_MIGHTBEDIRTY) vnodes_skipped++; goto unlock_and_continue; @@ -1321,7 +1342,7 @@ relock_queues: (m->hold_count != 0)) { vm_page_unlock(m); VM_OBJECT_UNLOCK(object); - vm_page_requeue(m); + vm_pageout_requeue(m); m = next; continue; } @@ -1358,7 +1379,7 @@ relock_queues: * page activation count stats. */ if (actcount && (object->ref_count != 0)) { - vm_page_requeue(m); + vm_pageout_requeue(m); } else { m->act_count -= min(m->act_count, ACT_DECLINE); if (vm_pageout_algorithm || @@ -1376,7 +1397,7 @@ relock_queues: vm_page_deactivate(m); } } else { - vm_page_requeue(m); + vm_pageout_requeue(m); } } vm_page_unlock(m); @@ -1588,7 +1609,7 @@ vm_pageout_page_stats() (m->hold_count != 0)) { vm_page_unlock(m); VM_OBJECT_UNLOCK(object); - vm_page_requeue(m); + vm_pageout_requeue(m); m = next; continue; } @@ -1604,7 +1625,7 @@ vm_pageout_page_stats() m->act_count += ACT_ADVANCE + actcount; if (m->act_count > ACT_MAX) m->act_count = ACT_MAX; - vm_page_requeue(m); + vm_pageout_requeue(m); } else { if (m->act_count == 0) { /* @@ -1620,7 +1641,7 @@ vm_pageout_page_stats() vm_page_deactivate(m); } else { m->act_count -= min(m->act_count, ACT_DECLINE); - vm_page_requeue(m); + vm_pageout_requeue(m); } } vm_page_unlock(m); From owner-svn-src-head@FreeBSD.ORG Sat Oct 13 23:54:27 2012 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id 49DC0EBF; Sat, 13 Oct 2012 23:54:27 +0000 (UTC) (envelope-from attilio@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 2F4FB8FC0A; Sat, 13 Oct 2012 23:54:27 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id q9DNsREq034604; Sat, 13 Oct 2012 23:54:27 GMT (envelope-from attilio@svn.freebsd.org) Received: (from attilio@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q9DNsQLJ034593; Sat, 13 Oct 2012 23:54:26 GMT (envelope-from attilio@svn.freebsd.org) Message-Id: <201210132354.q9DNsQLJ034593@svn.freebsd.org> From: Attilio Rao Date: Sat, 13 Oct 2012 23:54:26 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r241519 - in head: . sbin sbin/mount_fusefs sys/conf sys/fs/fuse sys/modules sys/modules/fuse X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 13 Oct 2012 23:54:27 -0000 Author: attilio Date: Sat Oct 13 23:54:26 2012 New Revision: 241519 URL: http://svn.freebsd.org/changeset/base/241519 Log: Import a FreeBSD port of the FUSE Linux module. This has been developed during 2 summer of code mandates and being revived by gnn recently. The functionality in this commit mirrors entirely content of fusefs-kmod port, which doesn't need to be installed anymore for -CURRENT setups. In order to get some sparse technical notes, please refer to: http://lists.freebsd.org/pipermail/freebsd-fs/2012-March/013876.html or to the project branch: svn://svn.freebsd.org/base/projects/fuse/ which also contains granular history of changes happened during port refinements. This commit does not came from the branch reintegration itself because it seems svn is not behaving properly for this functionaly at the moment. Partly Sponsored by: Google, Summer of Code program 2005, 2011 Originally submitted by: ilya, Csaba Henk In collabouration with: pho Tested by: flo, gnn, Gustau Perez, Kevin Oberman MFC after: 2 months Added: head/sbin/mount_fusefs/ head/sbin/mount_fusefs/Makefile (contents, props changed) head/sbin/mount_fusefs/mount_fusefs.8 (contents, props changed) head/sbin/mount_fusefs/mount_fusefs.c (contents, props changed) head/sys/fs/fuse/ head/sys/fs/fuse/fuse.h (contents, props changed) head/sys/fs/fuse/fuse_debug.h (contents, props changed) head/sys/fs/fuse/fuse_device.c (contents, props changed) head/sys/fs/fuse/fuse_file.c (contents, props changed) head/sys/fs/fuse/fuse_file.h (contents, props changed) head/sys/fs/fuse/fuse_internal.c (contents, props changed) head/sys/fs/fuse/fuse_internal.h (contents, props changed) head/sys/fs/fuse/fuse_io.c (contents, props changed) head/sys/fs/fuse/fuse_io.h (contents, props changed) head/sys/fs/fuse/fuse_ipc.c (contents, props changed) head/sys/fs/fuse/fuse_ipc.h (contents, props changed) head/sys/fs/fuse/fuse_kernel.h (contents, props changed) head/sys/fs/fuse/fuse_main.c (contents, props changed) head/sys/fs/fuse/fuse_node.c (contents, props changed) head/sys/fs/fuse/fuse_node.h (contents, props changed) head/sys/fs/fuse/fuse_param.h (contents, props changed) head/sys/fs/fuse/fuse_vfsops.c (contents, props changed) head/sys/fs/fuse/fuse_vnops.c (contents, props changed) head/sys/modules/fuse/ head/sys/modules/fuse/Makefile (contents, props changed) Modified: head/UPDATING head/sbin/Makefile head/sys/conf/NOTES head/sys/conf/files head/sys/conf/options head/sys/modules/Makefile Modified: head/UPDATING ============================================================================== --- head/UPDATING Sat Oct 13 22:22:53 2012 (r241518) +++ head/UPDATING Sat Oct 13 23:54:26 2012 (r241519) @@ -24,6 +24,9 @@ NOTE TO PEOPLE WHO THINK THAT FreeBSD 10 disable the most expensive debugging functionality run "ln -s 'abort:false,junk:false' /etc/malloc.conf".) +20121014: + Import the FUSE kernel and userland support into base system. + 20121013: The GNU sort(1) program has been removed since the BSD-licensed sort(1) has been the default for quite some time and no serious Modified: head/sbin/Makefile ============================================================================== --- head/sbin/Makefile Sat Oct 13 22:22:53 2012 (r241518) +++ head/sbin/Makefile Sat Oct 13 23:54:26 2012 (r241519) @@ -49,6 +49,7 @@ SUBDIR=adjkerntz \ mksnap_ffs \ mount \ mount_cd9660 \ + mount_fusefs \ mount_msdosfs \ mount_nfs \ mount_ntfs \ Added: head/sbin/mount_fusefs/Makefile ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ head/sbin/mount_fusefs/Makefile Sat Oct 13 23:54:26 2012 (r241519) @@ -0,0 +1,33 @@ +# $FreeBSD$ + +.if defined(DEBUG) +DEBUG_FLAGS+= -D_DEBUG -g +.endif + +.if defined(DEBUG2G) +DEBUG_FLAGS+= -D_DEBUG2G -g +.endif + +.if defined(DEBUG3G) +DEBUG_FLAGS+= -D_DEBUG3G -g +.endif + +.if defined(DEBUG_MSG) +DEBUG_FLAGS+= -D_DEBUG_MSG +.endif + +.if defined(F4BVERS) +DEBUG_FLAGS+= -DFUSE4BSD_VERSION="\"${F4BVERS}\"" +.endif + +PROG= mount_fusefs +SRCS= mount_fusefs.c getmntopts.c +MAN8= mount_fusefs.8 +NO_MANCOMPRESS?= yes + +MOUNT= ${.CURDIR}/../mount +CFLAGS+= -I${MOUNT} + +.PATH: ${MOUNT} + +.include Added: head/sbin/mount_fusefs/mount_fusefs.8 ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ head/sbin/mount_fusefs/mount_fusefs.8 Sat Oct 13 23:54:26 2012 (r241519) @@ -0,0 +1,363 @@ +.\" Copyright (c) 1980, 1989, 1991, 1993 +.\" The Regents of the University of California. +.\" Copyright (c) 2005, 2006 Csaba Henk +.\" All rights reserved. +.\" +.\" Redistribution and use in source and binary forms, with or without +.\" modification, are permitted provided that the following conditions +.\" are met: +.\" 1. Redistributions of source code must retain the above copyright +.\" notice, this list of conditions and the following disclaimer. +.\" 2. Redistributions in binary form must reproduce the above copyright +.\" notice, this list of conditions and the following disclaimer in the +.\" documentation and/or other materials provided with the distribution. +.\" 4. Neither the name of the University nor the names of its contributors +.\" may be used to endorse or promote products derived from this software +.\" without specific prior written permission. +.\" +.\" THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND +.\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE +.\" ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE +.\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL +.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS +.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) +.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT +.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY +.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF +.\" SUCH DAMAGE. +.\" +.\" $FreeBSD$ +.\" +.Dd October 11, 2012 +.Dt MOUNT_FUSEFS 8 +.Os +.Sh NAME +.Nm mount_fusefs +.Nd mount a Fuse file system daemon +.Sh SYNOPSIS +.Nm +.Op Fl A +.Op Fl S +.Op Fl v +.Op Fl D Ar fuse_daemon +.Op Fl O Ar daemon_opts +.Op Fl s Ar special +.Op Fl m Ar node +.Op Fl h +.Op Fl V +.Op Fl o Ar option ... +.Ar special node +.Op Ar fuse_daemon ... +.Sh DESCRIPTION +Basic usage is to start a fuse daemon on the given +.Ar special +file. In practice, the daemon is assigned a +.Ar special +file automatically, which can then be indentified via +.Xr fstat 1 . +That special file can then be mounted by +.Nm . +.Pp +However, the procedure of spawning a daemon will usually be automated +so that it is performed by +.Nm . +If the command invoking a given +.Ar fuse_daemon +is appended to the list of arguments, +.Nm +will call the +.Ar fuse_daemon +via that command. In that way the +.Ar fuse_daemon +will be instructed to attach itself to +.Ar special . +From that on mounting goes as in the simple case. (See +.Sx DAEMON MOUNTS . ) +.Pp +The +.Ar special +argument normally will be treated as the path of the special file to mount. +.Pp +However, if +.Pa auto +is passed as +.Ar special , +then +.Nm +will look for a suitable free fuse device by itself. +.Pp +Finally, if +.Ar special +is an integer it will be interpreted as the number +of the file descriptor of an already open fuse device +(used when the Fuse library invokes +.Nm . +(See +.Sx DAEMON MOUNTS ) . +.Pp +The options are as follows: +.Bl -tag -width indent +.It Fl A , Ic --reject-allow_other +Prohibit the +.Cm allow_other +mount flag. Intended for use in scripts and the +.Xr sudoers 5 +file. +.It Fl S , Ic --safe +Run in safe mode (i.e. reject invoking a filesystem daemon) +.It Fl v +Be verbose +.It Fl D, Ic --daemon Ar daemon +Call the specified +.Ar daemon +.It Fl O, Ic --daemon_opts Ar opts +Add +.Ar opts +to the daemon's command line +.It Fl s, Ic --special Ar special +Use +.Ar special +as special +.It Fl m, Ic --mountpath Ar node +Mount on +.Ar node +.It Fl h, Ic --help +Show help +.It Fl V, Ic --version +Show version information +.It Fl o +Mount options are specified via +.Fl o . +The following options are available (and also their negated versions, +by prefixing them with +.Dq no ) : +.Bl -tag -width indent +.It Cm default_permissions +Enable traditional (file mode based) permission checking in kernel +.It Cm allow_other +Do not apply +.Sx STRICT ACCESS POLICY . +Only root can use this option +.It Cm max_read Ns = Ns Ar n +Limit size of read requests to +.Ar n +.It Cm private +Refuse shared mounting of the daemon. This is the default behaviour, +to allow sharing, expicitly use +.Fl o Cm noprivate +.It Cm neglect_shares +Don't refuse unmounting if there are secondary mounts +.It Cm push_symlinks_in +Prefix absolute symlinks with the mountpoint +.El +.Pp +.El +.Pp +Besides the above mount options, there is a set of pseudo-mount options which +are supported by the Fuse library. One can list these by passing +.Fl h +to a Fuse daemon. Most of these options have effect only on the behaviour of +the daemon (that is, their scope is limited to userspace). However, +there are some which do require in-kernel support. +Currently the options supported by the kernel are: +.Bl -tag -width indent +.It Cm direct_io +Bypass the buffer cache system +.It Cm kernel_cache +By default cached buffers of a given file are flushed at each +.Xr open 2 . +This option disables this behaviour +.El +.Sh DAEMON MOUNTS +Usually users don't need to use +.Nm +directly, as the Fuse library enables Fuse daemons to invoke +.Nm . +That is, +.Pp +.Dl fuse_daemon device mountpoint +.Pp +has the same effect as +.Pp +.Dl mount_fusefs auto mountpoint fuse_daemon +.Pp +This is the recommended usage when you want basic usage +(eg, run the daemon at a low privilege level but mount it as root). +.Sh STRICT ACCESS POLICY +The strict access policy for Fuse filesystems lets one to use the filesystem +only if the filesystem daemon has the same credentials (uid, real uid, gid, +real gid) as the user. +.Pp +This is applied for Fuse mounts by default and only root can mount without +the strict access policy (ie. the +.Cm allow_other +mount option). +.Pp +This is to shield users from the daemon +.Dq spying +on their I/O activities. +.Pp +Users might opt to willingly relax strict access policy (as far they +are concerned) by doing their own secondary mount (See +.Sx SHARED MOUNTS ) . +.Sh SHARED MOUNTS +A Fuse daemon can be shared (ie. mounted multiple times). +When doing the first (primary) mount, the spawner and the mounter of the daemon +must have the same uid, or the mounter should be the superuser. +.Pp +After the primary mount is in place, secondary mounts can be done by anyone +unless this feature is disabled by +.Cm private . +The behaviour of a secondary mount is analogous to that of symbolic +links: they redirect all filesystem operations to the primary mount. +.Pp +Doing a secondary mount is like signing an agreement: by this action, the mounter +agrees that the Fuse daemon can trace her I/O activities. From then on +she is not banned from using the filesystem (either via her own mount or +via the primary mount), regardless whether +.Cm allow_other +is used or not. +.Pp +The device name of a secondary mount is the device name of the corresponding +primary mount, followed by a '#' character and the index of the secondary +mount; e.g. +.Pa /dev/fuse0#3 . +.Sh SECURITY +System administrators might want to use a custom mount policy (ie., one going +beyond the +.Va vfs.usermount +sysctl). The primary tool for such purposes is +.Xr sudo 8 . +However, given that +.Nm +is capable of invoking an arbitrary program, one must be careful when doing this. +.Nm +is designed in a way such that it makes that easy. For this purpose, +there are options which disable certain risky features (ie. +.Fl S +and +.Fl A ) , +and command line parsing is done in a flexible way: mixing options and +non-options is allowed, but processing them stops at the third non-option +argument (after the first two has been utilized as device and mountpoint). +The rest of the command line specifies the daemon and its arguments. +(Alternatively, the daemon, the special and the mount path can be +specified using the respective options.) Note that +.Nm +ignores the environment variable +.Ev POSIXLY_CORRECT +and always behaves as described. +.Pp +In general, to be as scripting / +.Xr sudoers 5 +friendly as possible, no information has a fixed +position in the command line, but once a given piece of information is +provided, subsequent arguments/options cannot override it (with the +exception of some non-critical ones). +.Sh ENVIRONMENT +.Bl -tag -width ".Ev MOUNT_FUSEFS_SAFE" +.It Ev MOUNT_FUSEFS_SAFE +This has the same effect as the +.Fl S +option. +.It Ev MOUNT_FUSEFS_VERBOSE +This has the same effect as the +.Fl v +option. +.It Ev MOUNT_FUSEFS_IGNORE_UNKNOWN +If set, +.Nm +will ignore uknown mount options. +.It Ev MOUNT_FUSEFS_CALL_BY_LIB +Adjust behaviour to the needs of the FUSE library. Currently it effects +help output. +.El +.Pp +Although the following variables don't have any effect on +.Nm +itself, they affect the behaviour of fuse daemons: +.Bl -tag -width ".Ev FUSE_DEV_NAME" +.It Ev FUSE_DEV_NAME +Device to attach. If not set, the multiplexer path +.Ar /dev/fuse +is used. +.It Ev FUSE_DEV_FD +File desciptor of an opened Fuse device to use. Overrides +.Ev FUSE_DEV_NAME . +.It Ev FUSE_NO_MOUNT +If set, the library won't attempt to mount the filesystem, even +if a mountpoint argument is supplied. +.El +.Sh FILES +.Bl -tag -width /dev/fuse +.It Pa /dev/fuse +Fuse device with which the kernel and Fuse daemons can communicate. +.It Pa /dev/fuse +The multiplexer path. An +.Xr open 2 +performed on it automatically is passed to a free Fuse device by the kernel +(which might be created just for this puprose). +.El +.Sh EXAMPLES +Mount the example filesystem in the Fuse distribution (from its directory): +either +.Pp +.Dl ./fusexmp /mnt/fuse +.Pp +or +.Pp +.Dl mount_fusefs auto /mnt/fuse ./fusexmp +.Pp +Doing the same in two steps, using +.Pa /dev/fuse0 : +.Pp +.Dl FUSE_DEV_NAME=/dev/fuse ./fusexmp && +.Dl mount_fusefs /dev/fuse /mnt/fuse +.Pp +A script wrapper for fusexmp which ensures that +.Nm +doesn't call any external utility and also provides a hacky +(non race-free) automatic device selection: +.Pp +.Dl #!/bin/sh -e +.Pp +.Dl FUSE_DEV_NAME=/dev/fuse fusexmp +.Dl mount_fusefs -S /dev/fuse /mnt/fuse \(lq$@\(rq +.Sh SEE ALSO +.Xr fstat 1 , +.Xr mount 8 , +.Xr umount 8 , +.Xr sudo 8 +.Sh CAVEATS +Secondary mounts should be unmounted via their device name. If an attempt is +made to be unmount them via their filesystem root path, the unmount request +will be forwarded to the primary mount path. +In general, unmounting by device name is less error-prone than by mount path +(although the latter will also work under normal circumstances). +.Pp +If the daemon is specified via the +.Fl D +and +.Fl O +options, it will be invoked via +.Xr system 3 , +and the daemon's command line will also have an +.Dq & +control operator appended, so that we don't have to wait for its termination. +You should use a simple command line when invoking the daemon via these options. +.Sh HISTORY +.Nm +appears as the part of the FreeBSD implementation of the Fuse userspace filesystem +framework (see http://fuse.sourceforge.net). This user interface is FreeBSD specific. +.Sh BUGS +.Ar special +is treated as a multiplexer if and only if it is literally the same as +.Pa auto +or +.Pa /dev/fuse . +Other paths which are equivalent with +.Pa /dev/fuse +(eg., +.Pa /../dev/fuse ) +are not. Added: head/sbin/mount_fusefs/mount_fusefs.c ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ head/sbin/mount_fusefs/mount_fusefs.c Sat Oct 13 23:54:26 2012 (r241519) @@ -0,0 +1,504 @@ +/*- + * Copyright (c) 2005 Jean-Sebastien Pedron + * Copyright (c) 2005 Csaba Henk + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + * + */ + +#include +__FBSDID("$FreeBSD$"); + +#include +#include +#include +#include +#include + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#include "mntopts.h" + +#ifndef FUSE4BSD_VERSION +#define FUSE4BSD_VERSION "0.3.9-pre1" +#endif + +void __usage_short(void); +void usage(void); +void helpmsg(void); +void showversion(void); +int init_backgrounded(void); + +struct mntopt mopts[] = { + #define ALTF_PRIVATE 0x01 + { "private", 0, ALTF_PRIVATE, 1 }, + { "neglect_shares", 0, 0x02, 1 }, + { "push_symlinks_in", 0, 0x04, 1 }, + { "allow_other", 0, 0x08, 1 }, + { "default_permissions", 0, 0x10, 1 }, + #define ALTF_MAXREAD 0x20 + { "max_read=", 0, ALTF_MAXREAD, 1 }, + #define ALTF_SUBTYPE 0x40 + { "subtype=", 0, ALTF_SUBTYPE, 1 }, + #define ALTF_SYNC_UNMOUNT 0x80 + { "sync_unmount", 0, ALTF_SYNC_UNMOUNT, 1 }, + /* Linux specific options, we silently ignore them */ + { "fsname=", 0, 0x00, 1 }, + { "fd=", 0, 0x00, 1 }, + { "rootmode=", 0, 0x00, 1 }, + { "user_id=", 0, 0x00, 1 }, + { "group_id=", 0, 0x00, 1 }, + { "large_read", 0, 0x00, 1 }, + /* "nonempty", just the first two chars are stripped off during parsing */ + { "nempty", 0, 0x00, 1 }, + MOPT_STDOPTS, + MOPT_END +}; + +struct mntval { + int mv_flag; + void *mv_value; + int mv_len; +}; + +struct mntval mvals[] = { + { ALTF_MAXREAD, NULL, 0 }, + { ALTF_SUBTYPE, NULL, 0 }, + { 0, NULL, 0 } +}; + +char *progname; + +#define DEFAULT_MOUNT_FLAGS ALTF_PRIVATE | ALTF_SYNC_UNMOUNT + +int +main(int argc, char *argv[]) +{ + struct iovec *iov; + char ch = '\0'; + int mntflags, iovlen, verbose = 0; + char *dev = NULL, *dir = NULL, mntpath[MAXPATHLEN]; + char *devo = NULL, *diro = NULL; + char ndev[128], fdstr[15]; + int i, done = 0, reject_allow_other = 0, safe_level = 0; + int altflags = DEFAULT_MOUNT_FLAGS; + int __altflags = DEFAULT_MOUNT_FLAGS; + struct mntopt *mo; + struct mntval *mv; + static struct option longopts[] = { + {"reject-allow_other", no_argument, NULL, 'A'}, + {"safe", no_argument, NULL, 'S'}, + {"daemon", required_argument, NULL, 'D'}, + {"daemon_opts", required_argument, NULL, 'O'}, + {"special", required_argument, NULL, 's'}, + {"mountpath", required_argument, NULL, 'm'}, + {"version", no_argument, NULL, 'V'}, + {"help", no_argument, NULL, 'h'}, + {0,0,0,0} + }; + int pid = 0; + int fd = -1, fdx; + char *ep; + char *daemon_str = NULL, *daemon_opts = NULL; + + progname = argv[0]; + + /* + * We want a parsing routine which is not sensitive to + * the position of args/opts; it should extract the + * first two args and stop at the beginning of the rest. + * (This makes it easier to call mount_fusefs from external + * utils than it is with a strict "util flags args" syntax.) + */ + + iov = NULL; + iovlen = 0; + mntflags = 0; + /* All in all, I feel it more robust this way... */ + unsetenv("POSIXLY_CORRECT"); + if (getenv("MOUNT_FUSEFS_IGNORE_UNKNOWN")) + getmnt_silent = 1; + if (getenv("MOUNT_FUSEFS_VERBOSE")) + verbose = 1; + + do { + for (i = 0; i < 3; i++) { + if (optind < argc && argv[optind][0] != '-') { + if (dir) { + done = 1; + break; + } + if (dev) + dir = argv[optind]; + else + dev = argv[optind]; + optind++; + } + } + switch(ch) { + case 'A': + reject_allow_other = 1; + break; + case 'S': + safe_level = 1; + break; + case 'D': + if (daemon_str) + errx(1, "daemon specified inconsistently"); + daemon_str = optarg; + break; + case 'O': + if (daemon_opts) + errx(1, "daemon opts specified inconsistently"); + daemon_opts = optarg; + break; + case 'o': + getmntopts(optarg, mopts, &mntflags, &altflags); + for (mv = mvals; mv->mv_flag; ++mv) { + if (! (altflags & mv->mv_flag)) + continue; + for (mo = mopts; mo->m_flag; ++mo) { + char *p, *q; + + if (mo->m_flag != mv->mv_flag) + continue; + p = strstr(optarg, mo->m_option); + if (p) { + p += strlen(mo->m_option); + q = p; + while (*q != '\0' && *q != ',') + q++; + mv->mv_len = q - p + 1; + mv->mv_value = malloc(mv->mv_len); + memcpy(mv->mv_value, p, mv->mv_len - 1); + ((char *)mv->mv_value)[mv->mv_len - 1] = '\0'; + break; + } + } + } + break; + case 's': + if (devo) + errx(1, "special specified inconsistently"); + devo = optarg; + break; + case 'm': + if (diro) + errx(1, "mount path specified inconsistently"); + diro = optarg; + break; + case 'v': + verbose = 1; + break; + case 'h': + helpmsg(); + break; + case 'V': + showversion(); + break; + case '\0': + break; + case '?': + default: + usage(); + } + if (done) + break; + } while ((ch = getopt_long(argc, argv, "AvVho:SD:O:s:m:", longopts, NULL)) != -1); + + argc -= optind; + argv += optind; + + if (devo) { + if (dev) + errx(1, "special specified inconsistently"); + dev = devo; + } else if (diro) + errx(1, "if mountpoint is given via an option, special should also be given via an option"); + + if (diro) { + if (dir) + errx(1, "mount path specified inconsistently"); + dir = diro; + } + + if ((! dev) && argc > 0) { + dev = *argv++; + argc--; + } + + if ((! dir) && argc > 0) { + dir = *argv++; + argc--; + } + + if (! (dev && dir)) + errx(1, "missing special and/or mountpoint"); + + for (mo = mopts; mo->m_flag; ++mo) { + if (altflags & mo->m_flag) { + int iov_done = 0; + + if (reject_allow_other && + strcmp(mo->m_option, "allow_other") == 0) + /* + * reject_allow_other is stronger than a + * negative of allow_other: if this is set, + * allow_other is blocked, period. + */ + errx(1, "\"allow_other\" usage is banned by respective option"); + + for (mv = mvals; mv->mv_flag; ++mv) { + if (mo->m_flag != mv->mv_flag) + continue; + if (mv->mv_value) { + build_iovec(&iov, &iovlen, mo->m_option, mv->mv_value, mv->mv_len); + iov_done = 1; + break; + } + } + if (! iov_done) + build_iovec(&iov, &iovlen, mo->m_option, + __DECONST(void *, ""), -1); + } + if (__altflags & mo->m_flag) { + char *uscore_opt; + + if (asprintf(&uscore_opt, "__%s", mo->m_option) == -1) + err(1, "failed to allocate memory"); + build_iovec(&iov, &iovlen, uscore_opt, + __DECONST(void *, ""), -1); + free(uscore_opt); + } + } + + if (getenv("MOUNT_FUSEFS_SAFE")) + safe_level = 1; + + if (safe_level > 0 && (argc > 0 || daemon_str || daemon_opts)) + errx(1, "safe mode, spawning daemon not allowed"); + + if ((argc > 0 && (daemon_str || daemon_opts)) || + (daemon_opts && ! daemon_str)) + errx(1, "daemon specified inconsistently"); + + /* + * Resolve the mountpoint with realpath(3) and remove unnecessary + * slashes from the devicename if there are any. + */ + if (checkpath(dir, mntpath) != 0) + err(1, "%s", mntpath); + (void)rmslashes(dev, dev); + + if (strcmp(dev, "auto") == 0) + dev = __DECONST(char *, "/dev/fuse"); + + if (strcmp(dev, "/dev/fuse") == 0) { + if (! (argc > 0 || daemon_str)) { + fprintf(stderr, "Please also specify the fuse daemon to run when mounting via the multiplexer!\n"); + usage(); + } + if ((fd = open(dev, O_RDWR)) < 0) + err(1, "failed to open fuse device"); + } else { + fdx = strtol(dev, &ep, 10); + if (*ep == '\0') + fd = fdx; + } + + /* Identifying device */ + if (fd >= 0) { + struct stat sbuf; + char *ndevbas, *lep; + + if (fstat(fd, &sbuf) == -1) + err(1, "cannot stat device file descriptor"); + + strcpy(ndev, _PATH_DEV); + ndevbas = ndev + strlen(_PATH_DEV); + devname_r(sbuf.st_rdev, S_IFCHR, ndevbas, + sizeof(ndev) - strlen(_PATH_DEV)); + + if (strncmp(ndevbas, "fuse", 4)) + errx(1, "mounting inappropriate device"); + + strtol(ndevbas + 4, &lep, 10); + if (*lep != '\0') + errx(1, "mounting inappropriate device"); + + dev = ndev; + } + + if (argc > 0 || daemon_str) { + char *fds; + + if (fd < 0 && (fd = open(dev, O_RDWR)) < 0) + err(1, "failed to open fuse device"); + + if (asprintf(&fds, "%d", fd) == -1) + err(1, "failed to allocate memory"); + setenv("FUSE_DEV_FD", fds, 1); + free(fds); + setenv("FUSE_NO_MOUNT", "1", 1); + + if (daemon_str) { + char *bgdaemon; + int len; + + if (! daemon_opts) + daemon_opts = __DECONST(char *, ""); + + len = strlen(daemon_str) + 1 + strlen(daemon_opts) + + 2 + 1; + bgdaemon = calloc(1, len); + + if (! bgdaemon) + err(1, "failed to allocate memory"); + + strlcpy(bgdaemon, daemon_str, len); + strlcat(bgdaemon, " ", len); + strlcat(bgdaemon, daemon_opts, len); + strlcat(bgdaemon, " &", len); + + if (system(bgdaemon)) + err(1, "failed to call fuse daemon"); + } else { + if ((pid = fork()) < 0) + err(1, "failed to fork for fuse daemon"); + + if (pid == 0) { + execvp(argv[0], argv); + err(1, "failed to exec fuse daemon"); + } + } + } + + if (fd >= 0 && ! init_backgrounded() && close(fd) < 0) { + if (pid) + kill(pid, SIGKILL); + err(1, "failed to close fuse device"); + } + + /* Prepare the options vector for nmount(). build_iovec() is declared + * in mntopts.h. */ + sprintf(fdstr, "%d", fd); + build_iovec(&iov, &iovlen, "fstype", __DECONST(void *, "fusefs"), -1); + build_iovec(&iov, &iovlen, "fspath", mntpath, -1); + build_iovec(&iov, &iovlen, "from", dev, -1); + build_iovec(&iov, &iovlen, "fd", fdstr, -1); + + if (verbose) + fprintf(stderr, "mounting fuse daemon on device %s\n", dev); + + if (nmount(iov, iovlen, mntflags) < 0) + err(EX_OSERR, "%s on %s", dev, mntpath); + + exit(0); +} + +void +__usage_short(void) { + fprintf(stderr, + "usage:\n%s [-A|-S|-v|-V|-h|-D daemon|-O args|-s special|-m node|-o option...] special node [daemon args...]\n\n", + basename(progname)); +} + +void +usage(void) +{ + struct mntopt *mo; + + __usage_short(); + + fprintf(stderr, "known options:\n"); + for (mo = mopts; mo->m_flag; ++mo) + fprintf(stderr, "\t%s\n", mo->m_option); + + fprintf(stderr, "\n(use -h for a detailed description of these options)\n"); + exit(EX_USAGE); +} + +void +helpmsg(void) +{ + if (! getenv("MOUNT_FUSEFS_CALL_BY_LIB")) { + __usage_short(); + fprintf(stderr, "description of options:\n"); + } + + /* + * The main use case of this function is giving info embedded in general + * FUSE lib help output. Therefore the style and the content of the output + * tries to fit there as much as possible. + */ + fprintf(stderr, + " -o allow_other allow access to other users\n" + /* " -o nonempty allow mounts over non-empty file/dir\n" */ + " -o default_permissions enable permission checking by kernel\n" + /* + " -o fsname=NAME set filesystem name\n" + " -o large_read issue large read requests (2.4 only)\n" + */ + " -o subtype=NAME set filesystem type\n" + " -o max_read=N set maximum size of read requests\n" + " -o noprivate allow secondary mounting of the filesystem\n" + " -o neglect_shares don't report EBUSY when unmount attempted\n" + " in presence of secondary mounts\n" + " -o push_symlinks_in prefix absolute symlinks with mountpoint\n" + " -o sync_unmount do unmount synchronously\n" + ); + exit(EX_USAGE); +} + +void +showversion(void) +{ + puts("mount_fusefs [fuse4bsd] version: " FUSE4BSD_VERSION); + exit(EX_USAGE); +} + +int +init_backgrounded(void) +{ + int ibg; + size_t len; + + len = sizeof(ibg); + + if (sysctlbyname("vfs.fuse.init_backgrounded", &ibg, &len, NULL, 0)) + return (0); + + return (ibg); +} Modified: head/sys/conf/NOTES ============================================================================== --- head/sys/conf/NOTES Sat Oct 13 22:22:53 2012 (r241518) +++ head/sys/conf/NOTES Sat Oct 13 23:54:26 2012 (r241519) @@ -1003,6 +1003,7 @@ options NFSCLIENT #Network File System # The rest are optional: options CD9660 #ISO 9660 filesystem options FDESCFS #File descriptor filesystem +options FUSE #FUSE support module options HPFS #OS/2 File system options MSDOSFS #MS DOS File System (FAT, FAT32) options NFSSERVER #Network File System server Modified: head/sys/conf/files ============================================================================== --- head/sys/conf/files Sat Oct 13 22:22:53 2012 (r241518) +++ head/sys/conf/files Sat Oct 13 23:54:26 2012 (r241519) @@ -2317,6 +2317,15 @@ fs/devfs/devfs_vnops.c standard fs/fdescfs/fdesc_vfsops.c optional fdescfs fs/fdescfs/fdesc_vnops.c optional fdescfs fs/fifofs/fifo_vnops.c standard +fs/fuse/fuse_device.c optional fuse +fs/fuse/fuse_file.c optional fuse +fs/fuse/fuse_internal.c optional fuse +fs/fuse/fuse_io.c optional fuse +fs/fuse/fuse_ipc.c optional fuse +fs/fuse/fuse_main.c optional fuse +fs/fuse/fuse_node.c optional fuse +fs/fuse/fuse_vfsops.c optional fuse +fs/fuse/fuse_vnops.c optional fuse fs/hpfs/hpfs_alsubr.c optional hpfs fs/hpfs/hpfs_lookup.c optional hpfs fs/hpfs/hpfs_subr.c optional hpfs Modified: head/sys/conf/options ============================================================================== --- head/sys/conf/options Sat Oct 13 22:22:53 2012 (r241518) +++ head/sys/conf/options Sat Oct 13 23:54:26 2012 (r241519) @@ -211,6 +211,7 @@ CODA opt_dontuse.h EXT2FS opt_dontuse.h FDESCFS opt_dontuse.h FFS opt_dontuse.h +FUSE opt_dontuse.h HPFS opt_dontuse.h MSDOSFS opt_dontuse.h NANDFS opt_dontuse.h Added: head/sys/fs/fuse/fuse.h ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ head/sys/fs/fuse/fuse.h Sat Oct 13 23:54:26 2012 (r241519) @@ -0,0 +1,223 @@ +/* + * Copyright (c) 2007-2009 Google Inc. + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are + * met: + * + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * * Redistributions in binary form must reproduce the above + * copyright notice, this list of conditions and the following disclaimer + * in the documentation and/or other materials provided with the + * distribution. + * * Neither the name of Google Inc. nor the names of its + * contributors may be used to endorse or promote products derived from + * this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR + * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT + * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, + * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT + * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, + * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY + * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE *** DIFF OUTPUT TRUNCATED AT 1000 LINES ***