From owner-svn-src-stable@FreeBSD.ORG Sun Jun 9 12:39:23 2013 Return-Path: Delivered-To: svn-src-stable@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by hub.freebsd.org (Postfix) with ESMTP id DEC6873D; Sun, 9 Jun 2013 12:39:23 +0000 (UTC) (envelope-from marius@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) by mx1.freebsd.org (Postfix) with ESMTP id CF96A172F; Sun, 9 Jun 2013 12:39:23 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.7/8.14.7) with ESMTP id r59CdNMQ004397; Sun, 9 Jun 2013 12:39:23 GMT (envelope-from marius@svn.freebsd.org) Received: (from marius@localhost) by svn.freebsd.org (8.14.7/8.14.5/Submit) id r59CdMBD004384; Sun, 9 Jun 2013 12:39:22 GMT (envelope-from marius@svn.freebsd.org) Message-Id: <201306091239.r59CdMBD004384@svn.freebsd.org> From: Marius Strobl Date: Sun, 9 Jun 2013 12:39:22 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-9@freebsd.org Subject: svn commit: r251567 - in stable/9/sys: dev/ata modules/usb/umass modules/usb/urio modules/usb/usfs powerpc/powermac powerpc/psim X-SVN-Group: stable-9 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 09 Jun 2013 12:39:24 -0000 Author: marius Date: Sun Jun 9 12:39:21 2013 New Revision: 251567 URL: http://svnweb.freebsd.org/changeset/base/251567 Log: MFC: r249213 (partial) - Remove unused headers from the SRCS of some modules. - Use __FBSDID. - Use DEVMETHOD_END. - Use NULL instead of 0 for pointers. Modified: stable/9/sys/dev/ata/ata-cbus.c stable/9/sys/dev/ata/ata-isa.c stable/9/sys/modules/usb/umass/Makefile stable/9/sys/modules/usb/urio/Makefile stable/9/sys/modules/usb/usfs/Makefile stable/9/sys/powerpc/powermac/ata_dbdma.c stable/9/sys/powerpc/powermac/ata_kauai.c stable/9/sys/powerpc/powermac/ata_macio.c stable/9/sys/powerpc/psim/ata_iobus.c Directory Properties: stable/9/sys/ (props changed) stable/9/sys/dev/ (props changed) stable/9/sys/modules/ (props changed) Modified: stable/9/sys/dev/ata/ata-cbus.c ============================================================================== --- stable/9/sys/dev/ata/ata-cbus.c Sun Jun 9 08:28:23 2013 (r251566) +++ stable/9/sys/dev/ata/ata-cbus.c Sun Jun 9 12:39:21 2013 (r251567) @@ -273,7 +273,7 @@ static driver_t ata_cbus_driver = { static devclass_t ata_cbus_devclass; -DRIVER_MODULE(atacbus, isa, ata_cbus_driver, ata_cbus_devclass, 0, 0); +DRIVER_MODULE(atacbus, isa, ata_cbus_driver, ata_cbus_devclass, NULL, NULL); static int ata_cbuschannel_probe(device_t dev) Modified: stable/9/sys/dev/ata/ata-isa.c ============================================================================== --- stable/9/sys/dev/ata/ata-isa.c Sun Jun 9 08:28:23 2013 (r251566) +++ stable/9/sys/dev/ata/ata-isa.c Sun Jun 9 12:39:21 2013 (r251567) @@ -195,7 +195,7 @@ static device_method_t ata_isa_methods[] DEVMETHOD(device_suspend, ata_isa_suspend), DEVMETHOD(device_resume, ata_isa_resume), - { 0, 0 } + DEVMETHOD_END }; static driver_t ata_isa_driver = { @@ -204,5 +204,5 @@ static driver_t ata_isa_driver = { sizeof(struct ata_channel), }; -DRIVER_MODULE(ata, isa, ata_isa_driver, ata_devclass, 0, 0); +DRIVER_MODULE(ata, isa, ata_isa_driver, ata_devclass, NULL, NULL); MODULE_DEPEND(ata, ata, 1, 1, 1); Modified: stable/9/sys/modules/usb/umass/Makefile ============================================================================== --- stable/9/sys/modules/usb/umass/Makefile Sun Jun 9 08:28:23 2013 (r251566) +++ stable/9/sys/modules/usb/umass/Makefile Sun Jun 9 12:39:21 2013 (r251567) @@ -30,8 +30,7 @@ S= ${.CURDIR}/../../.. .PATH: $S/dev/usb/storage KMOD= umass -SRCS= ata_if.h bus_if.h device_if.h usb_if.h vnode_if.h \ - opt_usb.h opt_bus.h opt_cam.h opt_ata.h ata_if.h usbdevs.h \ - umass.c +SRCS= bus_if.h device_if.h opt_bus.h opt_cam.h opt_usb.h umass.c usb_if.h \ + usbdevs.h vnode_if.h .include Modified: stable/9/sys/modules/usb/urio/Makefile ============================================================================== --- stable/9/sys/modules/usb/urio/Makefile Sun Jun 9 08:28:23 2013 (r251566) +++ stable/9/sys/modules/usb/urio/Makefile Sun Jun 9 12:39:21 2013 (r251567) @@ -30,8 +30,6 @@ S= ${.CURDIR}/../../.. .PATH: $S/dev/usb/storage KMOD= urio -SRCS= ata_if.h bus_if.h device_if.h usb_if.h vnode_if.h \ - opt_usb.h opt_bus.h opt_cam.h opt_ata.h ata_if.h usbdevs.h \ - urio.c +SRCS= bus_if.h device_if.h opt_bus.h opt_usb.h usb_if.h usbdevs.h urio.c .include Modified: stable/9/sys/modules/usb/usfs/Makefile ============================================================================== --- stable/9/sys/modules/usb/usfs/Makefile Sun Jun 9 08:28:23 2013 (r251566) +++ stable/9/sys/modules/usb/usfs/Makefile Sun Jun 9 12:39:21 2013 (r251567) @@ -30,8 +30,7 @@ S= ${.CURDIR}/../../.. .PATH: $S/dev/usb/storage KMOD= usfs -SRCS= ata_if.h bus_if.h device_if.h usb_if.h vnode_if.h \ - opt_usb.h opt_bus.h opt_cam.h opt_ata.h ata_if.h usbdevs.h \ +SRCS= bus_if.h device_if.h opt_bus.h opt_usb.h usb_if.h usbdevs.h \ ustorage_fs.c .include Modified: stable/9/sys/powerpc/powermac/ata_dbdma.c ============================================================================== --- stable/9/sys/powerpc/powermac/ata_dbdma.c Sun Jun 9 08:28:23 2013 (r251566) +++ stable/9/sys/powerpc/powermac/ata_dbdma.c Sun Jun 9 12:39:21 2013 (r251567) @@ -23,10 +23,11 @@ * 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$ */ +#include +__FBSDID("* $FreeBSD$"); + /* * Common routines for the DMA engine on both the Apple Kauai and MacIO * ATA controllers. Modified: stable/9/sys/powerpc/powermac/ata_kauai.c ============================================================================== --- stable/9/sys/powerpc/powermac/ata_kauai.c Sun Jun 9 08:28:23 2013 (r251566) +++ stable/9/sys/powerpc/powermac/ata_kauai.c Sun Jun 9 12:39:21 2013 (r251567) @@ -99,7 +99,7 @@ static device_method_t ata_kauai_methods /* ATA interface */ DEVMETHOD(ata_setmode, ata_kauai_setmode), - { 0, 0 } + DEVMETHOD_END }; struct ata_kauai_softc { @@ -120,15 +120,15 @@ static driver_t ata_kauai_driver = { sizeof(struct ata_kauai_softc), }; -DRIVER_MODULE(ata, pci, ata_kauai_driver, ata_devclass, 0, 0); +DRIVER_MODULE(ata, pci, ata_kauai_driver, ata_devclass, NULL, NULL); MODULE_DEPEND(ata, ata, 1, 1, 1); /* * PCI ID search table */ -static struct kauai_pci_dev { - u_int32_t kpd_devid; - char *kpd_desc; +static const struct kauai_pci_dev { + u_int32_t kpd_devid; + const char *kpd_desc; } kauai_pci_devlist[] = { { 0x0033106b, "Uninorth2 Kauai ATA Controller" }, { 0x003b106b, "Intrepid Kauai ATA Controller" }, @@ -152,6 +152,7 @@ static const u_int pio_timing_kauai[] = 0x05000249, /* PIO3 */ 0x04000148 /* PIO4 */ }; + static const u_int pio_timing_shasta[] = { 0x0a000c97, /* PIO0 */ 0x07000712, /* PIO1 */ @@ -165,6 +166,7 @@ static const u_int dma_timing_kauai[] = 0x00209000, /* WDMA1 */ 0x00148000 /* WDMA2 */ }; + static const u_int dma_timing_shasta[] = { 0x00820800, /* WDMA0 */ 0x0028b000, /* WDMA1 */ @@ -179,6 +181,7 @@ static const u_int udma_timing_kauai[] = 0x00002a31, /* UDMA4 */ 0x00002921 /* UDMA5 */ }; + static const u_int udma_timing_shasta[] = { 0x00035901, /* UDMA0 */ 0x000348b1, /* UDMA1 */ @@ -368,4 +371,3 @@ ata_kauai_begin_transaction(struct ata_r return ata_begin_transaction(request); } - Modified: stable/9/sys/powerpc/powermac/ata_macio.c ============================================================================== --- stable/9/sys/powerpc/powermac/ata_macio.c Sun Jun 9 08:28:23 2013 (r251566) +++ stable/9/sys/powerpc/powermac/ata_macio.c Sun Jun 9 12:39:21 2013 (r251567) @@ -23,10 +23,11 @@ * 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$ */ +#include +__FBSDID("$FreeBSD$"); + /* * Mac-io ATA controller */ @@ -85,7 +86,7 @@ struct ide_timings { int active; /* minimum command active time [ns] */ }; -struct ide_timings pio_timings[5] = { +static const struct ide_timings pio_timings[5] = { { 600, 180 }, /* PIO 0 */ { 390, 150 }, /* PIO 1 */ { 240, 105 }, /* PIO 2 */ @@ -122,7 +123,7 @@ static device_method_t ata_macio_methods /* ATA interface */ DEVMETHOD(ata_setmode, ata_macio_setmode), - { 0, 0 } + DEVMETHOD_END }; struct ata_macio_softc { @@ -143,7 +144,7 @@ static driver_t ata_macio_driver = { sizeof(struct ata_macio_softc), }; -DRIVER_MODULE(ata, macio, ata_macio_driver, ata_devclass, 0, 0); +DRIVER_MODULE(ata, macio, ata_macio_driver, ata_devclass, NULL, NULL); MODULE_DEPEND(ata, ata, 1, 1, 1); static int @@ -332,4 +333,3 @@ ata_macio_begin_transaction(struct ata_r return ata_begin_transaction(request); } - Modified: stable/9/sys/powerpc/psim/ata_iobus.c ============================================================================== --- stable/9/sys/powerpc/psim/ata_iobus.c Sun Jun 9 08:28:23 2013 (r251566) +++ stable/9/sys/powerpc/psim/ata_iobus.c Sun Jun 9 12:39:21 2013 (r251567) @@ -23,10 +23,11 @@ * 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$ */ +#include +__FBSDID("$FreeBSD$"); + /* * PSIM local bus ATA controller */ @@ -80,7 +81,7 @@ static device_method_t ata_iobus_methods DEVMETHOD(bus_setup_intr, bus_generic_setup_intr), DEVMETHOD(bus_teardown_intr, bus_generic_teardown_intr), - { 0, 0 } + DEVMETHOD_END }; static driver_t ata_iobus_driver = { @@ -91,7 +92,8 @@ static driver_t ata_iobus_driver = { static devclass_t ata_iobus_devclass; -DRIVER_MODULE(ataiobus, iobus, ata_iobus_driver, ata_iobus_devclass, 0, 0); +DRIVER_MODULE(ataiobus, iobus, ata_iobus_driver, ata_iobus_devclass, NULL, + NULL); MODULE_DEPEND(ata, ata, 1, 1, 1); static int @@ -221,7 +223,7 @@ static device_method_t ata_iobus_sub_met /* ATA interface */ DEVMETHOD(ata_setmode, ata_iobus_sub_setmode), - { 0, 0 } + DEVMETHOD_END }; static driver_t ata_iobus_sub_driver = { @@ -230,7 +232,7 @@ static driver_t ata_iobus_sub_driver = { sizeof(struct ata_channel), }; -DRIVER_MODULE(ata, ataiobus, ata_iobus_sub_driver, ata_devclass, 0, 0); +DRIVER_MODULE(ata, ataiobus, ata_iobus_sub_driver, ata_devclass, NULL, NULL); static int ata_iobus_sub_probe(device_t dev) From owner-svn-src-stable@FreeBSD.ORG Sun Jun 9 12:46:43 2013 Return-Path: Delivered-To: svn-src-stable@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by hub.freebsd.org (Postfix) with ESMTP id 219C8B0A; Sun, 9 Jun 2013 12:46:43 +0000 (UTC) (envelope-from marius@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) by mx1.freebsd.org (Postfix) with ESMTP id 10E6F1797; Sun, 9 Jun 2013 12:46:43 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.7/8.14.7) with ESMTP id r59Ckgg0007236; Sun, 9 Jun 2013 12:46:42 GMT (envelope-from marius@svn.freebsd.org) Received: (from marius@localhost) by svn.freebsd.org (8.14.7/8.14.5/Submit) id r59Ckgs8007232; Sun, 9 Jun 2013 12:46:42 GMT (envelope-from marius@svn.freebsd.org) Message-Id: <201306091246.r59Ckgs8007232@svn.freebsd.org> From: Marius Strobl Date: Sun, 9 Jun 2013 12:46:42 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-9@freebsd.org Subject: svn commit: r251568 - stable/9/sys/dev/aac X-SVN-Group: stable-9 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 09 Jun 2013 12:46:43 -0000 Author: marius Date: Sun Jun 9 12:46:41 2013 New Revision: 251568 URL: http://svnweb.freebsd.org/changeset/base/251568 Log: MFC: r251115 - Remove pointless returns. - Make cm_data a void pointer and cm_flags unsigned as appropriate. Modified: stable/9/sys/dev/aac/aac.c stable/9/sys/dev/aac/aac_cam.c stable/9/sys/dev/aac/aac_disk.c stable/9/sys/dev/aac/aacvar.h Directory Properties: stable/9/sys/ (props changed) stable/9/sys/dev/ (props changed) Modified: stable/9/sys/dev/aac/aac.c ============================================================================== --- stable/9/sys/dev/aac/aac.c Sun Jun 9 12:39:21 2013 (r251567) +++ stable/9/sys/dev/aac/aac.c Sun Jun 9 12:46:41 2013 (r251568) @@ -379,8 +379,6 @@ aac_add_event(struct aac_softc *sc, stru event->ev_type); break; } - - return; } /* @@ -1631,8 +1629,6 @@ aac_map_command_sg(void *arg, bus_dma_se aac_requeue_ready(cm); } } - - return; } /* @@ -2362,7 +2358,6 @@ aac_timeout(struct aac_softc *sc) "longer running! code= 0x%x\n", code); } } - return; } /* @@ -3372,8 +3367,6 @@ aac_handle_aif(struct aac_softc *sc, str /* Wakeup any poll()ers */ selwakeuppri(&sc->rcv_select, PRIBIO); mtx_unlock(&sc->aac_aifq_lock); - - return; } /* @@ -3788,6 +3781,4 @@ aac_get_bus_info(struct aac_softc *sc) if (found) bus_generic_attach(sc->aac_dev); - - return; } Modified: stable/9/sys/dev/aac/aac_cam.c ============================================================================== --- stable/9/sys/dev/aac/aac_cam.c Sun Jun 9 12:39:21 2013 (r251567) +++ stable/9/sys/dev/aac/aac_cam.c Sun Jun 9 12:46:41 2013 (r251568) @@ -163,8 +163,6 @@ aac_cam_event(struct aac_softc *sc, stru event->ev_type); break; } - - return; } static int @@ -513,8 +511,6 @@ aac_cam_action(struct cam_sim *sim, unio aac_enqueue_ready(cm); aac_startio(cm->cm_sc); - - return; } static void @@ -623,8 +619,6 @@ aac_cam_complete(struct aac_command *cm) aac_release_command(cm); xpt_done(ccb); - - return; } static u_int32_t Modified: stable/9/sys/dev/aac/aac_disk.c ============================================================================== --- stable/9/sys/dev/aac/aac_disk.c Sun Jun 9 12:39:21 2013 (r251567) +++ stable/9/sys/dev/aac/aac_disk.c Sun Jun 9 12:46:41 2013 (r251568) @@ -167,8 +167,6 @@ aac_disk_strategy(struct bio *bp) mtx_lock(&sc->ad_controller->aac_io_lock); aac_submit_bio(bp); mtx_unlock(&sc->ad_controller->aac_io_lock); - - return; } /* Modified: stable/9/sys/dev/aac/aacvar.h ============================================================================== --- stable/9/sys/dev/aac/aacvar.h Sun Jun 9 12:39:21 2013 (r251567) +++ stable/9/sys/dev/aac/aacvar.h Sun Jun 9 12:46:41 2013 (r251568) @@ -158,13 +158,13 @@ struct aac_command struct aac_fib *cm_fib; /* FIB associated with this * command */ u_int64_t cm_fibphys; /* bus address of the FIB */ - struct bio *cm_data; /* pointer to data in kernel + void *cm_data; /* pointer to data in kernel * space */ u_int32_t cm_datalen; /* data length */ bus_dmamap_t cm_datamap; /* DMA map for bio data */ struct aac_sg_table *cm_sgtable; /* pointer to s/g table in * command */ - int cm_flags; + u_int cm_flags; #define AAC_CMD_MAPPED (1<<0) /* command has had its data * mapped */ #define AAC_CMD_DATAIN (1<<1) /* command involves data moving @@ -182,7 +182,7 @@ struct aac_command #define AAC_QUEUE_FRZN (1<<9) /* Freeze the processing of * commands on the queue. */ - void (* cm_complete)(struct aac_command *cm); + void (*cm_complete)(struct aac_command *cm); void *cm_private; time_t cm_timestamp; /* command creation time */ int cm_queue; From owner-svn-src-stable@FreeBSD.ORG Sun Jun 9 12:51:43 2013 Return-Path: Delivered-To: svn-src-stable@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [8.8.178.115]) by hub.freebsd.org (Postfix) with ESMTP id E5FAFEAC; Sun, 9 Jun 2013 12:51:43 +0000 (UTC) (envelope-from marius@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) by mx1.freebsd.org (Postfix) with ESMTP id C9E30181B; Sun, 9 Jun 2013 12:51:43 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.7/8.14.7) with ESMTP id r59Cphc7009555; Sun, 9 Jun 2013 12:51:43 GMT (envelope-from marius@svn.freebsd.org) Received: (from marius@localhost) by svn.freebsd.org (8.14.7/8.14.5/Submit) id r59Cphp2009552; Sun, 9 Jun 2013 12:51:43 GMT (envelope-from marius@svn.freebsd.org) Message-Id: <201306091251.r59Cphp2009552@svn.freebsd.org> From: Marius Strobl Date: Sun, 9 Jun 2013 12:51:43 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-9@freebsd.org Subject: svn commit: r251569 - in stable/9/sys/dev: msk sk X-SVN-Group: stable-9 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 09 Jun 2013 12:51:44 -0000 Author: marius Date: Sun Jun 9 12:51:42 2013 New Revision: 251569 URL: http://svnweb.freebsd.org/changeset/base/251569 Log: MFC: r251133 - Merge from r249476: Ensure that PCI bus BUS_GET_DMA_TAG() method sees the actual PCI device which makes the request for DMA tag, instead of some descendant of the PCI device, by creating a pass-through trampoline. - Sprinkle const on tables. - Use NULL instead of 0 for pointers. - Take advantage of nitems(). Modified: stable/9/sys/dev/msk/if_msk.c stable/9/sys/dev/sk/if_sk.c stable/9/sys/dev/sk/if_skreg.h Directory Properties: stable/9/sys/ (props changed) stable/9/sys/dev/ (props changed) Modified: stable/9/sys/dev/msk/if_msk.c ============================================================================== --- stable/9/sys/dev/msk/if_msk.c Sun Jun 9 12:46:41 2013 (r251568) +++ stable/9/sys/dev/msk/if_msk.c Sun Jun 9 12:51:42 2013 (r251569) @@ -162,7 +162,7 @@ TUNABLE_INT("hw.msk.jumbo_disable", &jum /* * Devices supported by this driver. */ -static struct msk_product { +static const struct msk_product { uint16_t msk_vendorid; uint16_t msk_deviceid; const char *msk_name; @@ -257,6 +257,7 @@ static int mskc_shutdown(device_t); static int mskc_setup_rambuffer(struct msk_softc *); static int mskc_suspend(device_t); static int mskc_resume(device_t); +static bus_dma_tag_t mskc_get_dma_tag(device_t, device_t); static void mskc_reset(struct msk_softc *); static int msk_probe(device_t); @@ -334,6 +335,8 @@ static device_method_t mskc_methods[] = DEVMETHOD(device_resume, mskc_resume), DEVMETHOD(device_shutdown, mskc_shutdown), + DEVMETHOD(bus_get_dma_tag, mskc_get_dma_tag), + DEVMETHOD_END }; @@ -368,9 +371,9 @@ static driver_t msk_driver = { static devclass_t msk_devclass; -DRIVER_MODULE(mskc, pci, mskc_driver, mskc_devclass, 0, 0); -DRIVER_MODULE(msk, mskc, msk_driver, msk_devclass, 0, 0); -DRIVER_MODULE(miibus, msk, miibus_driver, miibus_devclass, 0, 0); +DRIVER_MODULE(mskc, pci, mskc_driver, mskc_devclass, NULL, NULL); +DRIVER_MODULE(msk, mskc, msk_driver, msk_devclass, NULL, NULL); +DRIVER_MODULE(miibus, msk, miibus_driver, miibus_devclass, NULL, NULL); static struct resource_spec msk_res_spec_io[] = { { SYS_RES_IOPORT, PCIR_BAR(1), RF_ACTIVE }, @@ -1180,15 +1183,14 @@ msk_ioctl(struct ifnet *ifp, u_long comm static int mskc_probe(device_t dev) { - struct msk_product *mp; + const struct msk_product *mp; uint16_t vendor, devid; int i; vendor = pci_get_vendor(dev); devid = pci_get_device(dev); mp = msk_products; - for (i = 0; i < sizeof(msk_products)/sizeof(msk_products[0]); - i++, mp++) { + for (i = 0; i < nitems(msk_products); i++, mp++) { if (vendor == mp->msk_vendorid && devid == mp->msk_deviceid) { device_set_desc(dev, mp->msk_name); return (BUS_PROBE_DEFAULT); @@ -2119,6 +2121,13 @@ mskc_detach(device_t dev) return (0); } +static bus_dma_tag_t +mskc_get_dma_tag(device_t bus, device_t child __unused) +{ + + return (bus_get_dma_tag(bus)); +} + struct msk_dmamap_arg { bus_addr_t msk_busaddr; }; Modified: stable/9/sys/dev/sk/if_sk.c ============================================================================== --- stable/9/sys/dev/sk/if_sk.c Sun Jun 9 12:46:41 2013 (r251568) +++ stable/9/sys/dev/sk/if_sk.c Sun Jun 9 12:51:42 2013 (r251569) @@ -143,7 +143,7 @@ static const char rcsid[] = "$FreeBSD$"; #endif -static struct sk_type sk_devs[] = { +static const struct sk_type sk_devs[] = { { VENDORID_SK, DEVICEID_SK_V1, @@ -193,6 +193,7 @@ static int skc_detach(device_t); static int skc_shutdown(device_t); static int skc_suspend(device_t); static int skc_resume(device_t); +static bus_dma_tag_t skc_get_dma_tag(device_t, device_t); static int sk_detach(device_t); static int sk_probe(device_t); static int sk_attach(device_t); @@ -296,6 +297,8 @@ static device_method_t skc_methods[] = { DEVMETHOD(device_resume, skc_resume), DEVMETHOD(device_shutdown, skc_shutdown), + DEVMETHOD(bus_get_dma_tag, skc_get_dma_tag), + DEVMETHOD_END }; @@ -330,9 +333,9 @@ static driver_t sk_driver = { static devclass_t sk_devclass; -DRIVER_MODULE(skc, pci, skc_driver, skc_devclass, 0, 0); -DRIVER_MODULE(sk, skc, sk_driver, sk_devclass, 0, 0); -DRIVER_MODULE(miibus, sk, miibus_driver, miibus_devclass, 0, 0); +DRIVER_MODULE(skc, pci, skc_driver, skc_devclass, NULL, NULL); +DRIVER_MODULE(sk, skc, sk_driver, sk_devclass, NULL, NULL); +DRIVER_MODULE(miibus, sk, miibus_driver, miibus_devclass, NULL, NULL); static struct resource_spec sk_res_spec_io[] = { { SYS_RES_IOPORT, PCIR_BAR(1), RF_ACTIVE }, @@ -1186,7 +1189,7 @@ static int skc_probe(dev) device_t dev; { - struct sk_type *t = sk_devs; + const struct sk_type *t = sk_devs; while(t->sk_name != NULL) { if ((pci_get_vendor(dev) == t->sk_vid) && @@ -1889,6 +1892,13 @@ skc_detach(dev) return(0); } +static bus_dma_tag_t +skc_get_dma_tag(device_t bus, device_t child __unused) +{ + + return (bus_get_dma_tag(bus)); +} + struct sk_dmamap_arg { bus_addr_t sk_busaddr; }; @@ -3186,7 +3196,7 @@ sk_init_xmac(sc_if) struct sk_softc *sc; struct ifnet *ifp; u_int16_t eaddr[(ETHER_ADDR_LEN+1)/2]; - struct sk_bcom_hack bhack[] = { + static const struct sk_bcom_hack bhack[] = { { 0x18, 0x0c20 }, { 0x17, 0x0012 }, { 0x15, 0x1104 }, { 0x17, 0x0013 }, { 0x15, 0x0404 }, { 0x17, 0x8006 }, { 0x15, 0x0132 }, { 0x17, 0x8006 }, { 0x15, 0x0232 }, { 0x17, 0x800D }, { 0x15, 0x000F }, { 0x18, 0x0420 }, Modified: stable/9/sys/dev/sk/if_skreg.h ============================================================================== --- stable/9/sys/dev/sk/if_skreg.h Sun Jun 9 12:46:41 2013 (r251568) +++ stable/9/sys/dev/sk/if_skreg.h Sun Jun 9 12:51:42 2013 (r251569) @@ -1289,7 +1289,7 @@ struct sk_type { u_int16_t sk_vid; u_int16_t sk_did; - char *sk_name; + const char *sk_name; }; #define SK_ADDR_LO(x) ((u_int64_t) (x) & 0xffffffff) From owner-svn-src-stable@FreeBSD.ORG Sun Jun 9 12:55:45 2013 Return-Path: Delivered-To: svn-src-stable@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [8.8.178.115]) by hub.freebsd.org (Postfix) with ESMTP id 8E767313; Sun, 9 Jun 2013 12:55:45 +0000 (UTC) (envelope-from marius@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) by mx1.freebsd.org (Postfix) with ESMTP id 7197F1876; Sun, 9 Jun 2013 12:55:45 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.7/8.14.7) with ESMTP id r59CtjkP010298; Sun, 9 Jun 2013 12:55:45 GMT (envelope-from marius@svn.freebsd.org) Received: (from marius@localhost) by svn.freebsd.org (8.14.7/8.14.5/Submit) id r59CtiWG010295; Sun, 9 Jun 2013 12:55:44 GMT (envelope-from marius@svn.freebsd.org) Message-Id: <201306091255.r59CtiWG010295@svn.freebsd.org> From: Marius Strobl Date: Sun, 9 Jun 2013 12:55:44 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-9@freebsd.org Subject: svn commit: r251570 - stable/9/sys/dev/bce X-SVN-Group: stable-9 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 09 Jun 2013 12:55:45 -0000 Author: marius Date: Sun Jun 9 12:55:44 2013 New Revision: 251570 URL: http://svnweb.freebsd.org/changeset/base/251570 Log: MFC: r251142 - As a follow-up to r247565 (MFC'ed to stable/9 in r248036), make firmware images that do not require patching at runtime actually const. - Remove pointless softc members by employing the corresponding constants directly. - Remove pointless returns. - Remove unnecessary inclusion of opt_device_polling.h. - Replace an outdated and now bogus comment in bce_tick() with the appropriate one. Modified: stable/9/sys/dev/bce/if_bce.c stable/9/sys/dev/bce/if_bcefw.h stable/9/sys/dev/bce/if_bcereg.h Directory Properties: stable/9/sys/ (props changed) stable/9/sys/dev/ (props changed) Modified: stable/9/sys/dev/bce/if_bce.c ============================================================================== --- stable/9/sys/dev/bce/if_bce.c Sun Jun 9 12:51:42 2013 (r251569) +++ stable/9/sys/dev/bce/if_bce.c Sun Jun 9 12:55:44 2013 (r251570) @@ -375,7 +375,8 @@ static void bce_release_resources (struc /****************************************************************************/ static void bce_fw_cap_init (struct bce_softc *); static int bce_fw_sync (struct bce_softc *, u32); -static void bce_load_rv2p_fw (struct bce_softc *, u32 *, u32, u32); +static void bce_load_rv2p_fw (struct bce_softc *, const u32 *, u32, + u32); static void bce_load_cpu_fw (struct bce_softc *, struct cpu_reg *, struct fw_info *); static void bce_start_cpu (struct bce_softc *, struct cpu_reg *); @@ -1019,7 +1020,6 @@ bce_set_tunables(struct bce_softc *sc) sc->bce_tx_ticks = DEFAULT_TX_TICKS; sc->bce_tx_quick_cons_trip = DEFAULT_TX_QUICK_CONS_TRIP; } - } @@ -1332,23 +1332,6 @@ bce_attach(device_t dev) /* Fetch the permanent Ethernet MAC address. */ bce_get_mac_addr(sc); - /* - * Trip points control how many BDs - * should be ready before generating an - * interrupt while ticks control how long - * a BD can sit in the chain before - * generating an interrupt. Set the default - * values for the RX and TX chains. - */ - - /* Not used for L2. */ - sc->bce_comp_prod_trip_int = 0; - sc->bce_comp_prod_trip = 0; - sc->bce_com_ticks_int = 0; - sc->bce_com_ticks = 0; - sc->bce_cmd_ticks_int = 0; - sc->bce_cmd_ticks = 0; - /* Update statistics once every second. */ sc->bce_stats_ticks = 1000000 & 0xffff00; @@ -1935,7 +1918,6 @@ bce_miibus_read_reg(device_t dev, int ph DB_PRINT_PHY_REG(reg, val); return (val & 0xffff); - } @@ -3037,7 +3019,6 @@ bce_get_rx_buffer_sizes(struct bce_softc roundup2((MSIZE - MHLEN), 16) - (MSIZE - MHLEN); sc->rx_bd_mbuf_data_len = sc->rx_bd_mbuf_alloc_size - sc->rx_bd_mbuf_align_pad; - sc->pg_bd_mbuf_alloc_size = MCLBYTES; } else { if ((mtu + ETHER_HDR_LEN + ETHER_VLAN_ENCAP_LEN + ETHER_CRC_LEN) > MCLBYTES) { @@ -3067,7 +3048,6 @@ bce_get_rx_buffer_sizes(struct bce_softc sc->rx_bd_mbuf_align_pad); DBEXIT(BCE_VERBOSE_LOAD); - } /****************************************************************************/ @@ -3484,8 +3464,6 @@ bce_dma_map_addr(void *arg, bus_dma_segm } else { *busaddr = segs->ds_addr; } - - return; } @@ -3793,21 +3771,17 @@ bce_dma_alloc(device_t dev) * Create a DMA tag for RX mbufs. */ if (bce_hdr_split == TRUE) - max_size = max_seg_size = ((sc->rx_bd_mbuf_alloc_size < MCLBYTES) ? + max_size = ((sc->rx_bd_mbuf_alloc_size < MCLBYTES) ? MCLBYTES : sc->rx_bd_mbuf_alloc_size); else - max_size = max_seg_size = MJUM9BYTES; - max_segments = 1; + max_size = MJUM9BYTES; DBPRINT(sc, BCE_INFO_LOAD, "%s(): Creating rx_mbuf_tag " - "(max size = 0x%jX max segments = %d, max segment " - "size = 0x%jX)\n", __FUNCTION__, (uintmax_t) max_size, - max_segments, (uintmax_t) max_seg_size); + "(max size = 0x%jX)\n", __FUNCTION__, (uintmax_t)max_size); if (bus_dma_tag_create(sc->parent_tag, BCE_RX_BUF_ALIGN, BCE_DMA_BOUNDARY, sc->max_bus_addr, BUS_SPACE_MAXADDR, NULL, NULL, - max_size, max_segments, max_seg_size, 0, NULL, NULL, - &sc->rx_mbuf_tag)) { + max_size, 1, max_size, 0, NULL, NULL, &sc->rx_mbuf_tag)) { BCE_PRINTF("%s(%d): Could not allocate RX mbuf DMA tag!\n", __FILE__, __LINE__); rc = ENOMEM; @@ -3873,12 +3847,9 @@ bce_dma_alloc(device_t dev) /* * Create a DMA tag for page mbufs. */ - max_size = max_seg_size = ((sc->pg_bd_mbuf_alloc_size < MCLBYTES) ? - MCLBYTES : sc->pg_bd_mbuf_alloc_size); - if (bus_dma_tag_create(sc->parent_tag, 1, BCE_DMA_BOUNDARY, - sc->max_bus_addr, BUS_SPACE_MAXADDR, NULL, NULL, - max_size, 1, max_seg_size, 0, NULL, NULL, &sc->pg_mbuf_tag)) { + sc->max_bus_addr, BUS_SPACE_MAXADDR, NULL, NULL, MCLBYTES, + 1, MCLBYTES, 0, NULL, NULL, &sc->pg_mbuf_tag)) { BCE_PRINTF("%s(%d): Could not allocate page mbuf " "DMA tag!\n", __FILE__, __LINE__); rc = ENOMEM; @@ -4028,7 +3999,7 @@ bce_fw_sync_exit: /* Nothing. */ /****************************************************************************/ static void -bce_load_rv2p_fw(struct bce_softc *sc, u32 *rv2p_code, +bce_load_rv2p_fw(struct bce_softc *sc, const u32 *rv2p_code, u32 rv2p_code_len, u32 rv2p_proc) { int i; @@ -5244,24 +5215,28 @@ bce_blockinit(struct bce_softc *sc) REG_WR(sc, BCE_HC_STATISTICS_ADDR_H, BCE_ADDR_HI(sc->stats_block_paddr)); - /* Program various host coalescing parameters. */ + /* + * Program various host coalescing parameters. + * Trip points control how many BDs should be ready before generating + * an interrupt while ticks control how long a BD can sit in the chain + * before generating an interrupt. + */ REG_WR(sc, BCE_HC_TX_QUICK_CONS_TRIP, - (sc->bce_tx_quick_cons_trip_int << 16) | sc->bce_tx_quick_cons_trip); + (sc->bce_tx_quick_cons_trip_int << 16) | + sc->bce_tx_quick_cons_trip); REG_WR(sc, BCE_HC_RX_QUICK_CONS_TRIP, - (sc->bce_rx_quick_cons_trip_int << 16) | sc->bce_rx_quick_cons_trip); - REG_WR(sc, BCE_HC_COMP_PROD_TRIP, - (sc->bce_comp_prod_trip_int << 16) | sc->bce_comp_prod_trip); + (sc->bce_rx_quick_cons_trip_int << 16) | + sc->bce_rx_quick_cons_trip); REG_WR(sc, BCE_HC_TX_TICKS, (sc->bce_tx_ticks_int << 16) | sc->bce_tx_ticks); REG_WR(sc, BCE_HC_RX_TICKS, (sc->bce_rx_ticks_int << 16) | sc->bce_rx_ticks); - REG_WR(sc, BCE_HC_COM_TICKS, - (sc->bce_com_ticks_int << 16) | sc->bce_com_ticks); - REG_WR(sc, BCE_HC_CMD_TICKS, - (sc->bce_cmd_ticks_int << 16) | sc->bce_cmd_ticks); - REG_WR(sc, BCE_HC_STATS_TICKS, - (sc->bce_stats_ticks & 0xffff00)); + REG_WR(sc, BCE_HC_STATS_TICKS, sc->bce_stats_ticks & 0xffff00); REG_WR(sc, BCE_HC_STAT_COLLECT_TICKS, 0xbb8); /* 3ms */ + /* Not used for L2. */ + REG_WR(sc, BCE_HC_COMP_PROD_TRIP, 0); + REG_WR(sc, BCE_HC_COM_TICKS, 0); + REG_WR(sc, BCE_HC_CMD_TICKS, 0); /* Configure the Host Coalescing block. */ val = BCE_HC_CONFIG_RX_TMR_MODE | BCE_HC_CONFIG_TX_TMR_MODE | @@ -5554,15 +5529,14 @@ bce_get_pg_buf(struct bce_softc *sc, str m_new->m_data = m_new->m_ext.ext_buf; } - m_new->m_len = sc->pg_bd_mbuf_alloc_size; + m_new->m_len = MCLBYTES; /* ToDo: Consider calling m_fragment() to test error handling. */ /* Map the mbuf cluster into device memory. */ map = sc->pg_mbuf_map[*prod_idx]; error = bus_dmamap_load(sc->pg_mbuf_tag, map, mtod(m_new, void *), - sc->pg_bd_mbuf_alloc_size, bce_dma_map_addr, - &busaddr, BUS_DMA_NOWAIT); + MCLBYTES, bce_dma_map_addr, &busaddr, BUS_DMA_NOWAIT); /* Handle any mapping errors. */ if (error) { @@ -5586,7 +5560,7 @@ bce_get_pg_buf(struct bce_softc *sc, str pgbd->rx_bd_haddr_lo = htole32(BCE_ADDR_LO(busaddr)); pgbd->rx_bd_haddr_hi = htole32(BCE_ADDR_HI(busaddr)); - pgbd->rx_bd_len = htole32(sc->pg_bd_mbuf_alloc_size); + pgbd->rx_bd_len = htole32(MCLBYTES); pgbd->rx_bd_flags = htole32(RX_BD_FLAGS_START | RX_BD_FLAGS_END); /* Save the mbuf and update our counter. */ @@ -5974,10 +5948,9 @@ bce_free_rx_chain(struct bce_softc *sc) /* Clear each RX chain page. */ for (i = 0; i < sc->rx_pages; i++) - if (sc->rx_bd_chain[i] != NULL) { + if (sc->rx_bd_chain[i] != NULL) bzero((char *)sc->rx_bd_chain[i], BCE_RX_CHAIN_PAGE_SZ); - } sc->free_rx_bd = sc->max_rx_bd; @@ -6041,7 +6014,7 @@ bce_init_pg_chain(struct bce_softc *sc) CTX_WR(sc, GET_CID_ADDR(RX_CID), BCE_L2CTX_RX_PG_BUF_SIZE, 0); /* Configure the rx_bd and page chain mbuf cluster size. */ - val = (sc->rx_bd_mbuf_data_len << 16) | sc->pg_bd_mbuf_alloc_size; + val = (sc->rx_bd_mbuf_data_len << 16) | MCLBYTES; CTX_WR(sc, GET_CID_ADDR(RX_CID), BCE_L2CTX_RX_PG_BUF_SIZE, val); /* Configure the context reserved for jumbo support. */ @@ -7163,10 +7136,9 @@ bce_init_locked(struct bce_softc *sc) ether_mtu = ifp->if_mtu; else { if (bce_hdr_split == TRUE) { - if (ifp->if_mtu <= (sc->rx_bd_mbuf_data_len + - sc->pg_bd_mbuf_alloc_size)) - ether_mtu = sc->rx_bd_mbuf_data_len + - sc->pg_bd_mbuf_alloc_size; + if (ifp->if_mtu <= sc->rx_bd_mbuf_data_len + MCLBYTES) + ether_mtu = sc->rx_bd_mbuf_data_len + + MCLBYTES; else ether_mtu = ifp->if_mtu; } else { @@ -7194,9 +7166,6 @@ bce_init_locked(struct bce_softc *sc) bce_set_rx_mode(sc); if (bce_hdr_split == TRUE) { - DBPRINT(sc, BCE_INFO_LOAD, "%s(): pg_bd_mbuf_alloc_size = %d\n", - __FUNCTION__, sc->pg_bd_mbuf_alloc_size); - /* Init page buffer descriptor chain. */ bce_init_pg_chain(sc); } @@ -7690,7 +7659,6 @@ bce_start_locked(struct ifnet *ifp) bce_start_locked_exit: DBEXIT(BCE_VERBOSE_SEND | BCE_VERBOSE_CTX); - return; } @@ -8491,11 +8459,7 @@ bce_tick(void *xsc) /* Update the statistics from the hardware statistics block. */ bce_stats_update(sc); - /* - * ToDo: This is a safety measure. Need to re-evaluate - * high level processing logic and eliminate this code. - */ - /* Top off the receive and page chains. */ + /* Ensure page and RX chains get refilled in low-memory situations. */ if (bce_hdr_split == TRUE) bce_fill_pg_chain(sc); bce_fill_rx_chain(sc); @@ -8544,7 +8508,6 @@ bce_tick(void *xsc) bce_tick_exit: DBEXIT(BCE_EXTREME_MISC); - return; } static void @@ -11627,7 +11590,5 @@ bce_breakpoint(struct bce_softc *sc) /* Call the debugger. */ breakpoint(); - - return; } #endif Modified: stable/9/sys/dev/bce/if_bcefw.h ============================================================================== --- stable/9/sys/dev/bce/if_bcefw.h Sun Jun 9 12:51:42 2013 (r251569) +++ stable/9/sys/dev/bce/if_bcefw.h Sun Jun 9 12:55:44 2013 (r251570) @@ -57,7 +57,7 @@ u32 bce_COM_b06FwSbssAddr = 0x08004aa0; int bce_COM_b06FwSbssLen = 0x38; u32 bce_COM_b06FwSDataAddr = 0x00000000; int bce_COM_b06FwSDataLen = 0x0; -u32 bce_COM_b06FwText[(0x4a68/4) + 1] = { +const u32 bce_COM_b06FwText[(0x4a68/4) + 1] = { 0xa000046, 0x0, 0x0, 0xd, 0x636f6d36, 0x2e302e31, 0x35000000, 0x6000f02, 0x0, 0x3, 0xc8, @@ -1249,14 +1249,14 @@ u32 bce_COM_b06FwText[(0x4a68/4) + 1] = 0x440fffe, 0x24020002, 0xaf5101c0, 0xa34201c4, 0x3c021000, 0xaf4201f8, 0x8fbf0018, 0x8fb10014, 0x8fb00010, 0x3e00008, 0x27bd0020, 0x0 }; -u32 bce_COM_b06FwData[(0x0/4) + 1] = { 0x0 }; -u32 bce_COM_b06FwRodata[(0x14/4) + 1] = { +const u32 bce_COM_b06FwData[(0x0/4) + 1] = { 0x0 }; +const u32 bce_COM_b06FwRodata[(0x14/4) + 1] = { 0x8000acc, 0x8000b14, 0x8000b98, 0x8000be4, 0x8000c20, 0x0 }; -u32 bce_COM_b06FwBss[(0xc4/4) + 1] = { 0x0 }; -u32 bce_COM_b06FwSbss[(0x38/4) + 1] = { 0x0 }; -u32 bce_COM_b06FwSdata[(0x0/4) + 1] = { 0x0 }; +const u32 bce_COM_b06FwBss[(0xc4/4) + 1] = { 0x0 }; +const u32 bce_COM_b06FwSbss[(0x38/4) + 1] = { 0x0 }; +const u32 bce_COM_b06FwSdata[(0x0/4) + 1] = { 0x0 }; int bce_RXP_b06FwReleaseMajor = 0x6; @@ -1275,7 +1275,7 @@ u32 bce_RXP_b06FwSbssAddr = 0x08007320; int bce_RXP_b06FwSbssLen = 0x4c; u32 bce_RXP_b06FwSDataAddr = 0x00000000; int bce_RXP_b06FwSDataLen = 0x0; -u32 bce_RXP_b06FwText[(0x72d0/4) + 1] = { +const u32 bce_RXP_b06FwText[(0x72d0/4) + 1] = { 0xa000c84, 0x0, 0x0, 0xd, 0x72787036, 0x2e302e31, 0x35000000, 0x6000f03, 0x0, 0x1, 0x0, @@ -3114,15 +3114,15 @@ u32 bce_RXP_b06FwText[(0x72d0/4) + 1] = 0x8fbf0020, 0x8fb3001c, 0x8fb20018, 0x8fb10014, 0x8fb00010, 0x3c021000, 0x27bd0028, 0x3e00008, 0xaf4201b8, 0x0 }; -u32 bce_RXP_b06FwData[(0x0/4) + 1] = { 0x0 }; -u32 bce_RXP_b06FwRodata[(0x24/4) + 1] = { +const u32 bce_RXP_b06FwData[(0x0/4) + 1] = { 0x0 }; +const u32 bce_RXP_b06FwRodata[(0x24/4) + 1] = { 0x8003430, 0x8003430, 0x80033a8, 0x80033e0, 0x8003414, 0x8003438, 0x8003438, 0x8003438, 0x8003318, 0x0 }; -u32 bce_RXP_b06FwBss[(0x440/4) + 1] = { 0x0 }; -u32 bce_RXP_b06FwSbss[(0x4c/4) + 1] = { 0x0 }; -u32 bce_RXP_b06FwSdata[(0x0/4) + 1] = { 0x0 }; +const u32 bce_RXP_b06FwBss[(0x440/4) + 1] = { 0x0 }; +const u32 bce_RXP_b06FwSbss[(0x4c/4) + 1] = { 0x0 }; +const u32 bce_RXP_b06FwSdata[(0x0/4) + 1] = { 0x0 }; int bce_TPAT_b06FwReleaseMajor = 0x6; @@ -3141,7 +3141,7 @@ u32 bce_TPAT_b06FwSbssAddr = 0x08001c00; int bce_TPAT_b06FwSbssLen = 0x44; u32 bce_TPAT_b06FwSDataAddr = 0x00000000; int bce_TPAT_b06FwSDataLen = 0x0; -u32 bce_TPAT_b06FwText[(0x17d4/4) + 1] = { +const u32 bce_TPAT_b06FwText[(0x17d4/4) + 1] = { 0xa000124, 0x0, 0x0, 0xd, 0x74706136, 0x2e302e31, 0x35000000, 0x6000f01, 0x0, 0x0, 0x0, @@ -3524,11 +3524,11 @@ u32 bce_TPAT_b06FwText[(0x17d4/4) + 1] = 0x14a0fffb, 0x42042, 0xc35021, 0x8fbf0010, 0xa4c02, 0x312200ff, 0x27bd0018, 0xaf8a002c, 0x3e00008, 0xaf890030, 0x0 }; -u32 bce_TPAT_b06FwData[(0x0/4) + 1] = { 0x0 }; -u32 bce_TPAT_b06FwRodata[(0x0/4) + 1] = { 0x0 }; -u32 bce_TPAT_b06FwBss[(0x450/4) + 1] = { 0x0 }; -u32 bce_TPAT_b06FwSbss[(0x44/4) + 1] = { 0x0 }; -u32 bce_TPAT_b06FwSdata[(0x0/4) + 1] = { 0x0 }; +const u32 bce_TPAT_b06FwData[(0x0/4) + 1] = { 0x0 }; +const u32 bce_TPAT_b06FwRodata[(0x0/4) + 1] = { 0x0 }; +const u32 bce_TPAT_b06FwBss[(0x450/4) + 1] = { 0x0 }; +const u32 bce_TPAT_b06FwSbss[(0x44/4) + 1] = { 0x0 }; +const u32 bce_TPAT_b06FwSdata[(0x0/4) + 1] = { 0x0 }; int bce_TXP_b06FwReleaseMajor = 0x6; @@ -3547,7 +3547,7 @@ u32 bce_TXP_b06FwSbssAddr = 0x08003c20; int bce_TXP_b06FwSbssLen = 0x68; u32 bce_TXP_b06FwSDataAddr = 0x00000000; int bce_TXP_b06FwSDataLen = 0x0; -u32 bce_TXP_b06FwText[(0x3bfc/4) + 1] = { +const u32 bce_TXP_b06FwText[(0x3bfc/4) + 1] = { 0xa00002a, 0x0, 0x0, 0xd, 0x74787036, 0x2e302e31, 0x35000000, 0x6000f00, 0x0, 0x136, 0xea60, @@ -4509,11 +4509,11 @@ u32 bce_TXP_b06FwText[(0x3bfc/4) + 1] = 0x3c010800, 0xac243d58, 0x3c010800, 0xac233d68, 0x3c010800, 0xac223d60, 0x3e00008, 0x0, 0x0 }; -u32 bce_TXP_b06FwData[(0x0/4) + 1] = { 0x0 }; -u32 bce_TXP_b06FwRodata[(0x0/4) + 1] = { 0x0 }; -u32 bce_TXP_b06FwBss[(0x14c/4) + 1] = { 0x0 }; -u32 bce_TXP_b06FwSbss[(0x68/4) + 1] = { 0x0 }; -u32 bce_TXP_b06FwSdata[(0x0/4) + 1] = { 0x0 }; +const u32 bce_TXP_b06FwData[(0x0/4) + 1] = { 0x0 }; +const u32 bce_TXP_b06FwRodata[(0x0/4) + 1] = { 0x0 }; +const u32 bce_TXP_b06FwBss[(0x14c/4) + 1] = { 0x0 }; +const u32 bce_TXP_b06FwSbss[(0x68/4) + 1] = { 0x0 }; +const u32 bce_TXP_b06FwSdata[(0x0/4) + 1] = { 0x0 }; int bce_CP_b06FwReleaseMajor = 0x6; @@ -4532,7 +4532,7 @@ u32 bce_CP_b06FwSbssAddr = 0x08005884; int bce_CP_b06FwSbssLen = 0xf1; u32 bce_CP_b06FwSDataAddr = 0x00000000; int bce_CP_b06FwSDataLen = 0x0; -u32 bce_CP_b06FwText[(0x5688/4) + 1] = { +const u32 bce_CP_b06FwText[(0x5688/4) + 1] = { 0xa000028, 0x0, 0x0, 0xd, 0x6370362e, 0x302e3135, 0x0, 0x6000f04, 0x0, 0x0, 0x0, @@ -5918,7 +5918,7 @@ u32 bce_CP_b06FwText[(0x5688/4) + 1] = { 0x27bd0030, 0x8f83001c, 0x8c620004, 0x10400003, 0x0, 0x3e00008, 0x0, 0x8c640010, 0x8c650008, 0xa001527, 0x8c66000c, 0x0 }; -u32 bce_CP_b06FwData[(0x84/4) + 1] = { +const u32 bce_CP_b06FwData[(0x84/4) + 1] = { 0x0, 0x1b, 0xf, 0xa, 0x8, 0x6, 0x5, 0x5, 0x4, 0x4, 0x3, @@ -5928,7 +5928,7 @@ u32 bce_CP_b06FwData[(0x84/4) + 1] = { 0x2, 0x2, 0x2, 0x2, 0x2, 0x2, 0x2, 0x1, 0x1, 0x1, 0x0 }; -u32 bce_CP_b06FwRodata[(0x158/4) + 1] = { +const u32 bce_CP_b06FwRodata[(0x158/4) + 1] = { 0x8000f24, 0x8000d6c, 0x8000fb8, 0x8001060, 0x8000f4c, 0x8000f8c, 0x8001194, 0x8000d88, 0x80011b8, 0x8000dd8, 0x8001554, @@ -5951,12 +5951,12 @@ u32 bce_CP_b06FwRodata[(0x158/4) + 1] = 0x8002e1c, 0x8002de4, 0x8002df0, 0x8002dfc, 0x8002e08, 0x80052e8, 0x80052a8, 0x8005274, 0x8005248, 0x8005224, 0x80051e0, 0x0 }; -u32 bce_CP_b06FwBss[(0x5d8/4) + 1] = { 0x0 }; -u32 bce_CP_b06FwSbss[(0xf1/4) + 1] = { 0x0 }; -u32 bce_CP_b06FwSdata[(0x0/4) + 1] = { 0x0 }; +const u32 bce_CP_b06FwBss[(0x5d8/4) + 1] = { 0x0 }; +const u32 bce_CP_b06FwSbss[(0xf1/4) + 1] = { 0x0 }; +const u32 bce_CP_b06FwSdata[(0x0/4) + 1] = { 0x0 }; -u32 bce_rv2p_proc1[] = { +const u32 bce_rv2p_proc1[] = { 0x00000010, 0xb1800006, 0x0000001f, 0x0106000f, 0x00000008, 0x0500ffff, @@ -6681,7 +6681,7 @@ u32 bce_TXP_b09FwSbssAddr = 0x08003d88; int bce_TXP_b09FwSbssLen = 0x64; u32 bce_TXP_b09FwSDataAddr = 0x00000000; int bce_TXP_b09FwSDataLen = 0x0; -u32 bce_TXP_b09FwText[(0x3d28/4) + 1] = { +const u32 bce_TXP_b09FwText[(0x3d28/4) + 1] = { 0xa00002a, 0x0, 0x0, 0xd, 0x74787036, 0x2e302e31, 0x37000000, 0x6001100, 0x0, 0x136, 0xea60, @@ -7661,15 +7661,15 @@ u32 bce_TXP_b09FwText[(0x3d28/4) + 1] = 0xac263fcc, 0x3c010800, 0xac253fc4, 0x3c010800, 0xac243fc0, 0x3c010800, 0xac233fd0, 0x3c010800, 0xac223fc8, 0x3e00008, 0x0, 0x0 }; -u32 bce_TXP_b09FwData[(0x0/4) + 1] = { 0x0 }; -u32 bce_TXP_b09FwRodata[(0x30/4) + 1] = { +const u32 bce_TXP_b09FwData[(0x0/4) + 1] = { 0x0 }; +const u32 bce_TXP_b09FwRodata[(0x30/4) + 1] = { 0x80000940, 0x80000900, 0x80080100, 0x80080080, 0x80080000, 0x800e0000, 0x80080080, 0x80080000, 0x80000a80, 0x80000a00, 0x80000980, 0x80000900, 0x0 }; -u32 bce_TXP_b09FwBss[(0x24c/4) + 1] = { 0x0 }; -u32 bce_TXP_b09FwSbss[(0x64/4) + 1] = { 0x0 }; -u32 bce_TXP_b09FwSdata[(0x0/4) + 1] = { 0x0 }; +const u32 bce_TXP_b09FwBss[(0x24c/4) + 1] = { 0x0 }; +const u32 bce_TXP_b09FwSbss[(0x64/4) + 1] = { 0x0 }; +const u32 bce_TXP_b09FwSdata[(0x0/4) + 1] = { 0x0 }; int bce_TPAT_b09FwReleaseMajor = 0x6; @@ -7688,7 +7688,7 @@ u32 bce_TPAT_b09FwSbssAddr = 0x08001720; int bce_TPAT_b09FwSbssLen = 0x3c; u32 bce_TPAT_b09FwSDataAddr = 0x00000000; int bce_TPAT_b09FwSDataLen = 0x0; -u32 bce_TPAT_b09FwText[(0x12fc/4) + 1] = { +const u32 bce_TPAT_b09FwText[(0x12fc/4) + 1] = { 0xa000124, 0x0, 0x0, 0xd, 0x74706136, 0x2e302e31, 0x37000000, 0x6001101, 0x0, 0x0, 0x0, @@ -7994,12 +7994,12 @@ u32 bce_TPAT_b09FwText[(0x12fc/4) + 1] = 0x0, 0x0, 0x2402ffff, 0x2463ffff, 0x1462fffa, 0x24840004, 0x3e00008, 0x0, 0x0 }; -u32 bce_TPAT_b09FwData[(0x0/4) + 1] = { 0x0 }; -u32 bce_TPAT_b09FwRodata[(0x4/4) + 1] = { +const u32 bce_TPAT_b09FwData[(0x0/4) + 1] = { 0x0 }; +const u32 bce_TPAT_b09FwRodata[(0x4/4) + 1] = { 0x1, 0x0 }; -u32 bce_TPAT_b09FwBss[(0x12b4/4) + 1] = { 0x0 }; -u32 bce_TPAT_b09FwSbss[(0x3c/4) + 1] = { 0x0 }; -u32 bce_TPAT_b09FwSdata[(0x0/4) + 1] = { 0x0 }; +const u32 bce_TPAT_b09FwBss[(0x12b4/4) + 1] = { 0x0 }; +const u32 bce_TPAT_b09FwSbss[(0x3c/4) + 1] = { 0x0 }; +const u32 bce_TPAT_b09FwSdata[(0x0/4) + 1] = { 0x0 }; int bce_COM_b09FwReleaseMajor = 0x6; @@ -8018,7 +8018,7 @@ u32 bce_COM_b09FwSbssAddr = 0x08005608; int bce_COM_b09FwSbssLen = 0x30; u32 bce_COM_b09FwSDataAddr = 0x00000000; int bce_COM_b09FwSDataLen = 0x0; -u32 bce_COM_b09FwText[(0x5594/4) + 1] = { +const u32 bce_COM_b09FwText[(0x5594/4) + 1] = { 0xa000046, 0x0, 0x0, 0xd, 0x636f6d36, 0x2e302e31, 0x37000000, 0x6001102, 0x0, 0x3, 0xc8, @@ -9389,15 +9389,15 @@ u32 bce_COM_b09FwText[(0x5594/4) + 1] = 0x40f809, 0x0, 0xa001560, 0x0, 0xd, 0x3c1c0800, 0x279c5608, 0x8fbf0010, 0x3e00008, 0x27bd0018, 0x0 }; -u32 bce_COM_b09FwData[(0x0/4) + 1] = { 0x0 }; -u32 bce_COM_b09FwRodata[(0x38/4) + 1] = { +const u32 bce_COM_b09FwData[(0x0/4) + 1] = { 0x0 }; +const u32 bce_COM_b09FwRodata[(0x38/4) + 1] = { 0x80080240, 0x80080100, 0x80080080, 0x80080000, 0xc80, 0x3200, 0x8000e98, 0x8000ef4, 0x8000f88, 0x8001028, 0x8001074, 0x80080100, 0x80080080, 0x80080000, 0x0 }; -u32 bce_COM_b09FwBss[(0x11c/4) + 1] = { 0x0 }; -u32 bce_COM_b09FwSbss[(0x30/4) + 1] = { 0x0 }; -u32 bce_COM_b09FwSdata[(0x0/4) + 1] = { 0x0 }; +const u32 bce_COM_b09FwBss[(0x11c/4) + 1] = { 0x0 }; +const u32 bce_COM_b09FwSbss[(0x30/4) + 1] = { 0x0 }; +const u32 bce_COM_b09FwSdata[(0x0/4) + 1] = { 0x0 }; int bce_RXP_b09FwReleaseMajor = 0x6; @@ -9416,7 +9416,7 @@ u32 bce_RXP_b09FwSbssAddr = 0x08009400; int bce_RXP_b09FwSbssLen = 0x78; u32 bce_RXP_b09FwSDataAddr = 0x00000000; int bce_RXP_b09FwSDataLen = 0x0; -u32 bce_RXP_b09FwText[(0x9090/4) + 1] = { +const u32 bce_RXP_b09FwText[(0x9090/4) + 1] = { 0xa000c84, 0x0, 0x0, 0xd, 0x72787036, 0x2e302e31, 0x37000000, 0x6001103, 0x0, 0x1, 0x0, @@ -11786,9 +11786,9 @@ u32 bce_RXP_b09FwRodata[(0x33c/4) + 1] = 0x8007fc0, 0x8007fc0, 0x8007fc0, 0x8007fc0, 0x8007fe8, 0x8008b6c, 0x8008cc8, 0x8008ca8, 0x8008710, 0x8008b84, 0x0 }; -u32 bce_RXP_b09FwBss[(0x1bc/4) + 1] = { 0x0 }; -u32 bce_RXP_b09FwSbss[(0x78/4) + 1] = { 0x0 }; -u32 bce_RXP_b09FwSdata[(0x0/4) + 1] = { 0x0 }; +const u32 bce_RXP_b09FwBss[(0x1bc/4) + 1] = { 0x0 }; +const u32 bce_RXP_b09FwSbss[(0x78/4) + 1] = { 0x0 }; +const u32 bce_RXP_b09FwSdata[(0x0/4) + 1] = { 0x0 }; int bce_CP_b09FwReleaseMajor = 0x6; @@ -11807,7 +11807,7 @@ u32 bce_CP_b09FwSbssAddr = 0x080059b0; int bce_CP_b09FwSbssLen = 0xa8; u32 bce_CP_b09FwSDataAddr = 0x00000000; int bce_CP_b09FwSDataLen = 0x0; -u32 bce_CP_b09FwText[(0x5744/4) + 1] = { +const u32 bce_CP_b09FwText[(0x5744/4) + 1] = { 0xa000028, 0x0, 0x0, 0xd, 0x6370362e, 0x302e3137, 0x0, 0x6001104, 0x0, 0x0, 0x0, @@ -13205,7 +13205,7 @@ u32 bce_CP_b09FwText[(0x5744/4) + 1] = { 0xa00156a, 0x8fbf001c, 0xe0010d1, 0x0, 0x5040ff9e, 0x8fbf001c, 0x9259007d, 0x3330003f, 0xa0015c6, 0x36020040, 0x0 }; -u32 bce_CP_b09FwData[(0x84/4) + 1] = { +const u32 bce_CP_b09FwData[(0x84/4) + 1] = { 0x0, 0x1b, 0xf, 0xa, 0x8, 0x6, 0x5, 0x5, 0x4, 0x4, 0x3, @@ -13215,7 +13215,7 @@ u32 bce_CP_b09FwData[(0x84/4) + 1] = { 0x2, 0x2, 0x2, 0x2, 0x2, 0x2, 0x2, 0x1, 0x1, 0x1, 0x0 }; -u32 bce_CP_b09FwRodata[(0x1c0/4) + 1] = { +const u32 bce_CP_b09FwRodata[(0x1c0/4) + 1] = { 0x80080100, 0x80080080, 0x80080000, 0xc00, 0x3080, 0x80011d0, 0x800127c, 0x8001294, 0x80012a8, @@ -13245,12 +13245,12 @@ u32 bce_CP_b09FwRodata[(0x1c0/4) + 1] = 0x80080080, 0x80080000, 0x80080080, 0x8004c64, 0x8004c9c, 0x8004be4, 0x8004c64, 0x8004c64, 0x80049b8, 0x8004c64, 0x8005050, 0x0 }; -u32 bce_CP_b09FwBss[(0x19c/4) + 1] = { 0x0 }; -u32 bce_CP_b09FwSbss[(0xa8/4) + 1] = { 0x0 }; -u32 bce_CP_b09FwSdata[(0x0/4) + 1] = { 0x0 }; +const u32 bce_CP_b09FwBss[(0x19c/4) + 1] = { 0x0 }; +const u32 bce_CP_b09FwSbss[(0xa8/4) + 1] = { 0x0 }; +const u32 bce_CP_b09FwSdata[(0x0/4) + 1] = { 0x0 }; -u32 bce_xi_rv2p_proc1[] = { +const u32 bce_xi_rv2p_proc1[] = { 0x00000010, 0xb1800006, 0x0000001f, 0x05060011, 0x00000008, 0x0500ffff, @@ -13541,7 +13541,7 @@ u32 bce_xi_rv2p_proc1[] = { }; -u32 bce_xi_rv2p_proc2[] = { +const u32 bce_xi_rv2p_proc2[] = { 0x00000010, 0xb1800004, 0x0000001f, 0x05060011, 0x00000008, 0x050000ff, @@ -14008,9 +14008,9 @@ u32 bce_xi_rv2p_proc2[] = { 0x00000010, 0x001f0000, 0x00000018, 0x8000fe35, }; - -u32 bce_xi90_rv2p_proc1[] = { + +const u32 bce_xi90_rv2p_proc1[] = { 0x00000010, 0xb1800006, 0x0000001f, 0x03060011, 0x00000008, 0x0500ffff, @@ -14316,7 +14316,7 @@ u32 bce_xi90_rv2p_proc1[] = { }; -u32 bce_xi90_rv2p_proc2[] = { +const u32 bce_xi90_rv2p_proc2[] = { 0x00000010, 0xb1800004, 0x0000001f, 0x03060011, 0x00000008, 0x050000ff, @@ -14849,6 +14849,3 @@ u32 bce_xi90_rv2p_proc2[] = { bce_rv2p_proc2[BCE_RV2P_PROC2_MAX_BD_PAGE_LOC] = \ (bce_rv2p_proc2[BCE_RV2P_PROC2_MAX_BD_PAGE_LOC] & ~0xFFFF) | (value); \ } - - - Modified: stable/9/sys/dev/bce/if_bcereg.h ============================================================================== --- stable/9/sys/dev/bce/if_bcereg.h Sun Jun 9 12:51:42 2013 (r251569) +++ stable/9/sys/dev/bce/if_bcereg.h Sun Jun 9 12:55:44 2013 (r251570) @@ -32,10 +32,6 @@ #ifndef _BCEREG_H_DEFINED #define _BCEREG_H_DEFINED -#ifdef HAVE_KERNEL_OPTION_HEADERS -#include "opt_device_polling.h" -#endif - #include #include #include @@ -6337,13 +6333,13 @@ struct fw_info { u32 bss_addr; u32 bss_len; u32 bss_index; - u32 *bss; + const u32 *bss; /* Read-only section. */ u32 rodata_addr; u32 rodata_len; u32 rodata_index; - u32 *rodata; + const u32 *rodata; }; #define RV2P_PROC1 0 @@ -6422,6 +6418,8 @@ struct fw_info { struct bce_softc { + struct mtx bce_mtx; + /* Interface info */ struct ifnet *bce_ifp; @@ -6449,8 +6447,6 @@ struct bce_softc /* IRQ Resource Handle */ struct resource *bce_res_irq; - struct mtx bce_mtx; - /* Interrupt handler. */ void *bce_intrhand; @@ -6564,14 +6560,6 @@ struct bce_softc u16 bce_rx_ticks; u32 bce_stats_ticks; - /* ToDo: Can these be removed? */ - u16 bce_comp_prod_trip_int; - u16 bce_comp_prod_trip; - u16 bce_com_ticks_int; - u16 bce_com_ticks; - u16 bce_cmd_ticks_int; - u16 bce_cmd_ticks; - /* The address of the integrated PHY on the MII bus. */ int bce_phy_addr; @@ -6604,11 +6592,9 @@ struct bce_softc int watchdog_timer; /* Frame size and mbuf allocation size for RX frames. */ - u32 max_frame_size; int rx_bd_mbuf_alloc_size; int rx_bd_mbuf_data_len; int rx_bd_mbuf_align_pad; - int pg_bd_mbuf_alloc_size; /* Receive mode settings (i.e promiscuous, multicast, etc.). */ u32 rx_mode; From owner-svn-src-stable@FreeBSD.ORG Sun Jun 9 13:17:53 2013 Return-Path: Delivered-To: svn-src-stable@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by hub.freebsd.org (Postfix) with ESMTP id 58190E4; Sun, 9 Jun 2013 13:17:53 +0000 (UTC) (envelope-from marius@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) by mx1.freebsd.org (Postfix) with ESMTP id 4A89B1999; Sun, 9 Jun 2013 13:17:53 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.7/8.14.7) with ESMTP id r59DHrAv017774; Sun, 9 Jun 2013 13:17:53 GMT (envelope-from marius@svn.freebsd.org) Received: (from marius@localhost) by svn.freebsd.org (8.14.7/8.14.5/Submit) id r59DHrGg017773; Sun, 9 Jun 2013 13:17:53 GMT (envelope-from marius@svn.freebsd.org) Message-Id: <201306091317.r59DHrGg017773@svn.freebsd.org> From: Marius Strobl Date: Sun, 9 Jun 2013 13:17:53 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-9@freebsd.org Subject: svn commit: r251571 - stable/9/sys/dev/sym X-SVN-Group: stable-9 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 09 Jun 2013 13:17:53 -0000 Author: marius Date: Sun Jun 9 13:17:52 2013 New Revision: 251571 URL: http://svnweb.freebsd.org/changeset/base/251571 Log: MFC: r251394 CAM_DEV_QFREEZE handling should only be done on request submission but neither on completion nor by SIM drivers in the first place. This issue has been revealed by r249466. Modified: stable/9/sys/dev/sym/sym_hipd.c Directory Properties: stable/9/sys/ (props changed) stable/9/sys/dev/ (props changed) Modified: stable/9/sys/dev/sym/sym_hipd.c ============================================================================== --- stable/9/sys/dev/sym/sym_hipd.c Sun Jun 9 12:55:44 2013 (r251570) +++ stable/9/sys/dev/sym/sym_hipd.c Sun Jun 9 13:17:52 2013 (r251571) @@ -2349,17 +2349,6 @@ static void sym_enqueue_cam_ccb(ccb_p cp /* * Complete a pending CAM CCB. */ -static void _sym_xpt_done(hcb_p np, union ccb *ccb) -{ - SYM_LOCK_ASSERT(MA_OWNED); - - KASSERT((ccb->ccb_h.status & CAM_SIM_QUEUED) == 0, - ("%s: status=CAM_SIM_QUEUED", __func__)); - - if (ccb->ccb_h.flags & CAM_DEV_QFREEZE) - sym_freeze_cam_ccb(ccb); - xpt_done(ccb); -} static void sym_xpt_done(hcb_p np, union ccb *ccb, ccb_p cp) { @@ -2371,7 +2360,7 @@ static void sym_xpt_done(hcb_p np, union ccb->ccb_h.status &= ~CAM_SIM_QUEUED; ccb->ccb_h.sym_hcb_ptr = NULL; } - _sym_xpt_done(np, ccb); + xpt_done(ccb); } static void sym_xpt_done2(hcb_p np, union ccb *ccb, int cam_status) @@ -2379,7 +2368,7 @@ static void sym_xpt_done2(hcb_p np, unio SYM_LOCK_ASSERT(MA_OWNED); sym_set_cam_status(ccb, cam_status); - _sym_xpt_done(np, ccb); + xpt_done(ccb); } /* @@ -8969,7 +8958,7 @@ static int sym_cam_attach(hcb_p np) goto fail; np->sim = sim; - if (xpt_create_path(&path, 0, + if (xpt_create_path(&path, NULL, cam_sim_path(np->sim), CAM_TARGET_WILDCARD, CAM_LUN_WILDCARD) != CAM_REQ_CMP) { goto fail; From owner-svn-src-stable@FreeBSD.ORG Sun Jun 9 13:24:16 2013 Return-Path: Delivered-To: svn-src-stable@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by hub.freebsd.org (Postfix) with ESMTP id 9A96A2E1; Sun, 9 Jun 2013 13:24:16 +0000 (UTC) (envelope-from marius@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) by mx1.freebsd.org (Postfix) with ESMTP id 7D58A19BD; Sun, 9 Jun 2013 13:24:16 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.7/8.14.7) with ESMTP id r59DOGwT020333; Sun, 9 Jun 2013 13:24:16 GMT (envelope-from marius@svn.freebsd.org) Received: (from marius@localhost) by svn.freebsd.org (8.14.7/8.14.5/Submit) id r59DOG5j020332; Sun, 9 Jun 2013 13:24:16 GMT (envelope-from marius@svn.freebsd.org) Message-Id: <201306091324.r59DOG5j020332@svn.freebsd.org> From: Marius Strobl Date: Sun, 9 Jun 2013 13:24:16 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-9@freebsd.org Subject: svn commit: r251572 - stable/9/sys/dev/sym X-SVN-Group: stable-9 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 09 Jun 2013 13:24:16 -0000 Author: marius Date: Sun Jun 9 13:24:16 2013 New Revision: 251572 URL: http://svnweb.freebsd.org/changeset/base/251572 Log: MFC: r251402 (partial) Handle/mark/nuke unused arguments. Modified: stable/9/sys/dev/sym/sym_hipd.c Directory Properties: stable/9/sys/ (props changed) stable/9/sys/dev/ (props changed) Modified: stable/9/sys/dev/sym/sym_hipd.c ============================================================================== --- stable/9/sys/dev/sym/sym_hipd.c Sun Jun 9 13:17:52 2013 (r251571) +++ stable/9/sys/dev/sym/sym_hipd.c Sun Jun 9 13:24:16 2013 (r251572) @@ -592,11 +592,18 @@ static void sym_mfree(void *ptr, int siz * BUS handle. A reverse table (hashed) is maintained for virtual * to BUS address translation. */ -static void getbaddrcb(void *arg, bus_dma_segment_t *segs, int nseg, int error) +static void getbaddrcb(void *arg, bus_dma_segment_t *segs, int nseg __unused, + int error) { bus_addr_t *baddr; + + KASSERT(nseg == 1, ("%s: too many DMA segments (%d)", __func__, nseg)); + baddr = (bus_addr_t *)arg; - *baddr = segs->ds_addr; + if (error) + *baddr = 0; + else + *baddr = segs->ds_addr; } static m_addr_t ___dma_getp(m_pool_s *mp) @@ -1162,6 +1169,14 @@ struct sym_tcb { }; /* + * Assert some alignments required by the chip. + */ +CTASSERT(((offsetof(struct sym_reg, nc_sxfer) ^ + offsetof(struct sym_tcb, head.sval)) &3) == 0); +CTASSERT(((offsetof(struct sym_reg, nc_scntl3) ^ + offsetof(struct sym_tcb, head.wval)) &3) == 0); + +/* * Global LCB HEADER. * * Due to lack of indirect addressing on earlier NCR chips, @@ -1262,9 +1277,9 @@ struct sym_pmc { * LUN(s) > 0. */ #if SYM_CONF_MAX_LUN <= 1 -#define sym_lp(np, tp, lun) (!lun) ? (tp)->lun0p : 0 +#define sym_lp(tp, lun) (!lun) ? (tp)->lun0p : 0 #else -#define sym_lp(np, tp, lun) \ +#define sym_lp(tp, lun) \ (!lun) ? (tp)->lun0p : (tp)->lunmp ? (tp)->lunmp[(lun)] : 0 #endif @@ -2219,11 +2234,11 @@ static void sym_int_par (hcb_p np, u_sho static void sym_int_ma (hcb_p np); static int sym_dequeue_from_squeue(hcb_p np, int i, int target, int lun, int task); -static void sym_sir_bad_scsi_status (hcb_p np, int num, ccb_p cp); +static void sym_sir_bad_scsi_status (hcb_p np, ccb_p cp); static int sym_clear_tasks (hcb_p np, int status, int targ, int lun, int task); static void sym_sir_task_recovery (hcb_p np, int num); static int sym_evaluate_dp (hcb_p np, ccb_p cp, u32 scr, int *ofs); -static void sym_modify_dp (hcb_p np, tcb_p tp, ccb_p cp, int ofs); +static void sym_modify_dp(hcb_p np, ccb_p cp, int ofs); static int sym_compute_residual (hcb_p np, ccb_p cp); static int sym_show_msg (u_char * msg); static void sym_print_msg (ccb_p cp, char *label, u_char *msg); @@ -2257,7 +2272,7 @@ static int sym_fast_scatter_sg_physical( static int sym_scatter_sg_physical (hcb_p np, ccb_p cp, bus_dma_segment_t *psegs, int nsegs); static void sym_action2 (struct cam_sim *sim, union ccb *ccb); -static void sym_update_trans (hcb_p np, tcb_p tp, struct sym_trans *tip, +static void sym_update_trans(hcb_p np, struct sym_trans *tip, struct ccb_trans_settings *cts); static void sym_update_dflags(hcb_p np, u_char *flags, struct ccb_trans_settings *cts); @@ -2352,6 +2367,7 @@ static void sym_enqueue_cam_ccb(ccb_p cp static void sym_xpt_done(hcb_p np, union ccb *ccb, ccb_p cp) { + SYM_LOCK_ASSERT(MA_OWNED); if (ccb->ccb_h.status & CAM_SIM_QUEUED) { @@ -2365,6 +2381,7 @@ static void sym_xpt_done(hcb_p np, union static void sym_xpt_done2(hcb_p np, union ccb *ccb, int cam_status) { + SYM_LOCK_ASSERT(MA_OWNED); sym_set_cam_status(ccb, cam_status); @@ -4657,7 +4674,7 @@ sym_flush_comp_queue(hcb_p np, int cam_s * SCRATCHA is assumed to have been loaded with STARTPOS * before the SCRIPTS called the C code. */ -static void sym_sir_bad_scsi_status(hcb_p np, int num, ccb_p cp) +static void sym_sir_bad_scsi_status(hcb_p np, ccb_p cp) { tcb_p tp = &np->target[cp->target]; u32 startp; @@ -5084,7 +5101,7 @@ static void sym_sir_task_recovery(hcb_p * an IDENTIFY(lun) + ABORT MESSAGE. */ if (lun != -1) { - lcb_p lp = sym_lp(np, tp, lun); + lcb_p lp = sym_lp(tp, lun); lp->to_clear = 0; /* We donnot expect to fail here */ np->abrt_msg[0] = M_IDENTIFY | lun; np->abrt_msg[1] = M_ABORT; @@ -5377,7 +5394,7 @@ out_err: * Btw, we assume in that situation that such a message * is equivalent to a MODIFY DATA POINTER (offset=-1). */ -static void sym_modify_dp(hcb_p np, tcb_p tp, ccb_p cp, int ofs) +static void sym_modify_dp(hcb_p np, ccb_p cp, int ofs) { int dp_ofs = ofs; u32 dp_scr = INL (nc_temp); @@ -6106,7 +6123,7 @@ static void sym_int_sir (hcb_p np) case SIR_BAD_SCSI_STATUS: if (!cp) goto out; - sym_sir_bad_scsi_status(np, num, cp); + sym_sir_bad_scsi_status(np, cp); return; /* * We are asked by the SCRIPTS to prepare a @@ -6180,7 +6197,7 @@ static void sym_int_sir (hcb_p np) sym_print_msg(cp,"modify DP",np->msgin); tmp = (np->msgin[3]<<24) + (np->msgin[4]<<16) + (np->msgin[5]<<8) + (np->msgin[6]); - sym_modify_dp(np, tp, cp, tmp); + sym_modify_dp(np, cp, tmp); return; case M_X_SYNC_REQ: sym_sync_nego(np, tp, cp); @@ -6205,7 +6222,7 @@ static void sym_int_sir (hcb_p np) case M_IGN_RESIDUE: if (DEBUG_FLAGS & DEBUG_POINTER) sym_print_msg(cp,"ign wide residue", np->msgin); - sym_modify_dp(np, tp, cp, -1); + sym_modify_dp(np, cp, -1); return; case M_REJECT: if (INB (HS_PRT) == HS_NEGOTIATE) @@ -6264,7 +6281,7 @@ out_stuck: static ccb_p sym_get_ccb (hcb_p np, u_char tn, u_char ln, u_char tag_order) { tcb_p tp = &np->target[tn]; - lcb_p lp = sym_lp(np, tp, ln); + lcb_p lp = sym_lp(tp, ln); u_short tag = NO_TAG; SYM_QUEHEAD *qp; ccb_p cp = (ccb_p) NULL; @@ -6387,10 +6404,10 @@ out_free: /* * Release one control block */ -static void sym_free_ccb (hcb_p np, ccb_p cp) +static void sym_free_ccb(hcb_p np, ccb_p cp) { tcb_p tp = &np->target[cp->target]; - lcb_p lp = sym_lp(np, tp, cp->lun); + lcb_p lp = sym_lp(tp, cp->lun); if (DEBUG_FLAGS & DEBUG_TAGS) { PRINT_LUN(np, cp->target, cp->lun); @@ -6575,27 +6592,12 @@ static ccb_p sym_ccb_from_dsa(hcb_p np, } /* - * Target control block initialisation. - * Nothing important to do at the moment. - */ -static void sym_init_tcb (hcb_p np, u_char tn) -{ - /* - * Check some alignments required by the chip. - */ - assert (((offsetof(struct sym_reg, nc_sxfer) ^ - offsetof(struct sym_tcb, head.sval)) &3) == 0); - assert (((offsetof(struct sym_reg, nc_scntl3) ^ - offsetof(struct sym_tcb, head.wval)) &3) == 0); -} - -/* * Lun control block allocation and initialization. */ static lcb_p sym_alloc_lcb (hcb_p np, u_char tn, u_char ln) { tcb_p tp = &np->target[tn]; - lcb_p lp = sym_lp(np, tp, ln); + lcb_p lp = sym_lp(tp, ln); /* * Already done, just return. @@ -6608,11 +6610,6 @@ static lcb_p sym_alloc_lcb (hcb_p np, u_ assert(!sym_is_bit(tp->busy0_map, ln)); /* - * Initialize the target control block if not yet. - */ - sym_init_tcb (np, tn); - - /* * Allocate the LCB bus address array. * Compute the bus address of this table. */ @@ -6678,7 +6675,7 @@ fail: static void sym_alloc_lcb_tags (hcb_p np, u_char tn, u_char ln) { tcb_p tp = &np->target[tn]; - lcb_p lp = sym_lp(np, tp, ln); + lcb_p lp = sym_lp(tp, ln); int i; /* @@ -7288,7 +7285,7 @@ static void sym_complete_ok (hcb_p np, c */ csio = &cp->cam_ccb->csio; tp = &np->target[cp->target]; - lp = sym_lp(np, tp, cp->lun); + lp = sym_lp(tp, cp->lun); /* * Assume device discovered on first success. @@ -7487,7 +7484,7 @@ static void sym_action(struct cam_sim *s * Retrieve the target and lun descriptors. */ tp = &np->target[ccb_h->target_id]; - lp = sym_lp(np, tp, ccb_h->target_lun); + lp = sym_lp(tp, ccb_h->target_lun); /* * Complete the 1st INQUIRY command with error @@ -8025,14 +8022,14 @@ static void sym_action2(struct cam_sim * * Update SPI transport settings in TARGET control block. * Update SCSI device settings in LUN control block. */ - lp = sym_lp(np, tp, ccb_h->target_lun); + lp = sym_lp(tp, ccb_h->target_lun); if (cts->type == CTS_TYPE_CURRENT_SETTINGS) { - sym_update_trans(np, tp, &tp->tinfo.goal, cts); + sym_update_trans(np, &tp->tinfo.goal, cts); if (lp) sym_update_dflags(np, &lp->current_flags, cts); } if (cts->type == CTS_TYPE_USER_SETTINGS) { - sym_update_trans(np, tp, &tp->tinfo.user, cts); + sym_update_trans(np, &tp->tinfo.user, cts); if (lp) sym_update_dflags(np, &lp->user_flags, cts); } @@ -8042,7 +8039,7 @@ static void sym_action2(struct cam_sim * case XPT_GET_TRAN_SETTINGS: cts = &ccb->cts; tp = &np->target[ccb_h->target_id]; - lp = sym_lp(np, tp, ccb_h->target_lun); + lp = sym_lp(tp, ccb_h->target_lun); #define cts__scsi (&cts->proto_specific.scsi) #define cts__spi (&cts->xport_specific.spi) @@ -8167,7 +8164,7 @@ static void sym_action2(struct cam_sim * * Asynchronous notification handler. */ static void -sym_async(void *cb_arg, u32 code, struct cam_path *path, void *arg) +sym_async(void *cb_arg, u32 code, struct cam_path *path, void *args __unused) { hcb_p np; struct cam_sim *sim; @@ -8206,9 +8203,10 @@ sym_async(void *cb_arg, u32 code, struct /* * Update transfer settings of a target. */ -static void sym_update_trans(hcb_p np, tcb_p tp, struct sym_trans *tip, - struct ccb_trans_settings *cts) +static void sym_update_trans(hcb_p np, struct sym_trans *tip, + struct ccb_trans_settings *cts) { + SYM_LOCK_ASSERT(MA_OWNED); /* @@ -8285,6 +8283,7 @@ static void sym_update_trans(hcb_p np, t static void sym_update_dflags(hcb_p np, u_char *flags, struct ccb_trans_settings *cts) { + SYM_LOCK_ASSERT(MA_OWNED); #define cts__scsi (&cts->proto_specific.scsi) @@ -8882,7 +8881,7 @@ static void sym_pci_free(hcb_p np) for (target = 0; target < SYM_CONF_MAX_TARGET ; target++) { tp = &np->target[target]; for (lun = 0 ; lun < SYM_CONF_MAX_LUN ; lun++) { - lp = sym_lp(np, tp, lun); + lp = sym_lp(tp, lun); if (!lp) continue; if (lp->itlq_tbl) @@ -9001,6 +9000,7 @@ fail: */ static void sym_cam_free(hcb_p np) { + SYM_LOCK_ASSERT(MA_NOTOWNED); if (np->intr) { From owner-svn-src-stable@FreeBSD.ORG Sun Jun 9 13:50:15 2013 Return-Path: Delivered-To: svn-src-stable@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [8.8.178.115]) by hub.freebsd.org (Postfix) with ESMTP id 07A2B6CE; Sun, 9 Jun 2013 13:50:15 +0000 (UTC) (envelope-from marius@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) by mx1.freebsd.org (Postfix) with ESMTP id EDDEA1A50; Sun, 9 Jun 2013 13:50:14 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.7/8.14.7) with ESMTP id r59DoEqN027331; Sun, 9 Jun 2013 13:50:14 GMT (envelope-from marius@svn.freebsd.org) Received: (from marius@localhost) by svn.freebsd.org (8.14.7/8.14.5/Submit) id r59DoExI027330; Sun, 9 Jun 2013 13:50:14 GMT (envelope-from marius@svn.freebsd.org) Message-Id: <201306091350.r59DoExI027330@svn.freebsd.org> From: Marius Strobl Date: Sun, 9 Jun 2013 13:50:14 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-9@freebsd.org Subject: svn commit: r251573 - stable/9/sys/dev/bce X-SVN-Group: stable-9 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 09 Jun 2013 13:50:15 -0000 Author: marius Date: Sun Jun 9 13:50:14 2013 New Revision: 251573 URL: http://svnweb.freebsd.org/changeset/base/251573 Log: MFC: r251146 (partial) - Do not supply arguments as pointers to bce_get_{pg,rx}_buf() that are not altered or actually needed there any longer. - Honor errors passed to the DMA mapping callbacks. - In bce_get_rx_buf(), do not reserve stack space for more DMA segments than actually necessary. - In bce_rx_intr(), remove a pointless check for an empty mbuf pointer which can only happen in case of a severe programming error. Moreover, recovering from that situation would require way more actions with header splitting enabled (which it is by default). - Fix VLAN tagging in the RX path; do not attach the VLAN tag twice if the firmware has been told to keep it. [1] Obtained from: OpenBSD [1] Modified: stable/9/sys/dev/bce/if_bce.c Directory Properties: stable/9/sys/ (props changed) stable/9/sys/dev/ (props changed) Modified: stable/9/sys/dev/bce/if_bce.c ============================================================================== --- stable/9/sys/dev/bce/if_bce.c Sun Jun 9 13:24:16 2013 (r251572) +++ stable/9/sys/dev/bce/if_bce.c Sun Jun 9 13:50:14 2013 (r251573) @@ -399,14 +399,12 @@ static int bce_blockinit (struct bce static int bce_init_tx_chain (struct bce_softc *); static void bce_free_tx_chain (struct bce_softc *); -static int bce_get_rx_buf (struct bce_softc *, - struct mbuf *, u16 *, u16 *, u32 *); +static int bce_get_rx_buf (struct bce_softc *, u16, u16, u32 *); static int bce_init_rx_chain (struct bce_softc *); static void bce_fill_rx_chain (struct bce_softc *); static void bce_free_rx_chain (struct bce_softc *); -static int bce_get_pg_buf (struct bce_softc *, - struct mbuf *, u16 *, u16 *); +static int bce_get_pg_buf (struct bce_softc *, u16, u16); static int bce_init_pg_chain (struct bce_softc *); static void bce_fill_pg_chain (struct bce_softc *); static void bce_free_pg_chain (struct bce_softc *); @@ -3544,7 +3542,7 @@ bce_dma_alloc(device_t dev) sc->status_block, BCE_STATUS_BLK_SZ, bce_dma_map_addr, &sc->status_block_paddr, BUS_DMA_NOWAIT); - if (error) { + if (error || sc->status_block_paddr == 0) { BCE_PRINTF("%s(%d): Could not map status block " "DMA memory!\n", __FILE__, __LINE__); rc = ENOMEM; @@ -3581,7 +3579,7 @@ bce_dma_alloc(device_t dev) sc->stats_block, BCE_STATS_BLK_SZ, bce_dma_map_addr, &sc->stats_block_paddr, BUS_DMA_NOWAIT); - if(error) { + if (error || sc->stats_block_paddr == 0) { BCE_PRINTF("%s(%d): Could not map statistics block " "DMA memory!\n", __FILE__, __LINE__); rc = ENOMEM; @@ -3633,7 +3631,7 @@ bce_dma_alloc(device_t dev) sc->ctx_block[i], BCM_PAGE_SIZE, bce_dma_map_addr, &sc->ctx_paddr[i], BUS_DMA_NOWAIT); - if (error) { + if (error || sc->ctx_paddr[i] == 0) { BCE_PRINTF("%s(%d): Could not map CTX " "DMA memory!\n", __FILE__, __LINE__); rc = ENOMEM; @@ -3678,7 +3676,7 @@ bce_dma_alloc(device_t dev) BCE_TX_CHAIN_PAGE_SZ, bce_dma_map_addr, &sc->tx_bd_chain_paddr[i], BUS_DMA_NOWAIT); - if (error) { + if (error || sc->tx_bd_chain_paddr[i] == 0) { BCE_PRINTF("%s(%d): Could not map TX descriptor " "chain DMA memory!\n", __FILE__, __LINE__); rc = ENOMEM; @@ -3755,7 +3753,7 @@ bce_dma_alloc(device_t dev) BCE_RX_CHAIN_PAGE_SZ, bce_dma_map_addr, &sc->rx_bd_chain_paddr[i], BUS_DMA_NOWAIT); - if (error) { + if (error || sc->rx_bd_chain_paddr[i] == 0) { BCE_PRINTF("%s(%d): Could not map RX descriptor " "chain DMA memory!\n", __FILE__, __LINE__); rc = ENOMEM; @@ -3832,7 +3830,7 @@ bce_dma_alloc(device_t dev) BCE_PG_CHAIN_PAGE_SZ, bce_dma_map_addr, &sc->pg_bd_chain_paddr[i], BUS_DMA_NOWAIT); - if (error) { + if (error || sc->pg_bd_chain_paddr[i] == 0) { BCE_PRINTF("%s(%d): Could not map page descriptor " "chain DMA memory!\n", __FILE__, __LINE__); rc = ENOMEM; @@ -5351,29 +5349,27 @@ bce_blockinit_exit: /* 0 for success, positive value for failure. */ /****************************************************************************/ static int -bce_get_rx_buf(struct bce_softc *sc, struct mbuf *m, u16 *prod, - u16 *chain_prod, u32 *prod_bseq) +bce_get_rx_buf(struct bce_softc *sc, u16 prod, u16 chain_prod, u32 *prod_bseq) { - bus_dmamap_t map; - bus_dma_segment_t segs[BCE_MAX_SEGMENTS]; + bus_dma_segment_t segs[1]; struct mbuf *m_new = NULL; struct rx_bd *rxbd; int nsegs, error, rc = 0; #ifdef BCE_DEBUG - u16 debug_chain_prod = *chain_prod; + u16 debug_chain_prod = chain_prod; #endif DBENTER(BCE_EXTREME_RESET | BCE_EXTREME_RECV | BCE_EXTREME_LOAD); /* Make sure the inputs are valid. */ - DBRUNIF((*chain_prod > MAX_RX_BD_ALLOC), + DBRUNIF((chain_prod > MAX_RX_BD_ALLOC), BCE_PRINTF("%s(%d): RX producer out of range: " "0x%04X > 0x%04X\n", __FILE__, __LINE__, - *chain_prod, (u16) MAX_RX_BD_ALLOC)); + chain_prod, (u16)MAX_RX_BD_ALLOC)); DBPRINT(sc, BCE_EXTREME_RECV, "%s(enter): prod = 0x%04X, " "chain_prod = 0x%04X, prod_bseq = 0x%08X\n", __FUNCTION__, - *prod, *chain_prod, *prod_bseq); + prod, chain_prod, *prod_bseq); /* Update some debug statistic counters */ DBRUNIF((sc->free_rx_bd < sc->rx_low_watermark), @@ -5381,35 +5377,28 @@ bce_get_rx_buf(struct bce_softc *sc, str DBRUNIF((sc->free_rx_bd == sc->max_rx_bd), sc->rx_empty_count++); - /* Check whether this is a new mbuf allocation. */ - if (m == NULL) { - - /* Simulate an mbuf allocation failure. */ - DBRUNIF(DB_RANDOMTRUE(mbuf_alloc_failed_sim_control), - sc->mbuf_alloc_failed_count++; - sc->mbuf_alloc_failed_sim_count++; - rc = ENOBUFS; - goto bce_get_rx_buf_exit); - - /* This is a new mbuf allocation. */ - if (bce_hdr_split == TRUE) - MGETHDR(m_new, M_NOWAIT, MT_DATA); - else - m_new = m_getjcl(M_NOWAIT, MT_DATA, M_PKTHDR, - sc->rx_bd_mbuf_alloc_size); + /* Simulate an mbuf allocation failure. */ + DBRUNIF(DB_RANDOMTRUE(mbuf_alloc_failed_sim_control), + sc->mbuf_alloc_failed_count++; + sc->mbuf_alloc_failed_sim_count++; + rc = ENOBUFS; + goto bce_get_rx_buf_exit); - if (m_new == NULL) { - sc->mbuf_alloc_failed_count++; - rc = ENOBUFS; - goto bce_get_rx_buf_exit; - } + /* This is a new mbuf allocation. */ + if (bce_hdr_split == TRUE) + MGETHDR(m_new, M_NOWAIT, MT_DATA); + else + m_new = m_getjcl(M_NOWAIT, MT_DATA, M_PKTHDR, + sc->rx_bd_mbuf_alloc_size); - DBRUN(sc->debug_rx_mbuf_alloc++); - } else { - /* Reuse an existing mbuf. */ - m_new = m; + if (m_new == NULL) { + sc->mbuf_alloc_failed_count++; + rc = ENOBUFS; + goto bce_get_rx_buf_exit; } + DBRUN(sc->debug_rx_mbuf_alloc++); + /* Make sure we have a valid packet header. */ M_ASSERTPKTHDR(m_new); @@ -5420,9 +5409,8 @@ bce_get_rx_buf(struct bce_softc *sc, str /* ToDo: Consider calling m_fragment() to test error handling. */ /* Map the mbuf cluster into device memory. */ - map = sc->rx_mbuf_map[*chain_prod]; - error = bus_dmamap_load_mbuf_sg(sc->rx_mbuf_tag, map, m_new, - segs, &nsegs, BUS_DMA_NOWAIT); + error = bus_dmamap_load_mbuf_sg(sc->rx_mbuf_tag, + sc->rx_mbuf_map[chain_prod], m_new, segs, &nsegs, BUS_DMA_NOWAIT); /* Handle any mapping errors. */ if (error) { @@ -5443,7 +5431,7 @@ bce_get_rx_buf(struct bce_softc *sc, str __FUNCTION__, nsegs)); /* Setup the rx_bd for the segment. */ - rxbd = &sc->rx_bd_chain[RX_PAGE(*chain_prod)][RX_IDX(*chain_prod)]; + rxbd = &sc->rx_bd_chain[RX_PAGE(chain_prod)][RX_IDX(chain_prod)]; rxbd->rx_bd_haddr_lo = htole32(BCE_ADDR_LO(segs[0].ds_addr)); rxbd->rx_bd_haddr_hi = htole32(BCE_ADDR_HI(segs[0].ds_addr)); @@ -5452,15 +5440,15 @@ bce_get_rx_buf(struct bce_softc *sc, str *prod_bseq += segs[0].ds_len; /* Save the mbuf and update our counter. */ - sc->rx_mbuf_ptr[*chain_prod] = m_new; + sc->rx_mbuf_ptr[chain_prod] = m_new; sc->free_rx_bd -= nsegs; DBRUNMSG(BCE_INSANE_RECV, bce_dump_rx_mbuf_chain(sc, debug_chain_prod, nsegs)); DBPRINT(sc, BCE_EXTREME_RECV, "%s(exit): prod = 0x%04X, " - "chain_prod = 0x%04X, prod_bseq = 0x%08X\n", - __FUNCTION__, *prod, *chain_prod, *prod_bseq); + "chain_prod = 0x%04X, prod_bseq = 0x%08X\n", __FUNCTION__, prod, + chain_prod, *prod_bseq); bce_get_rx_buf_exit: DBEXIT(BCE_EXTREME_RESET | BCE_EXTREME_RECV | BCE_EXTREME_LOAD); @@ -5476,70 +5464,60 @@ bce_get_rx_buf_exit: /* 0 for success, positive value for failure. */ /****************************************************************************/ static int -bce_get_pg_buf(struct bce_softc *sc, struct mbuf *m, u16 *prod, - u16 *prod_idx) +bce_get_pg_buf(struct bce_softc *sc, u16 prod, u16 prod_idx) { - bus_dmamap_t map; bus_addr_t busaddr; struct mbuf *m_new = NULL; struct rx_bd *pgbd; int error, rc = 0; #ifdef BCE_DEBUG - u16 debug_prod_idx = *prod_idx; + u16 debug_prod_idx = prod_idx; #endif DBENTER(BCE_EXTREME_RESET | BCE_EXTREME_RECV | BCE_EXTREME_LOAD); /* Make sure the inputs are valid. */ - DBRUNIF((*prod_idx > MAX_PG_BD_ALLOC), + DBRUNIF((prod_idx > MAX_PG_BD_ALLOC), BCE_PRINTF("%s(%d): page producer out of range: " "0x%04X > 0x%04X\n", __FILE__, __LINE__, - *prod_idx, (u16) MAX_PG_BD_ALLOC)); + prod_idx, (u16)MAX_PG_BD_ALLOC)); DBPRINT(sc, BCE_EXTREME_RECV, "%s(enter): prod = 0x%04X, " - "chain_prod = 0x%04X\n", __FUNCTION__, *prod, *prod_idx); + "chain_prod = 0x%04X\n", __FUNCTION__, prod, prod_idx); /* Update counters if we've hit a new low or run out of pages. */ DBRUNIF((sc->free_pg_bd < sc->pg_low_watermark), sc->pg_low_watermark = sc->free_pg_bd); DBRUNIF((sc->free_pg_bd == sc->max_pg_bd), sc->pg_empty_count++); - /* Check whether this is a new mbuf allocation. */ - if (m == NULL) { - - /* Simulate an mbuf allocation failure. */ - DBRUNIF(DB_RANDOMTRUE(mbuf_alloc_failed_sim_control), - sc->mbuf_alloc_failed_count++; - sc->mbuf_alloc_failed_sim_count++; - rc = ENOBUFS; - goto bce_get_pg_buf_exit); - - /* This is a new mbuf allocation. */ - m_new = m_getcl(M_NOWAIT, MT_DATA, 0); - if (m_new == NULL) { - sc->mbuf_alloc_failed_count++; - rc = ENOBUFS; - goto bce_get_pg_buf_exit; - } - - DBRUN(sc->debug_pg_mbuf_alloc++); - } else { - /* Reuse an existing mbuf. */ - m_new = m; - m_new->m_data = m_new->m_ext.ext_buf; + /* Simulate an mbuf allocation failure. */ + DBRUNIF(DB_RANDOMTRUE(mbuf_alloc_failed_sim_control), + sc->mbuf_alloc_failed_count++; + sc->mbuf_alloc_failed_sim_count++; + rc = ENOBUFS; + goto bce_get_pg_buf_exit); + + /* This is a new mbuf allocation. */ + m_new = m_getcl(M_NOWAIT, MT_DATA, 0); + if (m_new == NULL) { + sc->mbuf_alloc_failed_count++; + rc = ENOBUFS; + goto bce_get_pg_buf_exit; } + DBRUN(sc->debug_pg_mbuf_alloc++); + m_new->m_len = MCLBYTES; /* ToDo: Consider calling m_fragment() to test error handling. */ /* Map the mbuf cluster into device memory. */ - map = sc->pg_mbuf_map[*prod_idx]; - error = bus_dmamap_load(sc->pg_mbuf_tag, map, mtod(m_new, void *), - MCLBYTES, bce_dma_map_addr, &busaddr, BUS_DMA_NOWAIT); + error = bus_dmamap_load(sc->pg_mbuf_tag, sc->pg_mbuf_map[prod_idx], + mtod(m_new, void *), MCLBYTES, bce_dma_map_addr, &busaddr, + BUS_DMA_NOWAIT); /* Handle any mapping errors. */ - if (error) { + if (error || busaddr == 0) { BCE_PRINTF("%s(%d): Error mapping mbuf into page chain!\n", __FILE__, __LINE__); @@ -5556,7 +5534,7 @@ bce_get_pg_buf(struct bce_softc *sc, str * The page chain uses the same rx_bd data structure * as the receive chain but doesn't require a byte sequence (bseq). */ - pgbd = &sc->pg_bd_chain[PG_PAGE(*prod_idx)][PG_IDX(*prod_idx)]; + pgbd = &sc->pg_bd_chain[PG_PAGE(prod_idx)][PG_IDX(prod_idx)]; pgbd->rx_bd_haddr_lo = htole32(BCE_ADDR_LO(busaddr)); pgbd->rx_bd_haddr_hi = htole32(BCE_ADDR_HI(busaddr)); @@ -5564,14 +5542,14 @@ bce_get_pg_buf(struct bce_softc *sc, str pgbd->rx_bd_flags = htole32(RX_BD_FLAGS_START | RX_BD_FLAGS_END); /* Save the mbuf and update our counter. */ - sc->pg_mbuf_ptr[*prod_idx] = m_new; + sc->pg_mbuf_ptr[prod_idx] = m_new; sc->free_pg_bd--; DBRUNMSG(BCE_INSANE_RECV, bce_dump_pg_mbuf_chain(sc, debug_prod_idx, 1)); DBPRINT(sc, BCE_EXTREME_RECV, "%s(exit): prod = 0x%04X, " - "prod_idx = 0x%04X\n", __FUNCTION__, *prod, *prod_idx); + "prod_idx = 0x%04X\n", __FUNCTION__, prod, prod_idx); bce_get_pg_buf_exit: DBEXIT(BCE_EXTREME_RESET | BCE_EXTREME_RECV | BCE_EXTREME_LOAD); @@ -5893,7 +5871,7 @@ bce_fill_rx_chain(struct bce_softc *sc) /* Keep filling the RX chain until it's full. */ while (sc->free_rx_bd > 0) { prod_idx = RX_CHAIN_IDX(prod); - if (bce_get_rx_buf(sc, NULL, &prod, &prod_idx, &prod_bseq)) { + if (bce_get_rx_buf(sc, prod, prod_idx, &prod_bseq)) { /* Bail out if we can't add an mbuf to the chain. */ break; } @@ -5907,13 +5885,11 @@ bce_fill_rx_chain(struct bce_softc *sc) /* We should never end up pointing to a next page pointer. */ DBRUNIF(((prod & USABLE_RX_BD_PER_PAGE) == USABLE_RX_BD_PER_PAGE), BCE_PRINTF("%s(): Invalid rx_prod value: 0x%04X\n", - __FUNCTION__, sc->rx_prod)); + __FUNCTION__, rx_prod)); /* Write the mailbox and tell the chip about the waiting rx_bd's. */ - REG_WR16(sc, MB_GET_CID_ADDR(RX_CID) + - BCE_L2MQ_RX_HOST_BDIDX, sc->rx_prod); - REG_WR(sc, MB_GET_CID_ADDR(RX_CID) + - BCE_L2MQ_RX_HOST_BSEQ, sc->rx_prod_bseq); + REG_WR16(sc, MB_GET_CID_ADDR(RX_CID) + BCE_L2MQ_RX_HOST_BDIDX, prod); + REG_WR(sc, MB_GET_CID_ADDR(RX_CID) + BCE_L2MQ_RX_HOST_BSEQ, prod_bseq); DBEXIT(BCE_VERBOSE_RESET | BCE_EXTREME_RECV | BCE_VERBOSE_LOAD | BCE_VERBOSE_CTX); @@ -6064,7 +6040,7 @@ bce_fill_pg_chain(struct bce_softc *sc) /* Keep filling the page chain until it's full. */ while (sc->free_pg_bd > 0) { prod_idx = PG_CHAIN_IDX(prod); - if (bce_get_pg_buf(sc, NULL, &prod, &prod_idx)) { + if (bce_get_pg_buf(sc, prod, prod_idx)) { /* Bail out if we can't add an mbuf to the chain. */ break; } @@ -6076,14 +6052,14 @@ bce_fill_pg_chain(struct bce_softc *sc) DBRUNIF(((prod & USABLE_RX_BD_PER_PAGE) == USABLE_RX_BD_PER_PAGE), BCE_PRINTF("%s(): Invalid pg_prod value: 0x%04X\n", - __FUNCTION__, sc->pg_prod)); + __FUNCTION__, pg_prod)); /* * Write the mailbox and tell the chip about * the new rx_bd's in the page chain. */ - REG_WR16(sc, MB_GET_CID_ADDR(RX_CID) + - BCE_L2MQ_RX_HOST_PG_BDIDX, sc->pg_prod); + REG_WR16(sc, MB_GET_CID_ADDR(RX_CID) + BCE_L2MQ_RX_HOST_PG_BDIDX, + prod); DBEXIT(BCE_VERBOSE_RESET | BCE_EXTREME_RECV | BCE_VERBOSE_LOAD | BCE_VERBOSE_CTX); @@ -6598,14 +6574,6 @@ bce_rx_intr(struct bce_softc *sc) DBRUN(sc->debug_rx_mbuf_alloc--); sc->free_rx_bd++; - if(m0 == NULL) { - DBPRINT(sc, BCE_EXTREME_RECV, - "%s(): Oops! Empty mbuf pointer " - "found in sc->rx_mbuf_ptr[0x%04X]!\n", - __FUNCTION__, sw_rx_cons_idx); - goto bce_rx_int_next_rx; - } - /* * Frames received on the NetXteme II are prepended * with an l2_fhdr structure which provides status @@ -6764,7 +6732,7 @@ bce_rx_intr(struct bce_softc *sc) m_freem(m0); m0 = NULL; - goto bce_rx_int_next_rx; + goto bce_rx_intr_next_rx; } /* Send the packet to the appropriate interface. */ @@ -6775,7 +6743,6 @@ bce_rx_intr(struct bce_softc *sc) /* Validate the checksum if offload enabled. */ if (ifp->if_capenable & IFCAP_RXCSUM) { - /* Check for an IP datagram. */ if (!(status & L2_FHDR_STATUS_SPLIT) && (status & L2_FHDR_STATUS_IP_DATAGRAM)) { @@ -6805,7 +6772,8 @@ bce_rx_intr(struct bce_softc *sc) } /* Attach the VLAN tag. */ - if (status & L2_FHDR_STATUS_L2_VLAN_TAG) { + if ((status & L2_FHDR_STATUS_L2_VLAN_TAG) && + !(sc->rx_mode & BCE_EMAC_RX_MODE_KEEP_VLAN_TAG)) { DBRUN(sc->vlan_tagged_frames_rcvd++); if (ifp->if_capenable & IFCAP_VLAN_HWTAGGING) { DBRUN(sc->vlan_tagged_frames_stripped++); @@ -6844,7 +6812,7 @@ bce_rx_intr(struct bce_softc *sc) /* Increment received packet statistics. */ ifp->if_ipackets++; -bce_rx_int_next_rx: +bce_rx_intr_next_rx: sw_rx_cons = NEXT_RX_BD(sw_rx_cons); /* If we have a packet, pass it up the stack */ @@ -8094,8 +8062,9 @@ bce_set_rx_mode(struct bce_softc *sc) /* Enable all multicast addresses. */ for (i = 0; i < NUM_MC_HASH_REGISTERS; i++) { - REG_WR(sc, BCE_EMAC_MULTICAST_HASH0 + (i * 4), 0xffffffff); - } + REG_WR(sc, BCE_EMAC_MULTICAST_HASH0 + (i * 4), + 0xffffffff); + } sort_mode |= BCE_RPM_SORT_USER0_MC_EN; } else { /* Accept one or more multicast(s). */ From owner-svn-src-stable@FreeBSD.ORG Sun Jun 9 13:58:37 2013 Return-Path: Delivered-To: svn-src-stable@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by hub.freebsd.org (Postfix) with ESMTP id EECDF931; Sun, 9 Jun 2013 13:58:37 +0000 (UTC) (envelope-from marius@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) by mx1.freebsd.org (Postfix) with ESMTP id E0B4F1A88; Sun, 9 Jun 2013 13:58:37 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.7/8.14.7) with ESMTP id r59DwbVI030184; Sun, 9 Jun 2013 13:58:37 GMT (envelope-from marius@svn.freebsd.org) Received: (from marius@localhost) by svn.freebsd.org (8.14.7/8.14.5/Submit) id r59Dwbm0030183; Sun, 9 Jun 2013 13:58:37 GMT (envelope-from marius@svn.freebsd.org) Message-Id: <201306091358.r59Dwbm0030183@svn.freebsd.org> From: Marius Strobl Date: Sun, 9 Jun 2013 13:58:37 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-9@freebsd.org Subject: svn commit: r251574 - stable/9/sys/dev/bce X-SVN-Group: stable-9 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 09 Jun 2013 13:58:38 -0000 Author: marius Date: Sun Jun 9 13:58:37 2013 New Revision: 251574 URL: http://svnweb.freebsd.org/changeset/base/251574 Log: MFC: r251159 - Checking for spurious interrupts is only necessary when using INTx. Actually, this may be further optimized for controller variants supporting one-shot MSIs but I'm lacking the necessary hardware for testing. - Add some missing synchronization of the statistics and status DMA maps. Modified: stable/9/sys/dev/bce/if_bce.c Directory Properties: stable/9/sys/ (props changed) stable/9/sys/dev/ (props changed) Modified: stable/9/sys/dev/bce/if_bce.c ============================================================================== --- stable/9/sys/dev/bce/if_bce.c Sun Jun 9 13:50:14 2013 (r251573) +++ stable/9/sys/dev/bce/if_bce.c Sun Jun 9 13:58:37 2013 (r251574) @@ -7873,7 +7873,7 @@ bce_watchdog_exit: /* interrupt causes (PHY, TX, RX). */ /* */ /* Returns: */ -/* 0 for success, positive value for failure. */ +/* Nothing. */ /****************************************************************************/ static void bce_intr(void *xsc) @@ -7895,16 +7895,16 @@ bce_intr(void *xsc) DBRUN(sc->interrupts_generated++); /* Synchnorize before we read from interface's status block */ - bus_dmamap_sync(sc->status_tag, sc->status_map, - BUS_DMASYNC_POSTREAD); + bus_dmamap_sync(sc->status_tag, sc->status_map, BUS_DMASYNC_POSTREAD); /* - * If the hardware status block index - * matches the last value read by the - * driver and we haven't asserted our - * interrupt then there's nothing to do. + * If the hardware status block index matches the last value read + * by the driver and we haven't asserted our interrupt then there's + * nothing to do. This may only happen in case of INTx due to the + * interrupt arriving at the CPU before the status block is updated. */ - if ((sc->status_block->status_idx == sc->last_status_idx) && + if ((sc->bce_flags & (BCE_USING_MSI_FLAG | BCE_USING_MSIX_FLAG)) == 0 && + sc->status_block->status_idx == sc->last_status_idx && (REG_RD(sc, BCE_PCICFG_MISC_STATUS) & BCE_PCICFG_MISC_STATUS_INTA_VALUE)) { DBPRINT(sc, BCE_VERBOSE_INTR, "%s(): Spurious interrupt.\n", @@ -7992,11 +7992,9 @@ bce_intr(void *xsc) if ((hw_rx_cons == sc->hw_rx_cons) && (hw_tx_cons == sc->hw_tx_cons)) break; - } - bus_dmamap_sync(sc->status_tag, sc->status_map, - BUS_DMASYNC_PREREAD); + bus_dmamap_sync(sc->status_tag, sc->status_map, BUS_DMASYNC_PREREAD); /* Re-enable interrupts. */ bce_enable_intr(sc, 0); @@ -8121,6 +8119,8 @@ bce_stats_update(struct bce_softc *sc) ifp = sc->bce_ifp; + bus_dmamap_sync(sc->stats_tag, sc->stats_map, BUS_DMASYNC_POSTREAD); + stats = (struct statistics_block *) sc->stats_block; /* @@ -8648,6 +8648,8 @@ bce_sysctl_stats_clear(SYSCTL_HANDLER_AR stats = (struct statistics_block *) sc->stats_block; bzero(stats, sizeof(struct statistics_block)); + bus_dmamap_sync(sc->stats_tag, sc->stats_map, + BUS_DMASYNC_PREREAD | BUS_DMASYNC_PREWRITE); /* Clear the internal H/W statistics counters. */ REG_WR(sc, BCE_HC_COMMAND, BCE_HC_COMMAND_CLR_STAT_NOW); @@ -10633,6 +10635,8 @@ bce_dump_status_block(struct bce_softc * { struct status_block *sblk; + bus_dmamap_sync(sc->status_tag, sc->status_map, BUS_DMASYNC_POSTREAD); + sblk = sc->status_block; BCE_PRINTF( @@ -10695,6 +10699,8 @@ bce_dump_stats_block(struct bce_softc *s { struct statistics_block *sblk; + bus_dmamap_sync(sc->stats_tag, sc->stats_map, BUS_DMASYNC_POSTREAD); + sblk = sc->stats_block; BCE_PRINTF( From owner-svn-src-stable@FreeBSD.ORG Sun Jun 9 15:08:51 2013 Return-Path: Delivered-To: svn-src-stable@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [8.8.178.115]) by hub.freebsd.org (Postfix) with ESMTP id C1090A22; Sun, 9 Jun 2013 15:08:51 +0000 (UTC) (envelope-from hrs@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) by mx1.freebsd.org (Postfix) with ESMTP id B17551D1C; Sun, 9 Jun 2013 15:08:51 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.7/8.14.7) with ESMTP id r59F8plu052806; Sun, 9 Jun 2013 15:08:51 GMT (envelope-from hrs@svn.freebsd.org) Received: (from hrs@localhost) by svn.freebsd.org (8.14.7/8.14.5/Submit) id r59F8pPO052805; Sun, 9 Jun 2013 15:08:51 GMT (envelope-from hrs@svn.freebsd.org) Message-Id: <201306091508.r59F8pPO052805@svn.freebsd.org> From: Hiroki Sato Date: Sun, 9 Jun 2013 15:08:51 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-8@freebsd.org Subject: svn commit: r251576 - stable/8/release/doc/en_US.ISO8859-1/errata X-SVN-Group: stable-8 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 09 Jun 2013 15:08:51 -0000 Author: hrs Date: Sun Jun 9 15:08:51 2013 New Revision: 251576 URL: http://svnweb.freebsd.org/changeset/base/251576 Log: - Remove bge(4) item [*]. - Add jail_parameters incompatibility. Discussed with: yongari [*] Modified: stable/8/release/doc/en_US.ISO8859-1/errata/article.xml Modified: stable/8/release/doc/en_US.ISO8859-1/errata/article.xml ============================================================================== --- stable/8/release/doc/en_US.ISO8859-1/errata/article.xml Sun Jun 9 14:31:59 2013 (r251575) +++ stable/8/release/doc/en_US.ISO8859-1/errata/article.xml Sun Jun 9 15:08:51 2013 (r251576) @@ -206,6 +206,54 @@ Open Issues + [20130609] There is incompatibility in &man.jail.8; + configuration because the &man.jail.8; utility and + rc.d/jail script has been changed. More + specifically, the following &man.sysctl.8; variables cannot be + used to set the default parameters for jails: + + security.jail.mount_zfs_allowed +security.jail.mount_procfs_allowed +security.jail.mount_nullfs_allowed +security.jail.mount_devfs_allowed +security.jail.mount_allowed +security.jail.chflags_allowed +security.jail.allow_raw_sockets +security.jail.sysvipc_allowed +security.jail.socket_unixiproute_only +security.jail.set_hostname_allowed + + These could be set by manually using &man.sysctl.8; utility, + the &man.sysctl.conf.5; file, or for some of them the following + variables in &man.rc.conf.5;: + + jail_set_hostname_allow="yes" +jail_socket_unixiproute_only="yes" +jail_sysvipc_allow="yes" + + These parameters must now be specified in + jail_parameters (or + jail_jailname_parameters + for per-jail configuration) in &man.rc.conf.5;. For + example: + + jail_parameters="allow.sysvipc allow.raw_sockets" + + The valid keywords are the following. For more detail, see + &man.jail.8; manual page. + + allow.set_hostname +allow.sysvipc +allow.raw_sockets +allow.chflags +allow.mount +allow.mount.devfs +allow.mount.nullfs +allow.mount.procfs +allow.mount.zfs +allow.quotas +allow.socket_af + [20130608] &os; &release; no longer supports &os; CVS repository. Some documents mistakenly refer to RELENG_8_4_0_RELEASE as CVS tag for the release and @@ -220,22 +268,8 @@ Please note that &os; source tree for &release; and its security branch cannot be updated by using official CVSup servers. - [20130607] The &man.bge.4; network interface driver has an - issue when TSO (TCP Segmentation Offload) is enabled. It causes - intermittent reset and re-initialization. - - A workaround is disabling the TSO feature. One can disable - it by adding the following line into the &man.rc.conf.5; - file: - - ifconfig_bge0="-tso" - - or by using the &man.ifconfig.8; utility manually: - - &prompt.root; ifconfig bge0 -tso - - A patch to fix this issue will be released as an Errata - Notice. + [20130607] (removed about a &man.bge.4; network interface + driver issue because it was incorrect) [20130606] The &man.fxp.4; network interface driver may not work well with the &man.dhclient.8; utility. More specifically, From owner-svn-src-stable@FreeBSD.ORG Sun Jun 9 17:47:02 2013 Return-Path: Delivered-To: svn-src-stable@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by hub.freebsd.org (Postfix) with ESMTP id 3EC71903; Sun, 9 Jun 2013 17:47:02 +0000 (UTC) (envelope-from markj@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) by mx1.freebsd.org (Postfix) with ESMTP id 204C316C1; Sun, 9 Jun 2013 17:47:02 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.7/8.14.7) with ESMTP id r59Hl2Ov004406; Sun, 9 Jun 2013 17:47:02 GMT (envelope-from markj@svn.freebsd.org) Received: (from markj@localhost) by svn.freebsd.org (8.14.7/8.14.5/Submit) id r59Hl1Lx004405; Sun, 9 Jun 2013 17:47:01 GMT (envelope-from markj@svn.freebsd.org) Message-Id: <201306091747.r59Hl1Lx004405@svn.freebsd.org> From: Mark Johnston Date: Sun, 9 Jun 2013 17:47:01 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-9@freebsd.org Subject: svn commit: r251582 - stable/9/lib/libelf X-SVN-Group: stable-9 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 09 Jun 2013 17:47:02 -0000 Author: markj Date: Sun Jun 9 17:47:01 2013 New Revision: 251582 URL: http://svnweb.freebsd.org/changeset/base/251582 Log: MFC r247221: Merge part of r1712 from elftoolchain, making it possible to resize ELF sections and indirectly change the layout of an ELF file when ELF_F_LAYOUT is not set. Modified: stable/9/lib/libelf/elf_update.c Directory Properties: stable/9/lib/libelf/ (props changed) Modified: stable/9/lib/libelf/elf_update.c ============================================================================== --- stable/9/lib/libelf/elf_update.c Sun Jun 9 17:40:06 2013 (r251581) +++ stable/9/lib/libelf/elf_update.c Sun Jun 9 17:47:01 2013 (r251582) @@ -41,89 +41,79 @@ __FBSDID("$FreeBSD$"); #include "_libelf.h" /* - * Update the internal data structures associated with an ELF object. - * Returns the size in bytes the ELF object would occupy in its file - * representation. + * Layout strategy: * - * After a successful call to this function, the following structures - * are updated: + * - Case 1: ELF_F_LAYOUT is asserted + * In this case the application has full control over where the + * section header table, program header table, and section data + * will reside. The library only perform error checks. * - * - The ELF header is updated. - * - All sections are sorted in order of ascending addresses and their - * section header table entries updated. An error is signalled - * if an overlap was detected among sections. - * - All data descriptors associated with a section are sorted in order - * of ascending addresses. Overlaps, if detected, are signalled as - * errors. Other sanity checks for alignments, section types etc. are - * made. + * - Case 2: ELF_F_LAYOUT is not asserted * - * After a resync_elf() successfully returns, the ELF descriptor is - * ready for being handed over to _libelf_write_elf(). + * The library will do the object layout using the following + * ordering: + * - The executable header is placed first, are required by the + * ELF specification. + * - The program header table is placed immediately following the + * executable header. + * - Section data, if any, is placed after the program header + * table, aligned appropriately. + * - The section header table, if needed, is placed last. * - * File alignments: - * PHDR - Addr - * SHDR - Addr + * There are two sub-cases to be taken care of: * - * XXX: how do we handle 'flags'. + * - Case 2a: e->e_cmd == ELF_C_READ or ELF_C_RDWR + * + * In this sub-case, the underlying ELF object may already have + * content in it, which the application may have modified. The + * library will retrieve content from the existing object as + * needed. + * + * - Case 2b: e->e_cmd == ELF_C_WRITE + * + * The ELF object is being created afresh in this sub-case; + * there is no pre-existing content in the underlying ELF + * object. */ /* * Compute the extents of a section, by looking at the data - * descriptors associated with it. The function returns zero if an - * error was detected. `*rc' holds the maximum file extent seen so - * far. + * descriptors associated with it. The function returns 1 if + * successful, or zero if an error was detected. */ static int -_libelf_compute_section_extents(Elf *e, Elf_Scn *s, off_t *rc) +_libelf_compute_section_extents(Elf *e, Elf_Scn *s, off_t rc) { int ec; - Elf_Data *d, *td; + size_t fsz, msz; + Elf_Data *d; + Elf32_Shdr *shdr32; + Elf64_Shdr *shdr64; unsigned int elftype; uint32_t sh_type; uint64_t d_align; uint64_t sh_align, sh_entsize, sh_offset, sh_size; uint64_t scn_size, scn_alignment; - /* - * We need to recompute library private data structures if one - * or more of the following is true: - * - The underlying Shdr structure has been marked `dirty'. Significant - * fields include: `sh_offset', `sh_type', `sh_size', `sh_addralign'. - * - The Elf_Data structures part of this section have been marked - * `dirty'. Affected members include `d_align', `d_offset', `d_type', - * and `d_size'. - * - The section as a whole is `dirty', e.g., it has been allocated - * using elf_newscn(), or if a new Elf_Data structure was added using - * elf_newdata(). - * - * Each of these conditions would result in the ELF_F_DIRTY bit being - * set on the section descriptor's `s_flags' field. - */ - ec = e->e_class; + shdr32 = &s->s_shdr.s_shdr32; + shdr64 = &s->s_shdr.s_shdr64; if (ec == ELFCLASS32) { - sh_type = s->s_shdr.s_shdr32.sh_type; - sh_align = (uint64_t) s->s_shdr.s_shdr32.sh_addralign; - sh_entsize = (uint64_t) s->s_shdr.s_shdr32.sh_entsize; - sh_offset = (uint64_t) s->s_shdr.s_shdr32.sh_offset; - sh_size = (uint64_t) s->s_shdr.s_shdr32.sh_size; + sh_type = shdr32->sh_type; + sh_align = (uint64_t) shdr32->sh_addralign; + sh_entsize = (uint64_t) shdr32->sh_entsize; + sh_offset = (uint64_t) shdr32->sh_offset; + sh_size = (uint64_t) shdr32->sh_size; } else { - sh_type = s->s_shdr.s_shdr64.sh_type; - sh_align = s->s_shdr.s_shdr64.sh_addralign; - sh_entsize = s->s_shdr.s_shdr64.sh_entsize; - sh_offset = s->s_shdr.s_shdr64.sh_offset; - sh_size = s->s_shdr.s_shdr64.sh_size; + sh_type = shdr64->sh_type; + sh_align = shdr64->sh_addralign; + sh_entsize = shdr64->sh_entsize; + sh_offset = shdr64->sh_offset; + sh_size = shdr64->sh_size; } - if (sh_type == SHT_NULL || sh_type == SHT_NOBITS) - return (1); - - if ((s->s_flags & ELF_F_DIRTY) == 0) { - if ((size_t) *rc < sh_offset + sh_size) - *rc = sh_offset + sh_size; - return (1); - } + assert(sh_type != SHT_NULL && sh_type != SHT_NOBITS); elftype = _libelf_xlate_shtype(sh_type); if (elftype > ELF_T_LAST) { @@ -131,15 +121,52 @@ _libelf_compute_section_extents(Elf *e, return (0); } - /* - * Compute the extent of the data descriptors associated with - * this section. - */ - scn_alignment = 0; if (sh_align == 0) sh_align = _libelf_falign(elftype, ec); - /* Compute the section alignment. */ + /* + * Check the section's data buffers for sanity and compute the + * section's alignment. + * Compute the section's size and alignment using the data + * descriptors associated with the section. + */ + if (STAILQ_EMPTY(&s->s_data)) { + /* + * The section's content (if any) has not been read in + * yet. If section is not dirty marked dirty, we can + * reuse the values in the 'sh_size' and 'sh_offset' + * fields of the section header. + */ + if ((s->s_flags & ELF_F_DIRTY) == 0) { + /* + * If the library is doing the layout, then we + * compute the new start offset for the + * section based on the current offset and the + * section's alignment needs. + * + * If the application is doing the layout, we + * can use the value in the 'sh_offset' field + * in the section header directly. + */ + if (e->e_flags & ELF_F_LAYOUT) + goto updatedescriptor; + else + goto computeoffset; + } + + /* + * Otherwise, we need to bring in the section's data + * from the underlying ELF object. + */ + if (e->e_cmd != ELF_C_WRITE && elf_getdata(s, NULL) == NULL) + return (0); + } + + /* + * Loop through the section's data descriptors. + */ + scn_size = 0L; + scn_alignment = 0L; STAILQ_FOREACH(d, &s->s_data, d_next) { if (d->d_type > ELF_T_LAST) { LIBELF_SET_ERROR(DATA, 0); @@ -153,23 +180,40 @@ _libelf_compute_section_extents(Elf *e, LIBELF_SET_ERROR(DATA, 0); return (0); } - if (d_align > scn_alignment) - scn_alignment = d_align; - } - scn_size = 0L; + /* + * The buffer's size should be a multiple of the + * memory size of the underlying type. + */ + msz = _libelf_msize(d->d_type, ec, e->e_version); + if (d->d_size % msz) { + LIBELF_SET_ERROR(DATA, 0); + return (0); + } - STAILQ_FOREACH_SAFE(d, &s->s_data, d_next, td) { + /* + * Compute the section's size. + */ if (e->e_flags & ELF_F_LAYOUT) { if ((uint64_t) d->d_off + d->d_size > scn_size) scn_size = d->d_off + d->d_size; } else { scn_size = roundup2(scn_size, d->d_align); d->d_off = scn_size; - scn_size += d->d_size; + fsz = _libelf_fsize(d->d_type, ec, d->d_version, + d->d_size / msz); + scn_size += fsz; } + + /* + * The section's alignment is the maximum alignment + * needed for its data buffers. + */ + if (d_align > scn_alignment) + scn_alignment = d_align; } + /* * If the application is requesting full control over the layout * of the section, check its values for sanity. @@ -180,46 +224,60 @@ _libelf_compute_section_extents(Elf *e, LIBELF_SET_ERROR(LAYOUT, 0); return (0); } - } else { - /* - * Otherwise compute the values in the section header. - */ + goto updatedescriptor; + } - if (scn_alignment > sh_align) - sh_align = scn_alignment; + /* + * Otherwise compute the values in the section header. + * + * The section alignment is the maximum alignment for any of + * its contained data descriptors. + */ + if (scn_alignment > sh_align) + sh_align = scn_alignment; - /* - * If the section entry size is zero, try and fill in an - * appropriate entry size. Per the elf(5) manual page - * sections without fixed-size entries should have their - * 'sh_entsize' field set to zero. - */ - if (sh_entsize == 0 && - (sh_entsize = _libelf_fsize(elftype, ec, e->e_version, - (size_t) 1)) == 1) - sh_entsize = 0; + /* + * If the section entry size is zero, try and fill in an + * appropriate entry size. Per the elf(5) manual page + * sections without fixed-size entries should have their + * 'sh_entsize' field set to zero. + */ + if (sh_entsize == 0 && + (sh_entsize = _libelf_fsize(elftype, ec, e->e_version, + (size_t) 1)) == 1) + sh_entsize = 0; - sh_size = scn_size; - sh_offset = roundup(*rc, sh_align); + sh_size = scn_size; - if (ec == ELFCLASS32) { - s->s_shdr.s_shdr32.sh_addralign = (uint32_t) sh_align; - s->s_shdr.s_shdr32.sh_entsize = (uint32_t) sh_entsize; - s->s_shdr.s_shdr32.sh_offset = (uint32_t) sh_offset; - s->s_shdr.s_shdr32.sh_size = (uint32_t) sh_size; - } else { - s->s_shdr.s_shdr64.sh_addralign = sh_align; - s->s_shdr.s_shdr64.sh_entsize = sh_entsize; - s->s_shdr.s_shdr64.sh_offset = sh_offset; - s->s_shdr.s_shdr64.sh_size = sh_size; - } - } +computeoffset: + /* + * Compute the new offset for the section based on + * the section's alignment needs. + */ + sh_offset = roundup(rc, sh_align); - if ((size_t) *rc < sh_offset + sh_size) - *rc = sh_offset + sh_size; + /* + * Update the section header. + */ + if (ec == ELFCLASS32) { + shdr32->sh_addralign = (uint32_t) sh_align; + shdr32->sh_entsize = (uint32_t) sh_entsize; + shdr32->sh_offset = (uint32_t) sh_offset; + shdr32->sh_size = (uint32_t) sh_size; + } else { + shdr64->sh_addralign = sh_align; + shdr64->sh_entsize = sh_entsize; + shdr64->sh_offset = sh_offset; + shdr64->sh_size = sh_size; + } +updatedescriptor: + /* + * Update the section descriptor. + */ s->s_size = sh_size; s->s_offset = sh_offset; + return (1); } @@ -267,13 +325,16 @@ _libelf_insert_section(Elf *e, Elf_Scn * return (1); } +/* + * Recompute section layout. + */ + static off_t _libelf_resync_sections(Elf *e, off_t rc) { int ec; - off_t nrc; + Elf_Scn *s; size_t sh_type, shdr_start, shdr_end; - Elf_Scn *s, *ts; ec = e->e_class; @@ -281,13 +342,7 @@ _libelf_resync_sections(Elf *e, off_t rc * Make a pass through sections, computing the extent of each * section. Order in increasing order of addresses. */ - - nrc = rc; - STAILQ_FOREACH(s, &e->e_u.e_elf.e_scn, s_next) - if (_libelf_compute_section_extents(e, s, &nrc) == 0) - return ((off_t) -1); - - STAILQ_FOREACH_SAFE(s, &e->e_u.e_elf.e_scn, s_next, ts) { + STAILQ_FOREACH(s, &e->e_u.e_elf.e_scn, s_next) { if (ec == ELFCLASS32) sh_type = s->s_shdr.s_shdr32.sh_type; else @@ -296,21 +351,22 @@ _libelf_resync_sections(Elf *e, off_t rc if (sh_type == SHT_NOBITS || sh_type == SHT_NULL) continue; - if (s->s_offset < (uint64_t) rc) { - if (s->s_offset + s->s_size < (uint64_t) rc) { - /* - * Try insert this section in the - * correct place in the list, - * detecting overlaps if any. - */ - STAILQ_REMOVE(&e->e_u.e_elf.e_scn, s, _Elf_Scn, - s_next); - if (_libelf_insert_section(e, s) == 0) - return ((off_t) -1); - } else { - LIBELF_SET_ERROR(LAYOUT, 0); + if (_libelf_compute_section_extents(e, s, rc) == 0) + return ((off_t) -1); + + if (s->s_size == 0) + continue; + + if (s->s_offset + s->s_size < (size_t) rc) { + /* + * Try insert this section in the + * correct place in the list, + * detecting overlaps if any. + */ + STAILQ_REMOVE(&e->e_u.e_elf.e_scn, s, _Elf_Scn, + s_next); + if (_libelf_insert_section(e, s) == 0) return ((off_t) -1); - } } else rc = s->s_offset + s->s_size; } @@ -338,8 +394,6 @@ _libelf_resync_sections(Elf *e, off_t rc } } - assert(nrc == rc); - return (rc); } From owner-svn-src-stable@FreeBSD.ORG Sun Jun 9 17:47:16 2013 Return-Path: Delivered-To: svn-src-stable@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by hub.freebsd.org (Postfix) with ESMTP id BAF2EA6C; Sun, 9 Jun 2013 17:47:16 +0000 (UTC) (envelope-from markj@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) by mx1.freebsd.org (Postfix) with ESMTP id 9F08D16C3; Sun, 9 Jun 2013 17:47:16 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.7/8.14.7) with ESMTP id r59HlGct004479; Sun, 9 Jun 2013 17:47:16 GMT (envelope-from markj@svn.freebsd.org) Received: (from markj@localhost) by svn.freebsd.org (8.14.7/8.14.5/Submit) id r59HlGAY004478; Sun, 9 Jun 2013 17:47:16 GMT (envelope-from markj@svn.freebsd.org) Message-Id: <201306091747.r59HlGAY004478@svn.freebsd.org> From: Mark Johnston Date: Sun, 9 Jun 2013 17:47:16 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-8@freebsd.org Subject: svn commit: r251583 - stable/8/lib/libelf X-SVN-Group: stable-8 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 09 Jun 2013 17:47:16 -0000 Author: markj Date: Sun Jun 9 17:47:16 2013 New Revision: 251583 URL: http://svnweb.freebsd.org/changeset/base/251583 Log: MFC r247221: Merge part of r1712 from elftoolchain, making it possible to resize ELF sections and indirectly change the layout of an ELF file when ELF_F_LAYOUT is not set. Modified: stable/8/lib/libelf/elf_update.c Directory Properties: stable/8/lib/libelf/ (props changed) Modified: stable/8/lib/libelf/elf_update.c ============================================================================== --- stable/8/lib/libelf/elf_update.c Sun Jun 9 17:47:01 2013 (r251582) +++ stable/8/lib/libelf/elf_update.c Sun Jun 9 17:47:16 2013 (r251583) @@ -41,89 +41,79 @@ __FBSDID("$FreeBSD$"); #include "_libelf.h" /* - * Update the internal data structures associated with an ELF object. - * Returns the size in bytes the ELF object would occupy in its file - * representation. + * Layout strategy: * - * After a successful call to this function, the following structures - * are updated: + * - Case 1: ELF_F_LAYOUT is asserted + * In this case the application has full control over where the + * section header table, program header table, and section data + * will reside. The library only perform error checks. * - * - The ELF header is updated. - * - All sections are sorted in order of ascending addresses and their - * section header table entries updated. An error is signalled - * if an overlap was detected among sections. - * - All data descriptors associated with a section are sorted in order - * of ascending addresses. Overlaps, if detected, are signalled as - * errors. Other sanity checks for alignments, section types etc. are - * made. + * - Case 2: ELF_F_LAYOUT is not asserted * - * After a resync_elf() successfully returns, the ELF descriptor is - * ready for being handed over to _libelf_write_elf(). + * The library will do the object layout using the following + * ordering: + * - The executable header is placed first, are required by the + * ELF specification. + * - The program header table is placed immediately following the + * executable header. + * - Section data, if any, is placed after the program header + * table, aligned appropriately. + * - The section header table, if needed, is placed last. * - * File alignments: - * PHDR - Addr - * SHDR - Addr + * There are two sub-cases to be taken care of: * - * XXX: how do we handle 'flags'. + * - Case 2a: e->e_cmd == ELF_C_READ or ELF_C_RDWR + * + * In this sub-case, the underlying ELF object may already have + * content in it, which the application may have modified. The + * library will retrieve content from the existing object as + * needed. + * + * - Case 2b: e->e_cmd == ELF_C_WRITE + * + * The ELF object is being created afresh in this sub-case; + * there is no pre-existing content in the underlying ELF + * object. */ /* * Compute the extents of a section, by looking at the data - * descriptors associated with it. The function returns zero if an - * error was detected. `*rc' holds the maximum file extent seen so - * far. + * descriptors associated with it. The function returns 1 if + * successful, or zero if an error was detected. */ static int -_libelf_compute_section_extents(Elf *e, Elf_Scn *s, off_t *rc) +_libelf_compute_section_extents(Elf *e, Elf_Scn *s, off_t rc) { int ec; - Elf_Data *d, *td; + size_t fsz, msz; + Elf_Data *d; + Elf32_Shdr *shdr32; + Elf64_Shdr *shdr64; unsigned int elftype; uint32_t sh_type; uint64_t d_align; uint64_t sh_align, sh_entsize, sh_offset, sh_size; uint64_t scn_size, scn_alignment; - /* - * We need to recompute library private data structures if one - * or more of the following is true: - * - The underlying Shdr structure has been marked `dirty'. Significant - * fields include: `sh_offset', `sh_type', `sh_size', `sh_addralign'. - * - The Elf_Data structures part of this section have been marked - * `dirty'. Affected members include `d_align', `d_offset', `d_type', - * and `d_size'. - * - The section as a whole is `dirty', e.g., it has been allocated - * using elf_newscn(), or if a new Elf_Data structure was added using - * elf_newdata(). - * - * Each of these conditions would result in the ELF_F_DIRTY bit being - * set on the section descriptor's `s_flags' field. - */ - ec = e->e_class; + shdr32 = &s->s_shdr.s_shdr32; + shdr64 = &s->s_shdr.s_shdr64; if (ec == ELFCLASS32) { - sh_type = s->s_shdr.s_shdr32.sh_type; - sh_align = (uint64_t) s->s_shdr.s_shdr32.sh_addralign; - sh_entsize = (uint64_t) s->s_shdr.s_shdr32.sh_entsize; - sh_offset = (uint64_t) s->s_shdr.s_shdr32.sh_offset; - sh_size = (uint64_t) s->s_shdr.s_shdr32.sh_size; + sh_type = shdr32->sh_type; + sh_align = (uint64_t) shdr32->sh_addralign; + sh_entsize = (uint64_t) shdr32->sh_entsize; + sh_offset = (uint64_t) shdr32->sh_offset; + sh_size = (uint64_t) shdr32->sh_size; } else { - sh_type = s->s_shdr.s_shdr64.sh_type; - sh_align = s->s_shdr.s_shdr64.sh_addralign; - sh_entsize = s->s_shdr.s_shdr64.sh_entsize; - sh_offset = s->s_shdr.s_shdr64.sh_offset; - sh_size = s->s_shdr.s_shdr64.sh_size; + sh_type = shdr64->sh_type; + sh_align = shdr64->sh_addralign; + sh_entsize = shdr64->sh_entsize; + sh_offset = shdr64->sh_offset; + sh_size = shdr64->sh_size; } - if (sh_type == SHT_NULL || sh_type == SHT_NOBITS) - return (1); - - if ((s->s_flags & ELF_F_DIRTY) == 0) { - if ((size_t) *rc < sh_offset + sh_size) - *rc = sh_offset + sh_size; - return (1); - } + assert(sh_type != SHT_NULL && sh_type != SHT_NOBITS); elftype = _libelf_xlate_shtype(sh_type); if (elftype > ELF_T_LAST) { @@ -131,15 +121,52 @@ _libelf_compute_section_extents(Elf *e, return (0); } - /* - * Compute the extent of the data descriptors associated with - * this section. - */ - scn_alignment = 0; if (sh_align == 0) sh_align = _libelf_falign(elftype, ec); - /* Compute the section alignment. */ + /* + * Check the section's data buffers for sanity and compute the + * section's alignment. + * Compute the section's size and alignment using the data + * descriptors associated with the section. + */ + if (STAILQ_EMPTY(&s->s_data)) { + /* + * The section's content (if any) has not been read in + * yet. If section is not dirty marked dirty, we can + * reuse the values in the 'sh_size' and 'sh_offset' + * fields of the section header. + */ + if ((s->s_flags & ELF_F_DIRTY) == 0) { + /* + * If the library is doing the layout, then we + * compute the new start offset for the + * section based on the current offset and the + * section's alignment needs. + * + * If the application is doing the layout, we + * can use the value in the 'sh_offset' field + * in the section header directly. + */ + if (e->e_flags & ELF_F_LAYOUT) + goto updatedescriptor; + else + goto computeoffset; + } + + /* + * Otherwise, we need to bring in the section's data + * from the underlying ELF object. + */ + if (e->e_cmd != ELF_C_WRITE && elf_getdata(s, NULL) == NULL) + return (0); + } + + /* + * Loop through the section's data descriptors. + */ + scn_size = 0L; + scn_alignment = 0L; STAILQ_FOREACH(d, &s->s_data, d_next) { if (d->d_type > ELF_T_LAST) { LIBELF_SET_ERROR(DATA, 0); @@ -153,23 +180,40 @@ _libelf_compute_section_extents(Elf *e, LIBELF_SET_ERROR(DATA, 0); return (0); } - if (d_align > scn_alignment) - scn_alignment = d_align; - } - scn_size = 0L; + /* + * The buffer's size should be a multiple of the + * memory size of the underlying type. + */ + msz = _libelf_msize(d->d_type, ec, e->e_version); + if (d->d_size % msz) { + LIBELF_SET_ERROR(DATA, 0); + return (0); + } - STAILQ_FOREACH_SAFE(d, &s->s_data, d_next, td) { + /* + * Compute the section's size. + */ if (e->e_flags & ELF_F_LAYOUT) { if ((uint64_t) d->d_off + d->d_size > scn_size) scn_size = d->d_off + d->d_size; } else { scn_size = roundup2(scn_size, d->d_align); d->d_off = scn_size; - scn_size += d->d_size; + fsz = _libelf_fsize(d->d_type, ec, d->d_version, + d->d_size / msz); + scn_size += fsz; } + + /* + * The section's alignment is the maximum alignment + * needed for its data buffers. + */ + if (d_align > scn_alignment) + scn_alignment = d_align; } + /* * If the application is requesting full control over the layout * of the section, check its values for sanity. @@ -180,46 +224,60 @@ _libelf_compute_section_extents(Elf *e, LIBELF_SET_ERROR(LAYOUT, 0); return (0); } - } else { - /* - * Otherwise compute the values in the section header. - */ + goto updatedescriptor; + } - if (scn_alignment > sh_align) - sh_align = scn_alignment; + /* + * Otherwise compute the values in the section header. + * + * The section alignment is the maximum alignment for any of + * its contained data descriptors. + */ + if (scn_alignment > sh_align) + sh_align = scn_alignment; - /* - * If the section entry size is zero, try and fill in an - * appropriate entry size. Per the elf(5) manual page - * sections without fixed-size entries should have their - * 'sh_entsize' field set to zero. - */ - if (sh_entsize == 0 && - (sh_entsize = _libelf_fsize(elftype, ec, e->e_version, - (size_t) 1)) == 1) - sh_entsize = 0; + /* + * If the section entry size is zero, try and fill in an + * appropriate entry size. Per the elf(5) manual page + * sections without fixed-size entries should have their + * 'sh_entsize' field set to zero. + */ + if (sh_entsize == 0 && + (sh_entsize = _libelf_fsize(elftype, ec, e->e_version, + (size_t) 1)) == 1) + sh_entsize = 0; - sh_size = scn_size; - sh_offset = roundup(*rc, sh_align); + sh_size = scn_size; - if (ec == ELFCLASS32) { - s->s_shdr.s_shdr32.sh_addralign = (uint32_t) sh_align; - s->s_shdr.s_shdr32.sh_entsize = (uint32_t) sh_entsize; - s->s_shdr.s_shdr32.sh_offset = (uint32_t) sh_offset; - s->s_shdr.s_shdr32.sh_size = (uint32_t) sh_size; - } else { - s->s_shdr.s_shdr64.sh_addralign = sh_align; - s->s_shdr.s_shdr64.sh_entsize = sh_entsize; - s->s_shdr.s_shdr64.sh_offset = sh_offset; - s->s_shdr.s_shdr64.sh_size = sh_size; - } - } +computeoffset: + /* + * Compute the new offset for the section based on + * the section's alignment needs. + */ + sh_offset = roundup(rc, sh_align); - if ((size_t) *rc < sh_offset + sh_size) - *rc = sh_offset + sh_size; + /* + * Update the section header. + */ + if (ec == ELFCLASS32) { + shdr32->sh_addralign = (uint32_t) sh_align; + shdr32->sh_entsize = (uint32_t) sh_entsize; + shdr32->sh_offset = (uint32_t) sh_offset; + shdr32->sh_size = (uint32_t) sh_size; + } else { + shdr64->sh_addralign = sh_align; + shdr64->sh_entsize = sh_entsize; + shdr64->sh_offset = sh_offset; + shdr64->sh_size = sh_size; + } +updatedescriptor: + /* + * Update the section descriptor. + */ s->s_size = sh_size; s->s_offset = sh_offset; + return (1); } @@ -267,13 +325,16 @@ _libelf_insert_section(Elf *e, Elf_Scn * return (1); } +/* + * Recompute section layout. + */ + static off_t _libelf_resync_sections(Elf *e, off_t rc) { int ec; - off_t nrc; + Elf_Scn *s; size_t sh_type, shdr_start, shdr_end; - Elf_Scn *s, *ts; ec = e->e_class; @@ -281,13 +342,7 @@ _libelf_resync_sections(Elf *e, off_t rc * Make a pass through sections, computing the extent of each * section. Order in increasing order of addresses. */ - - nrc = rc; - STAILQ_FOREACH(s, &e->e_u.e_elf.e_scn, s_next) - if (_libelf_compute_section_extents(e, s, &nrc) == 0) - return ((off_t) -1); - - STAILQ_FOREACH_SAFE(s, &e->e_u.e_elf.e_scn, s_next, ts) { + STAILQ_FOREACH(s, &e->e_u.e_elf.e_scn, s_next) { if (ec == ELFCLASS32) sh_type = s->s_shdr.s_shdr32.sh_type; else @@ -296,21 +351,22 @@ _libelf_resync_sections(Elf *e, off_t rc if (sh_type == SHT_NOBITS || sh_type == SHT_NULL) continue; - if (s->s_offset < (uint64_t) rc) { - if (s->s_offset + s->s_size < (uint64_t) rc) { - /* - * Try insert this section in the - * correct place in the list, - * detecting overlaps if any. - */ - STAILQ_REMOVE(&e->e_u.e_elf.e_scn, s, _Elf_Scn, - s_next); - if (_libelf_insert_section(e, s) == 0) - return ((off_t) -1); - } else { - LIBELF_SET_ERROR(LAYOUT, 0); + if (_libelf_compute_section_extents(e, s, rc) == 0) + return ((off_t) -1); + + if (s->s_size == 0) + continue; + + if (s->s_offset + s->s_size < (size_t) rc) { + /* + * Try insert this section in the + * correct place in the list, + * detecting overlaps if any. + */ + STAILQ_REMOVE(&e->e_u.e_elf.e_scn, s, _Elf_Scn, + s_next); + if (_libelf_insert_section(e, s) == 0) return ((off_t) -1); - } } else rc = s->s_offset + s->s_size; } @@ -338,8 +394,6 @@ _libelf_resync_sections(Elf *e, off_t rc } } - assert(nrc == rc); - return (rc); } From owner-svn-src-stable@FreeBSD.ORG Mon Jun 10 04:05:19 2013 Return-Path: Delivered-To: svn-src-stable@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [8.8.178.115]) by hub.freebsd.org (Postfix) with ESMTP id 1C4962B2; Mon, 10 Jun 2013 04:05:19 +0000 (UTC) (envelope-from kib@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) by mx1.freebsd.org (Postfix) with ESMTP id 0DDEF19DB; Mon, 10 Jun 2013 04:05:19 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.7/8.14.7) with ESMTP id r5A45INx006647; Mon, 10 Jun 2013 04:05:18 GMT (envelope-from kib@svn.freebsd.org) Received: (from kib@localhost) by svn.freebsd.org (8.14.7/8.14.5/Submit) id r5A45IEl006646; Mon, 10 Jun 2013 04:05:18 GMT (envelope-from kib@svn.freebsd.org) Message-Id: <201306100405.r5A45IEl006646@svn.freebsd.org> From: Konstantin Belousov Date: Mon, 10 Jun 2013 04:05:18 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-9@freebsd.org Subject: svn commit: r251592 - stable/9/sys/dev/drm2/i915 X-SVN-Group: stable-9 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 10 Jun 2013 04:05:19 -0000 Author: kib Date: Mon Jun 10 04:05:18 2013 New Revision: 251592 URL: http://svnweb.freebsd.org/changeset/base/251592 Log: MFC r251591: The vm_page lock is not needed around the call to vm_page_insert(). Modified: stable/9/sys/dev/drm2/i915/i915_gem.c Directory Properties: stable/9/sys/ (props changed) stable/9/sys/dev/ (props changed) Modified: stable/9/sys/dev/drm2/i915/i915_gem.c ============================================================================== --- stable/9/sys/dev/drm2/i915/i915_gem.c Mon Jun 10 01:48:21 2013 (r251591) +++ stable/9/sys/dev/drm2/i915/i915_gem.c Mon Jun 10 04:05:18 2013 (r251592) @@ -1426,9 +1426,7 @@ unlocked_vmobj: } m->valid = VM_PAGE_BITS_ALL; *mres = m; - vm_page_lock(m); vm_page_insert(m, vm_obj, OFF_TO_IDX(offset)); - vm_page_unlock(m); vm_page_busy(m); CTR4(KTR_DRM, "fault %p %jx %x phys %x", gem_obj, offset, prot, From owner-svn-src-stable@FreeBSD.ORG Mon Jun 10 04:09:14 2013 Return-Path: Delivered-To: svn-src-stable@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [8.8.178.115]) by hub.freebsd.org (Postfix) with ESMTP id 9AB6843E; Mon, 10 Jun 2013 04:09:14 +0000 (UTC) (envelope-from kib@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) by mx1.freebsd.org (Postfix) with ESMTP id 8C48B19F0; Mon, 10 Jun 2013 04:09:14 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.7/8.14.7) with ESMTP id r5A49EL4007405; Mon, 10 Jun 2013 04:09:14 GMT (envelope-from kib@svn.freebsd.org) Received: (from kib@localhost) by svn.freebsd.org (8.14.7/8.14.5/Submit) id r5A49E0v007404; Mon, 10 Jun 2013 04:09:14 GMT (envelope-from kib@svn.freebsd.org) Message-Id: <201306100409.r5A49E0v007404@svn.freebsd.org> From: Konstantin Belousov Date: Mon, 10 Jun 2013 04:09:14 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-9@freebsd.org Subject: svn commit: r251593 - stable/9/sys/i386/i386 X-SVN-Group: stable-9 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 10 Jun 2013 04:09:14 -0000 Author: kib Date: Mon Jun 10 04:09:14 2013 New Revision: 251593 URL: http://svnweb.freebsd.org/changeset/base/251593 Log: MFC r251283: MFamd64: when printing the trap information, show the %esp value. Modified: stable/9/sys/i386/i386/trap.c Directory Properties: stable/9/sys/ (props changed) Modified: stable/9/sys/i386/i386/trap.c ============================================================================== --- stable/9/sys/i386/i386/trap.c Mon Jun 10 04:05:18 2013 (r251592) +++ stable/9/sys/i386/i386/trap.c Mon Jun 10 04:09:14 2013 (r251593) @@ -766,10 +766,10 @@ trap(struct trapframe *frame) ksi.ksi_trapno = type; if (uprintf_signal) { uprintf("pid %d comm %s: signal %d err %x code %d type %d " - "addr 0x%x eip 0x%08x " + "addr 0x%x esp 0x%08x eip 0x%08x " "<%02x %02x %02x %02x %02x %02x %02x %02x>\n", p->p_pid, p->p_comm, i, frame->tf_err, ucode, type, addr, - frame->tf_eip, + frame->tf_esp, frame->tf_eip, fubyte((void *)(frame->tf_eip + 0)), fubyte((void *)(frame->tf_eip + 1)), fubyte((void *)(frame->tf_eip + 2)), From owner-svn-src-stable@FreeBSD.ORG Mon Jun 10 04:12:49 2013 Return-Path: Delivered-To: svn-src-stable@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [8.8.178.115]) by hub.freebsd.org (Postfix) with ESMTP id 0927E5EA; Mon, 10 Jun 2013 04:12:49 +0000 (UTC) (envelope-from kib@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) by mx1.freebsd.org (Postfix) with ESMTP id EFBEE1A12; Mon, 10 Jun 2013 04:12:48 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.7/8.14.7) with ESMTP id r5A4Cm4J009689; Mon, 10 Jun 2013 04:12:48 GMT (envelope-from kib@svn.freebsd.org) Received: (from kib@localhost) by svn.freebsd.org (8.14.7/8.14.5/Submit) id r5A4CmOF009687; Mon, 10 Jun 2013 04:12:48 GMT (envelope-from kib@svn.freebsd.org) Message-Id: <201306100412.r5A4CmOF009687@svn.freebsd.org> From: Konstantin Belousov Date: Mon, 10 Jun 2013 04:12:48 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-9@freebsd.org Subject: svn commit: r251594 - in stable/9/sys: amd64/amd64 i386/i386 X-SVN-Group: stable-9 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 10 Jun 2013 04:12:49 -0000 Author: kib Date: Mon Jun 10 04:12:48 2013 New Revision: 251594 URL: http://svnweb.freebsd.org/changeset/base/251594 Log: MFC r251324: Assert that interrupts are enabled in the trap handlers on x86 before calling generic code to deliver signals. Modified: stable/9/sys/amd64/amd64/trap.c stable/9/sys/i386/i386/trap.c Directory Properties: stable/9/sys/ (props changed) Modified: stable/9/sys/amd64/amd64/trap.c ============================================================================== --- stable/9/sys/amd64/amd64/trap.c Mon Jun 10 04:09:14 2013 (r251593) +++ stable/9/sys/amd64/amd64/trap.c Mon Jun 10 04:12:48 2013 (r251594) @@ -630,6 +630,7 @@ trap(struct trapframe *frame) fubyte((void *)(frame->tf_rip + 6)), fubyte((void *)(frame->tf_rip + 7))); } + KASSERT((read_rflags() & PSL_I) != 0, ("interrupts disabled")); trapsignal(td, &ksi); user: Modified: stable/9/sys/i386/i386/trap.c ============================================================================== --- stable/9/sys/i386/i386/trap.c Mon Jun 10 04:09:14 2013 (r251593) +++ stable/9/sys/i386/i386/trap.c Mon Jun 10 04:12:48 2013 (r251594) @@ -779,6 +779,7 @@ trap(struct trapframe *frame) fubyte((void *)(frame->tf_eip + 6)), fubyte((void *)(frame->tf_eip + 7))); } + KASSERT((read_eflags() & PSL_I) != 0, ("interrupts disabled")); trapsignal(td, &ksi); #ifdef DEBUG From owner-svn-src-stable@FreeBSD.ORG Mon Jun 10 04:23:12 2013 Return-Path: Delivered-To: svn-src-stable@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [8.8.178.115]) by hub.freebsd.org (Postfix) with ESMTP id 8E8D17B2; Mon, 10 Jun 2013 04:23:12 +0000 (UTC) (envelope-from kib@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) by mx1.freebsd.org (Postfix) with ESMTP id 812691A45; Mon, 10 Jun 2013 04:23:12 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.7/8.14.7) with ESMTP id r5A4NCiM012791; Mon, 10 Jun 2013 04:23:12 GMT (envelope-from kib@svn.freebsd.org) Received: (from kib@localhost) by svn.freebsd.org (8.14.7/8.14.5/Submit) id r5A4NCen012789; Mon, 10 Jun 2013 04:23:12 GMT (envelope-from kib@svn.freebsd.org) Message-Id: <201306100423.r5A4NCen012789@svn.freebsd.org> From: Konstantin Belousov Date: Mon, 10 Jun 2013 04:23:12 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-8@freebsd.org Subject: svn commit: r251595 - in stable/8/sys: amd64/amd64 i386/i386 X-SVN-Group: stable-8 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 10 Jun 2013 04:23:12 -0000 Author: kib Date: Mon Jun 10 04:23:11 2013 New Revision: 251595 URL: http://svnweb.freebsd.org/changeset/base/251595 Log: MFC r251324: Assert that interrupts are enabled in the trap handlers on x86 before calling generic code to deliver signals. Modified: stable/8/sys/amd64/amd64/trap.c stable/8/sys/i386/i386/trap.c Directory Properties: stable/8/sys/ (props changed) stable/8/sys/amd64/ (props changed) stable/8/sys/i386/ (props changed) Modified: stable/8/sys/amd64/amd64/trap.c ============================================================================== --- stable/8/sys/amd64/amd64/trap.c Mon Jun 10 04:12:48 2013 (r251594) +++ stable/8/sys/amd64/amd64/trap.c Mon Jun 10 04:23:11 2013 (r251595) @@ -610,6 +610,7 @@ trap(struct trapframe *frame) ksi.ksi_code = ucode; ksi.ksi_trapno = type; ksi.ksi_addr = (void *)addr; + KASSERT((read_rflags() & PSL_I) != 0, ("interrupts disabled")); trapsignal(td, &ksi); user: Modified: stable/8/sys/i386/i386/trap.c ============================================================================== --- stable/8/sys/i386/i386/trap.c Mon Jun 10 04:12:48 2013 (r251594) +++ stable/8/sys/i386/i386/trap.c Mon Jun 10 04:23:11 2013 (r251595) @@ -755,6 +755,7 @@ trap(struct trapframe *frame) ksi.ksi_code = ucode; ksi.ksi_addr = (void *)addr; ksi.ksi_trapno = type; + KASSERT((read_eflags() & PSL_I) != 0, ("interrupts disabled")); trapsignal(td, &ksi); #ifdef DEBUG From owner-svn-src-stable@FreeBSD.ORG Mon Jun 10 23:09:46 2013 Return-Path: Delivered-To: svn-src-stable@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by hub.freebsd.org (Postfix) with ESMTP id 301E8325; Mon, 10 Jun 2013 23:09:46 +0000 (UTC) (envelope-from brooks@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) by mx1.freebsd.org (Postfix) with ESMTP id 215811960; Mon, 10 Jun 2013 23:09:46 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.7/8.14.7) with ESMTP id r5AN9jGB069128; Mon, 10 Jun 2013 23:09:45 GMT (envelope-from brooks@svn.freebsd.org) Received: (from brooks@localhost) by svn.freebsd.org (8.14.7/8.14.5/Submit) id r5AN9jrm069127; Mon, 10 Jun 2013 23:09:45 GMT (envelope-from brooks@svn.freebsd.org) Message-Id: <201306102309.r5AN9jrm069127@svn.freebsd.org> From: Brooks Davis Date: Mon, 10 Jun 2013 23:09:45 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-9@freebsd.org Subject: svn commit: r251611 - stable/9/usr.bin/xinstall X-SVN-Group: stable-9 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 10 Jun 2013 23:09:46 -0000 Author: brooks Date: Mon Jun 10 23:09:45 2013 New Revision: 251611 URL: http://svnweb.freebsd.org/changeset/base/251611 Log: MFC r251424: New install flags were merged to 9-STABLE and will appear in FreeBSD-9.2. Sponsored by: DARPA, AFRL Submitted by: ru Modified: stable/9/usr.bin/xinstall/install.1 Directory Properties: stable/9/usr.bin/xinstall/ (props changed) Modified: stable/9/usr.bin/xinstall/install.1 ============================================================================== --- stable/9/usr.bin/xinstall/install.1 Mon Jun 10 20:46:07 2013 (r251610) +++ stable/9/usr.bin/xinstall/install.1 Mon Jun 10 23:09:45 2013 (r251611) @@ -351,7 +351,7 @@ utility appeared in The meaning of the .Fl M option has changed as of -.Fx 10 +.Fx 9.2 and it now takes an argument. Command lines that used the old .Fl M From owner-svn-src-stable@FreeBSD.ORG Tue Jun 11 06:18:52 2013 Return-Path: Delivered-To: svn-src-stable@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [8.8.178.115]) by hub.freebsd.org (Postfix) with ESMTP id 98A8B8F0; Tue, 11 Jun 2013 06:18:52 +0000 (UTC) (envelope-from hselasky@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) by mx1.freebsd.org (Postfix) with ESMTP id 8A1411D73; Tue, 11 Jun 2013 06:18:52 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.7/8.14.7) with ESMTP id r5B6Iq1A005903; Tue, 11 Jun 2013 06:18:52 GMT (envelope-from hselasky@svn.freebsd.org) Received: (from hselasky@localhost) by svn.freebsd.org (8.14.7/8.14.5/Submit) id r5B6IqB6005901; Tue, 11 Jun 2013 06:18:52 GMT (envelope-from hselasky@svn.freebsd.org) Message-Id: <201306110618.r5B6IqB6005901@svn.freebsd.org> From: Hans Petter Selasky Date: Tue, 11 Jun 2013 06:18:52 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-9@freebsd.org Subject: svn commit: r251614 - stable/9/sys/dev/usb/controller X-SVN-Group: stable-9 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 11 Jun 2013 06:18:52 -0000 Author: hselasky Date: Tue Jun 11 06:18:51 2013 New Revision: 251614 URL: http://svnweb.freebsd.org/changeset/base/251614 Log: MFC r251249, r251251, r251252, r2512, r251254 and r251515: Correct XHCI DMA descriptor programming. Correct maximum IRQ rate. Modified: stable/9/sys/dev/usb/controller/xhci.c stable/9/sys/dev/usb/controller/xhcireg.h Directory Properties: stable/9/sys/ (props changed) stable/9/sys/dev/ (props changed) Modified: stable/9/sys/dev/usb/controller/xhci.c ============================================================================== --- stable/9/sys/dev/usb/controller/xhci.c Tue Jun 11 03:37:29 2013 (r251613) +++ stable/9/sys/dev/usb/controller/xhci.c Tue Jun 11 06:18:51 2013 (r251614) @@ -1533,9 +1533,11 @@ xhci_setup_generic_chain_sub(struct xhci struct xhci_td *td; struct xhci_td *td_next; struct xhci_td *td_alt_next; + struct xhci_td *td_first; uint32_t buf_offset; uint32_t average; uint32_t len_old; + uint32_t npkt_off; uint32_t dword; uint8_t shortpkt_old; uint8_t precompute; @@ -1545,12 +1547,13 @@ xhci_setup_generic_chain_sub(struct xhci buf_offset = 0; shortpkt_old = temp->shortpkt; len_old = temp->len; + npkt_off = 0; precompute = 1; restart: td = temp->td; - td_next = temp->td_next; + td_next = td_first = temp->td_next; while (1) { @@ -1651,7 +1654,7 @@ restart: /* fill out buffer pointers */ if (average == 0) { - npkt = 1; + npkt = 0; memset(&buf_res, 0, sizeof(buf_res)); } else { usbd_get_page(temp->pc, temp->offset + @@ -1665,8 +1668,10 @@ restart: if (buf_res.length > XHCI_TD_PAGE_SIZE) buf_res.length = XHCI_TD_PAGE_SIZE; + npkt_off += buf_res.length; + /* setup npkt */ - npkt = (average + temp->max_packet_size - 1) / + npkt = (len_old - npkt_off + temp->max_packet_size - 1) / temp->max_packet_size; if (npkt > 31) @@ -1684,32 +1689,55 @@ restart: td->td_trb[x].dwTrb2 = htole32(dword); - dword = XHCI_TRB_3_CHAIN_BIT | XHCI_TRB_3_CYCLE_BIT | - XHCI_TRB_3_TYPE_SET(temp->trb_type) | - (temp->do_isoc_sync ? - XHCI_TRB_3_FRID_SET(temp->isoc_frame / 8) : - XHCI_TRB_3_ISO_SIA_BIT) | - XHCI_TRB_3_TBC_SET(temp->tbc) | - XHCI_TRB_3_TLBPC_SET(temp->tlbpc); - - temp->do_isoc_sync = 0; - - if (temp->direction == UE_DIR_IN) { - dword |= XHCI_TRB_3_DIR_IN; - - /* - * NOTE: Only the SETUP stage should - * use the IDT bit. Else transactions - * can be sent using the wrong data - * toggle value. - */ - if (temp->trb_type != - XHCI_TRB_TYPE_SETUP_STAGE && - temp->trb_type != - XHCI_TRB_TYPE_STATUS_STAGE) - dword |= XHCI_TRB_3_ISP_BIT; + switch (temp->trb_type) { + case XHCI_TRB_TYPE_ISOCH: + /* BEI: Interrupts are inhibited until EOT */ + dword = XHCI_TRB_3_CHAIN_BIT | XHCI_TRB_3_CYCLE_BIT | + XHCI_TRB_3_BEI_BIT | + XHCI_TRB_3_TBC_SET(temp->tbc) | + XHCI_TRB_3_TLBPC_SET(temp->tlbpc); + if (td != td_first) { + dword |= XHCI_TRB_3_TYPE_SET(XHCI_TRB_TYPE_NORMAL); + } else if (temp->do_isoc_sync != 0) { + temp->do_isoc_sync = 0; + /* wait until "isoc_frame" */ + dword |= XHCI_TRB_3_TYPE_SET(XHCI_TRB_TYPE_ISOCH) | + XHCI_TRB_3_FRID_SET(temp->isoc_frame / 8); + } else { + /* start data transfer at next interval */ + dword |= XHCI_TRB_3_TYPE_SET(XHCI_TRB_TYPE_ISOCH) | + XHCI_TRB_3_ISO_SIA_BIT; + } + if (temp->direction == UE_DIR_IN) + dword |= XHCI_TRB_3_DIR_IN | XHCI_TRB_3_ISP_BIT; + break; + case XHCI_TRB_TYPE_DATA_STAGE: + dword = XHCI_TRB_3_CHAIN_BIT | XHCI_TRB_3_CYCLE_BIT | + XHCI_TRB_3_TYPE_SET(XHCI_TRB_TYPE_DATA_STAGE) | + XHCI_TRB_3_TBC_SET(temp->tbc) | + XHCI_TRB_3_TLBPC_SET(temp->tlbpc); + if (temp->direction == UE_DIR_IN) + dword |= XHCI_TRB_3_DIR_IN | XHCI_TRB_3_ISP_BIT; + break; + case XHCI_TRB_TYPE_STATUS_STAGE: + dword = XHCI_TRB_3_CHAIN_BIT | XHCI_TRB_3_CYCLE_BIT | + XHCI_TRB_3_TYPE_SET(XHCI_TRB_TYPE_STATUS_STAGE) | + XHCI_TRB_3_TBC_SET(temp->tbc) | + XHCI_TRB_3_TLBPC_SET(temp->tlbpc); + if (temp->direction == UE_DIR_IN) + dword |= XHCI_TRB_3_DIR_IN; + break; + default: /* XHCI_TRB_TYPE_NORMAL */ + /* BEI: Interrupts are inhibited until EOT */ + dword = XHCI_TRB_3_CHAIN_BIT | XHCI_TRB_3_CYCLE_BIT | + XHCI_TRB_3_TYPE_SET(XHCI_TRB_TYPE_NORMAL) | + XHCI_TRB_3_BEI_BIT | + XHCI_TRB_3_TBC_SET(temp->tbc) | + XHCI_TRB_3_TLBPC_SET(temp->tlbpc); + if (temp->direction == UE_DIR_IN) + dword |= XHCI_TRB_3_DIR_IN | XHCI_TRB_3_ISP_BIT; + break; } - td->td_trb[x].dwTrb3 = htole32(dword); average -= buf_res.length; @@ -1773,9 +1801,14 @@ restart: goto restart; } - /* remove cycle bit from first if we are stepping the TRBs */ - if (temp->step_td) - td->td_trb[0].dwTrb3 &= ~htole32(XHCI_TRB_3_CYCLE_BIT); + /* + * Remove cycle bit from the first TRB if we are + * stepping them: + */ + if (temp->step_td != 0) { + td_first->td_trb[0].dwTrb3 &= ~htole32(XHCI_TRB_3_CYCLE_BIT); + usb_pc_cpu_flush(td_first->page_cache); + } /* remove chain bit because this is the last TRB in the chain */ td->td_trb[td->ntrb - 1].dwTrb2 &= ~htole32(XHCI_TRB_2_TDSZ_SET(15)); @@ -2601,6 +2634,7 @@ xhci_transfer_insert(struct usb_xfer *xf { struct xhci_td *td_first; struct xhci_td *td_last; + struct xhci_trb *trb_link; struct xhci_endpoint_ext *pepext; uint64_t addr; uint8_t i; @@ -2666,11 +2700,15 @@ xhci_transfer_insert(struct usb_xfer *xf /* compute terminating return address */ addr += inext * sizeof(struct xhci_trb); + /* compute link TRB pointer */ + trb_link = td_last->td_trb + td_last->ntrb; + /* update next pointer of last link TRB */ - td_last->td_trb[td_last->ntrb].qwTrb0 = htole64(addr); - td_last->td_trb[td_last->ntrb].dwTrb2 = htole32(XHCI_TRB_2_IRQ_SET(0)); - td_last->td_trb[td_last->ntrb].dwTrb3 = htole32(XHCI_TRB_3_IOC_BIT | - XHCI_TRB_3_CYCLE_BIT | XHCI_TRB_3_TYPE_SET(XHCI_TRB_TYPE_LINK)); + trb_link->qwTrb0 = htole64(addr); + trb_link->dwTrb2 = htole32(XHCI_TRB_2_IRQ_SET(0)); + trb_link->dwTrb3 = htole32(XHCI_TRB_3_IOC_BIT | + XHCI_TRB_3_CYCLE_BIT | + XHCI_TRB_3_TYPE_SET(XHCI_TRB_TYPE_LINK)); #ifdef USB_DEBUG xhci_dump_trb(&td_last->td_trb[td_last->ntrb]); Modified: stable/9/sys/dev/usb/controller/xhcireg.h ============================================================================== --- stable/9/sys/dev/usb/controller/xhcireg.h Tue Jun 11 03:37:29 2013 (r251613) +++ stable/9/sys/dev/usb/controller/xhcireg.h Tue Jun 11 06:18:51 2013 (r251614) @@ -166,7 +166,7 @@ #define XHCI_IMOD_IVAL_SET(x) (((x) & 0xFFFF) << 0) /* 250ns unit */ #define XHCI_IMOD_ICNT_GET(x) (((x) >> 16) & 0xFFFF) /* 250ns unit */ #define XHCI_IMOD_ICNT_SET(x) (((x) & 0xFFFF) << 16) /* 250ns unit */ -#define XHCI_IMOD_DEFAULT 0x000001F4U /* 8000 IRQ/second */ +#define XHCI_IMOD_DEFAULT 0x000003E8U /* 8000 IRQ/second */ #define XHCI_ERSTSZ(n) (0x0028 + (0x20 * (n))) /* XHCI event ring segment table size */ #define XHCI_ERSTS_GET(x) ((x) & 0xFFFF) #define XHCI_ERSTS_SET(x) ((x) & 0xFFFF) From owner-svn-src-stable@FreeBSD.ORG Tue Jun 11 06:22:10 2013 Return-Path: Delivered-To: svn-src-stable@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by hub.freebsd.org (Postfix) with ESMTP id 9B789B2C; Tue, 11 Jun 2013 06:22:10 +0000 (UTC) (envelope-from hselasky@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) by mx1.freebsd.org (Postfix) with ESMTP id 8DC651DA2; Tue, 11 Jun 2013 06:22:10 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.7/8.14.7) with ESMTP id r5B6MA85008063; Tue, 11 Jun 2013 06:22:10 GMT (envelope-from hselasky@svn.freebsd.org) Received: (from hselasky@localhost) by svn.freebsd.org (8.14.7/8.14.5/Submit) id r5B6MApq008061; Tue, 11 Jun 2013 06:22:10 GMT (envelope-from hselasky@svn.freebsd.org) Message-Id: <201306110622.r5B6MApq008061@svn.freebsd.org> From: Hans Petter Selasky Date: Tue, 11 Jun 2013 06:22:10 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-8@freebsd.org Subject: svn commit: r251615 - stable/8/sys/dev/usb/controller X-SVN-Group: stable-8 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 11 Jun 2013 06:22:10 -0000 Author: hselasky Date: Tue Jun 11 06:22:09 2013 New Revision: 251615 URL: http://svnweb.freebsd.org/changeset/base/251615 Log: MFC r251249, r251251, r251252, r251253, r251254 and r251515: Correct XHCI DMA descriptor programming. Correct maximum IRQ rate. Modified: stable/8/sys/dev/usb/controller/xhci.c stable/8/sys/dev/usb/controller/xhcireg.h Directory Properties: stable/8/sys/ (props changed) stable/8/sys/dev/ (props changed) stable/8/sys/dev/usb/ (props changed) Modified: stable/8/sys/dev/usb/controller/xhci.c ============================================================================== --- stable/8/sys/dev/usb/controller/xhci.c Tue Jun 11 06:18:51 2013 (r251614) +++ stable/8/sys/dev/usb/controller/xhci.c Tue Jun 11 06:22:09 2013 (r251615) @@ -1533,9 +1533,11 @@ xhci_setup_generic_chain_sub(struct xhci struct xhci_td *td; struct xhci_td *td_next; struct xhci_td *td_alt_next; + struct xhci_td *td_first; uint32_t buf_offset; uint32_t average; uint32_t len_old; + uint32_t npkt_off; uint32_t dword; uint8_t shortpkt_old; uint8_t precompute; @@ -1545,12 +1547,13 @@ xhci_setup_generic_chain_sub(struct xhci buf_offset = 0; shortpkt_old = temp->shortpkt; len_old = temp->len; + npkt_off = 0; precompute = 1; restart: td = temp->td; - td_next = temp->td_next; + td_next = td_first = temp->td_next; while (1) { @@ -1651,7 +1654,7 @@ restart: /* fill out buffer pointers */ if (average == 0) { - npkt = 1; + npkt = 0; memset(&buf_res, 0, sizeof(buf_res)); } else { usbd_get_page(temp->pc, temp->offset + @@ -1665,8 +1668,10 @@ restart: if (buf_res.length > XHCI_TD_PAGE_SIZE) buf_res.length = XHCI_TD_PAGE_SIZE; + npkt_off += buf_res.length; + /* setup npkt */ - npkt = (average + temp->max_packet_size - 1) / + npkt = (len_old - npkt_off + temp->max_packet_size - 1) / temp->max_packet_size; if (npkt > 31) @@ -1684,32 +1689,55 @@ restart: td->td_trb[x].dwTrb2 = htole32(dword); - dword = XHCI_TRB_3_CHAIN_BIT | XHCI_TRB_3_CYCLE_BIT | - XHCI_TRB_3_TYPE_SET(temp->trb_type) | - (temp->do_isoc_sync ? - XHCI_TRB_3_FRID_SET(temp->isoc_frame / 8) : - XHCI_TRB_3_ISO_SIA_BIT) | - XHCI_TRB_3_TBC_SET(temp->tbc) | - XHCI_TRB_3_TLBPC_SET(temp->tlbpc); - - temp->do_isoc_sync = 0; - - if (temp->direction == UE_DIR_IN) { - dword |= XHCI_TRB_3_DIR_IN; - - /* - * NOTE: Only the SETUP stage should - * use the IDT bit. Else transactions - * can be sent using the wrong data - * toggle value. - */ - if (temp->trb_type != - XHCI_TRB_TYPE_SETUP_STAGE && - temp->trb_type != - XHCI_TRB_TYPE_STATUS_STAGE) - dword |= XHCI_TRB_3_ISP_BIT; + switch (temp->trb_type) { + case XHCI_TRB_TYPE_ISOCH: + /* BEI: Interrupts are inhibited until EOT */ + dword = XHCI_TRB_3_CHAIN_BIT | XHCI_TRB_3_CYCLE_BIT | + XHCI_TRB_3_BEI_BIT | + XHCI_TRB_3_TBC_SET(temp->tbc) | + XHCI_TRB_3_TLBPC_SET(temp->tlbpc); + if (td != td_first) { + dword |= XHCI_TRB_3_TYPE_SET(XHCI_TRB_TYPE_NORMAL); + } else if (temp->do_isoc_sync != 0) { + temp->do_isoc_sync = 0; + /* wait until "isoc_frame" */ + dword |= XHCI_TRB_3_TYPE_SET(XHCI_TRB_TYPE_ISOCH) | + XHCI_TRB_3_FRID_SET(temp->isoc_frame / 8); + } else { + /* start data transfer at next interval */ + dword |= XHCI_TRB_3_TYPE_SET(XHCI_TRB_TYPE_ISOCH) | + XHCI_TRB_3_ISO_SIA_BIT; + } + if (temp->direction == UE_DIR_IN) + dword |= XHCI_TRB_3_DIR_IN | XHCI_TRB_3_ISP_BIT; + break; + case XHCI_TRB_TYPE_DATA_STAGE: + dword = XHCI_TRB_3_CHAIN_BIT | XHCI_TRB_3_CYCLE_BIT | + XHCI_TRB_3_TYPE_SET(XHCI_TRB_TYPE_DATA_STAGE) | + XHCI_TRB_3_TBC_SET(temp->tbc) | + XHCI_TRB_3_TLBPC_SET(temp->tlbpc); + if (temp->direction == UE_DIR_IN) + dword |= XHCI_TRB_3_DIR_IN | XHCI_TRB_3_ISP_BIT; + break; + case XHCI_TRB_TYPE_STATUS_STAGE: + dword = XHCI_TRB_3_CHAIN_BIT | XHCI_TRB_3_CYCLE_BIT | + XHCI_TRB_3_TYPE_SET(XHCI_TRB_TYPE_STATUS_STAGE) | + XHCI_TRB_3_TBC_SET(temp->tbc) | + XHCI_TRB_3_TLBPC_SET(temp->tlbpc); + if (temp->direction == UE_DIR_IN) + dword |= XHCI_TRB_3_DIR_IN; + break; + default: /* XHCI_TRB_TYPE_NORMAL */ + /* BEI: Interrupts are inhibited until EOT */ + dword = XHCI_TRB_3_CHAIN_BIT | XHCI_TRB_3_CYCLE_BIT | + XHCI_TRB_3_TYPE_SET(XHCI_TRB_TYPE_NORMAL) | + XHCI_TRB_3_BEI_BIT | + XHCI_TRB_3_TBC_SET(temp->tbc) | + XHCI_TRB_3_TLBPC_SET(temp->tlbpc); + if (temp->direction == UE_DIR_IN) + dword |= XHCI_TRB_3_DIR_IN | XHCI_TRB_3_ISP_BIT; + break; } - td->td_trb[x].dwTrb3 = htole32(dword); average -= buf_res.length; @@ -1773,9 +1801,14 @@ restart: goto restart; } - /* remove cycle bit from first if we are stepping the TRBs */ - if (temp->step_td) - td->td_trb[0].dwTrb3 &= ~htole32(XHCI_TRB_3_CYCLE_BIT); + /* + * Remove cycle bit from the first TRB if we are + * stepping them: + */ + if (temp->step_td != 0) { + td_first->td_trb[0].dwTrb3 &= ~htole32(XHCI_TRB_3_CYCLE_BIT); + usb_pc_cpu_flush(td_first->page_cache); + } /* remove chain bit because this is the last TRB in the chain */ td->td_trb[td->ntrb - 1].dwTrb2 &= ~htole32(XHCI_TRB_2_TDSZ_SET(15)); @@ -2601,6 +2634,7 @@ xhci_transfer_insert(struct usb_xfer *xf { struct xhci_td *td_first; struct xhci_td *td_last; + struct xhci_trb *trb_link; struct xhci_endpoint_ext *pepext; uint64_t addr; uint8_t i; @@ -2666,11 +2700,15 @@ xhci_transfer_insert(struct usb_xfer *xf /* compute terminating return address */ addr += inext * sizeof(struct xhci_trb); + /* compute link TRB pointer */ + trb_link = td_last->td_trb + td_last->ntrb; + /* update next pointer of last link TRB */ - td_last->td_trb[td_last->ntrb].qwTrb0 = htole64(addr); - td_last->td_trb[td_last->ntrb].dwTrb2 = htole32(XHCI_TRB_2_IRQ_SET(0)); - td_last->td_trb[td_last->ntrb].dwTrb3 = htole32(XHCI_TRB_3_IOC_BIT | - XHCI_TRB_3_CYCLE_BIT | XHCI_TRB_3_TYPE_SET(XHCI_TRB_TYPE_LINK)); + trb_link->qwTrb0 = htole64(addr); + trb_link->dwTrb2 = htole32(XHCI_TRB_2_IRQ_SET(0)); + trb_link->dwTrb3 = htole32(XHCI_TRB_3_IOC_BIT | + XHCI_TRB_3_CYCLE_BIT | + XHCI_TRB_3_TYPE_SET(XHCI_TRB_TYPE_LINK)); #ifdef USB_DEBUG xhci_dump_trb(&td_last->td_trb[td_last->ntrb]); Modified: stable/8/sys/dev/usb/controller/xhcireg.h ============================================================================== --- stable/8/sys/dev/usb/controller/xhcireg.h Tue Jun 11 06:18:51 2013 (r251614) +++ stable/8/sys/dev/usb/controller/xhcireg.h Tue Jun 11 06:22:09 2013 (r251615) @@ -166,7 +166,7 @@ #define XHCI_IMOD_IVAL_SET(x) (((x) & 0xFFFF) << 0) /* 250ns unit */ #define XHCI_IMOD_ICNT_GET(x) (((x) >> 16) & 0xFFFF) /* 250ns unit */ #define XHCI_IMOD_ICNT_SET(x) (((x) & 0xFFFF) << 16) /* 250ns unit */ -#define XHCI_IMOD_DEFAULT 0x000001F4U /* 8000 IRQ/second */ +#define XHCI_IMOD_DEFAULT 0x000003E8U /* 8000 IRQ/second */ #define XHCI_ERSTSZ(n) (0x0028 + (0x20 * (n))) /* XHCI event ring segment table size */ #define XHCI_ERSTS_GET(x) ((x) & 0xFFFF) #define XHCI_ERSTS_SET(x) ((x) & 0xFFFF) From owner-svn-src-stable@FreeBSD.ORG Tue Jun 11 06:48:02 2013 Return-Path: Delivered-To: svn-src-stable@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by hub.freebsd.org (Postfix) with ESMTP id 05466130; Tue, 11 Jun 2013 06:48:02 +0000 (UTC) (envelope-from hps@bitfrost.no) Received: from mta.bitpro.no (mta.bitpro.no [92.42.64.202]) by mx1.freebsd.org (Postfix) with ESMTP id BDA1C1EA1; Tue, 11 Jun 2013 06:47:58 +0000 (UTC) Received: from mail.bitfrost.no (mail.bitfrost.no [46.29.221.36]) by mta.bitpro.no (Postfix) with ESMTP id B4A5D7A0D9; Tue, 11 Jun 2013 08:47:57 +0200 (CEST) X-Virus-Scanned: Debian amavisd-new at bitfrost.no Received: from laptop015.hselasky.homeunix.org (cm-176.74.213.204.customer.telag.net [176.74.213.204]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (No client certificate requested) (Authenticated sender: hanspetter) by mail.bitfrost.no (Postfix) with ESMTPSA id 1AE2220D1C; Tue, 11 Jun 2013 08:47:54 +0200 (CEST) Message-ID: <51B6C86E.3090102@bitfrost.no> Date: Tue, 11 Jun 2013 08:49:18 +0200 From: Hans Petter Selasky Organization: Bitfrost A/S MIME-Version: 1.0 Subject: Re: svn commit: r251614 - stable/9/sys/dev/usb/controller References: <201306110618.r5B6IqB6005901@svn.freebsd.org> In-Reply-To: <201306110618.r5B6IqB6005901@svn.freebsd.org> Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit Cc: svn-src-stable@freebsd.org, svn-src-all@freebsd.org, src-committers@freebsd.org, svn-src-stable-9@freebsd.org X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 11 Jun 2013 06:48:02 -0000 On 06/11/13 08:18, Hans Petter Selasky wrote: > Author: hselasky > Date: Tue Jun 11 06:18:51 2013 > New Revision: 251614 > URL: http://svnweb.freebsd.org/changeset/base/251614 > > Log: > MFC r251249, r251251, r251252, r2512, r251254 and r251515: ^^53. C&P error. > Correct XHCI DMA descriptor programming. > Correct maximum IRQ rate. From owner-svn-src-stable@FreeBSD.ORG Tue Jun 11 23:19:06 2013 Return-Path: Delivered-To: svn-src-stable@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [8.8.178.115]) by hub.freebsd.org (Postfix) with ESMTP id 3849293D; Tue, 11 Jun 2013 23:19:06 +0000 (UTC) (envelope-from ken@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) by mx1.freebsd.org (Postfix) with ESMTP id 28673136F; Tue, 11 Jun 2013 23:19:06 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.7/8.14.7) with ESMTP id r5BNJ6Gc036172; Tue, 11 Jun 2013 23:19:06 GMT (envelope-from ken@svn.freebsd.org) Received: (from ken@localhost) by svn.freebsd.org (8.14.7/8.14.5/Submit) id r5BNJ2Dn036152; Tue, 11 Jun 2013 23:19:02 GMT (envelope-from ken@svn.freebsd.org) Message-Id: <201306112319.r5BNJ2Dn036152@svn.freebsd.org> From: "Kenneth D. Merry" Date: Tue, 11 Jun 2013 23:19:02 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-9@freebsd.org Subject: svn commit: r251641 - in stable/9/sys: conf fs/nfs fs/nfsclient fs/nfsserver modules/nfsd modules/nfsserver nfs nfsserver X-SVN-Group: stable-9 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 11 Jun 2013 23:19:06 -0000 Author: ken Date: Tue Jun 11 23:19:02 2013 New Revision: 251641 URL: http://svnweb.freebsd.org/changeset/base/251641 Log: MFC NFS FHA changes 249592 and 249596: ------------------------------------------------------------------------ r249592 | ken | 2013-04-17 15:00:22 -0600 (Wed, 17 Apr 2013) | 180 lines Revamp the old NFS server's File Handle Affinity (FHA) code so that it will work with either the old or new server. The FHA code keeps a cache of currently active file handles for NFSv2 and v3 requests, so that read and write requests for the same file are directed to the same group of threads (reads) or thread (writes). It does not currently work for NFSv4 requests. They are more complex, and will take more work to support. This improves read-ahead performance, especially with ZFS, if the FHA tuning parameters are configured appropriately. Without the FHA code, concurrent reads that are part of a sequential read from a file will be directed to separate NFS threads. This has the effect of confusing the ZFS zfetch (prefetch) code and makes sequential reads significantly slower with clients like Linux that do a lot of prefetching. The FHA code has also been updated to direct write requests to nearby file offsets to the same thread in the same way it batches reads, and the FHA code will now also send writes to multiple threads when needed. This improves sequential write performance in ZFS, because writes to a file are now more ordered. Since NFS writes (generally less than 64K) are smaller than the typical ZFS record size (usually 128K), out of order NFS writes to the same block can trigger a read in ZFS. Sending them down the same thread increases the odds of their being in order. In order for multiple write threads per file in the FHA code to be useful, writes in the NFS server have been changed to use a LK_SHARED vnode lock, and upgrade that to LK_EXCLUSIVE if the filesystem doesn't allow multiple writers to a file at once. ZFS is currently the only filesystem that allows multiple writers to a file, because it has internal file range locking. This change does not affect the NFSv4 code. This improves random write performance to a single file in ZFS, since we can now have multiple writers inside ZFS at one time. I have changed the default tuning parameters to a 22 bit (4MB) window size (from 256K) and unlimited commands per thread as a result of my benchmarking with ZFS. The FHA code has been updated to allow configuring the tuning parameters from loader tunable variables in addition to sysctl variables. The read offset window calculation has been slightly modified as well. Instead of having separate bins, each file handle has a rolling window of bin_shift size. This minimizes glitches in throughput when shifting from one bin to another. sys/conf/files: Add nfs_fha_new.c and nfs_fha_old.c. Compile nfs_fha.c when either the old or the new NFS server is built. sys/fs/nfs/nfsport.h, sys/fs/nfs/nfs_commonport.c: Bring in changes from Rick Macklem to newnfs_realign that allow it to operate in blocking (M_WAITOK) or non-blocking (M_NOWAIT) mode. sys/fs/nfs/nfs_commonsubs.c, sys/fs/nfs/nfs_var.h: Bring in a change from Rick Macklem to allow telling nfsm_dissect() whether or not to wait for mallocs. sys/fs/nfs/nfsm_subs.h: Bring in changes from Rick Macklem to create a new nfsm_dissect_nonblock() inline function and NFSM_DISSECT_NONBLOCK() macro. sys/fs/nfs/nfs_commonkrpc.c, sys/fs/nfsclient/nfs_clkrpc.c: Add the malloc wait flag to a newnfs_realign() call. sys/fs/nfsserver/nfs_nfsdkrpc.c: Setup the new NFS server's RPC thread pool so that it will call the FHA code. Add the malloc flag argument to newnfs_realign(). Unstaticize newnfs_nfsv3_procid[] so that we can use it in the FHA code. sys/fs/nfsserver/nfs_nfsdsocket.c: In nfsrvd_dorpc(), add NFSPROC_WRITE to the list of RPC types that use the LK_SHARED lock type. sys/fs/nfsserver/nfs_nfsdport.c: In nfsd_fhtovp(), if we're starting a write, check to see whether the underlying filesystem supports shared writes. If not, upgrade the lock type from LK_SHARED to LK_EXCLUSIVE. sys/nfsserver/nfs_fha.c: Remove all code that is specific to the NFS server implementation. Anything that is server-specific is now accessed through a callback supplied by that server's FHA shim in the new softc. There are now separate sysctls and tunables for the FHA implementations for the old and new NFS servers. The new NFS server has its tunables under vfs.nfsd.fha, the old NFS server's tunables are under vfs.nfsrv.fha as before. In fha_extract_info(), use callouts for all server-specific code. Getting file handles and offsets is now done in the individual server's shim module. In fha_hash_entry_choose_thread(), change the way we decide whether two reads are in proximity to each other. Previously, the calculation was a simple shift operation to see whether the offsets were in the same power of 2 bucket. The issue was that there would be a bucket (and therefore thread) transition, even if the reads were in close proximity. When there is a thread transition, reads wind up going somewhat out of order, and ZFS gets confused. The new calculation simply tries to see whether the offsets are within 1 << bin_shift of each other. If they are, the reads will be sent to the same thread. The effect of this change is that for sequential reads, if the client doesn't exceed the max_reqs_per_nfsd parameter and the bin_shift is set to a reasonable value (22, or 4MB works well in my tests), the reads in any sequential stream will largely be confined to a single thread. Change fha_assign() so that it takes a softc argument. It is now called from the individual server's shim code, which will pass in the softc. Change fhe_stats_sysctl() so that it takes a softc parameter. It is now called from the individual server's shim code. Add the current offset to the list of things printed out about each active thread. Change the num_reads and num_writes counters in the fha_hash_entry structure to 32-bit values, and rename them num_rw and num_exclusive, respectively, to reflect their changed usage. Add an enable sysctl and tunable that allows the user to disable the FHA code (when vfs.XXX.fha.enable = 0). This is useful for before/after performance comparisons. nfs_fha.h: Move most structure definitions out of nfs_fha.c and into the header file, so that the individual server shims can see them. Change the default bin_shift to 22 (4MB) instead of 18 (256K). Allow unlimited commands per thread. sys/nfsserver/nfs_fha_old.c, sys/nfsserver/nfs_fha_old.h, sys/fs/nfsserver/nfs_fha_new.c, sys/fs/nfsserver/nfs_fha_new.h: Add shims for the old and new NFS servers to interface with the FHA code, and callbacks for the The shims contain all of the code and definitions that are specific to the NFS servers. They setup the server-specific callbacks and set the server name for the sysctl and loader tunable variables. sys/nfsserver/nfs_srvkrpc.c: Configure the RPC code to call fhaold_assign() instead of fha_assign(). sys/modules/nfsd/Makefile: Add nfs_fha.c and nfs_fha_new.c. sys/modules/nfsserver/Makefile: Add nfs_fha_old.c. Reviewed by: rmacklem Sponsored by: Spectra Logic ------------------------------------------------------------------------ r249596 | ken | 2013-04-17 16:42:43 -0600 (Wed, 17 Apr 2013) | 7 lines Move the NFS FHA (File Handle Affinity) code from sys/nfsserver to sys/nfs, since it is now shared by the two NFS servers. Suggested by: rmacklem Sponsored by: Spectra Logic ------------------------------------------------------------------------ Sponsored by: Spectra Logic Added: stable/9/sys/fs/nfsserver/nfs_fha_new.c - copied, changed from r249592, head/sys/fs/nfsserver/nfs_fha_new.c stable/9/sys/fs/nfsserver/nfs_fha_new.h - copied unchanged from r249592, head/sys/fs/nfsserver/nfs_fha_new.h stable/9/sys/nfs/nfs_fha.c - copied unchanged from r249596, head/sys/nfs/nfs_fha.c stable/9/sys/nfs/nfs_fha.h - copied unchanged from r249596, head/sys/nfs/nfs_fha.h stable/9/sys/nfsserver/nfs_fha_old.c - copied, changed from r249592, head/sys/nfsserver/nfs_fha_old.c stable/9/sys/nfsserver/nfs_fha_old.h - copied unchanged from r249592, head/sys/nfsserver/nfs_fha_old.h Deleted: stable/9/sys/nfsserver/nfs_fha.c stable/9/sys/nfsserver/nfs_fha.h Modified: stable/9/sys/conf/files stable/9/sys/fs/nfs/nfs_commonkrpc.c stable/9/sys/fs/nfs/nfs_commonport.c stable/9/sys/fs/nfs/nfs_commonsubs.c stable/9/sys/fs/nfs/nfs_var.h stable/9/sys/fs/nfs/nfsm_subs.h stable/9/sys/fs/nfs/nfsport.h stable/9/sys/fs/nfsclient/nfs_clkrpc.c stable/9/sys/fs/nfsserver/nfs_nfsdkrpc.c stable/9/sys/fs/nfsserver/nfs_nfsdport.c stable/9/sys/fs/nfsserver/nfs_nfsdsocket.c stable/9/sys/modules/nfsd/Makefile stable/9/sys/modules/nfsserver/Makefile stable/9/sys/nfsserver/nfs_srvkrpc.c Directory Properties: stable/9/sys/ (props changed) stable/9/sys/conf/ (props changed) stable/9/sys/fs/ (props changed) stable/9/sys/modules/ (props changed) Modified: stable/9/sys/conf/files ============================================================================== --- stable/9/sys/conf/files Tue Jun 11 21:47:16 2013 (r251640) +++ stable/9/sys/conf/files Tue Jun 11 23:19:02 2013 (r251641) @@ -2169,6 +2169,7 @@ fs/nfsclient/nfs_clvfsops.c optional nfs fs/nfsclient/nfs_clport.c optional nfscl fs/nfsclient/nfs_clbio.c optional nfscl fs/nfsclient/nfs_clnfsiod.c optional nfscl +fs/nfsserver/nfs_fha_new.c optional nfsd inet fs/nfsserver/nfs_nfsdsocket.c optional nfsd inet fs/nfsserver/nfs_nfsdsubs.c optional nfsd inet fs/nfsserver/nfs_nfsdstate.c optional nfsd inet @@ -2991,6 +2992,7 @@ nfs/bootp_subr.c optional bootp nfsclie nfs/krpc_subr.c optional bootp nfsclient | bootp nfscl nfs/nfs_common.c optional nfsclient | nfsserver nfs/nfs_diskless.c optional nfsclient nfs_root | nfscl nfs_root +nfs/nfs_fha.c optional nfsserver | nfsd nfs/nfs_lock.c optional nfsclient | nfscl | nfslockd | nfsd nfsclient/nfs_bio.c optional nfsclient nfsclient/nfs_node.c optional nfsclient @@ -2999,7 +3001,7 @@ nfsclient/nfs_subs.c optional nfsclient nfsclient/nfs_nfsiod.c optional nfsclient nfsclient/nfs_vfsops.c optional nfsclient nfsclient/nfs_vnops.c optional nfsclient -nfsserver/nfs_fha.c optional nfsserver +nfsserver/nfs_fha_old.c optional nfsserver nfsserver/nfs_serv.c optional nfsserver nfsserver/nfs_srvkrpc.c optional nfsserver nfsserver/nfs_srvsubs.c optional nfsserver Modified: stable/9/sys/fs/nfs/nfs_commonkrpc.c ============================================================================== --- stable/9/sys/fs/nfs/nfs_commonkrpc.c Tue Jun 11 21:47:16 2013 (r251640) +++ stable/9/sys/fs/nfs/nfs_commonkrpc.c Tue Jun 11 23:19:02 2013 (r251641) @@ -771,7 +771,7 @@ tryagain: * These could cause pointer alignment problems, so copy them to * well aligned mbufs. */ - newnfs_realign(&nd->nd_mrep); + newnfs_realign(&nd->nd_mrep, M_WAITOK); nd->nd_md = nd->nd_mrep; nd->nd_dpos = NFSMTOD(nd->nd_md, caddr_t); nd->nd_repstat = 0; Modified: stable/9/sys/fs/nfs/nfs_commonport.c ============================================================================== --- stable/9/sys/fs/nfs/nfs_commonport.c Tue Jun 11 21:47:16 2013 (r251640) +++ stable/9/sys/fs/nfs/nfs_commonport.c Tue Jun 11 23:19:02 2013 (r251641) @@ -126,11 +126,11 @@ static int nfssvc_call(struct thread *, /* * These architectures don't need re-alignment, so just return. */ -void -newnfs_realign(struct mbuf **pm) +int +newnfs_realign(struct mbuf **pm, int how) { - return; + return (0); } #else /* !__NO_STRICT_ALIGNMENT */ /* @@ -149,8 +149,8 @@ newnfs_realign(struct mbuf **pm) * with TCP. Use vfs.nfs.realign_count and realign_test to check this. * */ -void -newnfs_realign(struct mbuf **pm) +int +newnfs_realign(struct mbuf **pm, int how) { struct mbuf *m, *n; int off, space; @@ -167,11 +167,11 @@ newnfs_realign(struct mbuf **pm) space = m_length(m, NULL); if (space >= MINCLSIZE) { /* NB: m_copyback handles space > MCLBYTES */ - n = m_getcl(M_WAITOK, MT_DATA, 0); + n = m_getcl(how, MT_DATA, 0); } else - n = m_get(M_WAITOK, MT_DATA); + n = m_get(how, MT_DATA); if (n == NULL) - return; + return (ENOMEM); /* * Align the remainder of the mbuf chain. */ @@ -189,6 +189,8 @@ newnfs_realign(struct mbuf **pm) } pm = &m->m_next; } + + return (0); } #endif /* __NO_STRICT_ALIGNMENT */ Modified: stable/9/sys/fs/nfs/nfs_commonsubs.c ============================================================================== --- stable/9/sys/fs/nfs/nfs_commonsubs.c Tue Jun 11 21:47:16 2013 (r251640) +++ stable/9/sys/fs/nfs/nfs_commonsubs.c Tue Jun 11 23:19:02 2013 (r251641) @@ -252,7 +252,7 @@ out: * cases. */ APPLESTATIC void * -nfsm_dissct(struct nfsrv_descript *nd, int siz) +nfsm_dissct(struct nfsrv_descript *nd, int siz, int how) { mbuf_t mp2; int siz2, xfer; @@ -277,7 +277,9 @@ nfsm_dissct(struct nfsrv_descript *nd, i } else if (siz > ncl_mbuf_mhlen) { panic("nfs S too big"); } else { - NFSMGET(mp2); + MGET(mp2, MT_DATA, how); + if (mp2 == NULL) + return (NULL); mbuf_setnext(mp2, mbuf_next(nd->nd_md)); mbuf_setnext(nd->nd_md, mp2); mbuf_setlen(nd->nd_md, mbuf_len(nd->nd_md) - left); Modified: stable/9/sys/fs/nfs/nfs_var.h ============================================================================== --- stable/9/sys/fs/nfs/nfs_var.h Tue Jun 11 21:47:16 2013 (r251640) +++ stable/9/sys/fs/nfs/nfs_var.h Tue Jun 11 23:19:02 2013 (r251641) @@ -232,7 +232,7 @@ int nfsm_strtom(struct nfsrv_descript *, int nfsm_mbufuio(struct nfsrv_descript *, struct uio *, int); int nfsm_fhtom(struct nfsrv_descript *, u_int8_t *, int, int); int nfsm_advance(struct nfsrv_descript *, int, int); -void *nfsm_dissct(struct nfsrv_descript *, int); +void *nfsm_dissct(struct nfsrv_descript *, int, int); void newnfs_trimleading(struct nfsrv_descript *); void newnfs_trimtrailing(struct nfsrv_descript *, mbuf_t, caddr_t); Modified: stable/9/sys/fs/nfs/nfsm_subs.h ============================================================================== --- stable/9/sys/fs/nfs/nfsm_subs.h Tue Jun 11 21:47:16 2013 (r251640) +++ stable/9/sys/fs/nfs/nfsm_subs.h Tue Jun 11 23:19:02 2013 (r251641) @@ -100,7 +100,23 @@ nfsm_dissect(struct nfsrv_descript *nd, retp = (void *)nd->nd_dpos; nd->nd_dpos += siz; } else { - retp = nfsm_dissct(nd, siz); + retp = nfsm_dissct(nd, siz, M_WAITOK); + } + return (retp); +} + +static __inline void * +nfsm_dissect_nonblock(struct nfsrv_descript *nd, int siz) +{ + int tt1; + void *retp; + + tt1 = NFSMTOD(nd->nd_md, caddr_t) + nd->nd_md->m_len - nd->nd_dpos; + if (tt1 >= siz) { + retp = (void *)nd->nd_dpos; + nd->nd_dpos += siz; + } else { + retp = nfsm_dissct(nd, siz, M_NOWAIT); } return (retp); } @@ -113,6 +129,15 @@ nfsm_dissect(struct nfsrv_descript *nd, goto nfsmout; \ } \ } while (0) + +#define NFSM_DISSECT_NONBLOCK(a, c, s) \ + do { \ + (a) = (c)nfsm_dissect_nonblock(nd, (s)); \ + if ((a) == NULL) { \ + error = EBADRPC; \ + goto nfsmout; \ + } \ + } while (0) #endif /* !APPLE */ #define NFSM_STRSIZ(s, m) \ Modified: stable/9/sys/fs/nfs/nfsport.h ============================================================================== --- stable/9/sys/fs/nfs/nfsport.h Tue Jun 11 21:47:16 2013 (r251640) +++ stable/9/sys/fs/nfs/nfsport.h Tue Jun 11 23:19:02 2013 (r251641) @@ -730,7 +730,7 @@ MALLOC_DECLARE(M_NEWNFSDROLLBACK); */ int nfscl_loadattrcache(struct vnode **, struct nfsvattr *, void *, void *, int, int); -void newnfs_realign(struct mbuf **); +int newnfs_realign(struct mbuf **, int); /* * If the port runs on an SMP box that can enforce Atomic ops with low Modified: stable/9/sys/fs/nfsclient/nfs_clkrpc.c ============================================================================== --- stable/9/sys/fs/nfsclient/nfs_clkrpc.c Tue Jun 11 21:47:16 2013 (r251640) +++ stable/9/sys/fs/nfsclient/nfs_clkrpc.c Tue Jun 11 23:19:02 2013 (r251641) @@ -82,7 +82,7 @@ nfscb_program(struct svc_req *rqst, SVCX */ nd.nd_mrep = rqst->rq_args; rqst->rq_args = NULL; - newnfs_realign(&nd.nd_mrep); + newnfs_realign(&nd.nd_mrep, M_WAITOK); nd.nd_md = nd.nd_mrep; nd.nd_dpos = mtod(nd.nd_md, caddr_t); nd.nd_nam = svc_getrpccaller(rqst); Copied and modified: stable/9/sys/fs/nfsserver/nfs_fha_new.c (from r249592, head/sys/fs/nfsserver/nfs_fha_new.c) ============================================================================== --- head/sys/fs/nfsserver/nfs_fha_new.c Wed Apr 17 21:00:22 2013 (r249592, copy source) +++ stable/9/sys/fs/nfsserver/nfs_fha_new.c Tue Jun 11 23:19:02 2013 (r251641) @@ -30,11 +30,11 @@ __FBSDID("$FreeBSD$"); #include #include +#include #include #include #include #include -#include #include static void fhanew_init(void *foo); Copied: stable/9/sys/fs/nfsserver/nfs_fha_new.h (from r249592, head/sys/fs/nfsserver/nfs_fha_new.h) ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ stable/9/sys/fs/nfsserver/nfs_fha_new.h Tue Jun 11 23:19:02 2013 (r251641, copy of r249592, head/sys/fs/nfsserver/nfs_fha_new.h) @@ -0,0 +1,39 @@ +/*- + * Copyright (c) 2008 Isilon Inc http://www.isilon.com/ + * Copyright (c) 2013 Spectra Logic Corporation + * + * + * 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$ */ + +#ifndef _NFS_FHA_NEW_H +#define _NFS_FHA_NEW_H 1 + +#ifdef _KERNEL + +#define FHANEW_SERVER_NAME "nfsd" + +SVCTHREAD *fhanew_assign(SVCTHREAD *this_thread, struct svc_req *req); +#endif /* _KERNEL */ + +#endif /* _NFS_FHA_NEW_H */ Modified: stable/9/sys/fs/nfsserver/nfs_nfsdkrpc.c ============================================================================== --- stable/9/sys/fs/nfsserver/nfs_nfsdkrpc.c Tue Jun 11 21:47:16 2013 (r251640) +++ stable/9/sys/fs/nfsserver/nfs_nfsdkrpc.c Tue Jun 11 23:19:02 2013 (r251641) @@ -42,6 +42,9 @@ __FBSDID("$FreeBSD$"); #include #include +#include +#include + #include NFSDLOCKMUTEX; @@ -51,7 +54,7 @@ struct nfsv4lock nfsd_suspend_lock; /* * Mapping of old NFS Version 2 RPC numbers to generic numbers. */ -static int newnfs_nfsv3_procid[NFS_V3NPROCS] = { +int newnfs_nfsv3_procid[NFS_V3NPROCS] = { NFSPROC_NULL, NFSPROC_GETATTR, NFSPROC_SETATTR, @@ -147,7 +150,7 @@ nfssvc_program(struct svc_req *rqst, SVC */ nd.nd_mrep = rqst->rq_args; rqst->rq_args = NULL; - newnfs_realign(&nd.nd_mrep); + newnfs_realign(&nd.nd_mrep, M_WAITOK); nd.nd_md = nd.nd_mrep; nd.nd_dpos = mtod(nd.nd_md, caddr_t); nd.nd_nam = svc_getrpccaller(rqst); @@ -491,8 +494,8 @@ nfsrvd_init(int terminating) nfsrvd_pool = svcpool_create("nfsd", SYSCTL_STATIC_CHILDREN(_vfs_nfsd)); nfsrvd_pool->sp_rcache = NULL; - nfsrvd_pool->sp_assign = NULL; - nfsrvd_pool->sp_done = NULL; + nfsrvd_pool->sp_assign = fhanew_assign; + nfsrvd_pool->sp_done = fha_nd_complete; NFSD_LOCK(); } Modified: stable/9/sys/fs/nfsserver/nfs_nfsdport.c ============================================================================== --- stable/9/sys/fs/nfsserver/nfs_nfsdport.c Tue Jun 11 21:47:16 2013 (r251640) +++ stable/9/sys/fs/nfsserver/nfs_nfsdport.c Tue Jun 11 23:19:02 2013 (r251641) @@ -2707,9 +2707,11 @@ nfsd_fhtovp(struct nfsrv_descript *nd, s goto out; } - if (startwrite) + if (startwrite) { vn_start_write(NULL, mpp, V_WAIT); - + if (lktype == LK_SHARED && !(MNT_SHARED_WRITES(mp))) + lktype = LK_EXCLUSIVE; + } nd->nd_repstat = nfsvno_fhtovp(mp, fhp, nd->nd_nam, lktype, vpp, exp, &credanon); vfs_unbusy(mp); Modified: stable/9/sys/fs/nfsserver/nfs_nfsdsocket.c ============================================================================== --- stable/9/sys/fs/nfsserver/nfs_nfsdsocket.c Tue Jun 11 21:47:16 2013 (r251640) +++ stable/9/sys/fs/nfsserver/nfs_nfsdsocket.c Tue Jun 11 23:19:02 2013 (r251641) @@ -379,6 +379,7 @@ nfsrvd_dorpc(struct nfsrv_descript *nd, goto out; } if (nd->nd_procnum == NFSPROC_READ || + nd->nd_procnum == NFSPROC_WRITE || nd->nd_procnum == NFSPROC_READDIR || nd->nd_procnum == NFSPROC_READLINK || nd->nd_procnum == NFSPROC_GETATTR || Modified: stable/9/sys/modules/nfsd/Makefile ============================================================================== --- stable/9/sys/modules/nfsd/Makefile Tue Jun 11 21:47:16 2013 (r251640) +++ stable/9/sys/modules/nfsd/Makefile Tue Jun 11 23:19:02 2013 (r251641) @@ -1,8 +1,10 @@ # $FreeBSD$ -.PATH: ${.CURDIR}/../../fs/nfsserver +.PATH: ${.CURDIR}/../../fs/nfsserver ${.CURDIR}/../../nfs KMOD= nfsd SRCS= vnode_if.h \ + nfs_fha.c \ + nfs_fha_new.c \ nfs_nfsdserv.c \ nfs_nfsdcache.c \ nfs_nfsdkrpc.c \ Modified: stable/9/sys/modules/nfsserver/Makefile ============================================================================== --- stable/9/sys/modules/nfsserver/Makefile Tue Jun 11 21:47:16 2013 (r251640) +++ stable/9/sys/modules/nfsserver/Makefile Tue Jun 11 23:19:02 2013 (r251641) @@ -1,9 +1,9 @@ # $FreeBSD$ -.PATH: ${.CURDIR}/../../nfsserver +.PATH: ${.CURDIR}/../../nfsserver ${.CURDIR}/../../nfs KMOD= nfsserver SRCS= vnode_if.h \ - nfs_fha.c nfs_serv.c nfs_srvkrpc.c nfs_srvsubs.c \ + nfs_fha.c nfs_fha_old.c nfs_serv.c nfs_srvkrpc.c nfs_srvsubs.c \ opt_mac.h \ opt_kgssapi.h \ opt_nfs.h Copied: stable/9/sys/nfs/nfs_fha.c (from r249596, head/sys/nfs/nfs_fha.c) ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ stable/9/sys/nfs/nfs_fha.c Tue Jun 11 23:19:02 2013 (r251641, copy of r249596, head/sys/nfs/nfs_fha.c) @@ -0,0 +1,556 @@ +/*- + * Copyright (c) 2008 Isilon Inc http://www.isilon.com/ + * + * 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 + +static MALLOC_DEFINE(M_NFS_FHA, "NFS FHA", "NFS FHA"); + +/* + * XXX need to commonize definitions between old and new NFS code. Define + * this here so we don't include one nfsproto.h over the other. + */ +#define NFS_PROG 100003 + +void +fha_init(struct fha_params *softc) +{ + char tmpstr[128]; + + /* + * A small hash table to map filehandles to fha_hash_entry + * structures. + */ + softc->g_fha.hashtable = hashinit(256, M_NFS_FHA, + &softc->g_fha.hashmask); + + /* + * Set the default tuning parameters. + */ + softc->ctls.enable = FHA_DEF_ENABLE; + softc->ctls.bin_shift = FHA_DEF_BIN_SHIFT; + softc->ctls.max_nfsds_per_fh = FHA_DEF_MAX_NFSDS_PER_FH; + softc->ctls.max_reqs_per_nfsd = FHA_DEF_MAX_REQS_PER_NFSD; + + /* + * Allow the user to override the defaults at boot time with + * tunables. + */ + snprintf(tmpstr, sizeof(tmpstr), "vfs.%s.fha.enable", + softc->server_name); + TUNABLE_INT_FETCH(tmpstr, &softc->ctls.enable); + snprintf(tmpstr, sizeof(tmpstr), "vfs.%s.fha.bin_shift", + softc->server_name); + TUNABLE_INT_FETCH(tmpstr, &softc->ctls.bin_shift); + snprintf(tmpstr, sizeof(tmpstr), "vfs.%s.fha.max_nfsds_per_fh", + softc->server_name); + TUNABLE_INT_FETCH(tmpstr, &softc->ctls.max_nfsds_per_fh); + snprintf(tmpstr, sizeof(tmpstr), "vfs.%s.fha.max_reqs_per_nfsd", + softc->server_name); + TUNABLE_INT_FETCH(tmpstr, &softc->ctls.max_reqs_per_nfsd); + + /* + * Add sysctls so the user can change the tuning parameters at + * runtime. + */ + SYSCTL_ADD_UINT(&softc->sysctl_ctx, SYSCTL_CHILDREN(softc->sysctl_tree), + OID_AUTO, "enable", CTLFLAG_RW, + &softc->ctls.enable, 0, "Enable NFS File Handle Affinity (FHA)"); + + SYSCTL_ADD_UINT(&softc->sysctl_ctx, SYSCTL_CHILDREN(softc->sysctl_tree), + OID_AUTO, "bin_shift", CTLFLAG_RW, + &softc->ctls.bin_shift, 0, "For FHA reads, no two requests will " + "contend if they're 2^(bin_shift) bytes apart"); + + SYSCTL_ADD_UINT(&softc->sysctl_ctx, SYSCTL_CHILDREN(softc->sysctl_tree), + OID_AUTO, "max_nfsds_per_fh", CTLFLAG_RW, + &softc->ctls.max_nfsds_per_fh, 0, "Maximum nfsd threads that " + "should be working on requests for the same file handle"); + + SYSCTL_ADD_UINT(&softc->sysctl_ctx, SYSCTL_CHILDREN(softc->sysctl_tree), + OID_AUTO, "max_reqs_per_nfsd", CTLFLAG_RW, + &softc->ctls.max_reqs_per_nfsd, 0, "Maximum requests that " + "single nfsd thread should be working on at any time"); + + SYSCTL_ADD_OID(&softc->sysctl_ctx, SYSCTL_CHILDREN(softc->sysctl_tree), + OID_AUTO, "fhe_stats", CTLTYPE_STRING | CTLFLAG_RD, 0, 0, + softc->callbacks.fhe_stats_sysctl, "A", ""); + +} + +void +fha_uninit(struct fha_params *softc) +{ + sysctl_ctx_free(&softc->sysctl_ctx); + hashdestroy(softc->g_fha.hashtable, M_NFS_FHA, softc->g_fha.hashmask); +} + +/* + * This just specifies that offsets should obey affinity when within + * the same 1Mbyte (1<<20) chunk for the file (reads only for now). + */ +static void +fha_extract_info(struct svc_req *req, struct fha_info *i, + struct fha_callbacks *cb) +{ + struct mbuf *md; + fhandle_t fh; + caddr_t dpos; + static u_int64_t random_fh = 0; + int error; + int v3 = (req->rq_vers == 3); + rpcproc_t procnum; + + /* + * We start off with a random fh. If we get a reasonable + * procnum, we set the fh. If there's a concept of offset + * that we're interested in, we set that. + */ + i->fh = ++random_fh; + i->offset = 0; + i->locktype = LK_EXCLUSIVE; + + /* + * Extract the procnum and convert to v3 form if necessary, + * taking care to deal with out-of-range procnums. Caller will + * ensure that rq_vers is either 2 or 3. + */ + procnum = req->rq_proc; + if (!v3) { + rpcproc_t tmp_procnum; + + tmp_procnum = cb->get_procnum(procnum); + if (tmp_procnum == -1) + goto out; + procnum = tmp_procnum; + } + + /* + * We do affinity for most. However, we divide a realm of affinity + * by file offset so as to allow for concurrent random access. We + * only do this for reads today, but this may change when IFS supports + * efficient concurrent writes. + */ + if (cb->no_offset(procnum)) + goto out; + + error = cb->realign(&req->rq_args, M_NOWAIT); + if (error) + goto out; + md = req->rq_args; + dpos = mtod(md, caddr_t); + + /* Grab the filehandle. */ + error = cb->get_fh(&fh, v3, &md, &dpos); + if (error) + goto out; + + bcopy(fh.fh_fid.fid_data, &i->fh, sizeof(i->fh)); + + /* Content ourselves with zero offset for all but reads. */ + if (cb->is_read(procnum) || cb->is_write(procnum)) + cb->get_offset(&md, &dpos, v3, i); + +out: + cb->set_locktype(procnum, i); +} + +static struct fha_hash_entry * +fha_hash_entry_new(u_int64_t fh) +{ + struct fha_hash_entry *e; + + e = malloc(sizeof(*e), M_NFS_FHA, M_WAITOK); + e->fh = fh; + e->num_rw = 0; + e->num_exclusive = 0; + e->num_threads = 0; + LIST_INIT(&e->threads); + + return (e); +} + +static void +fha_hash_entry_destroy(struct fha_hash_entry *e) +{ + + if (e->num_rw + e->num_exclusive) + panic("nonempty fhe"); + free(e, M_NFS_FHA); +} + +static void +fha_hash_entry_remove(struct fha_hash_entry *e) +{ + + LIST_REMOVE(e, link); + fha_hash_entry_destroy(e); +} + +static struct fha_hash_entry * +fha_hash_entry_lookup(struct fha_params *softc, u_int64_t fh) +{ + SVCPOOL *pool; + + pool = *softc->pool; + + struct fha_hash_entry *fhe, *new_fhe; + + LIST_FOREACH(fhe, &softc->g_fha.hashtable[fh % softc->g_fha.hashmask], + link) + if (fhe->fh == fh) + break; + + if (!fhe) { + /* Allocate a new entry. */ + mtx_unlock(&pool->sp_lock); + new_fhe = fha_hash_entry_new(fh); + mtx_lock(&pool->sp_lock); + + /* Double-check to make sure we still need the new entry. */ + LIST_FOREACH(fhe, + &softc->g_fha.hashtable[fh % softc->g_fha.hashmask], link) + if (fhe->fh == fh) + break; + if (!fhe) { + fhe = new_fhe; + LIST_INSERT_HEAD( + &softc->g_fha.hashtable[fh % softc->g_fha.hashmask], + fhe, link); + } else + fha_hash_entry_destroy(new_fhe); + } + + return (fhe); +} + +static void +fha_hash_entry_add_thread(struct fha_hash_entry *fhe, SVCTHREAD *thread) +{ + + LIST_INSERT_HEAD(&fhe->threads, thread, st_alink); + fhe->num_threads++; +} + +static void +fha_hash_entry_remove_thread(struct fha_hash_entry *fhe, SVCTHREAD *thread) +{ + + LIST_REMOVE(thread, st_alink); + fhe->num_threads--; +} + +/* + * Account for an ongoing operation associated with this file. + */ +static void +fha_hash_entry_add_op(struct fha_hash_entry *fhe, int locktype, int count) +{ + + if (LK_EXCLUSIVE == locktype) + fhe->num_exclusive += count; + else + fhe->num_rw += count; +} + +static SVCTHREAD * +get_idle_thread(SVCPOOL *pool) +{ + SVCTHREAD *st; + + LIST_FOREACH(st, &pool->sp_idlethreads, st_ilink) { + if (st->st_xprt == NULL && STAILQ_EMPTY(&st->st_reqs)) + return (st); + } + return (NULL); +} + + +/* + * Get the service thread currently associated with the fhe that is + * appropriate to handle this operation. + */ +SVCTHREAD * +fha_hash_entry_choose_thread(struct fha_params *softc, + struct fha_hash_entry *fhe, struct fha_info *i, SVCTHREAD *this_thread); + +SVCTHREAD * +fha_hash_entry_choose_thread(struct fha_params *softc, + struct fha_hash_entry *fhe, struct fha_info *i, SVCTHREAD *this_thread) +{ + SVCTHREAD *thread, *min_thread = NULL; + SVCPOOL *pool; + int req_count, min_count = 0; + off_t offset1, offset2; + + pool = *softc->pool; + + LIST_FOREACH(thread, &fhe->threads, st_alink) { + req_count = thread->st_reqcount; + + /* If there are any writes in progress, use the first thread. */ + if (fhe->num_exclusive) { +#if 0 + ITRACE_CURPROC(ITRACE_NFS, ITRACE_INFO, + "fha: %p(%d)w", thread, req_count); +#endif + return (thread); + } + + /* + * Check for read locality, making sure that we won't + * exceed our per-thread load limit in the process. + */ + offset1 = i->offset; + offset2 = STAILQ_FIRST(&thread->st_reqs)->rq_p3; + + if (((offset1 >= offset2) + && ((offset1 - offset2) < (1 << softc->ctls.bin_shift))) + || ((offset2 > offset1) + && ((offset2 - offset1) < (1 << softc->ctls.bin_shift)))) { + if ((softc->ctls.max_reqs_per_nfsd == 0) || + (req_count < softc->ctls.max_reqs_per_nfsd)) { +#if 0 + ITRACE_CURPROC(ITRACE_NFS, ITRACE_INFO, + "fha: %p(%d)r", thread, req_count); +#endif + return (thread); + } + } + + /* + * We don't have a locality match, so skip this thread, + * but keep track of the most attractive thread in case + * we need to come back to it later. + */ +#if 0 + ITRACE_CURPROC(ITRACE_NFS, ITRACE_INFO, + "fha: %p(%d)s off1 %llu off2 %llu", thread, + req_count, offset1, offset2); +#endif + if ((min_thread == NULL) || (req_count < min_count)) { + min_count = req_count; + min_thread = thread; + } + } + + /* + * We didn't find a good match yet. See if we can add + * a new thread to this file handle entry's thread list. + */ + if ((softc->ctls.max_nfsds_per_fh == 0) || + (fhe->num_threads < softc->ctls.max_nfsds_per_fh)) { + /* + * We can add a new thread, so try for an idle thread + * first, and fall back to this_thread if none are idle. + */ + if (STAILQ_EMPTY(&this_thread->st_reqs)) { + thread = this_thread; +#if 0 + ITRACE_CURPROC(ITRACE_NFS, ITRACE_INFO, + "fha: %p(%d)t", thread, thread->st_reqcount); +#endif + } else if ((thread = get_idle_thread(pool))) { +#if 0 + ITRACE_CURPROC(ITRACE_NFS, ITRACE_INFO, + "fha: %p(%d)i", thread, thread->st_reqcount); +#endif + } else { + thread = this_thread; +#if 0 + ITRACE_CURPROC(ITRACE_NFS, ITRACE_INFO, + "fha: %p(%d)b", thread, thread->st_reqcount); +#endif + } + fha_hash_entry_add_thread(fhe, thread); + } else { + /* + * We don't want to use any more threads for this file, so + * go back to the most attractive nfsd we're already using. + */ + thread = min_thread; + } + + return (thread); +} + +/* + * After getting a request, try to assign it to some thread. Usually we + * handle it ourselves. + */ +SVCTHREAD * +fha_assign(SVCTHREAD *this_thread, struct svc_req *req, + struct fha_params *softc) +{ + SVCPOOL *pool; + SVCTHREAD *thread; + struct fha_info i; + struct fha_hash_entry *fhe; + struct fha_callbacks *cb; + + cb = &softc->callbacks; + + /* Check to see whether we're enabled. */ + if (softc->ctls.enable == 0) + return (this_thread); + + /* + * Only do placement if this is an NFS request. + */ + if (req->rq_prog != NFS_PROG) + return (this_thread); + + if (req->rq_vers != 2 && req->rq_vers != 3) + return (this_thread); + + pool = req->rq_xprt->xp_pool; + fha_extract_info(req, &i, cb); + + /* + * We save the offset associated with this request for later + * nfsd matching. + */ + fhe = fha_hash_entry_lookup(softc, i.fh); + req->rq_p1 = fhe; + req->rq_p2 = i.locktype; + req->rq_p3 = i.offset; + + /* + * Choose a thread, taking into consideration locality, thread load, + * and the number of threads already working on this file. + */ + thread = fha_hash_entry_choose_thread(softc, fhe, &i, this_thread); + KASSERT(thread, ("fha_assign: NULL thread!")); + fha_hash_entry_add_op(fhe, i.locktype, 1); + + return (thread); +} + +/* + * Called when we're done with an operation. The request has already + * been de-queued. + */ +void +fha_nd_complete(SVCTHREAD *thread, struct svc_req *req) +{ + struct fha_hash_entry *fhe = req->rq_p1; + + /* + * This may be called for reqs that didn't go through + * fha_assign (e.g. extra NULL ops used for RPCSEC_GSS. + */ + if (!fhe) + return; + + fha_hash_entry_add_op(fhe, req->rq_p2, -1); + + if (thread->st_reqcount == 0) { + fha_hash_entry_remove_thread(fhe, thread); + if (0 == fhe->num_rw + fhe->num_exclusive) + fha_hash_entry_remove(fhe); + } +} + +int +fhe_stats_sysctl(SYSCTL_HANDLER_ARGS, struct fha_params *softc) +{ + int error, count, i; + struct sbuf sb; + struct fha_hash_entry *fhe; + bool_t first = TRUE; + SVCTHREAD *thread; + SVCPOOL *pool; + + sbuf_new(&sb, NULL, 4096, SBUF_FIXEDLEN); + + pool = NULL; + + if (!*softc->pool) { + sbuf_printf(&sb, "NFSD not running\n"); + goto out; + } + pool = *softc->pool; + + mtx_lock(&pool->sp_lock); + count = 0; + for (i = 0; i <= softc->g_fha.hashmask; i++) + if (!LIST_EMPTY(&softc->g_fha.hashtable[i])) + count++; + + if (count == 0) { + sbuf_printf(&sb, "No file handle entries.\n"); + goto out; + } + + for (i = 0; i <= softc->g_fha.hashmask; i++) { + LIST_FOREACH(fhe, &softc->g_fha.hashtable[i], link) { + sbuf_printf(&sb, "%sfhe %p: {\n", first ? "" : ", ", fhe); + + sbuf_printf(&sb, " fh: %ju\n", (uintmax_t) fhe->fh); + sbuf_printf(&sb, " num_rw: %d\n", fhe->num_rw); + sbuf_printf(&sb, " num_exclusive: %d\n", fhe->num_exclusive); + sbuf_printf(&sb, " num_threads: %d\n", fhe->num_threads); + + LIST_FOREACH(thread, &fhe->threads, st_alink) { + sbuf_printf(&sb, " thread %p offset %ju " + "(count %d)\n", thread, + STAILQ_FIRST(&thread->st_reqs)->rq_p3, + thread->st_reqcount); + } + + sbuf_printf(&sb, "}"); + first = FALSE; + + /* Limit the output. */ + if (++count > 128) { + sbuf_printf(&sb, "..."); + break; + } + } + } + + out: + if (pool) + mtx_unlock(&pool->sp_lock); + sbuf_trim(&sb); + sbuf_finish(&sb); + error = sysctl_handle_string(oidp, sbuf_data(&sb), sbuf_len(&sb), req); + sbuf_delete(&sb); + return (error); +} Copied: stable/9/sys/nfs/nfs_fha.h (from r249596, head/sys/nfs/nfs_fha.h) ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ stable/9/sys/nfs/nfs_fha.h Tue Jun 11 23:19:02 2013 (r251641, copy of r249596, head/sys/nfs/nfs_fha.h) @@ -0,0 +1,112 @@ +/*- + * Copyright (c) 2008 Isilon Inc http://www.isilon.com/ + * + * 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$ */ + +#ifndef _NFS_FHA_H +#define _NFS_FHA_H 1 + +#ifdef _KERNEL + +/* Sysctl defaults. */ +#define FHA_DEF_ENABLE 1 +#define FHA_DEF_BIN_SHIFT 22 /* 4MB */ +#define FHA_DEF_MAX_NFSDS_PER_FH 8 +#define FHA_DEF_MAX_REQS_PER_NFSD 0 /* Unlimited */ + +/* This is the global structure that represents the state of the fha system. */ +struct fha_global { + struct fha_hash_entry_list *hashtable; + u_long hashmask; +}; + +struct fha_ctls { + int enable; + uint32_t bin_shift; + uint32_t max_nfsds_per_fh; + uint32_t max_reqs_per_nfsd; +}; + +/* + * These are the entries in the filehandle hash. They talk about a specific + * file, requests against which are being handled by one or more nfsds. We + * keep a chain of nfsds against the file. We only have more than one if reads + * are ongoing, and then only if the reads affect disparate regions of the + * file. + * + * In general, we want to assign a new request to an existing nfsd if it is + * going to contend with work happening already on that nfsd, or if the + * operation is a read and the nfsd is already handling a proximate read. We + * do this to avoid jumping around in the read stream unnecessarily, and to + * avoid contention between threads over single files. + */ +struct fha_hash_entry { + LIST_ENTRY(fha_hash_entry) link; + u_int64_t fh; + u_int32_t num_rw; + u_int32_t num_exclusive; + u_int8_t num_threads; + struct svcthread_list threads; +}; + +LIST_HEAD(fha_hash_entry_list, fha_hash_entry); + +/* A structure used for passing around data internally. */ +struct fha_info { + u_int64_t fh; + off_t offset; + int locktype; +}; + +struct fha_callbacks { + rpcproc_t (*get_procnum)(rpcproc_t procnum); + int (*realign)(struct mbuf **mb, int malloc_flags); + int (*get_fh)(fhandle_t *fh, int v3, struct mbuf **md, caddr_t *dpos); + int (*is_read)(rpcproc_t procnum); + int (*is_write)(rpcproc_t procnum); + int (*get_offset)(struct mbuf **md, caddr_t *dpos, int v3, struct + fha_info *info); + int (*no_offset)(rpcproc_t procnum); + void (*set_locktype)(rpcproc_t procnum, struct fha_info *info); + int (*fhe_stats_sysctl)(SYSCTL_HANDLER_ARGS); +}; + +struct fha_params { + struct fha_global g_fha; + struct sysctl_ctx_list sysctl_ctx; + struct sysctl_oid *sysctl_tree; *** DIFF OUTPUT TRUNCATED AT 1000 LINES *** From owner-svn-src-stable@FreeBSD.ORG Wed Jun 12 00:33:31 2013 Return-Path: Delivered-To: svn-src-stable@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [8.8.178.115]) by hub.freebsd.org (Postfix) with ESMTP id 58A02249; Wed, 12 Jun 2013 00:33:31 +0000 (UTC) (envelope-from delphij@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) by mx1.freebsd.org (Postfix) with ESMTP id 4A8FE1734; Wed, 12 Jun 2013 00:33:31 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.7/8.14.7) with ESMTP id r5C0XV1C060199; Wed, 12 Jun 2013 00:33:31 GMT (envelope-from delphij@svn.freebsd.org) Received: (from delphij@localhost) by svn.freebsd.org (8.14.7/8.14.5/Submit) id r5C0XVp1060198; Wed, 12 Jun 2013 00:33:31 GMT (envelope-from delphij@svn.freebsd.org) Message-Id: <201306120033.r5C0XVp1060198@svn.freebsd.org> From: Xin LI Date: Wed, 12 Jun 2013 00:33:31 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-9@freebsd.org Subject: svn commit: r251642 - stable/9/rescue/rescue X-SVN-Group: stable-9 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 12 Jun 2013 00:33:31 -0000 Author: delphij Date: Wed Jun 12 00:33:30 2013 New Revision: 251642 URL: http://svnweb.freebsd.org/changeset/base/251642 Log: MFC r250626: Add less to rescue build. Modified: stable/9/rescue/rescue/Makefile Directory Properties: stable/9/rescue/rescue/ (props changed) Modified: stable/9/rescue/rescue/Makefile ============================================================================== --- stable/9/rescue/rescue/Makefile Tue Jun 11 23:19:02 2013 (r251641) +++ stable/9/rescue/rescue/Makefile Wed Jun 12 00:33:30 2013 (r251642) @@ -190,6 +190,9 @@ CRUNCH_PROGS_usr.bin+= bzip2 CRUNCH_ALIAS_bzip2= bunzip2 bzcat CRUNCH_LIBS+= -lbz2 +CRUNCH_PROGS_usr.bin+= less +CRUNCH_ALIAS_less= more + CRUNCH_PROGS_usr.bin+= xz CRUNCH_ALIAS_xz= unxz lzma unlzma xzcat lzcat CRUNCH_LIBS+= -llzma From owner-svn-src-stable@FreeBSD.ORG Wed Jun 12 07:04:27 2013 Return-Path: Delivered-To: svn-src-stable@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by hub.freebsd.org (Postfix) with ESMTP id BDCD5524; Wed, 12 Jun 2013 07:04:27 +0000 (UTC) (envelope-from dim@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) by mx1.freebsd.org (Postfix) with ESMTP id 9F7B2145E; Wed, 12 Jun 2013 07:04:27 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.7/8.14.7) with ESMTP id r5C74RqV083344; Wed, 12 Jun 2013 07:04:27 GMT (envelope-from dim@svn.freebsd.org) Received: (from dim@localhost) by svn.freebsd.org (8.14.7/8.14.5/Submit) id r5C74RXI083343; Wed, 12 Jun 2013 07:04:27 GMT (envelope-from dim@svn.freebsd.org) Message-Id: <201306120704.r5C74RXI083343@svn.freebsd.org> From: Dimitry Andric Date: Wed, 12 Jun 2013 07:04:27 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-9@freebsd.org Subject: svn commit: r251645 - stable/9/contrib/llvm/lib/CodeGen/AsmPrinter X-SVN-Group: stable-9 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 12 Jun 2013 07:04:27 -0000 Author: dim Date: Wed Jun 12 07:04:27 2013 New Revision: 251645 URL: http://svnweb.freebsd.org/changeset/base/251645 Log: MFC r251431: Pull in r183297 from upstream llvm trunk: PR15662: Optimized debug info produces out of order function parameters When a function is inlined we lazily construct the variables representing the function's parameters. After that, we add any remaining unused parameters. If the function doesn't use all the parameters, or uses them out of order, then the DWARF would produce them in that order, producing a parameter order that doesn't match the source. This fix causes us to always keep the arg variables at the start of the variable list & in the original order from the source. Reported by: avg Modified: stable/9/contrib/llvm/lib/CodeGen/AsmPrinter/DwarfDebug.cpp Directory Properties: stable/9/contrib/llvm/ (props changed) Modified: stable/9/contrib/llvm/lib/CodeGen/AsmPrinter/DwarfDebug.cpp ============================================================================== --- stable/9/contrib/llvm/lib/CodeGen/AsmPrinter/DwarfDebug.cpp Wed Jun 12 06:56:15 2013 (r251644) +++ stable/9/contrib/llvm/lib/CodeGen/AsmPrinter/DwarfDebug.cpp Wed Jun 12 07:04:27 2013 (r251645) @@ -1447,9 +1447,37 @@ void DwarfDebug::beginFunction(const Mac } void DwarfDebug::addScopeVariable(LexicalScope *LS, DbgVariable *Var) { -// SmallVector &Vars = ScopeVariables.lookup(LS); - ScopeVariables[LS].push_back(Var); -// Vars.push_back(Var); + SmallVectorImpl &Vars = ScopeVariables[LS]; + DIVariable DV = Var->getVariable(); + if (DV.getTag() == dwarf::DW_TAG_arg_variable) { + DISubprogram Ctxt(DV.getContext()); + DIArray Variables = Ctxt.getVariables(); + // If the variable is a parameter (arg_variable) and this is an optimized + // build (the subprogram has a 'variables' list) make sure we keep the + // parameters in order. Otherwise we would produce an incorrect function + // type with parameters out of order if function parameters were used out of + // order or unused (see the call to addScopeVariable in endFunction where + // the remaining unused variables (including parameters) are added). + if (unsigned NumVariables = Variables.getNumElements()) { + // Keep the parameters at the start of the variables list. Search through + // current variable list (Vars) and the full function variable list in + // lock-step looking for this parameter in the full list to find the + // insertion point. + SmallVectorImpl::iterator I = Vars.begin(); + unsigned j = 0; + while (I != Vars.end() && j != NumVariables && + Variables.getElement(j) != DV && + (*I)->getVariable().getTag() == dwarf::DW_TAG_arg_variable) { + if (Variables.getElement(j) == (*I)->getVariable()) + ++I; + ++j; + } + Vars.insert(I, Var); + return; + } + } + + Vars.push_back(Var); } /// endFunction - Gather and emit post-function debug information. From owner-svn-src-stable@FreeBSD.ORG Wed Jun 12 13:17:44 2013 Return-Path: Delivered-To: svn-src-stable@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [8.8.178.115]) by hub.freebsd.org (Postfix) with ESMTP id 6C8D8A10; Wed, 12 Jun 2013 13:17:44 +0000 (UTC) (envelope-from gjb@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) by mx1.freebsd.org (Postfix) with ESMTP id 5EEFA1BD2; Wed, 12 Jun 2013 13:17:44 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.7/8.14.7) with ESMTP id r5CDHiBv001400; Wed, 12 Jun 2013 13:17:44 GMT (envelope-from gjb@svn.freebsd.org) Received: (from gjb@localhost) by svn.freebsd.org (8.14.7/8.14.5/Submit) id r5CDHiak001397; Wed, 12 Jun 2013 13:17:44 GMT (envelope-from gjb@svn.freebsd.org) Message-Id: <201306121317.r5CDHiak001397@svn.freebsd.org> From: Glen Barber Date: Wed, 12 Jun 2013 13:17:44 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-9@freebsd.org Subject: svn commit: r251653 - stable/9 X-SVN-Group: stable-9 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 12 Jun 2013 13:17:44 -0000 Author: gjb Date: Wed Jun 12 13:17:43 2013 New Revision: 251653 URL: http://svnweb.freebsd.org/changeset/base/251653 Log: MFC r240403 (obrien): Not all Pmake derivatives silently handle empty shell output, so ensure there is something for make(1) to consume. Bmake gives output such as: "warning: Couldn't read shell's output for "/bin/sh -c true" Approved by: kib (mentor) Modified: stable/9/Makefile (contents, props changed) stable/9/Makefile.inc1 (contents, props changed) Modified: stable/9/Makefile ============================================================================== --- stable/9/Makefile Wed Jun 12 13:15:28 2013 (r251652) +++ stable/9/Makefile Wed Jun 12 13:17:43 2013 (r251653) @@ -216,7 +216,7 @@ ${TGTS}: .MAIN: all STARTTIME!= LC_ALL=C date -CHECK_TIME!= find ${.CURDIR}/sys/sys/param.h -mtime -0s +CHECK_TIME!= find ${.CURDIR}/sys/sys/param.h -mtime -0s ; echo .if !empty(CHECK_TIME) .error check your date/time: ${STARTTIME} .endif Modified: stable/9/Makefile.inc1 ============================================================================== --- stable/9/Makefile.inc1 Wed Jun 12 13:15:28 2013 (r251652) +++ stable/9/Makefile.inc1 Wed Jun 12 13:17:43 2013 (r251653) @@ -1658,7 +1658,7 @@ DTBOUTPUTPATH= ${KRNLOBJDIR}/${KERNCONF} .if !defined(FDT_DTS_FILE) || empty(FDT_DTS_FILE) .if exists(${KERNCONFDIR}/${KERNCONF}) FDT_DTS_FILE!= awk 'BEGIN {FS="="} /^makeoptions[[:space:]]+FDT_DTS_FILE/ {print $$2}' \ - ${KERNCONFDIR}/${KERNCONF} + ${KERNCONFDIR}/${KERNCONF} ; echo .endif .endif From owner-svn-src-stable@FreeBSD.ORG Wed Jun 12 19:04:09 2013 Return-Path: Delivered-To: svn-src-stable@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by hub.freebsd.org (Postfix) with ESMTP id F29D4387; Wed, 12 Jun 2013 19:04:08 +0000 (UTC) (envelope-from asomers@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) by mx1.freebsd.org (Postfix) with ESMTP id E49701B9E; Wed, 12 Jun 2013 19:04:08 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.7/8.14.7) with ESMTP id r5CJ48EG013112; Wed, 12 Jun 2013 19:04:08 GMT (envelope-from asomers@svn.freebsd.org) Received: (from asomers@localhost) by svn.freebsd.org (8.14.7/8.14.5/Submit) id r5CJ48Pg013111; Wed, 12 Jun 2013 19:04:08 GMT (envelope-from asomers@svn.freebsd.org) Message-Id: <201306121904.r5CJ48Pg013111@svn.freebsd.org> From: Alan Somers Date: Wed, 12 Jun 2013 19:04:08 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-9@freebsd.org Subject: svn commit: r251663 - stable/9/etc/rc.d X-SVN-Group: stable-9 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 12 Jun 2013 19:04:09 -0000 Author: asomers Date: Wed Jun 12 19:04:08 2013 New Revision: 251663 URL: http://svnweb.freebsd.org/changeset/base/251663 Log: MFC r250617 etc/rc.d/syslogd Add netif as a requirement of syslogd to get lo0 up. Currently, this doesn't affect the rc order, because mountcritremote already depends on netif. Reviewed by: eadler Approved by: ken (mentor) Modified: stable/9/etc/rc.d/syslogd Directory Properties: stable/9/etc/ (props changed) stable/9/etc/rc.d/ (props changed) Modified: stable/9/etc/rc.d/syslogd ============================================================================== --- stable/9/etc/rc.d/syslogd Wed Jun 12 18:48:53 2013 (r251662) +++ stable/9/etc/rc.d/syslogd Wed Jun 12 19:04:08 2013 (r251663) @@ -3,8 +3,10 @@ # $FreeBSD$ # +# netif is required for lo0 because syslogd tries to open a local socket +# # PROVIDE: syslogd -# REQUIRE: mountcritremote FILESYSTEMS newsyslog +# REQUIRE: mountcritremote FILESYSTEMS newsyslog netif # BEFORE: SERVERS . /etc/rc.subr From owner-svn-src-stable@FreeBSD.ORG Wed Jun 12 20:08:31 2013 Return-Path: Delivered-To: svn-src-stable@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by hub.freebsd.org (Postfix) with ESMTP id 0A4B3524; Wed, 12 Jun 2013 20:08:31 +0000 (UTC) (envelope-from gnn@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) by mx1.freebsd.org (Postfix) with ESMTP id F02351EB7; Wed, 12 Jun 2013 20:08:30 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.7/8.14.7) with ESMTP id r5CK8UDX033737; Wed, 12 Jun 2013 20:08:30 GMT (envelope-from gnn@svn.freebsd.org) Received: (from gnn@localhost) by svn.freebsd.org (8.14.7/8.14.5/Submit) id r5CK8U1s033734; Wed, 12 Jun 2013 20:08:30 GMT (envelope-from gnn@svn.freebsd.org) Message-Id: <201306122008.r5CK8U1s033734@svn.freebsd.org> From: "George V. Neville-Neil" Date: Wed, 12 Jun 2013 20:08:30 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-9@freebsd.org Subject: svn commit: r251666 - in stable/9/sys/cddl/dev/dtrace: amd64 i386 X-SVN-Group: stable-9 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 12 Jun 2013 20:08:31 -0000 Author: gnn Date: Wed Jun 12 20:08:30 2013 New Revision: 251666 URL: http://svnweb.freebsd.org/changeset/base/251666 Log: MFC: 236567 Integrate a fix for a very odd signal delivery problem found by Bryan Cantril and others in the Solaris/Illumos version of DTrace. Obtained from: https://www.illumos.org/issues/789 Modified: stable/9/sys/cddl/dev/dtrace/amd64/dtrace_subr.c stable/9/sys/cddl/dev/dtrace/i386/dtrace_subr.c Directory Properties: stable/9/sys/ (props changed) Modified: stable/9/sys/cddl/dev/dtrace/amd64/dtrace_subr.c ============================================================================== --- stable/9/sys/cddl/dev/dtrace/amd64/dtrace_subr.c Wed Jun 12 20:05:19 2013 (r251665) +++ stable/9/sys/cddl/dev/dtrace/amd64/dtrace_subr.c Wed Jun 12 20:08:30 2013 (r251666) @@ -27,6 +27,10 @@ * Use is subject to license terms. */ +/* + * Copyright (c) 2011, Joyent, Inc. All rights reserved. + */ + #include #include #include @@ -299,14 +303,15 @@ dtrace_safe_defer_signal(void) } /* - * If we've executed the original instruction, but haven't performed - * the jmp back to t->t_dtrace_npc or the clean up of any registers - * used to emulate %rip-relative instructions in 64-bit mode, do that - * here and take the signal right away. We detect this condition by - * seeing if the program counter is the range [scrpc + isz, astpc). + * If we have executed the original instruction, but we have performed + * neither the jmp back to t->t_dtrace_npc nor the clean up of any + * registers used to emulate %rip-relative instructions in 64-bit mode, + * we'll save ourselves some effort by doing that here and taking the + * signal right away. We detect this condition by seeing if the program + * counter is the range [scrpc + isz, astpc). */ - if (t->t_dtrace_astpc - rp->r_pc < - t->t_dtrace_astpc - t->t_dtrace_scrpc - isz) { + if (rp->r_pc >= t->t_dtrace_scrpc + isz && + rp->r_pc < t->t_dtrace_astpc) { #ifdef __amd64 /* * If there is a scratch register and we're on the Modified: stable/9/sys/cddl/dev/dtrace/i386/dtrace_subr.c ============================================================================== --- stable/9/sys/cddl/dev/dtrace/i386/dtrace_subr.c Wed Jun 12 20:05:19 2013 (r251665) +++ stable/9/sys/cddl/dev/dtrace/i386/dtrace_subr.c Wed Jun 12 20:08:30 2013 (r251666) @@ -27,6 +27,10 @@ * Use is subject to license terms. */ +/* + * Copyright (c) 2011, Joyent, Inc. All rights reserved. + */ + #include #include #include @@ -300,14 +304,15 @@ dtrace_safe_defer_signal(void) } /* - * If we've executed the original instruction, but haven't performed - * the jmp back to t->t_dtrace_npc or the clean up of any registers - * used to emulate %rip-relative instructions in 64-bit mode, do that - * here and take the signal right away. We detect this condition by - * seeing if the program counter is the range [scrpc + isz, astpc). + * If we have executed the original instruction, but we have performed + * neither the jmp back to t->t_dtrace_npc nor the clean up of any + * registers used to emulate %rip-relative instructions in 64-bit mode, + * we'll save ourselves some effort by doing that here and taking the + * signal right away. We detect this condition by seeing if the program + * counter is the range [scrpc + isz, astpc). */ - if (t->t_dtrace_astpc - rp->r_pc < - t->t_dtrace_astpc - t->t_dtrace_scrpc - isz) { + if (rp->r_pc >= t->t_dtrace_scrpc + isz && + rp->r_pc < t->t_dtrace_astpc) { #ifdef __amd64 /* * If there is a scratch register and we're on the From owner-svn-src-stable@FreeBSD.ORG Wed Jun 12 21:41:09 2013 Return-Path: Delivered-To: svn-src-stable@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [8.8.178.115]) by hub.freebsd.org (Postfix) with ESMTP id E065F8F2; Wed, 12 Jun 2013 21:41:09 +0000 (UTC) (envelope-from asomers@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) by mx1.freebsd.org (Postfix) with ESMTP id D1FA315CD; Wed, 12 Jun 2013 21:41:09 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.7/8.14.7) with ESMTP id r5CLf9m7063864; Wed, 12 Jun 2013 21:41:09 GMT (envelope-from asomers@svn.freebsd.org) Received: (from asomers@localhost) by svn.freebsd.org (8.14.7/8.14.5/Submit) id r5CLf9ql063863; Wed, 12 Jun 2013 21:41:09 GMT (envelope-from asomers@svn.freebsd.org) Message-Id: <201306122141.r5CLf9ql063863@svn.freebsd.org> From: Alan Somers Date: Wed, 12 Jun 2013 21:41:09 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-9@freebsd.org Subject: svn commit: r251669 - stable/9/sbin/camcontrol X-SVN-Group: stable-9 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 12 Jun 2013 21:41:10 -0000 Author: asomers Date: Wed Jun 12 21:41:09 2013 New Revision: 251669 URL: http://svnweb.freebsd.org/changeset/base/251669 Log: MFC r250662 sbin/camcontrol/camcontrol.c If an expander returns 0x00 (no device attached) in the ATTACHED DEVICE field of the SMP DISCOVER response, ignore the value of ATTACHED SAS ADDRESS, because it is invalid. Some expanders zero out the address when the attached device is removed, but others do not. Section 9.4.3.10 of the SAS Protocol Layer 2 revision 04b does not require them to do so. Approved by: ken (mentor) Modified: stable/9/sbin/camcontrol/camcontrol.c Directory Properties: stable/9/sbin/camcontrol/ (props changed) Modified: stable/9/sbin/camcontrol/camcontrol.c ============================================================================== --- stable/9/sbin/camcontrol/camcontrol.c Wed Jun 12 21:12:05 2013 (r251668) +++ stable/9/sbin/camcontrol/camcontrol.c Wed Jun 12 21:41:09 2013 (r251669) @@ -7137,8 +7137,12 @@ smpphylist(struct cam_device *device, in continue; } - item = findsasdevice(&devlist, - scsi_8btou64(disresponse->attached_sas_address)); + if (disresponse->attached_device == SMP_DIS_AD_TYPE_NONE) { + item = NULL; + } else { + item = findsasdevice(&devlist, + scsi_8btou64(disresponse->attached_sas_address)); + } if ((quiet == 0) || (item != NULL)) { From owner-svn-src-stable@FreeBSD.ORG Wed Jun 12 22:19:51 2013 Return-Path: Delivered-To: svn-src-stable@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [8.8.178.115]) by hub.freebsd.org (Postfix) with ESMTP id 46A034F7; Wed, 12 Jun 2013 22:19:51 +0000 (UTC) (envelope-from asomers@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) by mx1.freebsd.org (Postfix) with ESMTP id 1E5F21812; Wed, 12 Jun 2013 22:19:51 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.7/8.14.7) with ESMTP id r5CMJorm074741; Wed, 12 Jun 2013 22:19:50 GMT (envelope-from asomers@svn.freebsd.org) Received: (from asomers@localhost) by svn.freebsd.org (8.14.7/8.14.5/Submit) id r5CMJoTR074739; Wed, 12 Jun 2013 22:19:50 GMT (envelope-from asomers@svn.freebsd.org) Message-Id: <201306122219.r5CMJoTR074739@svn.freebsd.org> From: Alan Somers Date: Wed, 12 Jun 2013 22:19:50 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-9@freebsd.org Subject: svn commit: r251670 - stable/9/sys/dev/mps X-SVN-Group: stable-9 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 12 Jun 2013 22:19:51 -0000 Author: asomers Date: Wed Jun 12 22:19:49 2013 New Revision: 251670 URL: http://svnweb.freebsd.org/changeset/base/251670 Log: MFC r251396 sys/dev/mps/mps.c sys/dev/mps/mps_user.c Fix uninitialized memory reference in mps_read_config_page. It was referencing a field (params->hdr.Ext.ExtPageType) that would only be set when reading an Extended config page. The symptom was that MPSIO_READ_CFG_PAGE ioctls would randomly fail with MPI2_IOCSTATUS_CONFIG_INVALID_PAGE errors. The solution is to determine whether an extended or an ordinary config page is requested by looking at the PageType field, which should be available regardless. Similarly, mps_user_read_extcfg_header and mps_user_read_extcfg_page, which call mps_read_config_page, had to be fixed to always set the PageType field. They were implicitly assuming that mps_read_config_page always operated on Extended pages. Reviewed by: ken Approved by: ken (mentor) Modified: stable/9/sys/dev/mps/mps.c stable/9/sys/dev/mps/mps_user.c Directory Properties: stable/9/sys/ (props changed) stable/9/sys/dev/ (props changed) Modified: stable/9/sys/dev/mps/mps.c ============================================================================== --- stable/9/sys/dev/mps/mps.c Wed Jun 12 21:41:09 2013 (r251669) +++ stable/9/sys/dev/mps/mps.c Wed Jun 12 22:19:49 2013 (r251670) @@ -2409,7 +2409,7 @@ mps_read_config_page(struct mps_softc *s req->SGLFlags = 0; req->ChainOffset = 0; req->PageAddress = params->page_address; - if (params->hdr.Ext.ExtPageType != 0) { + if (params->hdr.Struct.PageType == MPI2_CONFIG_PAGETYPE_EXTENDED) { MPI2_CONFIG_EXTENDED_PAGE_HEADER *hdr; hdr = ¶ms->hdr.Ext; Modified: stable/9/sys/dev/mps/mps_user.c ============================================================================== --- stable/9/sys/dev/mps/mps_user.c Wed Jun 12 21:41:09 2013 (r251669) +++ stable/9/sys/dev/mps/mps_user.c Wed Jun 12 22:19:49 2013 (r251670) @@ -305,6 +305,7 @@ mps_user_read_extcfg_header(struct mps_s hdr = ¶ms.hdr.Ext; params.action = MPI2_CONFIG_ACTION_PAGE_HEADER; hdr->PageVersion = ext_page_req->header.PageVersion; + hdr->PageType = MPI2_CONFIG_PAGETYPE_EXTENDED; hdr->ExtPageLength = 0; hdr->PageNumber = ext_page_req->header.PageNumber; hdr->ExtPageType = ext_page_req->header.ExtPageType; @@ -346,6 +347,7 @@ mps_user_read_extcfg_page(struct mps_sof params.action = MPI2_CONFIG_ACTION_PAGE_READ_CURRENT; params.page_address = le32toh(ext_page_req->page_address); hdr->PageVersion = reqhdr->PageVersion; + hdr->PageType = MPI2_CONFIG_PAGETYPE_EXTENDED; hdr->PageNumber = reqhdr->PageNumber; hdr->ExtPageType = reqhdr->ExtPageType; hdr->ExtPageLength = reqhdr->ExtPageLength; From owner-svn-src-stable@FreeBSD.ORG Wed Jun 12 23:13:42 2013 Return-Path: Delivered-To: svn-src-stable@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [8.8.178.115]) by hub.freebsd.org (Postfix) with ESMTP id D7A1DDD; Wed, 12 Jun 2013 23:13:42 +0000 (UTC) (envelope-from rmacklem@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) by mx1.freebsd.org (Postfix) with ESMTP id C970819B5; Wed, 12 Jun 2013 23:13:42 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.7/8.14.7) with ESMTP id r5CNDgCu092751; Wed, 12 Jun 2013 23:13:42 GMT (envelope-from rmacklem@svn.freebsd.org) Received: (from rmacklem@localhost) by svn.freebsd.org (8.14.7/8.14.5/Submit) id r5CNDg9W092750; Wed, 12 Jun 2013 23:13:42 GMT (envelope-from rmacklem@svn.freebsd.org) Message-Id: <201306122313.r5CNDg9W092750@svn.freebsd.org> From: Rick Macklem Date: Wed, 12 Jun 2013 23:13:42 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-9@freebsd.org Subject: svn commit: r251671 - stable/9/sys/nfsclient X-SVN-Group: stable-9 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 12 Jun 2013 23:13:42 -0000 Author: rmacklem Date: Wed Jun 12 23:13:42 2013 New Revision: 251671 URL: http://svnweb.freebsd.org/changeset/base/251671 Log: MFC: r251089 Add a patch analygous to r248567, r248581, r251079 to the old NFS client to avoid the panic reported in the PR by doing the vnode_pager_setsize() call after unlocking the mutex. Modified: stable/9/sys/nfsclient/nfs_subs.c Directory Properties: stable/9/sys/ (props changed) Modified: stable/9/sys/nfsclient/nfs_subs.c ============================================================================== --- stable/9/sys/nfsclient/nfs_subs.c Wed Jun 12 22:19:49 2013 (r251670) +++ stable/9/sys/nfsclient/nfs_subs.c Wed Jun 12 23:13:42 2013 (r251671) @@ -478,6 +478,8 @@ nfs_loadattrcache(struct vnode **vpp, st struct timespec mtime, mtime_save; int v3 = NFS_ISV3(vp); int error = 0; + u_quad_t nsize; + int setnsize; md = *mdp; t1 = (mtod(md, caddr_t) + md->m_len) - *dposp; @@ -580,6 +582,8 @@ nfs_loadattrcache(struct vnode **vpp, st vap->va_filerev = 0; } np->n_attrstamp = time_second; + setnsize = 0; + nsize = 0; if (vap->va_size != np->n_size) { if (vap->va_type == VREG) { if (dontshrink && vap->va_size < np->n_size) { @@ -606,7 +610,8 @@ nfs_loadattrcache(struct vnode **vpp, st np->n_size = vap->va_size; np->n_flag |= NSIZECHANGED; } - vnode_pager_setsize(vp, np->n_size); + setnsize = 1; + nsize = vap->va_size; } else { np->n_size = vap->va_size; } @@ -643,6 +648,8 @@ nfs_loadattrcache(struct vnode **vpp, st KDTRACE_NFS_ATTRCACHE_LOAD_DONE(vp, &np->n_vattr, 0); #endif mtx_unlock(&np->n_mtx); + if (setnsize) + vnode_pager_setsize(vp, nsize); out: #ifdef KDTRACE_HOOKS if (error) From owner-svn-src-stable@FreeBSD.ORG Thu Jun 13 05:52:00 2013 Return-Path: Delivered-To: svn-src-stable@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by hub.freebsd.org (Postfix) with ESMTP id 554B9CE1; Thu, 13 Jun 2013 05:52:00 +0000 (UTC) (envelope-from hrs@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) by mx1.freebsd.org (Postfix) with ESMTP id 45EF4198C; Thu, 13 Jun 2013 05:52:00 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.7/8.14.7) with ESMTP id r5D5q0iR017542; Thu, 13 Jun 2013 05:52:00 GMT (envelope-from hrs@svn.freebsd.org) Received: (from hrs@localhost) by svn.freebsd.org (8.14.7/8.14.5/Submit) id r5D5q0vP017541; Thu, 13 Jun 2013 05:52:00 GMT (envelope-from hrs@svn.freebsd.org) Message-Id: <201306130552.r5D5q0vP017541@svn.freebsd.org> From: Hiroki Sato Date: Thu, 13 Jun 2013 05:52:00 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-8@freebsd.org Subject: svn commit: r251680 - stable/8/release/doc/en_US.ISO8859-1/errata X-SVN-Group: stable-8 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 13 Jun 2013 05:52:00 -0000 Author: hrs Date: Thu Jun 13 05:51:59 2013 New Revision: 251680 URL: http://svnweb.freebsd.org/changeset/base/251680 Log: Document an issue in vtnet(4) + QEMU 1.4.1 or later. Modified: stable/8/release/doc/en_US.ISO8859-1/errata/article.xml Modified: stable/8/release/doc/en_US.ISO8859-1/errata/article.xml ============================================================================== --- stable/8/release/doc/en_US.ISO8859-1/errata/article.xml Thu Jun 13 05:46:19 2013 (r251679) +++ stable/8/release/doc/en_US.ISO8859-1/errata/article.xml Thu Jun 13 05:51:59 2013 (r251680) @@ -206,6 +206,16 @@ Open Issues + [20130613] The &man.vtnet.4; network interface driver + displays the following message upon configuration when using + QEMU 1.4.1 and later: + + vtnet0: error setting host MAC filter table + + This message is harmless when the interface has only one MAC + address. The patch for this issue is filed to a PR kern/178955. + [20130609] There is incompatibility in &man.jail.8; configuration because the &man.jail.8; utility and rc.d/jail script has been changed. More From owner-svn-src-stable@FreeBSD.ORG Thu Jun 13 14:38:30 2013 Return-Path: Delivered-To: svn-src-stable@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [8.8.178.115]) by hub.freebsd.org (Postfix) with ESMTP id BF41DCB0; Thu, 13 Jun 2013 14:38:30 +0000 (UTC) (envelope-from emaste@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) by mx1.freebsd.org (Postfix) with ESMTP id A132F1031; Thu, 13 Jun 2013 14:38:30 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.7/8.14.7) with ESMTP id r5DEcUwg087150; Thu, 13 Jun 2013 14:38:30 GMT (envelope-from emaste@svn.freebsd.org) Received: (from emaste@localhost) by svn.freebsd.org (8.14.7/8.14.5/Submit) id r5DEcU31087146; Thu, 13 Jun 2013 14:38:30 GMT (envelope-from emaste@svn.freebsd.org) Message-Id: <201306131438.r5DEcU31087146@svn.freebsd.org> From: Ed Maste Date: Thu, 13 Jun 2013 14:38:30 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-9@freebsd.org Subject: svn commit: r251686 - stable/9/share/mk X-SVN-Group: stable-9 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 13 Jun 2013 14:38:30 -0000 Author: emaste Date: Thu Jun 13 14:38:29 2013 New Revision: 251686 URL: http://svnweb.freebsd.org/changeset/base/251686 Log: MFC r244224, r248753 Minor refactoring prior to .symbols file changes - Combine .if x and .if !x using .else - Separate out beforelinking dependency - Add comments to clarify .if nesting Always define and use PROGNAME This avoids having separate cases in the install rule for PROGNAME set and not set. This is a minor cleanup in advance of further support for standalone debug files. Modified: stable/9/share/mk/bsd.lib.mk stable/9/share/mk/bsd.prog.mk Directory Properties: stable/9/share/mk/ (props changed) Modified: stable/9/share/mk/bsd.lib.mk ============================================================================== --- stable/9/share/mk/bsd.lib.mk Thu Jun 13 13:05:08 2013 (r251685) +++ stable/9/share/mk/bsd.lib.mk Thu Jun 13 14:38:29 2013 (r251686) @@ -39,9 +39,7 @@ CFLAGS+= ${DEBUG_FLAGS} .if ${MK_CTF} != "no" && ${DEBUG_FLAGS:M-g} != "" CTFFLAGS+= -g .endif -.endif - -.if !defined(DEBUG_FLAGS) +.else STRIP?= -s .endif @@ -173,10 +171,9 @@ SOLINKOPTS+= -Wl,--fatal-warnings -Wl,-- .endif .if target(beforelinking) -${SHLIB_NAME}: ${SOBJS} beforelinking -.else -${SHLIB_NAME}: ${SOBJS} +${SHLIB_NAME}: beforelinking .endif +${SHLIB_NAME}: ${SOBJS} @${ECHO} building shared library ${SHLIB_NAME} @rm -f ${.TARGET} ${SHLIB_LINK} .if defined(SHLIB_LINK) Modified: stable/9/share/mk/bsd.prog.mk ============================================================================== --- stable/9/share/mk/bsd.prog.mk Thu Jun 13 13:05:08 2013 (r251685) +++ stable/9/share/mk/bsd.prog.mk Thu Jun 13 14:38:29 2013 (r251686) @@ -41,15 +41,15 @@ PROG= ${PROG_CXX} .endif .if defined(PROG) +PROGNAME?= ${PROG} .if defined(SRCS) OBJS+= ${SRCS:N*.h:R:S/$/.o/g} .if target(beforelinking) -${PROG}: ${OBJS} beforelinking -.else -${PROG}: ${OBJS} +${PROG}: beforelinking .endif +${PROG}: ${OBJS} .if defined(PROG_CXX) ${CXX} ${CXXFLAGS} ${LDFLAGS} -o ${.TARGET} ${OBJS} ${LDADD} .else @@ -76,10 +76,9 @@ SRCS= ${PROG}.c OBJS= ${PROG}.o .if target(beforelinking) -${PROG}: ${OBJS} beforelinking -.else -${PROG}: ${OBJS} +${PROG}: beforelinking .endif +${PROG}: ${OBJS} .if defined(PROG_CXX) ${CXX} ${CXXFLAGS} ${LDFLAGS} -o ${.TARGET} ${OBJS} ${LDADD} .else @@ -90,7 +89,7 @@ ${PROG}: ${OBJS} .endif .endif -.endif +.endif # !defined(SRCS) .if ${MK_MAN} != "no" && !defined(MAN) && \ !defined(MAN1) && !defined(MAN2) && !defined(MAN3) && \ @@ -99,7 +98,7 @@ ${PROG}: ${OBJS} MAN= ${PROG}.1 MAN1= ${MAN} .endif -.endif +.endif # defined(PROG) all: objwarn ${PROG} ${SCRIPTS} .if ${MK_MAN} != "no" @@ -153,13 +152,8 @@ realinstall: _proginstall .ORDER: beforeinstall _proginstall _proginstall: .if defined(PROG) -.if defined(PROGNAME) ${INSTALL} ${STRIP} -o ${BINOWN} -g ${BINGRP} -m ${BINMODE} \ ${_INSTALLFLAGS} ${PROG} ${DESTDIR}${BINDIR}/${PROGNAME} -.else - ${INSTALL} ${STRIP} -o ${BINOWN} -g ${BINGRP} -m ${BINMODE} \ - ${_INSTALLFLAGS} ${PROG} ${DESTDIR}${BINDIR} -.endif .endif .endif # !target(realinstall) From owner-svn-src-stable@FreeBSD.ORG Thu Jun 13 15:45:55 2013 Return-Path: Delivered-To: svn-src-stable@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [8.8.178.115]) by hub.freebsd.org (Postfix) with ESMTP id 30BD7C7D; Thu, 13 Jun 2013 15:45:55 +0000 (UTC) (envelope-from brooks@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) by mx1.freebsd.org (Postfix) with ESMTP id 231391315; Thu, 13 Jun 2013 15:45:55 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.7/8.14.7) with ESMTP id r5DFjtab008971; Thu, 13 Jun 2013 15:45:55 GMT (envelope-from brooks@svn.freebsd.org) Received: (from brooks@localhost) by svn.freebsd.org (8.14.7/8.14.5/Submit) id r5DFjtqG008970; Thu, 13 Jun 2013 15:45:55 GMT (envelope-from brooks@svn.freebsd.org) Message-Id: <201306131545.r5DFjtqG008970@svn.freebsd.org> From: Brooks Davis Date: Thu, 13 Jun 2013 15:45:55 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-9@freebsd.org Subject: svn commit: r251687 - stable/9/sys/sys X-SVN-Group: stable-9 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 13 Jun 2013 15:45:55 -0000 Author: brooks Date: Thu Jun 13 15:45:54 2013 New Revision: 251687 URL: http://svnweb.freebsd.org/changeset/base/251687 Log: Bump __FreeBSD_version to bound boostrapping of ctfmerge which was fixed in r249243. Modified: stable/9/sys/sys/param.h Modified: stable/9/sys/sys/param.h ============================================================================== --- stable/9/sys/sys/param.h Thu Jun 13 14:38:29 2013 (r251686) +++ stable/9/sys/sys/param.h Thu Jun 13 15:45:54 2013 (r251687) @@ -58,7 +58,7 @@ * in the range 5 to 9. */ #undef __FreeBSD_version -#define __FreeBSD_version 901504 /* Master, propagated to newvers */ +#define __FreeBSD_version 901505 /* Master, propagated to newvers */ /* * __FreeBSD_kernel__ indicates that this system uses the kernel of FreeBSD, From owner-svn-src-stable@FreeBSD.ORG Thu Jun 13 17:13:16 2013 Return-Path: Delivered-To: svn-src-stable@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by hub.freebsd.org (Postfix) with ESMTP id 954DEDFA; Thu, 13 Jun 2013 17:13:16 +0000 (UTC) (envelope-from brooks@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) by mx1.freebsd.org (Postfix) with ESMTP id 86A2518BE; Thu, 13 Jun 2013 17:13:16 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.7/8.14.7) with ESMTP id r5DHDGTL038377; Thu, 13 Jun 2013 17:13:16 GMT (envelope-from brooks@svn.freebsd.org) Received: (from brooks@localhost) by svn.freebsd.org (8.14.7/8.14.5/Submit) id r5DHDG0J038374; Thu, 13 Jun 2013 17:13:16 GMT (envelope-from brooks@svn.freebsd.org) Message-Id: <201306131713.r5DHDG0J038374@svn.freebsd.org> From: Brooks Davis Date: Thu, 13 Jun 2013 17:13:16 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-9@freebsd.org Subject: svn commit: r251688 - in stable/9/usr.sbin/makefs: . compat X-SVN-Group: stable-9 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 13 Jun 2013 17:13:16 -0000 Author: brooks Date: Thu Jun 13 17:13:15 2013 New Revision: 251688 URL: http://svnweb.freebsd.org/changeset/base/251688 Log: MFC r250407: Remove duplicated copies of various NetBSD compatibility shims used by makefs and use libnetbsd, contrib/mtree, and contrib/mknod instead. Sponsored by: DARPA, AFRL Deleted: stable/9/usr.sbin/makefs/compat/ stable/9/usr.sbin/makefs/getid.c Modified: stable/9/usr.sbin/makefs/Makefile stable/9/usr.sbin/makefs/makefs.h stable/9/usr.sbin/makefs/walk.c Directory Properties: stable/9/usr.sbin/makefs/ (props changed) Modified: stable/9/usr.sbin/makefs/Makefile ============================================================================== --- stable/9/usr.sbin/makefs/Makefile Thu Jun 13 15:45:54 2013 (r251687) +++ stable/9/usr.sbin/makefs/Makefile Thu Jun 13 17:13:15 2013 (r251688) @@ -5,7 +5,6 @@ PROG= makefs CFLAGS+=-I${.CURDIR} SRCS= cd9660.c ffs.c \ - getid.c \ makefs.c \ mtree.c \ walk.c @@ -15,19 +14,28 @@ WARNS?= 2 .include "${.CURDIR}/cd9660/Makefile.inc" .include "${.CURDIR}/ffs/Makefile.inc" -.include "${.CURDIR}/compat/Makefile.inc" CFLAGS+=-DHAVE_STRUCT_STAT_ST_FLAGS=1 CFLAGS+=-DHAVE_STRUCT_STAT_ST_GEN=1 -.PATH: ${.CURDIR}/../mtree -CFLAGS+=-I${.CURDIR}/../mtree -SRCS+= misc.c spec.c +.PATH: ${.CURDIR}/../../contrib/mtree +CFLAGS+=-I${.CURDIR}/../../contrib/mtree +SRCS+= getid.c misc.c spec.c + +.PATH: ${.CURDIR}/../../contrib/mknod +CFLAGS+=-I${.CURDIR}/../../contrib/mknod +SRCS+= pack_dev.c .PATH: ${.CURDIR}/../../sys/ufs/ffs SRCS+= ffs_tables.c -DPADD= ${LIBSBUF} -LDADD= -lsbuf +CFLAGS+= -I${.CURDIR}/../../lib/libnetbsd +LIBNETBSDDIR= ${.OBJDIR}/../../lib/libnetbsd +LIBNETBSD= ${LIBNETBSDDIR}/libnetbsd.a +DPADD+= ${LIBNETBSD} +LDADD+= ${LIBNETBSD} + +DPADD+= ${LIBSBUF} ${LIBUTIL} +LDADD+= -lsbuf -lutil .include Modified: stable/9/usr.sbin/makefs/makefs.h ============================================================================== --- stable/9/usr.sbin/makefs/makefs.h Thu Jun 13 15:45:54 2013 (r251687) +++ stable/9/usr.sbin/makefs/makefs.h Thu Jun 13 17:13:15 2013 (r251688) @@ -282,22 +282,4 @@ void ffs_fragacct_swap(struct fs *, in fsinode *link_check(fsinode *); -/* - * Declarations for compat routines. - */ -long long strsuftoll(const char *, const char *, long long, long long); -long long strsuftollx(const char *, const char *, - long long, long long, char *, size_t); - -struct passwd; -int uid_from_user(const char *, uid_t *); -int pwcache_userdb(int (*)(int), void (*)(void), - struct passwd * (*)(const char *), struct passwd * (*)(uid_t)); -struct group; -int gid_from_group(const char *, gid_t *); -int pwcache_groupdb(int (*)(int), void (*)(void), - struct group * (*)(const char *), struct group * (*)(gid_t)); - -int setup_getid(const char *dir); - #endif /* _MAKEFS_H */ Modified: stable/9/usr.sbin/makefs/walk.c ============================================================================== --- stable/9/usr.sbin/makefs/walk.c Thu Jun 13 15:45:54 2013 (r251687) +++ stable/9/usr.sbin/makefs/walk.c Thu Jun 13 17:13:15 2013 (r251688) @@ -304,7 +304,7 @@ apply_specfile(const char *specfile, con if ((fp = fopen(specfile, "r")) == NULL) err(1, "Can't open `%s'", specfile); TIMER_START(start); - root = mtree_readspec(fp); + root = spec(fp); TIMER_RESULTS(start, "spec"); if (fclose(fp) == EOF) err(1, "Can't close `%s'", specfile); @@ -320,33 +320,6 @@ apply_specfile(const char *specfile, con } -static u_int -nodetoino(u_int type) -{ - - switch (type) { - case F_BLOCK: - return S_IFBLK; - case F_CHAR: - return S_IFCHR; - case F_DIR: - return S_IFDIR; - case F_FIFO: - return S_IFIFO; - case F_FILE: - return S_IFREG; - case F_LINK: - return S_IFLNK; - case F_SOCK: - return S_IFSOCK; - default: - printf("unknown type %d", type); - abort(); - } - /* NOTREACHED */ -} - - static void apply_specdir(const char *dir, NODE *specnode, fsnode *dirnode, int speconly) { From owner-svn-src-stable@FreeBSD.ORG Thu Jun 13 18:47:56 2013 Return-Path: Delivered-To: svn-src-stable@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [8.8.178.115]) by hub.freebsd.org (Postfix) with ESMTP id 3292BF94; Thu, 13 Jun 2013 18:47:56 +0000 (UTC) (envelope-from gnn@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) by mx1.freebsd.org (Postfix) with ESMTP id 2397B1DBD; Thu, 13 Jun 2013 18:47:56 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.7/8.14.7) with ESMTP id r5DIludJ067588; Thu, 13 Jun 2013 18:47:56 GMT (envelope-from gnn@svn.freebsd.org) Received: (from gnn@localhost) by svn.freebsd.org (8.14.7/8.14.5/Submit) id r5DIlsMD067578; Thu, 13 Jun 2013 18:47:54 GMT (envelope-from gnn@svn.freebsd.org) Message-Id: <201306131847.r5DIlsMD067578@svn.freebsd.org> From: "George V. Neville-Neil" Date: Thu, 13 Jun 2013 18:47:54 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-9@freebsd.org Subject: svn commit: r251697 - in stable/9: cddl/contrib/dtracetoolkit share share/dtrace X-SVN-Group: stable-9 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 13 Jun 2013 18:47:56 -0000 Author: gnn Date: Thu Jun 13 18:47:53 2013 New Revision: 251697 URL: http://svnweb.freebsd.org/changeset/base/251697 Log: MFC: 235380,235454,235455,235456,235457,235613,235614,235628,236567, 238125,238535,238660,238979,239972 Bring all changes to the DTrace Toolkit into FreeBSD 9. Added: - copied from r235613, head/share/dtrace/ stable/9/share/dtrace/hotopen - copied unchanged from r238660, head/share/dtrace/hotopen stable/9/share/dtrace/nfsattrstats - copied unchanged from r238535, head/share/dtrace/nfsattrstats stable/9/share/dtrace/nfsclienttime - copied unchanged from r235614, head/share/dtrace/nfsclienttime Directory Properties: stable/9/share/dtrace/ (props changed) Replaced: - copied from r235380, head/cddl/contrib/dtracetoolkit/ Directory Properties: stable/9/cddl/contrib/dtracetoolkit/ (props changed) Modified: stable/9/cddl/contrib/dtracetoolkit/dtruss stable/9/cddl/contrib/dtracetoolkit/execsnoop stable/9/cddl/contrib/dtracetoolkit/opensnoop stable/9/cddl/contrib/dtracetoolkit/procsystime stable/9/share/Makefile stable/9/share/dtrace/Makefile stable/9/share/dtrace/README Directory Properties: stable/9/cddl/contrib/ (props changed) stable/9/share/ (props changed) Modified: stable/9/cddl/contrib/dtracetoolkit/dtruss ============================================================================== --- head/cddl/contrib/dtracetoolkit/dtruss Sat May 12 21:25:48 2012 (r235380) +++ stable/9/cddl/contrib/dtracetoolkit/dtruss Thu Jun 13 18:47:53 2013 (r251697) @@ -1,4 +1,4 @@ -#!/usr/bin/sh +#!/bin/sh # # dtruss - print process system call time details. # Written using DTrace (Solaris 10 3/05). @@ -240,7 +240,7 @@ syscall:::entry */ /* print 3 args, return as hex */ -syscall::lwp_sigmask:return +syscall::sigprocmask:return /self->start/ { /* calculate elapsed time */ @@ -268,10 +268,11 @@ syscall::lwp_sigmask:return } /* print 3 args, arg0 as a string */ +syscall::access*:return, syscall::stat*:return, syscall::lstat*:return, -syscall::open*:return, -syscall::resolvepath:return +syscall::readlink*:return, +syscall::open*:return /self->start/ { /* calculate elapsed time */ @@ -329,7 +330,6 @@ syscall::*read*:return } /* print 0 arg output */ -syscall::gtime:return, syscall::*fork*:return /self->start/ { @@ -357,9 +357,6 @@ syscall::*fork*:return } /* print 1 arg output */ -syscall::brk:return, -syscall::times:return, -syscall::stime:return, syscall::close:return /self->start/ { @@ -387,7 +384,7 @@ syscall::close:return } /* print 2 arg output */ -syscall::utime:return, +syscall::utimes:return, syscall::munmap:return /self->start/ { Modified: stable/9/cddl/contrib/dtracetoolkit/execsnoop ============================================================================== --- head/cddl/contrib/dtracetoolkit/execsnoop Sat May 12 21:25:48 2012 (r235380) +++ stable/9/cddl/contrib/dtracetoolkit/execsnoop Thu Jun 13 18:47:53 2013 (r251697) @@ -1,25 +1,24 @@ -#!/usr/bin/sh +#!/bin/sh # # execsnoop - snoop process execution as it occurs. # Written using DTrace (Solaris 10 3/05). # # $Id: execsnoop 3 2007-08-01 10:50:08Z brendan $ # -# USAGE: execsnoop [-a|-A|-ehjsvZ] [-c command] +# USAGE: execsnoop [-a|-A|-ehsvJ] [-c command] # # execsnoop # default output # # -a # print all data # -A # dump all data, space delimited # -e # safe output - parseable -# -j # print project ID # -s # print start time, us # -v # print start time, string -# -Z # print zonename +# -J # print jail ID # -c command # command name to snoop # eg, # execsnoop -v # human readable timestamps -# execsnoop -Z # print zonename +# execsnoop -J # print jail ID # execsnoop -c ls # snoop ls commands only # # The parseable output ensures that the ARGS field doesn't contain @@ -31,8 +30,7 @@ # PPID Parent Process ID # COMM command name for the process # ARGS argument listing for the process -# ZONE zonename -# PROJ project ID +# JAIL ID Jail ID # TIME timestamp for the command, us # STRTIME timestamp for the command, string # @@ -72,34 +70,32 @@ ### default variables opt_dump=0; opt_cmd=0; opt_time=0; opt_timestr=0; filter=0; command=. -opt_zone=0; opt_safe=0; opt_proj=0 +opt_jailid=0; opt_safe=0 ### process options -while getopts aAc:ehjsvZ name +while getopts aAc:ehsvJ name do case $name in - a) opt_time=1; opt_timestr=1; opt_zone=1; opt_proj=1 ;; + a) opt_time=1; opt_timestr=1; opt_jailid=1 ;; A) opt_dump=1 ;; c) opt_cmd=1; command=$OPTARG ;; e) opt_safe=1 ;; - j) opt_proj=1 ;; s) opt_time=1 ;; v) opt_timestr=1 ;; - Z) opt_zone=1 ;; + J) opt_jailid=1 ;; h|?) cat <<-END >&2 - USAGE: execsnoop [-a|-A|-ehjsvZ] [-c command] + USAGE: execsnoop [-a|-A|-ehjsvJ] [-c command] execsnoop # default output -a # print all data -A # dump all data, space delimited -e # safe output, parseable - -j # print project ID -s # print start time, us -v # print start time, string - -Z # print zonename + -J # print jail ID -c command # command name to snoop eg, execsnoop -v # human readable timestamps - execsnoop -Z # print zonename + execsnoop -J # print jail ID execsnoop -c ls # snoop ls commands only END exit 1 @@ -108,7 +104,7 @@ done ### option logic if [ $opt_dump -eq 1 ]; then - opt_time=0; opt_timestr=0; opt_zone=0; opt_proj=0 + opt_time=0; opt_timestr=0; opt_jailid=0 fi if [ $opt_cmd -eq 1 ]; then filter=1 @@ -126,9 +122,8 @@ fi inline int OPT_cmd = '$opt_cmd'; inline int OPT_time = '$opt_time'; inline int OPT_timestr = '$opt_timestr'; - inline int OPT_zone = '$opt_zone'; + inline int OPT_jailid = '$opt_jailid'; inline int OPT_safe = '$opt_safe'; - inline int OPT_proj = '$opt_proj'; inline int FILTER = '$filter'; inline string COMMAND = "'$command'"; @@ -143,30 +138,28 @@ fi /* print optional headers */ OPT_time ? printf("%-14s ", "TIME") : 1; OPT_timestr ? printf("%-20s ", "STRTIME") : 1; - OPT_zone ? printf("%-10s ", "ZONE") : 1; - OPT_proj ? printf("%5s ", "PROJ") : 1; + OPT_jailid ? printf("%-10s ", "JAIL ID") : 1; /* print main headers */ - OPT_dump ? printf("%s %s %s %s %s %s %s %s\n", - "TIME", "ZONE", "PROJ", "UID", "PID", "PPID", "COMM", "ARGS") : + OPT_dump ? printf("%s %s %s %s %s %s %s\n", + "TIME", "JAIL ID", "UID", "PID", "PPID", "COMM", "ARGS") : printf("%5s %6s %6s %s\n", "UID", "PID", "PPID", "ARGS"); } /* * Print exec event */ - syscall::exec:return, syscall::exece:return + syscall::execve:return /(FILTER == 0) || (OPT_cmd == 1 && COMMAND == execname)/ { /* print optional fields */ OPT_time ? printf("%-14d ", timestamp/1000) : 1; OPT_timestr ? printf("%-20Y ", walltimestamp) : 1; - OPT_zone ? printf("%-10s ", zonename) : 1; - OPT_proj ? printf("%5d ", curpsinfo->pr_projid) : 1; + OPT_jailid ? printf("%-10d ", curpsinfo->pr_jailid) : 1; /* print main data */ - OPT_dump ? printf("%d %s %d %d %d %d %s ", timestamp/1000, - zonename, curpsinfo->pr_projid, uid, pid, ppid, execname) : + OPT_dump ? printf("%d %d %d %d %d %s ", timestamp/1000, + curpsinfo->pr_jailid, uid, pid, ppid, execname) : printf("%5d %6d %6d ", uid, pid, ppid); OPT_safe ? printf("%S\n", curpsinfo->pr_psargs) : printf("%s\n", curpsinfo->pr_psargs); Modified: stable/9/cddl/contrib/dtracetoolkit/opensnoop ============================================================================== --- head/cddl/contrib/dtracetoolkit/opensnoop Sat May 12 21:25:48 2012 (r235380) +++ stable/9/cddl/contrib/dtracetoolkit/opensnoop Thu Jun 13 18:47:53 2013 (r251697) @@ -1,4 +1,4 @@ -#!/usr/bin/sh +#!/bin/sh # # opensnoop - snoop file opens as they occur. # Written using DTrace (Solaris 10 3/05). @@ -189,7 +189,7 @@ fi /* * Print open event */ - syscall::open:entry, syscall::open64:entry + syscall::open:entry { /* save pathname */ self->pathp = arg0; @@ -203,7 +203,7 @@ fi /* OPT_file is checked on return to ensure pathp is mapped */ } - syscall::open:return, syscall::open64:return + syscall::open:return /self->ok && (! OPT_failonly || (int)arg0 < 0) && ((OPT_file == 0) || (OPT_file == 1 && PATHNAME == copyinstr(self->pathp)))/ { @@ -235,7 +235,7 @@ fi /* * Cleanup */ - syscall::open:return, syscall::open64:return + syscall::open:return /self->ok/ { self->pathp = 0; Modified: stable/9/cddl/contrib/dtracetoolkit/procsystime ============================================================================== --- head/cddl/contrib/dtracetoolkit/procsystime Sat May 12 21:25:48 2012 (r235380) +++ stable/9/cddl/contrib/dtracetoolkit/procsystime Thu Jun 13 18:47:53 2013 (r251697) @@ -1,4 +1,4 @@ -#!/usr/bin/sh +#!/bin/sh # # procsystime - print process system call time details. # Written using DTrace (Solaris 10 3/05). Modified: stable/9/share/Makefile ============================================================================== --- stable/9/share/Makefile Thu Jun 13 18:47:28 2013 (r251696) +++ stable/9/share/Makefile Thu Jun 13 18:47:53 2013 (r251697) @@ -8,6 +8,7 @@ SUBDIR= ${_colldef} \ ${_dict} \ ${_doc} \ + dtrace \ ${_examples} \ ${_i18n} \ ${_man} \ Modified: stable/9/share/dtrace/Makefile ============================================================================== --- head/share/dtrace/Makefile Fri May 18 16:40:15 2012 (r235613) +++ stable/9/share/dtrace/Makefile Thu Jun 13 18:47:53 2013 (r251697) @@ -12,9 +12,9 @@ SUBDIR= ${_toolkit} _toolkit= toolkit .endif -SCRIPTS= nfsclienttime +SCRIPTS= nfsclienttime hotopen -SCRIPTSDIR= ${SHAREDIR}/dtrace/ +SCRIPTSDIR= ${SHAREDIR}/dtrace NO_OBJ= Modified: stable/9/share/dtrace/README ============================================================================== --- head/share/dtrace/README Fri May 18 16:40:15 2012 (r235613) +++ stable/9/share/dtrace/README Thu Jun 13 18:47:53 2013 (r251697) @@ -2,7 +2,7 @@ $FreeBSD$ This directory contains scripts for use with the DTrace system. The toolkit/ directory contains the latest vendor import of Brendan -Gregg's DTRaceToolkit while all the other files and directories +Gregg's DTraceToolkit while all the other files and directories contain code generated by the FreeBSD Project for use with DTrace on FreeBSD. Copied: stable/9/share/dtrace/hotopen (from r238660, head/share/dtrace/hotopen) ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ stable/9/share/dtrace/hotopen Thu Jun 13 18:47:53 2013 (r251697, copy of r238660, head/share/dtrace/hotopen) @@ -0,0 +1,61 @@ +#!/bin/sh +# +# Copyright (c) 2012 George V. Neville-Neil +# All rights reserved. +# +# This software was developed at the University of Cambridge Computer +# Laboratory with support from a grant from Google, Inc. +# +# 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$ +# +# The hotopen D script periodically outputs table of which UIDs +# are opening files. This is a very quick way to find out if +# a paritcular user is thrashing a system with rapid calls to +# open/close. +# +# Usage: hotopen +# + +/usr/sbin/dtrace -n ' +#pragma D option quiet +BEGIN +{ + printf("Files opened per UID in the last second.\n"); +} + +syscall::open:entry +{ + @files[uid] = count(); + output = 1; +} + +tick-1sec +/output != 0/ +{ + printf("%-20Y \n", walltimestamp); + printa("uid %d\tcount %@d\n", @files, @files); + trunc(@files); + output = 0; +} +' Copied: stable/9/share/dtrace/nfsattrstats (from r238535, head/share/dtrace/nfsattrstats) ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ stable/9/share/dtrace/nfsattrstats Thu Jun 13 18:47:53 2013 (r251697, copy of r238535, head/share/dtrace/nfsattrstats) @@ -0,0 +1,74 @@ +#!/bin/sh +# +# Copyright (c) 2012 Robert N. M. Watson +# All rights reserved. +# +# This software was developed at the University of Cambridge Computer +# Laboratory with support from a grant from Google, Inc. +# +# 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$ +# +# This script creates a trace of NFS RPCs, NFS attribute cache +# activity, and NFS access cache activity, along with the system call +# that instigated the activity. Notice that NFS events may happen +# outside of the context of a system call, most likely due to the VM +# system paging from NFS, in which case the system call name is +# reported as "-" + +/usr/sbin/dtrace -n ' +#pragma D option quiet + +dtrace:::BEGIN +{ + printf("probe\targ0\texecutable\tsyscall\n"); +} + +syscall:::entry +{ + + self->syscallname = probefunc; +} + +syscall:::return +{ + + self->syscallname = ""; +} + +nfsclient::: +/self->syscallname != 0 && self->syscallname != ""/ +{ + + printf("%s\t%s\t%s\t%s\n", probemod, stringof(arg0), execname, + self->syscallname); +} + +nfsclient::: +/self->syscallname == 0 || self->syscallname == ""/ +{ + + printf("%s\t%s\t%s\t%s\n", probemod, stringof(arg0), execname, + self->syscallname); +} +' Copied: stable/9/share/dtrace/nfsclienttime (from r235614, head/share/dtrace/nfsclienttime) ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ stable/9/share/dtrace/nfsclienttime Thu Jun 13 18:47:53 2013 (r251697, copy of r235614, head/share/dtrace/nfsclienttime) @@ -0,0 +1,74 @@ +#!/bin/sh +# +# Copyright (c) 2012 Robert N. M. Watson +# All rights reserved. +# +# This software was developed at the University of Cambridge Computer +# Laboratory with support from a grant from Google, Inc. +# +# 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$ +# +# This script measures all time spent waiting on RPC replies for each +# system call, and then generates a histogram of those times sorted by +# system call name. +# +# Currently only supports NFSv3 +# +# Usage: nfsclienttime +# +# Press Ctrl-C to exit and display statistics. +# + +/usr/sbin/dtrace -n ' +#pragma D option quiet + +dtrace:::BEGIN +{ + printf("Collecting data...press Ctrl-C to exit.\n"); +} + +syscall:::entry +{ + + self->count = 0; +} + +nfsclient:nfs3::start +{ + + self->timestamp = timestamp; +} + +nfsclient:nfs3::done +{ + + self->count += (timestamp - self->timestamp); +} + +syscall:::return +/self->count != 0/ { + + @syscalls[probefunc] = quantize(self->count); +} +' From owner-svn-src-stable@FreeBSD.ORG Thu Jun 13 19:25:37 2013 Return-Path: Delivered-To: svn-src-stable@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [8.8.178.115]) by hub.freebsd.org (Postfix) with ESMTP id 395E6DA6; Thu, 13 Jun 2013 19:25:37 +0000 (UTC) (envelope-from jhb@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) by mx1.freebsd.org (Postfix) with ESMTP id 2B3561F0B; Thu, 13 Jun 2013 19:25:37 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.7/8.14.7) with ESMTP id r5DJPbj2080523; Thu, 13 Jun 2013 19:25:37 GMT (envelope-from jhb@svn.freebsd.org) Received: (from jhb@localhost) by svn.freebsd.org (8.14.7/8.14.5/Submit) id r5DJPb2E080522; Thu, 13 Jun 2013 19:25:37 GMT (envelope-from jhb@svn.freebsd.org) Message-Id: <201306131925.r5DJPb2E080522@svn.freebsd.org> From: John Baldwin Date: Thu, 13 Jun 2013 19:25:37 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-9@freebsd.org Subject: svn commit: r251698 - stable/9/sys/rpc X-SVN-Group: stable-9 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 13 Jun 2013 19:25:37 -0000 Author: jhb Date: Thu Jun 13 19:25:36 2013 New Revision: 251698 URL: http://svnweb.freebsd.org/changeset/base/251698 Log: MFC 249263: Fix a potential socket leak in the NFS server. Modified: stable/9/sys/rpc/svc_vc.c Directory Properties: stable/9/sys/ (props changed) Modified: stable/9/sys/rpc/svc_vc.c ============================================================================== --- stable/9/sys/rpc/svc_vc.c Thu Jun 13 18:47:53 2013 (r251697) +++ stable/9/sys/rpc/svc_vc.c Thu Jun 13 19:25:36 2013 (r251698) @@ -137,7 +137,9 @@ svc_vc_create(SVCPOOL *pool, struct sock struct sockaddr* sa; int error; - if (so->so_state & SS_ISCONNECTED) { + SOCK_LOCK(so); + if (so->so_state & (SS_ISCONNECTED|SS_ISDISCONNECTED)) { + SOCK_UNLOCK(so); error = so->so_proto->pr_usrreqs->pru_peeraddr(so, &sa); if (error) return (NULL); @@ -145,6 +147,7 @@ svc_vc_create(SVCPOOL *pool, struct sock free(sa, M_SONAME); return (xprt); } + SOCK_UNLOCK(so); xprt = svc_xprt_alloc(); sx_init(&xprt->xp_lock, "xprt->xp_lock"); From owner-svn-src-stable@FreeBSD.ORG Thu Jun 13 19:35:57 2013 Return-Path: Delivered-To: svn-src-stable@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [8.8.178.115]) by hub.freebsd.org (Postfix) with ESMTP id 10076FB0; Thu, 13 Jun 2013 19:35:57 +0000 (UTC) (envelope-from jhb@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) by mx1.freebsd.org (Postfix) with ESMTP id 01BAB1F59; Thu, 13 Jun 2013 19:35:57 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.7/8.14.7) with ESMTP id r5DJZuts083611; Thu, 13 Jun 2013 19:35:56 GMT (envelope-from jhb@svn.freebsd.org) Received: (from jhb@localhost) by svn.freebsd.org (8.14.7/8.14.5/Submit) id r5DJZuTk083610; Thu, 13 Jun 2013 19:35:56 GMT (envelope-from jhb@svn.freebsd.org) Message-Id: <201306131935.r5DJZuTk083610@svn.freebsd.org> From: John Baldwin Date: Thu, 13 Jun 2013 19:35:56 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-8@freebsd.org Subject: svn commit: r251699 - stable/8/sys/rpc X-SVN-Group: stable-8 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 13 Jun 2013 19:35:57 -0000 Author: jhb Date: Thu Jun 13 19:35:56 2013 New Revision: 251699 URL: http://svnweb.freebsd.org/changeset/base/251699 Log: MFC 249263: Fix a potential socket leak in the NFS server. Modified: stable/8/sys/rpc/svc_vc.c Directory Properties: stable/8/sys/ (props changed) stable/8/sys/rpc/ (props changed) Modified: stable/8/sys/rpc/svc_vc.c ============================================================================== --- stable/8/sys/rpc/svc_vc.c Thu Jun 13 19:25:36 2013 (r251698) +++ stable/8/sys/rpc/svc_vc.c Thu Jun 13 19:35:56 2013 (r251699) @@ -137,7 +137,9 @@ svc_vc_create(SVCPOOL *pool, struct sock struct sockaddr* sa; int error; - if (so->so_state & SS_ISCONNECTED) { + SOCK_LOCK(so); + if (so->so_state & (SS_ISCONNECTED|SS_ISDISCONNECTED)) { + SOCK_UNLOCK(so); error = so->so_proto->pr_usrreqs->pru_peeraddr(so, &sa); if (error) return (NULL); @@ -145,6 +147,7 @@ svc_vc_create(SVCPOOL *pool, struct sock free(sa, M_SONAME); return (xprt); } + SOCK_UNLOCK(so); xprt = svc_xprt_alloc(); sx_init(&xprt->xp_lock, "xprt->xp_lock"); From owner-svn-src-stable@FreeBSD.ORG Thu Jun 13 20:29:07 2013 Return-Path: Delivered-To: svn-src-stable@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by hub.freebsd.org (Postfix) with ESMTP id 16F74D74; Thu, 13 Jun 2013 20:29:07 +0000 (UTC) (envelope-from jhb@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) by mx1.freebsd.org (Postfix) with ESMTP id 08C03114A; Thu, 13 Jun 2013 20:29:07 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.7/8.14.7) with ESMTP id r5DKT6bV000261; Thu, 13 Jun 2013 20:29:06 GMT (envelope-from jhb@svn.freebsd.org) Received: (from jhb@localhost) by svn.freebsd.org (8.14.7/8.14.5/Submit) id r5DKT6Ch000260; Thu, 13 Jun 2013 20:29:06 GMT (envelope-from jhb@svn.freebsd.org) Message-Id: <201306132029.r5DKT6Ch000260@svn.freebsd.org> From: John Baldwin Date: Thu, 13 Jun 2013 20:29:06 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-9@freebsd.org Subject: svn commit: r251700 - stable/9/sys/dev/pci X-SVN-Group: stable-9 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 13 Jun 2013 20:29:07 -0000 Author: jhb Date: Thu Jun 13 20:29:06 2013 New Revision: 251700 URL: http://svnweb.freebsd.org/changeset/base/251700 Log: MFC 249315: Proxy allocation requests for the PCI ROM BAR from child devices similar to how the VGA bus driver currently proxies allocation requests for other PCI BARs. Modified: stable/9/sys/dev/pci/vga_pci.c Directory Properties: stable/9/sys/ (props changed) stable/9/sys/dev/ (props changed) Modified: stable/9/sys/dev/pci/vga_pci.c ============================================================================== --- stable/9/sys/dev/pci/vga_pci.c Thu Jun 13 19:35:56 2013 (r251699) +++ stable/9/sys/dev/pci/vga_pci.c Thu Jun 13 20:29:06 2013 (r251700) @@ -56,7 +56,8 @@ struct vga_resource { struct vga_pci_softc { device_t vga_msi_child; /* Child driver using MSI. */ - struct vga_resource vga_res[PCIR_MAX_BAR_0 + 1]; + struct vga_resource vga_bars[PCIR_MAX_BAR_0 + 1]; + struct vga_resource vga_bios; }; SYSCTL_DECL(_hw_pci); @@ -156,12 +157,24 @@ vga_pci_teardown_intr(device_t dev, devi return (BUS_TEARDOWN_INTR(device_get_parent(dev), dev, irq, cookie)); } +static struct vga_resource * +lookup_res(struct vga_pci_softc *sc, int rid) +{ + int bar; + + if (rid == PCIR_BIOS) + return (&sc->vga_bios); + bar = PCI_RID2BAR(rid); + if (bar >= 0 && bar <= PCIR_MAX_BAR_0) + return (&sc->vga_bars[bar]); + return (NULL); +} + static struct resource * vga_pci_alloc_resource(device_t dev, device_t child, int type, int *rid, u_long start, u_long end, u_long count, u_int flags) { - struct vga_pci_softc *sc; - int bar; + struct vga_resource *vr; switch (type) { case SYS_RES_MEMORY: @@ -170,16 +183,15 @@ vga_pci_alloc_resource(device_t dev, dev * For BARs, we cache the resource so that we only allocate it * from the PCI bus once. */ - bar = PCI_RID2BAR(*rid); - if (bar < 0 || bar > PCIR_MAX_BAR_0) + vr = lookup_res(device_get_softc(dev), *rid); + if (vr == NULL) return (NULL); - sc = device_get_softc(dev); - if (sc->vga_res[bar].vr_res == NULL) - sc->vga_res[bar].vr_res = bus_alloc_resource(dev, type, - rid, start, end, count, flags); - if (sc->vga_res[bar].vr_res != NULL) - sc->vga_res[bar].vr_refs++; - return (sc->vga_res[bar].vr_res); + if (vr->vr_res == NULL) + vr->vr_res = bus_alloc_resource(dev, type, rid, start, + end, count, flags); + if (vr->vr_res != NULL) + vr->vr_refs++; + return (vr->vr_res); } return (bus_alloc_resource(dev, type, rid, start, end, count, flags)); } @@ -188,8 +200,8 @@ static int vga_pci_release_resource(device_t dev, device_t child, int type, int rid, struct resource *r) { - struct vga_pci_softc *sc; - int bar, error; + struct vga_resource *vr; + int error; switch (type) { case SYS_RES_MEMORY: @@ -198,24 +210,22 @@ vga_pci_release_resource(device_t dev, d * For BARs, we release the resource from the PCI bus * when the last child reference goes away. */ - bar = PCI_RID2BAR(rid); - if (bar < 0 || bar > PCIR_MAX_BAR_0) + vr = lookup_res(device_get_softc(dev), rid); + if (vr == NULL) return (EINVAL); - sc = device_get_softc(dev); - if (sc->vga_res[bar].vr_res == NULL) + if (vr->vr_res == NULL) return (EINVAL); - KASSERT(sc->vga_res[bar].vr_res == r, - ("vga_pci resource mismatch")); - if (sc->vga_res[bar].vr_refs > 1) { - sc->vga_res[bar].vr_refs--; + KASSERT(vr->vr_res == r, ("vga_pci resource mismatch")); + if (vr->vr_refs > 1) { + vr->vr_refs--; return (0); } - KASSERT(sc->vga_res[bar].vr_refs > 0, + KASSERT(vr->vr_refs > 0, ("vga_pci resource reference count underflow")); error = bus_release_resource(dev, type, rid, r); if (error == 0) { - sc->vga_res[bar].vr_res = NULL; - sc->vga_res[bar].vr_refs = 0; + vr->vr_res = NULL; + vr->vr_refs = 0; } return (error); } From owner-svn-src-stable@FreeBSD.ORG Thu Jun 13 20:40:40 2013 Return-Path: Delivered-To: svn-src-stable@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by hub.freebsd.org (Postfix) with ESMTP id 1E5CA2F5; Thu, 13 Jun 2013 20:40:40 +0000 (UTC) (envelope-from eadler@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) by mx1.freebsd.org (Postfix) with ESMTP id 0FE6B11BD; Thu, 13 Jun 2013 20:40:40 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.7/8.14.7) with ESMTP id r5DKed02005211; Thu, 13 Jun 2013 20:40:39 GMT (envelope-from eadler@svn.freebsd.org) Received: (from eadler@localhost) by svn.freebsd.org (8.14.7/8.14.5/Submit) id r5DKedvO005209; Thu, 13 Jun 2013 20:40:39 GMT (envelope-from eadler@svn.freebsd.org) Message-Id: <201306132040.r5DKedvO005209@svn.freebsd.org> From: Eitan Adler Date: Thu, 13 Jun 2013 20:40:39 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-9@freebsd.org Subject: svn commit: r251701 - in stable/9/sys/dev/usb: . net X-SVN-Group: stable-9 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 13 Jun 2013 20:40:40 -0000 Author: eadler Date: Thu Jun 13 20:40:39 2013 New Revision: 251701 URL: http://svnweb.freebsd.org/changeset/base/251701 Log: MFC r251109: Add support for tethering on the iPhone 4S PR: usb/179078 Modified: stable/9/sys/dev/usb/net/if_ipheth.c stable/9/sys/dev/usb/usbdevs Directory Properties: stable/9/sys/ (props changed) stable/9/sys/dev/ (props changed) Modified: stable/9/sys/dev/usb/net/if_ipheth.c ============================================================================== --- stable/9/sys/dev/usb/net/if_ipheth.c Thu Jun 13 20:29:06 2013 (r251700) +++ stable/9/sys/dev/usb/net/if_ipheth.c Thu Jun 13 20:40:39 2013 (r251701) @@ -161,6 +161,9 @@ static const STRUCT_USB_HOST_ID ipheth_d {IPHETH_ID(USB_VENDOR_APPLE, USB_PRODUCT_APPLE_IPHONE_4, IPHETH_USBINTF_CLASS, IPHETH_USBINTF_SUBCLASS, IPHETH_USBINTF_PROTO)}, + {IPHETH_ID(USB_VENDOR_APPLE, USB_PRODUCT_APPLE_IPHONE_4S, + IPHETH_USBINTF_CLASS, IPHETH_USBINTF_SUBCLASS, + IPHETH_USBINTF_PROTO)}, {IPHETH_ID(USB_VENDOR_APPLE, USB_PRODUCT_APPLE_IPHONE_5, IPHETH_USBINTF_CLASS, IPHETH_USBINTF_SUBCLASS, IPHETH_USBINTF_PROTO)}, Modified: stable/9/sys/dev/usb/usbdevs ============================================================================== --- stable/9/sys/dev/usb/usbdevs Thu Jun 13 20:29:06 2013 (r251700) +++ stable/9/sys/dev/usb/usbdevs Thu Jun 13 20:40:39 2013 (r251701) @@ -1081,6 +1081,7 @@ product APPLE IPOD_TOUCH 0x1291 iPod Tou product APPLE IPHONE_3G 0x1292 iPhone 3G product APPLE IPHONE_3GS 0x1294 iPhone 3GS product APPLE IPHONE_4 0x1297 iPhone 4 +product APPLE IPHONE_4S 0x12a0 iPhone 4S product APPLE IPHONE_5 0x12a8 iPhone 5 product APPLE IPAD 0x129a iPad product APPLE ETHERNET 0x1402 Ethernet A1277 From owner-svn-src-stable@FreeBSD.ORG Thu Jun 13 20:41:10 2013 Return-Path: Delivered-To: svn-src-stable@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by hub.freebsd.org (Postfix) with ESMTP id AA6F9512; Thu, 13 Jun 2013 20:41:10 +0000 (UTC) (envelope-from eadler@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) by mx1.freebsd.org (Postfix) with ESMTP id 32C9C11C4; Thu, 13 Jun 2013 20:41:10 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.7/8.14.7) with ESMTP id r5DKfAjS005586; Thu, 13 Jun 2013 20:41:10 GMT (envelope-from eadler@svn.freebsd.org) Received: (from eadler@localhost) by svn.freebsd.org (8.14.7/8.14.5/Submit) id r5DKf9t3005584; Thu, 13 Jun 2013 20:41:09 GMT (envelope-from eadler@svn.freebsd.org) Message-Id: <201306132041.r5DKf9t3005584@svn.freebsd.org> From: Eitan Adler Date: Thu, 13 Jun 2013 20:41:09 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-8@freebsd.org Subject: svn commit: r251702 - in stable/8/sys/dev/usb: . net X-SVN-Group: stable-8 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 13 Jun 2013 20:41:10 -0000 Author: eadler Date: Thu Jun 13 20:41:09 2013 New Revision: 251702 URL: http://svnweb.freebsd.org/changeset/base/251702 Log: MFC r251109: Add support for tethering on the iPhone 4S PR: usb/179078 Modified: stable/8/sys/dev/usb/net/if_ipheth.c stable/8/sys/dev/usb/usbdevs Directory Properties: stable/8/sys/ (props changed) stable/8/sys/dev/ (props changed) stable/8/sys/dev/usb/ (props changed) Modified: stable/8/sys/dev/usb/net/if_ipheth.c ============================================================================== --- stable/8/sys/dev/usb/net/if_ipheth.c Thu Jun 13 20:40:39 2013 (r251701) +++ stable/8/sys/dev/usb/net/if_ipheth.c Thu Jun 13 20:41:09 2013 (r251702) @@ -161,6 +161,9 @@ static const STRUCT_USB_HOST_ID ipheth_d {IPHETH_ID(USB_VENDOR_APPLE, USB_PRODUCT_APPLE_IPHONE_4, IPHETH_USBINTF_CLASS, IPHETH_USBINTF_SUBCLASS, IPHETH_USBINTF_PROTO)}, + {IPHETH_ID(USB_VENDOR_APPLE, USB_PRODUCT_APPLE_IPHONE_4S, + IPHETH_USBINTF_CLASS, IPHETH_USBINTF_SUBCLASS, + IPHETH_USBINTF_PROTO)}, {IPHETH_ID(USB_VENDOR_APPLE, USB_PRODUCT_APPLE_IPHONE_5, IPHETH_USBINTF_CLASS, IPHETH_USBINTF_SUBCLASS, IPHETH_USBINTF_PROTO)}, Modified: stable/8/sys/dev/usb/usbdevs ============================================================================== --- stable/8/sys/dev/usb/usbdevs Thu Jun 13 20:40:39 2013 (r251701) +++ stable/8/sys/dev/usb/usbdevs Thu Jun 13 20:41:09 2013 (r251702) @@ -1081,6 +1081,7 @@ product APPLE IPOD_TOUCH 0x1291 iPod Tou product APPLE IPHONE_3G 0x1292 iPhone 3G product APPLE IPHONE_3GS 0x1294 iPhone 3GS product APPLE IPHONE_4 0x1297 iPhone 4 +product APPLE IPHONE_4S 0x12a0 iPhone 4S product APPLE IPHONE_5 0x12a8 iPhone 5 product APPLE IPAD 0x129a iPad product APPLE ETHERNET 0x1402 Ethernet A1277 From owner-svn-src-stable@FreeBSD.ORG Thu Jun 13 20:46:30 2013 Return-Path: Delivered-To: svn-src-stable@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by hub.freebsd.org (Postfix) with ESMTP id 0F0B496C; Thu, 13 Jun 2013 20:46:30 +0000 (UTC) (envelope-from eadler@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) by mx1.freebsd.org (Postfix) with ESMTP id E5DFC11EE; Thu, 13 Jun 2013 20:46:29 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.7/8.14.7) with ESMTP id r5DKkTI4006528; Thu, 13 Jun 2013 20:46:29 GMT (envelope-from eadler@svn.freebsd.org) Received: (from eadler@localhost) by svn.freebsd.org (8.14.7/8.14.5/Submit) id r5DKkTTR006526; Thu, 13 Jun 2013 20:46:29 GMT (envelope-from eadler@svn.freebsd.org) Message-Id: <201306132046.r5DKkTTR006526@svn.freebsd.org> From: Eitan Adler Date: Thu, 13 Jun 2013 20:46:29 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-9@freebsd.org Subject: svn commit: r251704 - stable/9/usr.bin/lockf X-SVN-Group: stable-9 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 13 Jun 2013 20:46:30 -0000 Author: eadler Date: Thu Jun 13 20:46:29 2013 New Revision: 251704 URL: http://svnweb.freebsd.org/changeset/base/251704 Log: MFC r250462: Add option to lockf to avoid creating a file if it does not exist. PR: bin/170775 Modified: stable/9/usr.bin/lockf/lockf.1 stable/9/usr.bin/lockf/lockf.c Directory Properties: stable/9/usr.bin/lockf/ (props changed) Modified: stable/9/usr.bin/lockf/lockf.1 ============================================================================== --- stable/9/usr.bin/lockf/lockf.1 Thu Jun 13 20:46:03 2013 (r251703) +++ stable/9/usr.bin/lockf/lockf.1 Thu Jun 13 20:46:29 2013 (r251704) @@ -32,7 +32,7 @@ .Nd execute a command while holding a file lock .Sh SYNOPSIS .Nm -.Op Fl ks +.Op Fl kns .Op Fl t Ar seconds .Ar file .Ar command @@ -90,6 +90,18 @@ Causes .Nm to operate silently. Failure to acquire the lock is indicated only in the exit status. +.It Fl n +Causes +.Nm +to fail if the specified lock +.Ar file +does not exist. If +.Fl n +is not specified, +.Nm +will create +.Ar file +if necessary. .It Fl t Ar seconds Specifies a timeout for waiting for the lock. By default, @@ -130,6 +142,10 @@ The utility was unable to create the lock file, e.g., because of insufficient access privileges. +.It Dv EX_UNAVAILABLE +The +.Fl n +option is specified and the specified lock file does not exist. .It Dv EX_USAGE There was an error on the .Nm Modified: stable/9/usr.bin/lockf/lockf.c ============================================================================== --- stable/9/usr.bin/lockf/lockf.c Thu Jun 13 20:46:03 2013 (r251703) +++ stable/9/usr.bin/lockf/lockf.c Thu Jun 13 20:46:29 2013 (r251704) @@ -56,16 +56,20 @@ static volatile sig_atomic_t timed_out; int main(int argc, char **argv) { - int ch, silent, status, waitsec; + int ch, flags, silent, status, waitsec; pid_t child; silent = keep = 0; + flags = O_CREAT; waitsec = -1; /* Infinite. */ - while ((ch = getopt(argc, argv, "skt:")) != -1) { + while ((ch = getopt(argc, argv, "sknt:")) != -1) { switch (ch) { case 'k': keep = 1; break; + case 'n': + flags &= ~O_CREAT; + break; case 's': silent = 1; break; @@ -118,13 +122,13 @@ main(int argc, char **argv) * avoiding the separate step of waiting for the lock. This * yields fairness and improved performance. */ - lockfd = acquire_lock(lockname, O_NONBLOCK); + lockfd = acquire_lock(lockname, flags | O_NONBLOCK); while (lockfd == -1 && !timed_out && waitsec != 0) { if (keep) - lockfd = acquire_lock(lockname, 0); + lockfd = acquire_lock(lockname, flags); else { wait_for_lock(lockname); - lockfd = acquire_lock(lockname, O_NONBLOCK); + lockfd = acquire_lock(lockname, flags | O_NONBLOCK); } } if (waitsec > 0) @@ -165,7 +169,7 @@ acquire_lock(const char *name, int flags { int fd; - if ((fd = open(name, O_RDONLY|O_CREAT|O_EXLOCK|flags, 0666)) == -1) { + if ((fd = open(name, flags|O_RDONLY|O_EXLOCK|flags, 0666)) == -1) { if (errno == EAGAIN || errno == EINTR) return (-1); err(EX_CANTCREAT, "cannot open %s", name); @@ -215,7 +219,7 @@ usage(void) { fprintf(stderr, - "usage: lockf [-ks] [-t seconds] file command [arguments]\n"); + "usage: lockf [-kns] [-t seconds] file command [arguments]\n"); exit(EX_USAGE); } From owner-svn-src-stable@FreeBSD.ORG Thu Jun 13 20:46:31 2013 Return-Path: Delivered-To: svn-src-stable@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by hub.freebsd.org (Postfix) with ESMTP id A400496D; Thu, 13 Jun 2013 20:46:31 +0000 (UTC) (envelope-from eadler@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) by mx1.freebsd.org (Postfix) with ESMTP id 8650511EF; Thu, 13 Jun 2013 20:46:31 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.7/8.14.7) with ESMTP id r5DKkVHq006565; Thu, 13 Jun 2013 20:46:31 GMT (envelope-from eadler@svn.freebsd.org) Received: (from eadler@localhost) by svn.freebsd.org (8.14.7/8.14.5/Submit) id r5DKkVvF006563; Thu, 13 Jun 2013 20:46:31 GMT (envelope-from eadler@svn.freebsd.org) Message-Id: <201306132046.r5DKkVvF006563@svn.freebsd.org> From: Eitan Adler Date: Thu, 13 Jun 2013 20:46:31 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-8@freebsd.org Subject: svn commit: r251705 - stable/8/usr.bin/lockf X-SVN-Group: stable-8 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 13 Jun 2013 20:46:31 -0000 Author: eadler Date: Thu Jun 13 20:46:30 2013 New Revision: 251705 URL: http://svnweb.freebsd.org/changeset/base/251705 Log: MFC r250462: Add option to lockf to avoid creating a file if it does not exist. PR: bin/170775 Modified: stable/8/usr.bin/lockf/lockf.1 stable/8/usr.bin/lockf/lockf.c Directory Properties: stable/8/usr.bin/lockf/ (props changed) Modified: stable/8/usr.bin/lockf/lockf.1 ============================================================================== --- stable/8/usr.bin/lockf/lockf.1 Thu Jun 13 20:46:29 2013 (r251704) +++ stable/8/usr.bin/lockf/lockf.1 Thu Jun 13 20:46:30 2013 (r251705) @@ -32,7 +32,7 @@ .Nd execute a command while holding a file lock .Sh SYNOPSIS .Nm -.Op Fl ks +.Op Fl kns .Op Fl t Ar seconds .Ar file .Ar command @@ -90,6 +90,18 @@ Causes .Nm to operate silently. Failure to acquire the lock is indicated only in the exit status. +.It Fl n +Causes +.Nm +to fail if the specified lock +.Ar file +does not exist. If +.Fl n +is not specified, +.Nm +will create +.Ar file +if necessary. .It Fl t Ar seconds Specifies a timeout for waiting for the lock. By default, @@ -130,6 +142,10 @@ The utility was unable to create the lock file, e.g., because of insufficient access privileges. +.It Dv EX_UNAVAILABLE +The +.Fl n +option is specified and the specified lock file does not exist. .It Dv EX_USAGE There was an error on the .Nm Modified: stable/8/usr.bin/lockf/lockf.c ============================================================================== --- stable/8/usr.bin/lockf/lockf.c Thu Jun 13 20:46:29 2013 (r251704) +++ stable/8/usr.bin/lockf/lockf.c Thu Jun 13 20:46:30 2013 (r251705) @@ -56,16 +56,20 @@ static volatile sig_atomic_t timed_out; int main(int argc, char **argv) { - int ch, silent, status, waitsec; + int ch, flags, silent, status, waitsec; pid_t child; silent = keep = 0; + flags = O_CREAT; waitsec = -1; /* Infinite. */ - while ((ch = getopt(argc, argv, "skt:")) != -1) { + while ((ch = getopt(argc, argv, "sknt:")) != -1) { switch (ch) { case 'k': keep = 1; break; + case 'n': + flags &= ~O_CREAT; + break; case 's': silent = 1; break; @@ -118,13 +122,13 @@ main(int argc, char **argv) * avoiding the separate step of waiting for the lock. This * yields fairness and improved performance. */ - lockfd = acquire_lock(lockname, O_NONBLOCK); + lockfd = acquire_lock(lockname, flags | O_NONBLOCK); while (lockfd == -1 && !timed_out && waitsec != 0) { if (keep) - lockfd = acquire_lock(lockname, 0); + lockfd = acquire_lock(lockname, flags); else { wait_for_lock(lockname); - lockfd = acquire_lock(lockname, O_NONBLOCK); + lockfd = acquire_lock(lockname, flags | O_NONBLOCK); } } if (waitsec > 0) @@ -165,7 +169,7 @@ acquire_lock(const char *name, int flags { int fd; - if ((fd = open(name, O_RDONLY|O_CREAT|O_EXLOCK|flags, 0666)) == -1) { + if ((fd = open(name, flags|O_RDONLY|O_EXLOCK|flags, 0666)) == -1) { if (errno == EAGAIN || errno == EINTR) return (-1); err(EX_CANTCREAT, "cannot open %s", name); @@ -215,7 +219,7 @@ usage(void) { fprintf(stderr, - "usage: lockf [-ks] [-t seconds] file command [arguments]\n"); + "usage: lockf [-kns] [-t seconds] file command [arguments]\n"); exit(EX_USAGE); } From owner-svn-src-stable@FreeBSD.ORG Thu Jun 13 21:01:33 2013 Return-Path: Delivered-To: svn-src-stable@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by hub.freebsd.org (Postfix) with ESMTP id 978D1FFF; Thu, 13 Jun 2013 21:01:33 +0000 (UTC) (envelope-from jhb@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) by mx1.freebsd.org (Postfix) with ESMTP id 8848D12A0; Thu, 13 Jun 2013 21:01:33 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.7/8.14.7) with ESMTP id r5DL1X1q012195; Thu, 13 Jun 2013 21:01:33 GMT (envelope-from jhb@svn.freebsd.org) Received: (from jhb@localhost) by svn.freebsd.org (8.14.7/8.14.5/Submit) id r5DL1XUo012194; Thu, 13 Jun 2013 21:01:33 GMT (envelope-from jhb@svn.freebsd.org) Message-Id: <201306132101.r5DL1XUo012194@svn.freebsd.org> From: John Baldwin Date: Thu, 13 Jun 2013 21:01:33 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-8@freebsd.org Subject: svn commit: r251706 - stable/8/sys/dev/pci X-SVN-Group: stable-8 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 13 Jun 2013 21:01:33 -0000 Author: jhb Date: Thu Jun 13 21:01:33 2013 New Revision: 251706 URL: http://svnweb.freebsd.org/changeset/base/251706 Log: MFC 249315: Proxy allocation requests for the PCI ROM BAR from child devices similar to how the VGA bus driver currently proxies allocation requests for other PCI BARs. Modified: stable/8/sys/dev/pci/vga_pci.c Directory Properties: stable/8/sys/ (props changed) stable/8/sys/dev/ (props changed) stable/8/sys/dev/pci/ (props changed) Modified: stable/8/sys/dev/pci/vga_pci.c ============================================================================== --- stable/8/sys/dev/pci/vga_pci.c Thu Jun 13 20:46:30 2013 (r251705) +++ stable/8/sys/dev/pci/vga_pci.c Thu Jun 13 21:01:33 2013 (r251706) @@ -56,7 +56,8 @@ struct vga_resource { struct vga_pci_softc { device_t vga_msi_child; /* Child driver using MSI. */ - struct vga_resource vga_res[PCIR_MAX_BAR_0 + 1]; + struct vga_resource vga_bars[PCIR_MAX_BAR_0 + 1]; + struct vga_resource vga_bios; }; SYSCTL_DECL(_hw_pci); @@ -155,12 +156,24 @@ vga_pci_teardown_intr(device_t dev, devi return (BUS_TEARDOWN_INTR(device_get_parent(dev), dev, irq, cookie)); } +static struct vga_resource * +lookup_res(struct vga_pci_softc *sc, int rid) +{ + int bar; + + if (rid == PCIR_BIOS) + return (&sc->vga_bios); + bar = PCI_RID2BAR(rid); + if (bar >= 0 && bar <= PCIR_MAX_BAR_0) + return (&sc->vga_bars[bar]); + return (NULL); +} + static struct resource * vga_pci_alloc_resource(device_t dev, device_t child, int type, int *rid, u_long start, u_long end, u_long count, u_int flags) { - struct vga_pci_softc *sc; - int bar; + struct vga_resource *vr; switch (type) { case SYS_RES_MEMORY: @@ -169,16 +182,15 @@ vga_pci_alloc_resource(device_t dev, dev * For BARs, we cache the resource so that we only allocate it * from the PCI bus once. */ - bar = PCI_RID2BAR(*rid); - if (bar < 0 || bar > PCIR_MAX_BAR_0) + vr = lookup_res(device_get_softc(dev), *rid); + if (vr == NULL) return (NULL); - sc = device_get_softc(dev); - if (sc->vga_res[bar].vr_res == NULL) - sc->vga_res[bar].vr_res = bus_alloc_resource(dev, type, - rid, start, end, count, flags); - if (sc->vga_res[bar].vr_res != NULL) - sc->vga_res[bar].vr_refs++; - return (sc->vga_res[bar].vr_res); + if (vr->vr_res == NULL) + vr->vr_res = bus_alloc_resource(dev, type, rid, start, + end, count, flags); + if (vr->vr_res != NULL) + vr->vr_refs++; + return (vr->vr_res); } return (bus_alloc_resource(dev, type, rid, start, end, count, flags)); } @@ -187,8 +199,8 @@ static int vga_pci_release_resource(device_t dev, device_t child, int type, int rid, struct resource *r) { - struct vga_pci_softc *sc; - int bar, error; + struct vga_resource *vr; + int error; switch (type) { case SYS_RES_MEMORY: @@ -197,24 +209,22 @@ vga_pci_release_resource(device_t dev, d * For BARs, we release the resource from the PCI bus * when the last child reference goes away. */ - bar = PCI_RID2BAR(rid); - if (bar < 0 || bar > PCIR_MAX_BAR_0) + vr = lookup_res(device_get_softc(dev), rid); + if (vr == NULL) return (EINVAL); - sc = device_get_softc(dev); - if (sc->vga_res[bar].vr_res == NULL) + if (vr->vr_res == NULL) return (EINVAL); - KASSERT(sc->vga_res[bar].vr_res == r, - ("vga_pci resource mismatch")); - if (sc->vga_res[bar].vr_refs > 1) { - sc->vga_res[bar].vr_refs--; + KASSERT(vr->vr_res == r, ("vga_pci resource mismatch")); + if (vr->vr_refs > 1) { + vr->vr_refs--; return (0); } - KASSERT(sc->vga_res[bar].vr_refs > 0, + KASSERT(vr->vr_refs > 0, ("vga_pci resource reference count underflow")); error = bus_release_resource(dev, type, rid, r); if (error == 0) { - sc->vga_res[bar].vr_res = NULL; - sc->vga_res[bar].vr_refs = 0; + vr->vr_res = NULL; + vr->vr_refs = 0; } return (error); } From owner-svn-src-stable@FreeBSD.ORG Thu Jun 13 21:02:44 2013 Return-Path: Delivered-To: svn-src-stable@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by hub.freebsd.org (Postfix) with ESMTP id 9DE162A2; Thu, 13 Jun 2013 21:02:44 +0000 (UTC) (envelope-from jhb@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) by mx1.freebsd.org (Postfix) with ESMTP id 8EB4012BA; Thu, 13 Jun 2013 21:02:44 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.7/8.14.7) with ESMTP id r5DL2ia0012461; Thu, 13 Jun 2013 21:02:44 GMT (envelope-from jhb@svn.freebsd.org) Received: (from jhb@localhost) by svn.freebsd.org (8.14.7/8.14.5/Submit) id r5DL2iNY012460; Thu, 13 Jun 2013 21:02:44 GMT (envelope-from jhb@svn.freebsd.org) Message-Id: <201306132102.r5DL2iNY012460@svn.freebsd.org> From: John Baldwin Date: Thu, 13 Jun 2013 21:02:44 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-9@freebsd.org Subject: svn commit: r251707 - stable/9/sbin/dhclient X-SVN-Group: stable-9 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 13 Jun 2013 21:02:44 -0000 Author: jhb Date: Thu Jun 13 21:02:44 2013 New Revision: 251707 URL: http://svnweb.freebsd.org/changeset/base/251707 Log: MFC 249766: Use a higher TTL (128) for DHCP packets. Modified: stable/9/sbin/dhclient/packet.c Directory Properties: stable/9/sbin/dhclient/ (props changed) Modified: stable/9/sbin/dhclient/packet.c ============================================================================== --- stable/9/sbin/dhclient/packet.c Thu Jun 13 21:01:33 2013 (r251706) +++ stable/9/sbin/dhclient/packet.c Thu Jun 13 21:02:44 2013 (r251707) @@ -128,7 +128,7 @@ assemble_udp_ip_header(unsigned char *bu ip.ip_len = htons(sizeof(ip) + sizeof(udp) + len); ip.ip_id = 0; ip.ip_off = 0; - ip.ip_ttl = 16; + ip.ip_ttl = 128; ip.ip_p = IPPROTO_UDP; ip.ip_sum = 0; ip.ip_src.s_addr = from; From owner-svn-src-stable@FreeBSD.ORG Thu Jun 13 21:03:24 2013 Return-Path: Delivered-To: svn-src-stable@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [8.8.178.115]) by hub.freebsd.org (Postfix) with ESMTP id 3DCDD411; Thu, 13 Jun 2013 21:03:24 +0000 (UTC) (envelope-from jhb@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) by mx1.freebsd.org (Postfix) with ESMTP id 2FF7D12C0; Thu, 13 Jun 2013 21:03:24 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.7/8.14.7) with ESMTP id r5DL3OGO012629; Thu, 13 Jun 2013 21:03:24 GMT (envelope-from jhb@svn.freebsd.org) Received: (from jhb@localhost) by svn.freebsd.org (8.14.7/8.14.5/Submit) id r5DL3OTH012628; Thu, 13 Jun 2013 21:03:24 GMT (envelope-from jhb@svn.freebsd.org) Message-Id: <201306132103.r5DL3OTH012628@svn.freebsd.org> From: John Baldwin Date: Thu, 13 Jun 2013 21:03:24 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-8@freebsd.org Subject: svn commit: r251708 - stable/8/sbin/dhclient X-SVN-Group: stable-8 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 13 Jun 2013 21:03:24 -0000 Author: jhb Date: Thu Jun 13 21:03:23 2013 New Revision: 251708 URL: http://svnweb.freebsd.org/changeset/base/251708 Log: MFC 249766: Use a higher TTL (128) for DHCP packets. Modified: stable/8/sbin/dhclient/packet.c Directory Properties: stable/8/sbin/dhclient/ (props changed) Modified: stable/8/sbin/dhclient/packet.c ============================================================================== --- stable/8/sbin/dhclient/packet.c Thu Jun 13 21:02:44 2013 (r251707) +++ stable/8/sbin/dhclient/packet.c Thu Jun 13 21:03:23 2013 (r251708) @@ -128,7 +128,7 @@ assemble_udp_ip_header(unsigned char *bu ip.ip_len = htons(sizeof(ip) + sizeof(udp) + len); ip.ip_id = 0; ip.ip_off = 0; - ip.ip_ttl = 16; + ip.ip_ttl = 128; ip.ip_p = IPPROTO_UDP; ip.ip_sum = 0; ip.ip_src.s_addr = from; From owner-svn-src-stable@FreeBSD.ORG Thu Jun 13 21:06:18 2013 Return-Path: Delivered-To: svn-src-stable@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by hub.freebsd.org (Postfix) with ESMTP id 1747A70B; Thu, 13 Jun 2013 21:06:18 +0000 (UTC) (envelope-from eadler@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) by mx1.freebsd.org (Postfix) with ESMTP id ED4C312DB; Thu, 13 Jun 2013 21:06:17 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.7/8.14.7) with ESMTP id r5DL6H3m013290; Thu, 13 Jun 2013 21:06:17 GMT (envelope-from eadler@svn.freebsd.org) Received: (from eadler@localhost) by svn.freebsd.org (8.14.7/8.14.5/Submit) id r5DL6HS8013273; Thu, 13 Jun 2013 21:06:17 GMT (envelope-from eadler@svn.freebsd.org) Message-Id: <201306132106.r5DL6HS8013273@svn.freebsd.org> From: Eitan Adler Date: Thu, 13 Jun 2013 21:06:17 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-8@freebsd.org Subject: svn commit: r251710 - stable/8/usr.bin/split X-SVN-Group: stable-8 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 13 Jun 2013 21:06:18 -0000 Author: eadler Date: Thu Jun 13 21:06:17 2013 New Revision: 251710 URL: http://svnweb.freebsd.org/changeset/base/251710 Log: MFC r227183,r229905,r250432,r250451,r250882: - Add missing static keywords to split(1) - Fix warning when compiling with gcc46: error: variable 'defname' set but not use - Implement 'split -d' which allows a numeric suffix instead of an alphabetic one. - Bump .Dd for recent content change. Avoid signed overflow in error handling code. PR: bin/116209 Modified: stable/8/usr.bin/split/split.1 stable/8/usr.bin/split/split.c Directory Properties: stable/8/usr.bin/split/ (props changed) Modified: stable/8/usr.bin/split/split.1 ============================================================================== --- stable/8/usr.bin/split/split.1 Thu Jun 13 21:05:38 2013 (r251709) +++ stable/8/usr.bin/split/split.1 Thu Jun 13 21:06:17 2013 (r251710) @@ -32,7 +32,7 @@ .\" @(#)split.1 8.3 (Berkeley) 4/16/94 .\" $FreeBSD$ .\" -.Dd September 2, 2010 +.Dd May 9, 2013 .Dt SPLIT 1 .Os .Sh NAME @@ -40,10 +40,12 @@ .Nd split a file into pieces .Sh SYNOPSIS .Nm +.Fl d .Op Fl l Ar line_count .Op Fl a Ar suffix_length .Op Ar file Op Ar prefix .Nm +.Fl d .Fl b Ar byte_count Ns .Oo .Sm off @@ -53,10 +55,12 @@ .Op Fl a Ar suffix_length .Op Ar file Op Ar prefix .Nm +.Fl d .Fl n Ar chunk_count .Op Fl a Ar suffix_length .Op Ar file Op Ar prefix .Nm +.Fl d .Fl p Ar pattern .Op Fl a Ar suffix_length .Op Ar file Op Ar prefix @@ -112,6 +116,8 @@ or is appended to the number, the file is split into .Ar byte_count gigabyte pieces. +.It Fl d +Use a numeric suffix instead of a alphabetic suffix. .It Fl l Ar line_count Create split files .Ar line_count Modified: stable/8/usr.bin/split/split.c ============================================================================== --- stable/8/usr.bin/split/split.c Thu Jun 13 21:05:38 2013 (r251709) +++ stable/8/usr.bin/split/split.c Thu Jun 13 21:06:17 2013 (r251710) @@ -55,6 +55,7 @@ static const char sccsid[] = "@(#)split. #include #include #include +#include #include #include #include @@ -65,16 +66,17 @@ static const char sccsid[] = "@(#)split. #define DEFLINE 1000 /* Default num lines per file. */ -off_t bytecnt; /* Byte count to split on. */ -off_t chunks = 0; /* Chunks count to split into. */ -long numlines; /* Line count to split on. */ -int file_open; /* If a file open. */ -int ifd = -1, ofd = -1; /* Input/output file descriptors. */ -char bfr[MAXBSIZE]; /* I/O buffer. */ -char fname[MAXPATHLEN]; /* File name prefix. */ -regex_t rgx; -int pflag; -long sufflen = 2; /* File name suffix length. */ +static off_t bytecnt; /* Byte count to split on. */ +static off_t chunks = 0; /* Chunks count to split into. */ +static long numlines; /* Line count to split on. */ +static int file_open; /* If a file open. */ +static int ifd = -1, ofd = -1; /* Input/output file descriptors. */ +static char bfr[MAXBSIZE]; /* I/O buffer. */ +static char fname[MAXPATHLEN]; /* File name prefix. */ +static regex_t rgx; +static int pflag; +static bool dflag; +static long sufflen = 2; /* File name suffix length. */ static void newfile(void); static void split1(void); @@ -92,7 +94,8 @@ main(int argc, char **argv) setlocale(LC_ALL, ""); - while ((ch = getopt(argc, argv, "0123456789a:b:l:n:p:")) != -1) + dflag = false; + while ((ch = getopt(argc, argv, "0123456789a:b:dl:n:p:")) != -1) switch (ch) { case '0': case '1': case '2': case '3': case '4': case '5': case '6': case '7': case '8': case '9': @@ -135,6 +138,9 @@ main(int argc, char **argv) errx(EX_USAGE, "%s: offset too large", optarg); bytecnt = (off_t)(bytecnti * scale); break; + case 'd': /* Decimal suffix */ + dflag = true; + break; case 'l': /* Line count. */ if (numlines != 0) usage(); @@ -352,6 +358,8 @@ newfile(void) long i, maxfiles, tfnum; static long fnum; static char *fpnt; + char beg, end; + int pattlen; if (ofd == -1) { if (fname[0] == '\0') { @@ -363,10 +371,22 @@ newfile(void) ofd = fileno(stdout); } - /* maxfiles = 26^sufflen, but don't use libm. */ + if (dflag) { + beg = '0'; + end = '9'; + } + else { + beg = 'a'; + end = 'z'; + } + pattlen = end - beg + 1; + + /* maxfiles = pattlen^sufflen, but don't use libm. */ for (maxfiles = 1, i = 0; i < sufflen; i++) - if ((maxfiles *= 26) <= 0) + if (LONG_MAX / pattlen < maxfiles) errx(EX_USAGE, "suffix is too long (max %ld)", i); + else + maxfiles *= pattlen; if (fnum == maxfiles) errx(EX_DATAERR, "too many files"); @@ -375,8 +395,8 @@ newfile(void) tfnum = fnum; i = sufflen - 1; do { - fpnt[i] = tfnum % 26 + 'a'; - tfnum /= 26; + fpnt[i] = tfnum % pattlen + beg; + tfnum /= pattlen; } while (i-- > 0); fpnt[sufflen] = '\0'; From owner-svn-src-stable@FreeBSD.ORG Thu Jun 13 21:06:18 2013 Return-Path: Delivered-To: svn-src-stable@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by hub.freebsd.org (Postfix) with ESMTP id 849E670C; Thu, 13 Jun 2013 21:06:18 +0000 (UTC) (envelope-from eadler@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) by mx1.freebsd.org (Postfix) with ESMTP id 6658C12DC; Thu, 13 Jun 2013 21:06:18 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.7/8.14.7) with ESMTP id r5DL6ItY013298; Thu, 13 Jun 2013 21:06:18 GMT (envelope-from eadler@svn.freebsd.org) Received: (from eadler@localhost) by svn.freebsd.org (8.14.7/8.14.5/Submit) id r5DL6IIA013296; Thu, 13 Jun 2013 21:06:18 GMT (envelope-from eadler@svn.freebsd.org) Message-Id: <201306132106.r5DL6IIA013296@svn.freebsd.org> From: Eitan Adler Date: Thu, 13 Jun 2013 21:06:18 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-9@freebsd.org Subject: svn commit: r251711 - stable/9/usr.bin/split X-SVN-Group: stable-9 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 13 Jun 2013 21:06:18 -0000 Author: eadler Date: Thu Jun 13 21:06:17 2013 New Revision: 251711 URL: http://svnweb.freebsd.org/changeset/base/251711 Log: MFC r227183,r229905,r250432,r250451,r250882: - Add missing static keywords to split(1) - Fix warning when compiling with gcc46: error: variable 'defname' set but not use - Implement 'split -d' which allows a numeric suffix instead of an alphabetic one. - Bump .Dd for recent content change. Avoid signed overflow in error handling code. PR: bin/116209 Modified: stable/9/usr.bin/split/split.1 stable/9/usr.bin/split/split.c Directory Properties: stable/9/usr.bin/split/ (props changed) Modified: stable/9/usr.bin/split/split.1 ============================================================================== --- stable/9/usr.bin/split/split.1 Thu Jun 13 21:06:17 2013 (r251710) +++ stable/9/usr.bin/split/split.1 Thu Jun 13 21:06:17 2013 (r251711) @@ -28,7 +28,7 @@ .\" @(#)split.1 8.3 (Berkeley) 4/16/94 .\" $FreeBSD$ .\" -.Dd September 2, 2010 +.Dd May 9, 2013 .Dt SPLIT 1 .Os .Sh NAME @@ -36,10 +36,12 @@ .Nd split a file into pieces .Sh SYNOPSIS .Nm +.Fl d .Op Fl l Ar line_count .Op Fl a Ar suffix_length .Op Ar file Op Ar prefix .Nm +.Fl d .Fl b Ar byte_count Ns .Oo .Sm off @@ -49,10 +51,12 @@ .Op Fl a Ar suffix_length .Op Ar file Op Ar prefix .Nm +.Fl d .Fl n Ar chunk_count .Op Fl a Ar suffix_length .Op Ar file Op Ar prefix .Nm +.Fl d .Fl p Ar pattern .Op Fl a Ar suffix_length .Op Ar file Op Ar prefix @@ -108,6 +112,8 @@ or is appended to the number, the file is split into .Ar byte_count gigabyte pieces. +.It Fl d +Use a numeric suffix instead of a alphabetic suffix. .It Fl l Ar line_count Create split files .Ar line_count Modified: stable/9/usr.bin/split/split.c ============================================================================== --- stable/9/usr.bin/split/split.c Thu Jun 13 21:06:17 2013 (r251710) +++ stable/9/usr.bin/split/split.c Thu Jun 13 21:06:17 2013 (r251711) @@ -51,6 +51,7 @@ static const char sccsid[] = "@(#)split. #include #include #include +#include #include #include #include @@ -61,16 +62,17 @@ static const char sccsid[] = "@(#)split. #define DEFLINE 1000 /* Default num lines per file. */ -off_t bytecnt; /* Byte count to split on. */ -off_t chunks = 0; /* Chunks count to split into. */ -long numlines; /* Line count to split on. */ -int file_open; /* If a file open. */ -int ifd = -1, ofd = -1; /* Input/output file descriptors. */ -char bfr[MAXBSIZE]; /* I/O buffer. */ -char fname[MAXPATHLEN]; /* File name prefix. */ -regex_t rgx; -int pflag; -long sufflen = 2; /* File name suffix length. */ +static off_t bytecnt; /* Byte count to split on. */ +static off_t chunks = 0; /* Chunks count to split into. */ +static long numlines; /* Line count to split on. */ +static int file_open; /* If a file open. */ +static int ifd = -1, ofd = -1; /* Input/output file descriptors. */ +static char bfr[MAXBSIZE]; /* I/O buffer. */ +static char fname[MAXPATHLEN]; /* File name prefix. */ +static regex_t rgx; +static int pflag; +static bool dflag; +static long sufflen = 2; /* File name suffix length. */ static void newfile(void); static void split1(void); @@ -88,7 +90,8 @@ main(int argc, char **argv) setlocale(LC_ALL, ""); - while ((ch = getopt(argc, argv, "0123456789a:b:l:n:p:")) != -1) + dflag = false; + while ((ch = getopt(argc, argv, "0123456789a:b:dl:n:p:")) != -1) switch (ch) { case '0': case '1': case '2': case '3': case '4': case '5': case '6': case '7': case '8': case '9': @@ -131,6 +134,9 @@ main(int argc, char **argv) errx(EX_USAGE, "%s: offset too large", optarg); bytecnt = (off_t)(bytecnti * scale); break; + case 'd': /* Decimal suffix */ + dflag = true; + break; case 'l': /* Line count. */ if (numlines != 0) usage(); @@ -348,6 +354,8 @@ newfile(void) long i, maxfiles, tfnum; static long fnum; static char *fpnt; + char beg, end; + int pattlen; if (ofd == -1) { if (fname[0] == '\0') { @@ -359,10 +367,22 @@ newfile(void) ofd = fileno(stdout); } - /* maxfiles = 26^sufflen, but don't use libm. */ + if (dflag) { + beg = '0'; + end = '9'; + } + else { + beg = 'a'; + end = 'z'; + } + pattlen = end - beg + 1; + + /* maxfiles = pattlen^sufflen, but don't use libm. */ for (maxfiles = 1, i = 0; i < sufflen; i++) - if ((maxfiles *= 26) <= 0) + if (LONG_MAX / pattlen < maxfiles) errx(EX_USAGE, "suffix is too long (max %ld)", i); + else + maxfiles *= pattlen; if (fnum == maxfiles) errx(EX_DATAERR, "too many files"); @@ -371,8 +391,8 @@ newfile(void) tfnum = fnum; i = sufflen - 1; do { - fpnt[i] = tfnum % 26 + 'a'; - tfnum /= 26; + fpnt[i] = tfnum % pattlen + beg; + tfnum /= pattlen; } while (i-- > 0); fpnt[sufflen] = '\0'; From owner-svn-src-stable@FreeBSD.ORG Fri Jun 14 00:02:29 2013 Return-Path: Delivered-To: svn-src-stable@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [8.8.178.115]) by hub.freebsd.org (Postfix) with ESMTP id C31A438F; Fri, 14 Jun 2013 00:02:29 +0000 (UTC) (envelope-from rmacklem@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) by mx1.freebsd.org (Postfix) with ESMTP id B536D12E5; Fri, 14 Jun 2013 00:02:29 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.7/8.14.7) with ESMTP id r5E02TjV070467; Fri, 14 Jun 2013 00:02:29 GMT (envelope-from rmacklem@svn.freebsd.org) Received: (from rmacklem@localhost) by svn.freebsd.org (8.14.7/8.14.5/Submit) id r5E02Tu1070466; Fri, 14 Jun 2013 00:02:29 GMT (envelope-from rmacklem@svn.freebsd.org) Message-Id: <201306140002.r5E02Tu1070466@svn.freebsd.org> From: Rick Macklem Date: Fri, 14 Jun 2013 00:02:29 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-8@freebsd.org Subject: svn commit: r251719 - stable/8/sys/nfsclient X-SVN-Group: stable-8 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 14 Jun 2013 00:02:29 -0000 Author: rmacklem Date: Fri Jun 14 00:02:29 2013 New Revision: 251719 URL: http://svnweb.freebsd.org/changeset/base/251719 Log: MFC: r251089 Add a patch analygous to r248567, r248581, r251079 to the old NFS client to avoid the panic reported in the PR by doing the vnode_pager_setsize() call after unlocking the mutex. Modified: stable/8/sys/nfsclient/nfs_subs.c Directory Properties: stable/8/sys/ (props changed) stable/8/sys/nfsclient/ (props changed) Modified: stable/8/sys/nfsclient/nfs_subs.c ============================================================================== --- stable/8/sys/nfsclient/nfs_subs.c Thu Jun 13 22:30:24 2013 (r251718) +++ stable/8/sys/nfsclient/nfs_subs.c Fri Jun 14 00:02:29 2013 (r251719) @@ -478,6 +478,8 @@ nfs_loadattrcache(struct vnode **vpp, st struct timespec mtime, mtime_save; int v3 = NFS_ISV3(vp); int error = 0; + u_quad_t nsize; + int setnsize; md = *mdp; t1 = (mtod(md, caddr_t) + md->m_len) - *dposp; @@ -580,6 +582,8 @@ nfs_loadattrcache(struct vnode **vpp, st vap->va_filerev = 0; } np->n_attrstamp = time_second; + setnsize = 0; + nsize = 0; if (vap->va_size != np->n_size) { if (vap->va_type == VREG) { if (dontshrink && vap->va_size < np->n_size) { @@ -606,7 +610,8 @@ nfs_loadattrcache(struct vnode **vpp, st np->n_size = vap->va_size; np->n_flag |= NSIZECHANGED; } - vnode_pager_setsize(vp, np->n_size); + setnsize = 1; + nsize = vap->va_size; } else { np->n_size = vap->va_size; } @@ -643,6 +648,8 @@ nfs_loadattrcache(struct vnode **vpp, st KDTRACE_NFS_ATTRCACHE_LOAD_DONE(vp, &np->n_vattr, 0); #endif mtx_unlock(&np->n_mtx); + if (setnsize) + vnode_pager_setsize(vp, nsize); out: #ifdef KDTRACE_HOOKS if (error) From owner-svn-src-stable@FreeBSD.ORG Fri Jun 14 00:30:12 2013 Return-Path: Delivered-To: svn-src-stable@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by hub.freebsd.org (Postfix) with ESMTP id 87BDB8B1; Fri, 14 Jun 2013 00:30:12 +0000 (UTC) (envelope-from rmacklem@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) by mx1.freebsd.org (Postfix) with ESMTP id 5FF9A13B8; Fri, 14 Jun 2013 00:30:12 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.7/8.14.7) with ESMTP id r5E0UCGp079544; Fri, 14 Jun 2013 00:30:12 GMT (envelope-from rmacklem@svn.freebsd.org) Received: (from rmacklem@localhost) by svn.freebsd.org (8.14.7/8.14.5/Submit) id r5E0UCKN079543; Fri, 14 Jun 2013 00:30:12 GMT (envelope-from rmacklem@svn.freebsd.org) Message-Id: <201306140030.r5E0UCKN079543@svn.freebsd.org> From: Rick Macklem Date: Fri, 14 Jun 2013 00:30:11 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-8@freebsd.org Subject: svn commit: r251721 - stable/8/usr.sbin/gssd X-SVN-Group: stable-8 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 14 Jun 2013 00:30:12 -0000 Author: rmacklem Date: Fri Jun 14 00:30:11 2013 New Revision: 251721 URL: http://svnweb.freebsd.org/changeset/base/251721 Log: MFC: r250176 Fix the getpwuid_r() call in the gssd daemon so that it handles the ERANGE error return case. Without this fix, authentication of users for certain system setups could fail unexpectedly. Modified: stable/8/usr.sbin/gssd/gssd.c Directory Properties: stable/8/usr.sbin/gssd/ (props changed) Modified: stable/8/usr.sbin/gssd/gssd.c ============================================================================== --- stable/8/usr.sbin/gssd/gssd.c Fri Jun 14 00:03:43 2013 (r251720) +++ stable/8/usr.sbin/gssd/gssd.c Fri Jun 14 00:30:11 2013 (r251721) @@ -36,6 +36,7 @@ __FBSDID("$FreeBSD$"); #include #include #include +#include #include #include #include @@ -475,8 +476,11 @@ gssd_pname_to_uid_1_svc(pname_to_uid_arg { gss_name_t name = gssd_find_resource(argp->pname); uid_t uid; - char buf[128]; + char buf[1024], *bufp; struct passwd pwd, *pw; + size_t buflen; + int error; + static size_t buflen_hint = 1024; memset(result, 0, sizeof(*result)); if (name) { @@ -485,7 +489,24 @@ gssd_pname_to_uid_1_svc(pname_to_uid_arg name, argp->mech, &uid); if (result->major_status == GSS_S_COMPLETE) { result->uid = uid; - getpwuid_r(uid, &pwd, buf, sizeof(buf), &pw); + buflen = buflen_hint; + for (;;) { + pw = NULL; + bufp = buf; + if (buflen > sizeof(buf)) + bufp = malloc(buflen); + if (bufp == NULL) + break; + error = getpwuid_r(uid, &pwd, bufp, buflen, + &pw); + if (error != ERANGE) + break; + if (buflen > sizeof(buf)) + free(bufp); + buflen += 1024; + if (buflen > buflen_hint) + buflen_hint = buflen; + } if (pw) { int len = NGRPS; int groups[NGRPS]; @@ -502,6 +523,8 @@ gssd_pname_to_uid_1_svc(pname_to_uid_arg result->gidlist.gidlist_len = 0; result->gidlist.gidlist_val = NULL; } + if (bufp != NULL && buflen > sizeof(buf)) + free(bufp); } } else { result->major_status = GSS_S_BAD_NAME; From owner-svn-src-stable@FreeBSD.ORG Fri Jun 14 00:33:55 2013 Return-Path: Delivered-To: svn-src-stable@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by hub.freebsd.org (Postfix) with ESMTP id B9CB2B04; Fri, 14 Jun 2013 00:33:55 +0000 (UTC) (envelope-from rmacklem@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) by mx1.freebsd.org (Postfix) with ESMTP id 91DA2146B; Fri, 14 Jun 2013 00:33:55 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.7/8.14.7) with ESMTP id r5E0XtEV080329; Fri, 14 Jun 2013 00:33:55 GMT (envelope-from rmacklem@svn.freebsd.org) Received: (from rmacklem@localhost) by svn.freebsd.org (8.14.7/8.14.5/Submit) id r5E0XtU7080328; Fri, 14 Jun 2013 00:33:55 GMT (envelope-from rmacklem@svn.freebsd.org) Message-Id: <201306140033.r5E0XtU7080328@svn.freebsd.org> From: Rick Macklem Date: Fri, 14 Jun 2013 00:33:55 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-8@freebsd.org Subject: svn commit: r251722 - stable/8/kerberos5/lib/libgssapi_krb5 X-SVN-Group: stable-8 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 14 Jun 2013 00:33:55 -0000 Author: rmacklem Date: Fri Jun 14 00:33:55 2013 New Revision: 251722 URL: http://svnweb.freebsd.org/changeset/base/251722 Log: MFC: r250177 Fix the getpwnam_r() call in the pname_to_uid() kerberos library function so that it handles the ERANGE error return case. Without this fix, authentication of users for certain system setups could fail unexpectedly. Modified: stable/8/kerberos5/lib/libgssapi_krb5/pname_to_uid.c Directory Properties: stable/8/kerberos5/lib/libgssapi_krb5/ (props changed) Modified: stable/8/kerberos5/lib/libgssapi_krb5/pname_to_uid.c ============================================================================== --- stable/8/kerberos5/lib/libgssapi_krb5/pname_to_uid.c Fri Jun 14 00:30:11 2013 (r251721) +++ stable/8/kerberos5/lib/libgssapi_krb5/pname_to_uid.c Fri Jun 14 00:33:55 2013 (r251722) @@ -26,6 +26,7 @@ */ /* $FreeBSD$ */ +#include #include #include "krb5/gsskrb5_locl.h" @@ -37,8 +38,12 @@ _gsskrb5_pname_to_uid(OM_uint32 *minor_s krb5_context context; krb5_const_principal name = (krb5_const_principal) pname; krb5_error_code kret; - char lname[MAXLOGNAME + 1], buf[128]; + char lname[MAXLOGNAME + 1], buf[1024], *bufp; struct passwd pwd, *pw; + size_t buflen; + int error; + OM_uint32 ret; + static size_t buflen_hint = 1024; GSSAPI_KRB5_INIT (&context); @@ -49,11 +54,30 @@ _gsskrb5_pname_to_uid(OM_uint32 *minor_s } *minor_status = 0; - getpwnam_r(lname, &pwd, buf, sizeof(buf), &pw); + buflen = buflen_hint; + for (;;) { + pw = NULL; + bufp = buf; + if (buflen > sizeof(buf)) + bufp = malloc(buflen); + if (bufp == NULL) + break; + error = getpwnam_r(lname, &pwd, bufp, buflen, &pw); + if (error != ERANGE) + break; + if (buflen > sizeof(buf)) + free(bufp); + buflen += 1024; + if (buflen > buflen_hint) + buflen_hint = buflen; + } if (pw) { *uidp = pw->pw_uid; - return (GSS_S_COMPLETE); + ret = GSS_S_COMPLETE; } else { - return (GSS_S_FAILURE); + ret = GSS_S_FAILURE; } + if (bufp != NULL && buflen > sizeof(buf)) + free(bufp); + return (ret); } From owner-svn-src-stable@FreeBSD.ORG Fri Jun 14 02:21:32 2013 Return-Path: Delivered-To: svn-src-stable@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [8.8.178.115]) by hub.freebsd.org (Postfix) with ESMTP id D5872EC; Fri, 14 Jun 2013 02:21:32 +0000 (UTC) (envelope-from hrs@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) by mx1.freebsd.org (Postfix) with ESMTP id B6BD018C0; Fri, 14 Jun 2013 02:21:32 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.7/8.14.7) with ESMTP id r5E2LWim015766; Fri, 14 Jun 2013 02:21:32 GMT (envelope-from hrs@svn.freebsd.org) Received: (from hrs@localhost) by svn.freebsd.org (8.14.7/8.14.5/Submit) id r5E2LWMB015764; Fri, 14 Jun 2013 02:21:32 GMT (envelope-from hrs@svn.freebsd.org) Message-Id: <201306140221.r5E2LWMB015764@svn.freebsd.org> From: Hiroki Sato Date: Fri, 14 Jun 2013 02:21:32 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-9@freebsd.org Subject: svn commit: r251724 - stable/9/usr.sbin/route6d X-SVN-Group: stable-9 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 14 Jun 2013 02:21:32 -0000 Author: hrs Date: Fri Jun 14 02:21:32 2013 New Revision: 251724 URL: http://svnweb.freebsd.org/changeset/base/251724 Log: MFC 228990,243232,243233: Overhaul of route6d(8): - Use queue(3) for linked-list. - Use a consistent naming scheme for struct members. - Use ANSI C style function declaration. - Add check of RTM_VERSION mismatch. - Increase the number of retry for NET_RT_DUMP from 5 to 15. - Use 2001:db8:: as an example instead of deprecated 3ffe:: address block. - Add check for connected routes. - Add support of RTM_IFANNOUNCE for dyanmically-added/removed interfaces. - Add support of *, ?, and [ in the interface list. - Add -P number to specify route flag which will never expire. - Add -Q number to specify route flag which route6d will add to routes via RIP. - Add -p pidfile to specify the process ID file. Modified: stable/9/usr.sbin/route6d/route6d.8 stable/9/usr.sbin/route6d/route6d.c Directory Properties: stable/9/usr.sbin/route6d/ (props changed) Modified: stable/9/usr.sbin/route6d/route6d.8 ============================================================================== --- stable/9/usr.sbin/route6d/route6d.8 Fri Jun 14 01:12:59 2013 (r251723) +++ stable/9/usr.sbin/route6d/route6d.8 Fri Jun 14 02:21:32 2013 (r251724) @@ -16,7 +16,7 @@ .\" .\" $FreeBSD$ .\" -.Dd January 31, 1997 +.Dd November 18, 2012 .Dt ROUTE6D 8 .Os .Sh NAME @@ -41,6 +41,15 @@ .Op Fl O Ar prefix/preflen,if1[,if2...\&] .Ek .Bk -words +.Op Fl P Ar number +.Ek +.Bk -words +.Op Fl p Ar pidfile +.Ek +.Bk -words +.Op Fl Q Ar number +.Ek +.Bk -words .Op Fl T Ar if1[,if2...\&] .Ek .Bk -words @@ -80,6 +89,12 @@ and advertises the aggregated route .Ar prefix/preflen , to the interfaces specified in the comma-separated interface list, .Ar if1[,if2...] . +The characters +.Qq Li * , +.Qq Li \&? , +and +.Qq Li \&[ +in the interface list will be interpreted as shell-style pattern. The .Nm utility creates a static route to @@ -143,7 +158,7 @@ option. For example, with .Do .Fl L -.Li 3ffe::/16,if1 +.Li 2001:db8::/16,if1 .Fl L .Li ::/0,if1 .Dc @@ -164,6 +179,33 @@ With this option .Nm will only advertise routes that matches .Ar prefix/preflen . +.It Fl P Ar number +Specifies routes to be ignored in calculation of expiration timer. +The +.Ar number +must be +.Li 1 , +.Li 2 , +or +.Li 3 +and it means route flags of +.Li RTF_PROTO1 , +.Li RTF_PROTO2 , +or +.Li RTF_PROTO3 . +When +.Li 1 +is specified, routes with +.Li RTF_PROTO1 +will never expire. +.It Fl p Ar pidfile +Specifies an alternative file in which to store the process ID. +The default is +.Pa /var/run/route6d.pid . +.It Fl Q Ar number +Specifies flag which will be used for routes added by RIP protocol. +The default is +.Li 2 Pq Li RTF_PROTO2 . .\" .It Fl q Makes Modified: stable/9/usr.sbin/route6d/route6d.c ============================================================================== --- stable/9/usr.sbin/route6d/route6d.c Fri Jun 14 01:12:59 2013 (r251723) +++ stable/9/usr.sbin/route6d/route6d.c Fri Jun 14 02:21:32 2013 (r251724) @@ -31,13 +31,14 @@ */ #ifndef lint -static char _rcsid[] = "$KAME: route6d.c,v 1.104 2003/10/31 00:30:20 itojun Exp $"; +static const char _rcsid[] = "$KAME: route6d.c,v 1.104 2003/10/31 00:30:20 itojun Exp $"; #endif #include #include #include +#include #include #include #include @@ -78,6 +79,7 @@ static char _rcsid[] = "$KAME: route6d.c #include "route6d.h" #define MAXFILTER 40 +#define RT_DUMP_MAXRETRY 15 #ifdef DEBUG #define INIT_INTERVAL6 6 @@ -102,9 +104,10 @@ static char _rcsid[] = "$KAME: route6d.c (addr).s6_addr[3] = (index) & 0xff; \ } while (0) -struct ifc { /* Configuration of an interface */ - char *ifc_name; /* if name */ - struct ifc *ifc_next; +struct ifc { /* Configuration of an interface */ + TAILQ_ENTRY(ifc) ifc_next; + + char ifc_name[IFNAMSIZ]; /* if name */ int ifc_index; /* if index */ int ifc_mtu; /* if mtu */ int ifc_metric; /* if metric */ @@ -112,30 +115,32 @@ struct ifc { /* Configuration of an in short ifc_cflags; /* IFC_XXX */ struct in6_addr ifc_mylladdr; /* my link-local address */ struct sockaddr_in6 ifc_ripsin; /* rip multicast address */ - struct iff *ifc_filter; /* filter structure */ - struct ifac *ifc_addr; /* list of AF_INET6 addresses */ + TAILQ_HEAD(, ifac) ifc_ifac_head; /* list of AF_INET6 addrs */ + TAILQ_HEAD(, iff) ifc_iff_head; /* list of filters */ int ifc_joined; /* joined to ff02::9 */ }; +TAILQ_HEAD(, ifc) ifc_head = TAILQ_HEAD_INITIALIZER(ifc_head); + +struct ifac { /* Adddress associated to an interface */ + TAILQ_ENTRY(ifac) ifac_next; -struct ifac { /* Adddress associated to an interface */ - struct ifc *ifa_conf; /* back pointer */ - struct ifac *ifa_next; - struct in6_addr ifa_addr; /* address */ - struct in6_addr ifa_raddr; /* remote address, valid in p2p */ - int ifa_plen; /* prefix length */ + struct ifc *ifac_ifc; /* back pointer */ + struct in6_addr ifac_addr; /* address */ + struct in6_addr ifac_raddr; /* remote address, valid in p2p */ + int ifac_scope_id; /* scope id */ + int ifac_plen; /* prefix length */ }; -struct iff { +struct iff { /* Filters for an interface */ + TAILQ_ENTRY(iff) iff_next; + int iff_type; struct in6_addr iff_addr; int iff_plen; - struct iff *iff_next; }; -struct ifc *ifc; -int nifc; /* number of valid ifc's */ struct ifc **index2ifc; -int nindex2ifc; +unsigned int nindex2ifc; struct ifc *loopifcp = NULL; /* pointing to loopback */ #ifdef HAVE_POLL_H struct pollfd set[2]; @@ -159,11 +164,12 @@ struct rip6 *ripbuf; /* packet buffer fo * One of the major drawbacks of the linear linked list is the difficulty * of representing the relationship between a couple of routes. This may * be a significant problem when we have to support route aggregation with - * supressing the specifices covered by the aggregate. + * suppressing the specifics covered by the aggregate. */ -struct riprt { - struct riprt *rrt_next; /* next destination */ +struct riprt { + TAILQ_ENTRY(riprt) rrt_next; /* next destination */ + struct riprt *rrt_same; /* same destination - future use */ struct netinfo6 rrt_info; /* network info */ struct in6_addr rrt_gw; /* gateway */ @@ -172,8 +178,7 @@ struct riprt { time_t rrt_t; /* when the route validated */ int rrt_index; /* ifindex from which this route got */ }; - -struct riprt *riprt = 0; +TAILQ_HEAD(, riprt) riprt_head = TAILQ_HEAD_INITIALIZER(riprt_head); int dflag = 0; /* debug flag */ int qflag = 0; /* quiet flag */ @@ -181,6 +186,8 @@ int nflag = 0; /* don't update kernel ro int aflag = 0; /* age out even the statically defined routes */ int hflag = 0; /* don't split horizon */ int lflag = 0; /* exchange site local routes */ +int Pflag = 0; /* don't age out routes with RTF_PROTO[123] */ +int Qflag = RTF_PROTO2; /* set RTF_PROTO[123] flag to routes by RIPng */ int sflag = 0; /* announce static routes w/ split horizon */ int Sflag = 0; /* announce static routes to every interface */ unsigned long routetag = 0; /* route tag attached on originating case */ @@ -222,7 +229,7 @@ int out_filter(struct riprt *, struct if void init(void); void sockopt(struct ifc *); void ifconfig(void); -void ifconfig1(const char *, const struct sockaddr *, struct ifc *, int); +int ifconfig1(const char *, const struct sockaddr *, struct ifc *, int); void rtrecv(void); int rt_del(const struct sockaddr_in6 *, const struct sockaddr_in6 *, const struct sockaddr_in6 *); @@ -240,12 +247,13 @@ void applyplen(struct in6_addr *, int); void ifrtdump(int); void ifdump(int); void ifdump0(FILE *, const struct ifc *); +void ifremove(int); void rtdump(int); void rt_entry(struct rt_msghdr *, int); void rtdexit(void); void riprequest(struct ifc *, struct netinfo6 *, int, struct sockaddr_in6 *); -void ripflush(struct ifc *, struct sockaddr_in6 *); +void ripflush(struct ifc *, struct sockaddr_in6 *, int, struct netinfo6 *np); void sendrequest(struct ifc *); int sin6mask2len(const struct sockaddr_in6 *); int mask2len(const struct in6_addr *, int); @@ -260,7 +268,7 @@ char *hms(void); const char *inet6_n2p(const struct in6_addr *); struct ifac *ifa_match(const struct ifc *, const struct in6_addr *, int); struct in6_addr *plen2mask(int); -struct riprt *rtsearch(struct netinfo6 *, struct riprt **); +struct riprt *rtsearch(struct netinfo6 *); int ripinterval(int); time_t ripsuptrig(void); void fatal(const char *, ...) @@ -276,16 +284,23 @@ void setindex2ifc(int, struct ifc *); #define MALLOC(type) ((type *)malloc(sizeof(type))) +#define IFIL_TYPE_ANY 0x0 +#define IFIL_TYPE_A 'A' +#define IFIL_TYPE_N 'N' +#define IFIL_TYPE_T 'T' +#define IFIL_TYPE_O 'O' +#define IFIL_TYPE_L 'L' + int -main(argc, argv) - int argc; - char **argv; +main(int argc, char *argv[]) { int ch; int error = 0; + unsigned long proto; struct ifc *ifcp; sigset_t mask, omask; - FILE *pidfile; + const char *pidfile = ROUTE6D_PID; + FILE *pidfh; char *progname; char *ep; @@ -296,7 +311,7 @@ main(argc, argv) progname = *argv; pid = getpid(); - while ((ch = getopt(argc, argv, "A:N:O:R:T:L:t:adDhlnqsS")) != -1) { + while ((ch = getopt(argc, argv, "A:N:O:R:T:L:t:adDhlnp:P:Q:qsS")) != -1) { switch (ch) { case 'A': case 'N': @@ -318,6 +333,41 @@ main(argc, argv) /*NOTREACHED*/ } break; + case 'p': + pidfile = optarg; + break; + case 'P': + ep = NULL; + proto = strtoul(optarg, &ep, 0); + if (!ep || *ep != '\0' || 3 < proto) { + fatal("invalid P flag"); + /*NOTREACHED*/ + } + if (proto == 0) + Pflag = 0; + if (proto == 1) + Pflag |= RTF_PROTO1; + if (proto == 2) + Pflag |= RTF_PROTO2; + if (proto == 3) + Pflag |= RTF_PROTO3; + break; + case 'Q': + ep = NULL; + proto = strtoul(optarg, &ep, 0); + if (!ep || *ep != '\0' || 3 < proto) { + fatal("invalid Q flag"); + /*NOTREACHED*/ + } + if (proto == 0) + Qflag = 0; + if (proto == 1) + Qflag |= RTF_PROTO1; + if (proto == 2) + Qflag |= RTF_PROTO2; + if (proto == 3) + Qflag |= RTF_PROTO3; + break; case 'R': if ((rtlog = fopen(optarg, "w")) == NULL) { fatal("Can not write to routelog"); @@ -372,11 +422,10 @@ main(argc, argv) init(); ifconfig(); - for (ifcp = ifc; ifcp; ifcp = ifcp->ifc_next) { + TAILQ_FOREACH(ifcp, &ifc_head, ifc_next) { if (ifcp->ifc_index < 0) { - fprintf(stderr, -"No ifindex found at %s (no link-local address?)\n", - ifcp->ifc_name); + fprintf(stderr, "No ifindex found at %s " + "(no link-local address?)\n", ifcp->ifc_name); error++; } } @@ -386,20 +435,19 @@ main(argc, argv) fatal("No loopback found"); /*NOTREACHED*/ } - for (ifcp = ifc; ifcp; ifcp = ifcp->ifc_next) + TAILQ_FOREACH(ifcp, &ifc_head, ifc_next) { ifrt(ifcp, 0); + } filterconfig(); krtread(0); if (dflag) ifrtdump(0); -#if 1 pid = getpid(); - if ((pidfile = fopen(ROUTE6D_PID, "w")) != NULL) { - fprintf(pidfile, "%d\n", pid); - fclose(pidfile); + if ((pidfh = fopen(pidfile, "w")) != NULL) { + fprintf(pidfh, "%d\n", pid); + fclose(pidfh); } -#endif if ((ripbuf = (struct rip6 *)malloc(RIP6_MAXMTU)) == NULL) { fatal("malloc"); @@ -427,8 +475,8 @@ main(argc, argv) */ alarm(ripinterval(INIT_INTERVAL6)); - for (ifcp = ifc; ifcp; ifcp = ifcp->ifc_next) { - if (iff_find(ifcp, 'N')) + TAILQ_FOREACH(ifcp, &ifc_head, ifc_next) { + if (iff_find(ifcp, IFIL_TYPE_N) != NULL) continue; if (ifcp->ifc_index > 0 && (ifcp->ifc_flags & IFF_UP)) sendrequest(ifcp); @@ -495,8 +543,7 @@ main(argc, argv) } void -sighandler(signo) - int signo; +sighandler(int signo) { switch (signo) { @@ -520,12 +567,12 @@ sighandler(signo) */ /* ARGSUSED */ void -rtdexit() +rtdexit(void) { struct riprt *rrt; alarm(0); - for (rrt = riprt; rrt; rrt = rrt->rrt_next) { + TAILQ_FOREACH(rrt, &riprt_head, rrt_next) { if (rrt->rrt_rflags & RRTF_AGGREGATE) { delroute(&rrt->rrt_info, &rrt->rrt_gw); } @@ -547,39 +594,27 @@ rtdexit() */ /* ARGSUSED */ void -ripalarm() +ripalarm(void) { struct ifc *ifcp; - struct riprt *rrt, *rrt_prev, *rrt_next; + struct riprt *rrt, *rrt_tmp; time_t t_lifetime, t_holddown; /* age the RIP routes */ - rrt_prev = 0; t_lifetime = time(NULL) - RIP_LIFETIME; t_holddown = t_lifetime - RIP_HOLDDOWN; - for (rrt = riprt; rrt; rrt = rrt_next) { - rrt_next = rrt->rrt_next; - - if (rrt->rrt_t == 0) { - rrt_prev = rrt; + TAILQ_FOREACH_SAFE(rrt, &riprt_head, rrt_next, rrt_tmp) { + if (rrt->rrt_t == 0) continue; - } - if (rrt->rrt_t < t_holddown) { - if (rrt_prev) { - rrt_prev->rrt_next = rrt->rrt_next; - } else { - riprt = rrt->rrt_next; - } + else if (rrt->rrt_t < t_holddown) { + TAILQ_REMOVE(&riprt_head, rrt, rrt_next); delroute(&rrt->rrt_info, &rrt->rrt_gw); free(rrt); - continue; - } - if (rrt->rrt_t < t_lifetime) + } else if (rrt->rrt_t < t_lifetime) rrt->rrt_info.rip6_metric = HOPCNT_INFINITY6; - rrt_prev = rrt; } /* Supply updates */ - for (ifcp = ifc; ifcp; ifcp = ifcp->ifc_next) { + TAILQ_FOREACH(ifcp, &ifc_head, ifc_next) { if (ifcp->ifc_index > 0 && (ifcp->ifc_flags & IFF_UP)) ripsend(ifcp, &ifcp->ifc_ripsin, 0); } @@ -587,15 +622,14 @@ ripalarm() } void -init() +init(void) { int error; const int int0 = 0, int1 = 1, int255 = 255; struct addrinfo hints, *res; char port[NI_MAXSERV]; - ifc = (struct ifc *)NULL; - nifc = 0; + TAILQ_INIT(&ifc_head); nindex2ifc = 0; /*initial guess*/ index2ifc = NULL; snprintf(port, sizeof(port), "%u", RIP6_PORT); @@ -735,13 +769,8 @@ init() /* * ripflush flushes the rip datagram stored in the rip buffer */ -static int nrt; -static struct netinfo6 *np; - void -ripflush(ifcp, sin6) - struct ifc *ifcp; - struct sockaddr_in6 *sin6; +ripflush(struct ifc *ifcp, struct sockaddr_in6 *sin6, int nrt, struct netinfo6 *np) { int i; int error; @@ -783,21 +812,19 @@ ripflush(ifcp, sin6) ifcp->ifc_name, inet6_n2p(&ifcp->ifc_ripsin.sin6_addr)); ifcp->ifc_flags &= ~IFF_UP; /* As if down for AF_INET6 */ } - nrt = 0; np = ripbuf->rip6_nets; } /* * Generate RIP6_RESPONSE packets and send them. */ void -ripsend(ifcp, sin6, flag) - struct ifc *ifcp; - struct sockaddr_in6 *sin6; - int flag; +ripsend(struct ifc *ifcp, struct sockaddr_in6 *sin6, int flag) { struct riprt *rrt; struct in6_addr *nh; /* next hop */ + struct netinfo6 *np; int maxrte; + int nrt; if (qflag) return; @@ -811,20 +838,24 @@ ripsend(ifcp, sin6, flag) sizeof(struct udphdr) - sizeof(struct rip6) + sizeof(struct netinfo6)) / sizeof(struct netinfo6); - nrt = 0; np = ripbuf->rip6_nets; nh = NULL; - for (rrt = riprt; rrt; rrt = rrt->rrt_next) { + nh = NULL; + nrt = 0; + np = ripbuf->rip6_nets; + TAILQ_FOREACH(rrt, &riprt_head, rrt_next) { if (rrt->rrt_rflags & RRTF_NOADVERTISE) continue; /* Put the route to the buffer */ *np = rrt->rrt_info; np++; nrt++; if (nrt == maxrte) { - ripflush(NULL, sin6); + ripflush(NULL, sin6, nrt, np); nh = NULL; + nrt = 0; + np = ripbuf->rip6_nets; } } if (nrt) /* Send last packet */ - ripflush(NULL, sin6); + ripflush(NULL, sin6, nrt, np); return; } @@ -833,11 +864,11 @@ ripsend(ifcp, sin6, flag) return; /* -N: no use */ - if (iff_find(ifcp, 'N') != NULL) + if (iff_find(ifcp, IFIL_TYPE_N) != NULL) return; /* -T: generate default route only */ - if (iff_find(ifcp, 'T') != NULL) { + if (iff_find(ifcp, IFIL_TYPE_T) != NULL) { struct netinfo6 rrt_info; memset(&rrt_info, 0, sizeof(struct netinfo6)); rrt_info.rip6_dest = in6addr_any; @@ -848,7 +879,7 @@ ripsend(ifcp, sin6, flag) np = ripbuf->rip6_nets; *np = rrt_info; nrt = 1; - ripflush(ifcp, sin6); + ripflush(ifcp, sin6, nrt, np); return; } @@ -858,7 +889,7 @@ ripsend(ifcp, sin6, flag) sizeof(struct netinfo6); nrt = 0; np = ripbuf->rip6_nets; nh = NULL; - for (rrt = riprt; rrt; rrt = rrt->rrt_next) { + TAILQ_FOREACH(rrt, &riprt_head, rrt_next) { if (rrt->rrt_rflags & RRTF_NOADVERTISE) continue; @@ -880,8 +911,13 @@ ripsend(ifcp, sin6, flag) !IN6_IS_ADDR_UNSPECIFIED(&rrt->rrt_gw) && (rrt->rrt_rflags & RRTF_NH_NOT_LLADDR) == 0) { if (nh == NULL || !IN6_ARE_ADDR_EQUAL(nh, &rrt->rrt_gw)) { - if (nrt == maxrte - 2) - ripflush(ifcp, sin6); + if (nrt == maxrte - 2) { + ripflush(ifcp, sin6, nrt, np); + nh = NULL; + nrt = 0; + np = ripbuf->rip6_nets; + } + np->rip6_dest = rrt->rrt_gw; if (IN6_IS_ADDR_LINKLOCAL(&np->rip6_dest)) SET_IN6_LINKLOCAL_IFINDEX(np->rip6_dest, 0); @@ -895,8 +931,12 @@ ripsend(ifcp, sin6, flag) !IN6_ARE_ADDR_EQUAL(nh, &rrt->rrt_gw) || rrt->rrt_rflags & RRTF_NH_NOT_LLADDR)) { /* Reset nexthop */ - if (nrt == maxrte - 2) - ripflush(ifcp, sin6); + if (nrt == maxrte - 2) { + ripflush(ifcp, sin6, nrt, np); + nh = NULL; + nrt = 0; + np = ripbuf->rip6_nets; + } memset(np, 0, sizeof(struct netinfo6)); np->rip6_metric = NEXTHOP_METRIC; nh = NULL; @@ -907,21 +947,21 @@ ripsend(ifcp, sin6, flag) *np = rrt->rrt_info; np++; nrt++; if (nrt == maxrte) { - ripflush(ifcp, sin6); + ripflush(ifcp, sin6, nrt, np); nh = NULL; + nrt = 0; + np = ripbuf->rip6_nets; } } if (nrt) /* Send last packet */ - ripflush(ifcp, sin6); + ripflush(ifcp, sin6, nrt, np); } /* * outbound filter logic, per-route/interface. */ int -out_filter(rrt, ifcp) - struct riprt *rrt; - struct ifc *ifcp; +out_filter(struct riprt *rrt, struct ifc *ifcp) { struct iff *iffp; struct in6_addr ia; @@ -931,7 +971,7 @@ out_filter(rrt, ifcp) * -A: filter out less specific routes, if we have aggregated * route configured. */ - for (iffp = ifcp->ifc_filter; iffp; iffp = iffp->iff_next) { + TAILQ_FOREACH(iffp, &ifcp->ifc_iff_head, iff_next) { if (iffp->iff_type != 'A') continue; if (rrt->rrt_info.rip6_plen <= iffp->iff_plen) @@ -948,7 +988,7 @@ out_filter(rrt, ifcp) */ if ((rrt->rrt_rflags & RRTF_AGGREGATE) != 0) { ok = 0; - for (iffp = ifcp->ifc_filter; iffp; iffp = iffp->iff_next) { + TAILQ_FOREACH(iffp, &ifcp->ifc_iff_head, iff_next) { if (iffp->iff_type != 'A') continue; if (rrt->rrt_info.rip6_plen == iffp->iff_plen && @@ -965,9 +1005,9 @@ out_filter(rrt, ifcp) /* * -O: advertise only if prefix matches the configured prefix. */ - if (iff_find(ifcp, 'O')) { + if (iff_find(ifcp, IFIL_TYPE_O) != NULL) { ok = 0; - for (iffp = ifcp->ifc_filter; iffp; iffp = iffp->iff_next) { + TAILQ_FOREACH(iffp, &ifcp->ifc_iff_head, iff_next) { if (iffp->iff_type != 'O') continue; if (rrt->rrt_info.rip6_plen < iffp->iff_plen) @@ -992,9 +1032,7 @@ out_filter(rrt, ifcp) * It checks options specified in the arguments and the split horizon rule. */ int -tobeadv(rrt, ifcp) - struct riprt *rrt; - struct ifc *ifcp; +tobeadv(struct riprt *rrt, struct ifc *ifcp) { /* Special care for static routes */ @@ -1019,9 +1057,7 @@ tobeadv(rrt, ifcp) * Send a rip packet actually. */ int -sendpacket(sin6, len) - struct sockaddr_in6 *sin6; - int len; +sendpacket(struct sockaddr_in6 *sin6, int len) { struct msghdr m; struct cmsghdr *cm; @@ -1080,7 +1116,7 @@ sendpacket(sin6, len) * table if necessary. */ void -riprecv() +riprecv(void) { struct ifc *ifcp, *ic; struct sockaddr_in6 fsock; @@ -1147,7 +1183,7 @@ riprecv() if (idx && IN6_IS_ADDR_LINKLOCAL(&fsock.sin6_addr)) SET_IN6_LINKLOCAL_IFINDEX(fsock.sin6_addr, idx); - if (len < sizeof(struct rip6)) { + if ((size_t)len < sizeof(struct rip6)) { trace(1, "Packet too short\n"); return; } @@ -1235,7 +1271,7 @@ riprecv() } /* -N: no use */ - if (iff_find(ifcp, 'N') != NULL) + if (iff_find(ifcp, IFIL_TYPE_N) != NULL) return; tracet(1, "Recv(%s): from %s.%d info(%zd)\n", @@ -1300,23 +1336,23 @@ riprecv() /* * -L: listen only if the prefix matches the configuration */ - ok = 1; /* if there's no L filter, it is ok */ - for (iffp = ifcp->ifc_filter; iffp; iffp = iffp->iff_next) { - if (iffp->iff_type != 'L') - continue; - ok = 0; - if (np->rip6_plen < iffp->iff_plen) - continue; - /* special rule: ::/0 means default, not "in /0" */ - if (iffp->iff_plen == 0 && np->rip6_plen > 0) - continue; - ia = np->rip6_dest; - applyplen(&ia, iffp->iff_plen); - if (IN6_ARE_ADDR_EQUAL(&ia, &iffp->iff_addr)) { - ok = 1; - break; - } - } + ok = 1; /* if there's no L filter, it is ok */ + TAILQ_FOREACH(iffp, &ifcp->ifc_iff_head, iff_next) { + if (iffp->iff_type != IFIL_TYPE_L) + continue; + ok = 0; + if (np->rip6_plen < iffp->iff_plen) + continue; + /* special rule: ::/0 means default, not "in /0" */ + if (iffp->iff_plen == 0 && np->rip6_plen > 0) + continue; + ia = np->rip6_dest; + applyplen(&ia, iffp->iff_plen); + if (IN6_ARE_ADDR_EQUAL(&ia, &iffp->iff_addr)) { + ok = 1; + break; + } + } if (!ok) { trace(2, " (filtered)\n"); continue; @@ -1329,7 +1365,7 @@ riprecv() np->rip6_metric = HOPCNT_INFINITY6; applyplen(&np->rip6_dest, np->rip6_plen); - if ((rrt = rtsearch(np, NULL)) != NULL) { + if ((rrt = rtsearch(np)) != NULL) { if (rrt->rrt_t == 0) continue; /* Intf route has priority */ nq = &rrt->rrt_info; @@ -1398,20 +1434,20 @@ riprecv() if (nq->rip6_plen == sizeof(struct in6_addr) * 8) rrt->rrt_flags |= RTF_HOST; - /* Put the route to the list */ - rrt->rrt_next = riprt; - riprt = rrt; /* Update routing table */ addroute(rrt, &nh, ifcp); rrt->rrt_rflags |= RRTF_CHANGED; need_trigger = 1; rrt->rrt_t = t; + + /* Put the route to the list */ + TAILQ_INSERT_HEAD(&riprt_head, rrt, rrt_next); } } /* XXX need to care the interval between triggered updates */ if (need_trigger) { if (nextalarm > time(NULL) + RIP_TRIG_INT6_MAX) { - for (ic = ifc; ic; ic = ic->ifc_next) { + TAILQ_FOREACH(ic, &ifc_head, ifc_next) { if (ifcp->ifc_index == ic->ifc_index) continue; if (ic->ifc_flags & IFF_UP) @@ -1420,8 +1456,9 @@ riprecv() } } /* Reset the flag */ - for (rrt = riprt; rrt; rrt = rrt->rrt_next) + TAILQ_FOREACH(rrt, &riprt_head, rrt_next) { rrt->rrt_rflags &= ~RRTF_CHANGED; + } } } @@ -1429,8 +1466,7 @@ riprecv() * Send all routes request packet to the specified interface. */ void -sendrequest(ifcp) - struct ifc *ifcp; +sendrequest(struct ifc *ifcp) { struct netinfo6 *np; int error; @@ -1458,11 +1494,10 @@ sendrequest(ifcp) * Process a RIP6_REQUEST packet. */ void -riprequest(ifcp, np, nn, sin6) - struct ifc *ifcp; - struct netinfo6 *np; - int nn; - struct sockaddr_in6 *sin6; +riprequest(struct ifc *ifcp, + struct netinfo6 *np, + int nn, + struct sockaddr_in6 *sin6) { int i; struct riprt *rrt; @@ -1472,7 +1507,7 @@ riprequest(ifcp, np, nn, sin6) /* Specific response, don't split-horizon */ trace(1, "\tRIP Request\n"); for (i = 0; i < nn; i++, np++) { - rrt = rtsearch(np, NULL); + rrt = rtsearch(np); if (rrt) np->rip6_metric = rrt->rrt_info.rip6_metric; else @@ -1490,7 +1525,7 @@ riprequest(ifcp, np, nn, sin6) * Get information of each interface. */ void -ifconfig() +ifconfig(void) { struct ifaddrs *ifap, *ifa; struct ifc *ifcp; @@ -1521,14 +1556,14 @@ ifconfig() /*NOTREACHED*/ } memset(ifcp, 0, sizeof(*ifcp)); + ifcp->ifc_index = -1; - ifcp->ifc_next = ifc; - ifc = ifcp; - nifc++; - ifcp->ifc_name = allocopy(ifa->ifa_name); - ifcp->ifc_addr = 0; - ifcp->ifc_filter = 0; + strlcpy(ifcp->ifc_name, ifa->ifa_name, + sizeof(ifcp->ifc_name)); + TAILQ_INIT(&ifcp->ifc_ifac_head); + TAILQ_INIT(&ifcp->ifc_iff_head); ifcp->ifc_flags = ifa->ifa_flags; + TAILQ_INSERT_HEAD(&ifc_head, ifcp, ifc_next); trace(1, "newif %s <%s>\n", ifcp->ifc_name, ifflags(ifcp->ifc_flags)); if (!strcmp(ifcp->ifc_name, LOOPBACK_IF)) @@ -1543,7 +1578,10 @@ ifconfig() } ifcp->ifc_flags = ifa->ifa_flags; } - ifconfig1(ifa->ifa_name, ifa->ifa_addr, ifcp, s); + if (ifconfig1(ifa->ifa_name, ifa->ifa_addr, ifcp, s) < 0) { + /* maybe temporary failure */ + continue; + } if ((ifcp->ifc_flags & (IFF_LOOPBACK | IFF_UP)) == IFF_UP && 0 < ifcp->ifc_index && !ifcp->ifc_joined) { mreq.ipv6mr_multiaddr = ifcp->ifc_ripsin.sin6_addr; @@ -1561,65 +1599,65 @@ ifconfig() freeifaddrs(ifap); } -void -ifconfig1(name, sa, ifcp, s) - const char *name; - const struct sockaddr *sa; - struct ifc *ifcp; - int s; +int +ifconfig1(const char *name, + const struct sockaddr *sa, + struct ifc *ifcp, + int s) { struct in6_ifreq ifr; const struct sockaddr_in6 *sin6; - struct ifac *ifa; + struct ifac *ifac; int plen; char buf[BUFSIZ]; sin6 = (const struct sockaddr_in6 *)sa; if (IN6_IS_ADDR_SITELOCAL(&sin6->sin6_addr) && !lflag) - return; + return (-1); ifr.ifr_addr = *sin6; strncpy(ifr.ifr_name, name, sizeof(ifr.ifr_name)); if (ioctl(s, SIOCGIFNETMASK_IN6, (char *)&ifr) < 0) { - fatal("ioctl: SIOCGIFNETMASK_IN6"); - /*NOTREACHED*/ + syslog(LOG_INFO, "ioctl: SIOCGIFNETMASK_IN6"); + return (-1); } plen = sin6mask2len(&ifr.ifr_addr); - if ((ifa = ifa_match(ifcp, &sin6->sin6_addr, plen)) != NULL) { + if ((ifac = ifa_match(ifcp, &sin6->sin6_addr, plen)) != NULL) { /* same interface found */ /* need check if something changed */ /* XXX not yet implemented */ - return; + return (-1); } /* * New address is found */ - if ((ifa = MALLOC(struct ifac)) == NULL) { + if ((ifac = MALLOC(struct ifac)) == NULL) { fatal("malloc: struct ifac"); /*NOTREACHED*/ } - memset(ifa, 0, sizeof(*ifa)); - ifa->ifa_conf = ifcp; - ifa->ifa_next = ifcp->ifc_addr; - ifcp->ifc_addr = ifa; - ifa->ifa_addr = sin6->sin6_addr; - ifa->ifa_plen = plen; + memset(ifac, 0, sizeof(*ifac)); + + ifac->ifac_ifc = ifcp; + ifac->ifac_addr = sin6->sin6_addr; + ifac->ifac_plen = plen; + ifac->ifac_scope_id = sin6->sin6_scope_id; if (ifcp->ifc_flags & IFF_POINTOPOINT) { ifr.ifr_addr = *sin6; if (ioctl(s, SIOCGIFDSTADDR_IN6, (char *)&ifr) < 0) { fatal("ioctl: SIOCGIFDSTADDR_IN6"); /*NOTREACHED*/ } - ifa->ifa_raddr = ifr.ifr_dstaddr.sin6_addr; - inet_ntop(AF_INET6, (void *)&ifa->ifa_raddr, buf, sizeof(buf)); + ifac->ifac_raddr = ifr.ifr_dstaddr.sin6_addr; + inet_ntop(AF_INET6, (void *)&ifac->ifac_raddr, buf, + sizeof(buf)); trace(1, "found address %s/%d -- %s\n", - inet6_n2p(&ifa->ifa_addr), ifa->ifa_plen, buf); + inet6_n2p(&ifac->ifac_addr), ifac->ifac_plen, buf); } else { trace(1, "found address %s/%d\n", - inet6_n2p(&ifa->ifa_addr), ifa->ifa_plen); + inet6_n2p(&ifac->ifac_addr), ifac->ifac_plen); } - if (ifcp->ifc_index < 0 && IN6_IS_ADDR_LINKLOCAL(&ifa->ifa_addr)) { - ifcp->ifc_mylladdr = ifa->ifa_addr; - ifcp->ifc_index = IN6_LINKLOCAL_IFINDEX(ifa->ifa_addr); + if (ifcp->ifc_index < 0 && IN6_IS_ADDR_LINKLOCAL(&ifac->ifac_addr)) { + ifcp->ifc_mylladdr = ifac->ifac_addr; + ifcp->ifc_index = IN6_LINKLOCAL_IFINDEX(ifac->ifac_addr); memcpy(&ifcp->ifc_ripsin, &ripsin, ripsin.ss_len); SET_IN6_LINKLOCAL_IFINDEX(ifcp->ifc_ripsin.sin6_addr, ifcp->ifc_index); @@ -1636,6 +1674,34 @@ ifconfig1(name, sa, ifcp, s) ifcp->ifc_index, ifcp->ifc_mtu, ifcp->ifc_metric); } else ifcp->ifc_cflags |= IFC_CHANGED; + + TAILQ_INSERT_HEAD(&ifcp->ifc_ifac_head, ifac, ifac_next); + + return 0; +} + +void +ifremove(int ifindex) +{ + struct ifc *ifcp; + struct riprt *rrt; + + TAILQ_FOREACH(ifcp, &ifc_head, ifc_next) { + if (ifcp->ifc_index == ifindex) + break; + } + if (ifcp == NULL) + return; + + tracet(1, "ifremove: %s is departed.\n", ifcp->ifc_name); + TAILQ_REMOVE(&ifc_head, ifcp, ifc_next); + + TAILQ_FOREACH(rrt, &riprt_head, rrt_next) { + if (rrt->rrt_index == ifcp->ifc_index && + rrt->rrt_rflags & RRTF_AGGREGATE) + delroute(&rrt->rrt_info, &rrt->rrt_gw); + } + free(ifcp); } /* @@ -1643,30 +1709,35 @@ ifconfig1(name, sa, ifcp, s) * Update interface information as necesssary. */ void -rtrecv() +rtrecv(void) { char buf[BUFSIZ]; - char *p, *q; + char *p, *q = NULL; struct rt_msghdr *rtm; struct ifa_msghdr *ifam; struct if_msghdr *ifm; *** DIFF OUTPUT TRUNCATED AT 1000 LINES *** From owner-svn-src-stable@FreeBSD.ORG Fri Jun 14 02:51:04 2013 Return-Path: Delivered-To: svn-src-stable@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [8.8.178.115]) by hub.freebsd.org (Postfix) with ESMTP id 237DC812; Fri, 14 Jun 2013 02:51:04 +0000 (UTC) (envelope-from pfg@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) by mx1.freebsd.org (Postfix) with ESMTP id 147401996; Fri, 14 Jun 2013 02:51:04 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.7/8.14.7) with ESMTP id r5E2p3nt024917; Fri, 14 Jun 2013 02:51:03 GMT (envelope-from pfg@svn.freebsd.org) Received: (from pfg@localhost) by svn.freebsd.org (8.14.7/8.14.5/Submit) id r5E2p3eF024916; Fri, 14 Jun 2013 02:51:03 GMT (envelope-from pfg@svn.freebsd.org) Message-Id: <201306140251.r5E2p3eF024916@svn.freebsd.org> From: "Pedro F. Giffuni" Date: Fri, 14 Jun 2013 02:51:03 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-9@freebsd.org Subject: svn commit: r251726 - stable/9/lib/libstand X-SVN-Group: stable-9 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 14 Jun 2013 02:51:04 -0000 Author: pfg Date: Fri Jun 14 02:51:03 2013 New Revision: 251726 URL: http://svnweb.freebsd.org/changeset/base/251726 Log: MFC r251561: libstand: Reset the seek pointer in ext2fs as done in UFS. Reset the seek pointer to 0 when a file is successfully opened, since otherwise the initial seek offset will contain the directory offset of the filesystem block that contained its directory entry. This bug was mostly harmless because typically the directory is less than one filesystem block in size so the offset would be zero. It did however generally break loading a kernel from the (large) kernel compile directory. Also reset the seek pointer when a new inode is opened in read_inode(), though this is not actually necessary now because all callers set it afterwards. PR: 177328 Submitted by: Eric van Gyzen Reviewed by: iedowse Modified: stable/9/lib/libstand/ext2fs.c Directory Properties: stable/9/ (props changed) stable/9/lib/ (props changed) stable/9/lib/libstand/ (props changed) Modified: stable/9/lib/libstand/ext2fs.c ============================================================================== --- stable/9/lib/libstand/ext2fs.c Fri Jun 14 02:25:40 2013 (r251725) +++ stable/9/lib/libstand/ext2fs.c Fri Jun 14 02:51:03 2013 (r251726) @@ -536,6 +536,7 @@ ext2fs_open(const char *upath, struct op * Found terminal component. */ error = 0; + fp->f_seekp = 0; out: if (buf) free(buf); @@ -584,6 +585,7 @@ read_inode(ino_t inumber, struct open_fi for (level = 0; level < NIADDR; level++) fp->f_blkno[level] = -1; fp->f_buf_blkno = -1; + fp->f_seekp = 0; out: free(buf); From owner-svn-src-stable@FreeBSD.ORG Fri Jun 14 03:21:54 2013 Return-Path: Delivered-To: svn-src-stable@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by hub.freebsd.org (Postfix) with ESMTP id 46330178; Fri, 14 Jun 2013 03:21:54 +0000 (UTC) (envelope-from pfg@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) by mx1.freebsd.org (Postfix) with ESMTP id 376E41BDB; Fri, 14 Jun 2013 03:21:54 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.7/8.14.7) with ESMTP id r5E3LswY036321; Fri, 14 Jun 2013 03:21:54 GMT (envelope-from pfg@svn.freebsd.org) Received: (from pfg@localhost) by svn.freebsd.org (8.14.7/8.14.5/Submit) id r5E3LsRY036320; Fri, 14 Jun 2013 03:21:54 GMT (envelope-from pfg@svn.freebsd.org) Message-Id: <201306140321.r5E3LsRY036320@svn.freebsd.org> From: "Pedro F. Giffuni" Date: Fri, 14 Jun 2013 03:21:54 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-8@freebsd.org Subject: svn commit: r251727 - stable/8/lib/libstand X-SVN-Group: stable-8 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 14 Jun 2013 03:21:54 -0000 Author: pfg Date: Fri Jun 14 03:21:53 2013 New Revision: 251727 URL: http://svnweb.freebsd.org/changeset/base/251727 Log: MFC r251561: libstand: Reset the seek pointer in ext2fs as done in UFS. PR: 177328 Submitted by: Eric van Gyzen Reviewed by: iedowse Modified: stable/8/lib/libstand/ext2fs.c Directory Properties: stable/8/ (props changed) stable/8/lib/ (props changed) stable/8/lib/libstand/ (props changed) Modified: stable/8/lib/libstand/ext2fs.c ============================================================================== --- stable/8/lib/libstand/ext2fs.c Fri Jun 14 02:51:03 2013 (r251726) +++ stable/8/lib/libstand/ext2fs.c Fri Jun 14 03:21:53 2013 (r251727) @@ -536,6 +536,7 @@ ext2fs_open(const char *upath, struct op * Found terminal component. */ error = 0; + fp->f_seekp = 0; out: if (buf) free(buf); @@ -584,6 +585,7 @@ read_inode(ino_t inumber, struct open_fi for (level = 0; level < NIADDR; level++) fp->f_blkno[level] = -1; fp->f_buf_blkno = -1; + fp->f_seekp = 0; out: free(buf); From owner-svn-src-stable@FreeBSD.ORG Fri Jun 14 03:28:30 2013 Return-Path: Delivered-To: svn-src-stable@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [8.8.178.115]) by hub.freebsd.org (Postfix) with ESMTP id 21CC8613; Fri, 14 Jun 2013 03:28:30 +0000 (UTC) (envelope-from pfg@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) by mx1.freebsd.org (Postfix) with ESMTP id 139DC1C25; Fri, 14 Jun 2013 03:28:30 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.7/8.14.7) with ESMTP id r5E3STCb037521; Fri, 14 Jun 2013 03:28:29 GMT (envelope-from pfg@svn.freebsd.org) Received: (from pfg@localhost) by svn.freebsd.org (8.14.7/8.14.5/Submit) id r5E3STvD037517; Fri, 14 Jun 2013 03:28:29 GMT (envelope-from pfg@svn.freebsd.org) Message-Id: <201306140328.r5E3STvD037517@svn.freebsd.org> From: "Pedro F. Giffuni" Date: Fri, 14 Jun 2013 03:28:29 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-8@freebsd.org Subject: svn commit: r251728 - stable/8/contrib/gcc X-SVN-Group: stable-8 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 14 Jun 2013 03:28:30 -0000 Author: pfg Date: Fri Jun 14 03:28:29 2013 New Revision: 251728 URL: http://svnweb.freebsd.org/changeset/base/251728 Log: MFC r250550, r250566; Update the gcc43 ChangeLog. Add support for "d" floating-point suffix, as defined by draft N1312 of TR 24732. Modified: stable/8/contrib/gcc/ChangeLog.gcc43 stable/8/contrib/gcc/c-lex.c Directory Properties: stable/8/ (props changed) stable/8/contrib/ (props changed) stable/8/contrib/gcc/ (props changed) stable/8/contrib/gcclibs/ (props changed) Modified: stable/8/contrib/gcc/ChangeLog.gcc43 ============================================================================== --- stable/8/contrib/gcc/ChangeLog.gcc43 Fri Jun 14 03:21:53 2013 (r251727) +++ stable/8/contrib/gcc/ChangeLog.gcc43 Fri Jun 14 03:28:29 2013 (r251728) @@ -182,6 +182,10 @@ * doc/invoke.texi: Document -mssse3/-mno-ssse3 switches. +2006-10-22 H.J. Lu + + * config/i386/tmmintrin.h: Remove the duplicated content. + 2006-10-21 Richard Guenther (r117932) PR tree-optimization/3511 Modified: stable/8/contrib/gcc/c-lex.c ============================================================================== --- stable/8/contrib/gcc/c-lex.c Fri Jun 14 03:21:53 2013 (r251727) +++ stable/8/contrib/gcc/c-lex.c Fri Jun 14 03:28:29 2013 (r251728) @@ -640,6 +640,13 @@ interpret_float (const cpp_token *token, char *copy; size_t copylen; + /* Default (no suffix) is double. */ + if (flags & CPP_N_DEFAULT) + { + flags ^= CPP_N_DEFAULT; + flags |= CPP_N_MEDIUM; + } + /* Decode type based on width and properties. */ if (flags & CPP_N_DFLOAT) if ((flags & CPP_N_WIDTH) == CPP_N_LARGE) From owner-svn-src-stable@FreeBSD.ORG Fri Jun 14 03:58:54 2013 Return-Path: Delivered-To: svn-src-stable@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by hub.freebsd.org (Postfix) with ESMTP id 19D7EFC5; Fri, 14 Jun 2013 03:58:54 +0000 (UTC) (envelope-from pfg@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) by mx1.freebsd.org (Postfix) with ESMTP id 0BA9B1DDC; Fri, 14 Jun 2013 03:58:54 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.7/8.14.7) with ESMTP id r5E3wrTS046594; Fri, 14 Jun 2013 03:58:53 GMT (envelope-from pfg@svn.freebsd.org) Received: (from pfg@localhost) by svn.freebsd.org (8.14.7/8.14.5/Submit) id r5E3wrYi046590; Fri, 14 Jun 2013 03:58:53 GMT (envelope-from pfg@svn.freebsd.org) Message-Id: <201306140358.r5E3wrYi046590@svn.freebsd.org> From: "Pedro F. Giffuni" Date: Fri, 14 Jun 2013 03:58:53 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-9@freebsd.org Subject: svn commit: r251731 - stable/9/sys/fs/ext2fs X-SVN-Group: stable-9 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 14 Jun 2013 03:58:54 -0000 Author: pfg Date: Fri Jun 14 03:58:52 2013 New Revision: 251731 URL: http://svnweb.freebsd.org/changeset/base/251731 Log: MFC r251562, r251612: Miscellaneous cleanups for ext2fs: - e2fs_bpg and e2fs_isize are always unsigned. - s/file system/filesystem/g (from ffs r96755) Modified: stable/9/sys/fs/ext2fs/ext2_alloc.c stable/9/sys/fs/ext2fs/ext2_balloc.c stable/9/sys/fs/ext2fs/ext2_vfsops.c stable/9/sys/fs/ext2fs/ext2fs.h Directory Properties: stable/9/ (props changed) stable/9/sys/ (props changed) stable/9/sys/fs/ (props changed) Modified: stable/9/sys/fs/ext2fs/ext2_alloc.c ============================================================================== --- stable/9/sys/fs/ext2fs/ext2_alloc.c Fri Jun 14 03:42:10 2013 (r251730) +++ stable/9/sys/fs/ext2fs/ext2_alloc.c Fri Jun 14 03:58:52 2013 (r251731) @@ -63,7 +63,7 @@ static daddr_t ext2_nodealloccg(struct i static daddr_t ext2_mapsearch(struct m_ext2fs *, char *, daddr_t); /* - * Allocate a block in the file system. + * Allocate a block in the filesystem. * * A preference may be optionally specified. If a preference is given * the following hierarchy is used to allocate a block: @@ -125,8 +125,8 @@ ext2_alloc(struct inode *ip, int32_t lbn } nospace: EXT2_UNLOCK(ump); - ext2_fserr(fs, cred->cr_uid, "file system full"); - uprintf("\n%s: write failed, file system is full\n", fs->e2fs_fsmnt); + ext2_fserr(fs, cred->cr_uid, "filesystem full"); + uprintf("\n%s: write failed, filesystem is full\n", fs->e2fs_fsmnt); return (ENOSPC); } @@ -338,7 +338,7 @@ fail: } /* - * Allocate an inode in the file system. + * Allocate an inode in the filesystem. * */ int @@ -1096,7 +1096,7 @@ ext2_mapsearch(struct m_ext2fs *fs, char } /* - * Fserr prints the name of a file system with an error diagnostic. + * Fserr prints the name of a filesystem with an error diagnostic. * * The form of the error message is: * fs: error message Modified: stable/9/sys/fs/ext2fs/ext2_balloc.c ============================================================================== --- stable/9/sys/fs/ext2fs/ext2_balloc.c Fri Jun 14 03:42:10 2013 (r251730) +++ stable/9/sys/fs/ext2fs/ext2_balloc.c Fri Jun 14 03:58:52 2013 (r251731) @@ -50,7 +50,7 @@ #include #include /* - * Balloc defines the structure of file system storage + * Balloc defines the structure of filesystem storage * by allocating the physical blocks on a device given * the inode and the logical block number in a file. */ Modified: stable/9/sys/fs/ext2fs/ext2_vfsops.c ============================================================================== --- stable/9/sys/fs/ext2fs/ext2_vfsops.c Fri Jun 14 03:42:10 2013 (r251730) +++ stable/9/sys/fs/ext2fs/ext2_vfsops.c Fri Jun 14 03:58:52 2013 (r251731) @@ -748,7 +748,7 @@ ext2_flushfiles(struct mount *mp, int fl return (error); } /* - * Get file system statistics. + * Get filesystem statistics. */ int ext2_statfs(struct mount *mp, struct statfs *sbp) @@ -853,7 +853,7 @@ loop: } /* - * Force stale file system control information to be flushed. + * Force stale filesystem control information to be flushed. */ if (waitfor != MNT_LAZY) { vn_lock(ump->um_devvp, LK_EXCLUSIVE | LK_RETRY); Modified: stable/9/sys/fs/ext2fs/ext2fs.h ============================================================================== --- stable/9/sys/fs/ext2fs/ext2fs.h Fri Jun 14 03:42:10 2013 (r251730) +++ stable/9/sys/fs/ext2fs/ext2fs.h Fri Jun 14 03:58:52 2013 (r251731) @@ -153,7 +153,7 @@ struct m_ext2fs { char e2fs_fmod; /* super block modified flag */ uint32_t e2fs_bsize; /* Block size */ uint32_t e2fs_bshift; /* calc of logical block no */ - int32_t e2fs_bpg; /* Number of blocks per group */ + uint32_t e2fs_bpg; /* Number of blocks per group */ int64_t e2fs_qbmask; /* = s_blocksize -1 */ uint32_t e2fs_fsbtodb; /* Shift to get disk block */ uint32_t e2fs_ipg; /* Number of inodes per group */ @@ -164,7 +164,7 @@ struct m_ext2fs { uint32_t e2fs_fpg; /* Number of fragments per group */ uint32_t e2fs_gdbcount; /* Number of group descriptors */ uint32_t e2fs_gcount; /* Number of groups */ - int32_t e2fs_isize; /* Size of inode */ + uint32_t e2fs_isize; /* Size of inode */ uint32_t e2fs_total_dir; /* Total number of directories */ uint8_t *e2fs_contigdirs; /* (u) # of contig. allocated dirs */ char e2fs_wasvalid; /* valid at mount time */ From owner-svn-src-stable@FreeBSD.ORG Fri Jun 14 08:46:10 2013 Return-Path: Delivered-To: svn-src-stable@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [8.8.178.115]) by hub.freebsd.org (Postfix) with ESMTP id E63A7861; Fri, 14 Jun 2013 08:46:10 +0000 (UTC) (envelope-from dimitry@andric.com) Received: from tensor.andric.com (tensor.andric.com [IPv6:2001:7b8:3a7:1:2d0:b7ff:fea0:8c26]) by mx1.freebsd.org (Postfix) with ESMTP id AFC061C62; Fri, 14 Jun 2013 08:46:10 +0000 (UTC) Received: from [IPv6:2001:7b8:3a7::bcda:4d69:e011:5322] (unknown [IPv6:2001:7b8:3a7:0:bcda:4d69:e011:5322]) (using TLSv1 with cipher AES128-SHA (128/128 bits)) (No client certificate requested) by tensor.andric.com (Postfix) with ESMTPSA id BAD995C44; Fri, 14 Jun 2013 10:46:08 +0200 (CEST) Content-Type: text/plain; charset=us-ascii Mime-Version: 1.0 (Mac OS X Mail 6.5 \(1508\)) Subject: Re: svn commit: r251728 - stable/8/contrib/gcc From: Dimitry Andric In-Reply-To: <201306140328.r5E3STvD037517@svn.freebsd.org> Date: Fri, 14 Jun 2013 10:46:06 +0200 Content-Transfer-Encoding: quoted-printable Message-Id: <38497015-A08E-4062-9B3A-F1836448FBF6@andric.com> References: <201306140328.r5E3STvD037517@svn.freebsd.org> To: Pedro F. Giffuni X-Mailer: Apple Mail (2.1508) Cc: svn-src-stable@freebsd.org, svn-src-all@freebsd.org, src-committers@freebsd.org, svn-src-stable-8@freebsd.org X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 14 Jun 2013 08:46:11 -0000 On Jun 14, 2013, at 05:28, Pedro F. Giffuni wrote: > Author: pfg > Date: Fri Jun 14 03:28:29 2013 > New Revision: 251728 > URL: http://svnweb.freebsd.org/changeset/base/251728 >=20 > Log: > MFC r250550, r250566; >=20 > Update the gcc43 ChangeLog. >=20 > Add support for "d" floating-point suffix, as defined by draft N1312 > of TR 24732. Hi Pedro, Unfortunately this breaks tinderbox: /src/gnu/usr.bin/cc/cc_int/../../../../contrib/gcc/c-lex.c: In function = 'interpret_float': /src/gnu/usr.bin/cc/cc_int/../../../../contrib/gcc/c-lex.c:644: error: = 'CPP_N_DEFAULT' undeclared (first use in this function) /src/gnu/usr.bin/cc/cc_int/../../../../contrib/gcc/c-lex.c:644: error: = (Each undeclared identifier is reported only once /src/gnu/usr.bin/cc/cc_int/../../../../contrib/gcc/c-lex.c:644: error: = for each function it appears in.) *** [c-lex.o] Error code 1 So apparently you need to also MFC the change that introduced the CPP_N_DEFAULT identifier? -Dimitry From owner-svn-src-stable@FreeBSD.ORG Fri Jun 14 11:16:52 2013 Return-Path: Delivered-To: svn-src-stable@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [8.8.178.115]) by hub.freebsd.org (Postfix) with ESMTP id C0D9B5F7; Fri, 14 Jun 2013 11:16:52 +0000 (UTC) (envelope-from pfg@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) by mx1.freebsd.org (Postfix) with ESMTP id 98D441365; Fri, 14 Jun 2013 11:16:52 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.7/8.14.7) with ESMTP id r5EAjWI7076383; Fri, 14 Jun 2013 10:45:32 GMT (envelope-from pfg@svn.freebsd.org) Received: (from pfg@localhost) by svn.freebsd.org (8.14.7/8.14.5/Submit) id r5EAjV2T076381; Fri, 14 Jun 2013 10:45:31 GMT (envelope-from pfg@svn.freebsd.org) Message-Id: <201306141045.r5EAjV2T076381@svn.freebsd.org> From: "Pedro F. Giffuni" Date: Fri, 14 Jun 2013 10:45:31 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-8@freebsd.org Subject: svn commit: r251746 - in stable/8/contrib/gcclibs/libcpp: . include X-SVN-Group: stable-8 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 14 Jun 2013 11:16:52 -0000 Author: pfg Date: Fri Jun 14 10:45:31 2013 New Revision: 251746 URL: http://svnweb.freebsd.org/changeset/base/251746 Log: MFC r250550: (Missing libcpp merge) Add support for "d" floating-point suffix, as defined by draft N1312 of TR 24732. Reported by: dim Pointy hat: pfg Modified: stable/8/contrib/gcclibs/libcpp/expr.c stable/8/contrib/gcclibs/libcpp/include/cpplib.h Directory Properties: stable/8/contrib/gcclibs/ (props changed) Modified: stable/8/contrib/gcclibs/libcpp/expr.c ============================================================================== --- stable/8/contrib/gcclibs/libcpp/expr.c Fri Jun 14 10:26:38 2013 (r251745) +++ stable/8/contrib/gcclibs/libcpp/expr.c Fri Jun 14 10:45:31 2013 (r251746) @@ -82,7 +82,7 @@ static void check_promotion (cpp_reader static unsigned int interpret_float_suffix (const uchar *s, size_t len) { - size_t f = 0, l = 0, i = 0, d = 0; + size_t f = 0, l = 0, i = 0, d = 0, d0 = 0; while (len--) switch (s[len]) @@ -101,7 +101,12 @@ interpret_float_suffix (const uchar *s, return 0; } - if (f + l > 1 || i > 1) + if (d == 1 && !f && !l) { + d = 0; + d0 = 1; + } + + if (f + d0 + l > 1 || i > 1) return 0; /* Allow dd, df, dl suffixes for decimal float constants. */ @@ -110,7 +115,8 @@ interpret_float_suffix (const uchar *s, return ((i ? CPP_N_IMAGINARY : 0) | (f ? CPP_N_SMALL : - l ? CPP_N_LARGE : CPP_N_MEDIUM) + d0 ? CPP_N_MEDIUM : + l ? CPP_N_LARGE : CPP_N_DEFAULT) | (d ? CPP_N_DFLOAT : 0)); } @@ -261,6 +267,13 @@ cpp_classify_number (cpp_reader *pfile, "traditional C rejects the \"%.*s\" suffix", (int) (limit - str), str); + /* A suffix for double is a GCC extension via decimal float support. + If the suffix also specifies an imaginary value we'll catch that + later. */ + if ((result == CPP_N_MEDIUM) && CPP_PEDANTIC (pfile)) + cpp_error (pfile, CPP_DL_PEDWARN, + "suffix for double constant is a GCC extension"); + /* Radix must be 10 for decimal floats. */ if ((result & CPP_N_DFLOAT) && radix != 10) { Modified: stable/8/contrib/gcclibs/libcpp/include/cpplib.h ============================================================================== --- stable/8/contrib/gcclibs/libcpp/include/cpplib.h Fri Jun 14 10:26:38 2013 (r251745) +++ stable/8/contrib/gcclibs/libcpp/include/cpplib.h Fri Jun 14 10:45:31 2013 (r251746) @@ -748,6 +748,7 @@ struct cpp_num #define CPP_N_UNSIGNED 0x1000 /* Properties. */ #define CPP_N_IMAGINARY 0x2000 #define CPP_N_DFLOAT 0x4000 +#define CPP_N_DEFAULT 0x8000 /* Classify a CPP_NUMBER token. The return value is a combination of the flags from the above sets. */ From owner-svn-src-stable@FreeBSD.ORG Fri Jun 14 11:49:26 2013 Return-Path: Delivered-To: svn-src-stable@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by hub.freebsd.org (Postfix) with ESMTP id 36B83EDD for ; Fri, 14 Jun 2013 11:49:26 +0000 (UTC) (envelope-from pfg@FreeBSD.org) Received: from nm12.bullet.mail.gq1.yahoo.com (nm12.bullet.mail.gq1.yahoo.com [98.136.218.45]) by mx1.freebsd.org (Postfix) with ESMTP id D1FFF18BF for ; Fri, 14 Jun 2013 11:49:25 +0000 (UTC) Received: from [98.137.12.62] by nm12.bullet.mail.gq1.yahoo.com with NNFMP; 14 Jun 2013 10:49:02 -0000 Received: from [208.71.42.204] by tm7.bullet.mail.gq1.yahoo.com with NNFMP; 14 Jun 2013 10:49:01 -0000 Received: from [127.0.0.1] by smtp215.mail.gq1.yahoo.com with NNFMP; 14 Jun 2013 10:49:01 -0000 X-Yahoo-Newman-Id: 973127.68860.bm@smtp215.mail.gq1.yahoo.com X-Yahoo-Newman-Property: ymail-3 X-YMail-OSG: TbwGMf0VM1npJgaKS7dxOFxojERifVioeMNQa8Q43IghTLl M.2KEZnHyJ_bdy1n6SimoWAZ652_IN7LV3SaTk9bFe8ggAvawG4KNZc58vbT LiUef0KuOo9jAPyfDdMEdpSchNObh9I9idiTHqLhUs1NNG9YaHrPCYVr9eFz zXf75ISlIhb1woHNJuPR4TDL9zfesjAaF1Zntwy.afU70517Qnc4xRWY1zKx gYzxdQ.5M0AFcg7eKjxIGmlC0bbi2dtRtL726cY7EnHuQkYoubJ_7Ia6ZflR XzyTqwHLZvSxOeVmBE1.vR7XX_bJT2sYSVJGnAKYzbF2G4rO0QWmNzQO_MMl z.HoZtguL2.dDuyTHhPo8pkojwYBF_UYvrT3TdXxuVvxszfKwn.Xg8gY9VSb vc1T6yq8f310YnG9OKJWOiPb_LzleT2jIUOjjK_9KXWbks5SfdY14gmXjK3s LjhJzGxsmLEP3lmYsjZuNS0PhMuegZL3FkX9kSNwjmqnfRmDnKaNGOgpsAs_ ndQ-- X-Yahoo-SMTP: xcjD0guswBAZaPPIbxpWwLcp9Unf X-Rocket-Received: from [192.168.0.102] (pfg@190.157.126.109 with ) by smtp215.mail.gq1.yahoo.com with SMTP; 14 Jun 2013 03:49:01 -0700 PDT Message-ID: <51BAF515.3040806@FreeBSD.org> Date: Fri, 14 Jun 2013 05:48:53 -0500 From: Pedro Giffuni User-Agent: Mozilla/5.0 (X11; FreeBSD amd64; rv:17.0) Gecko/20130407 Thunderbird/17.0.5 MIME-Version: 1.0 To: Dimitry Andric Subject: Re: svn commit: r251728 - stable/8/contrib/gcc References: <201306140328.r5E3STvD037517@svn.freebsd.org> <38497015-A08E-4062-9B3A-F1836448FBF6@andric.com> In-Reply-To: <38497015-A08E-4062-9B3A-F1836448FBF6@andric.com> Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit Cc: svn-src-stable@freebsd.org, svn-src-all@freebsd.org, src-committers@freebsd.org, svn-src-stable-8@freebsd.org X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 14 Jun 2013 11:49:26 -0000 On 14.06.2013 03:46, Dimitry Andric wrote: > On Jun 14, 2013, at 05:28, Pedro F. Giffuni wrote: >> Author: pfg >> Date: Fri Jun 14 03:28:29 2013 >> New Revision: 251728 >> URL: http://svnweb.freebsd.org/changeset/base/251728 >> >> Log: >> MFC r250550, r250566; >> >> Update the gcc43 ChangeLog. >> >> Add support for "d" floating-point suffix, as defined by draft N1312 >> of TR 24732. > Hi Pedro, > > Unfortunately this breaks tinderbox: > > /src/gnu/usr.bin/cc/cc_int/../../../../contrib/gcc/c-lex.c: In function 'interpret_float': > /src/gnu/usr.bin/cc/cc_int/../../../../contrib/gcc/c-lex.c:644: error: 'CPP_N_DEFAULT' undeclared (first use in this function) > /src/gnu/usr.bin/cc/cc_int/../../../../contrib/gcc/c-lex.c:644: error: (Each undeclared identifier is reported only once > /src/gnu/usr.bin/cc/cc_int/../../../../contrib/gcc/c-lex.c:644: error: for each function it appears in.) > *** [c-lex.o] Error code 1 > > So apparently you need to also MFC the change that introduced the > CPP_N_DEFAULT identifier? Sorry! It was indeed an incomplete merge. Fixed in r251746. Thank you for the notice, and for waiting for me to wake up ;) ! Pedro. From owner-svn-src-stable@FreeBSD.ORG Fri Jun 14 15:58:25 2013 Return-Path: Delivered-To: svn-src-stable@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by hub.freebsd.org (Postfix) with ESMTP id BB116646; Fri, 14 Jun 2013 15:58:25 +0000 (UTC) (envelope-from jhb@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) by mx1.freebsd.org (Postfix) with ESMTP id AD45817E6; Fri, 14 Jun 2013 15:58:25 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.7/8.14.7) with ESMTP id r5EFwPFM076792; Fri, 14 Jun 2013 15:58:25 GMT (envelope-from jhb@svn.freebsd.org) Received: (from jhb@localhost) by svn.freebsd.org (8.14.7/8.14.5/Submit) id r5EFwPdp076791; Fri, 14 Jun 2013 15:58:25 GMT (envelope-from jhb@svn.freebsd.org) Message-Id: <201306141558.r5EFwPdp076791@svn.freebsd.org> From: John Baldwin Date: Fri, 14 Jun 2013 15:58:25 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-9@freebsd.org Subject: svn commit: r251747 - stable/9/etc/mtree X-SVN-Group: stable-9 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 14 Jun 2013 15:58:25 -0000 Author: jhb Date: Fri Jun 14 15:58:24 2013 New Revision: 251747 URL: http://svnweb.freebsd.org/changeset/base/251747 Log: Merge a missing part of 235613 to add the new dirs to mtree. Modified: stable/9/etc/mtree/BSD.usr.dist Directory Properties: stable/9/etc/mtree/ (props changed) Modified: stable/9/etc/mtree/BSD.usr.dist ============================================================================== --- stable/9/etc/mtree/BSD.usr.dist Fri Jun 14 10:45:31 2013 (r251746) +++ stable/9/etc/mtree/BSD.usr.dist Fri Jun 14 15:58:24 2013 (r251747) @@ -200,6 +200,10 @@ .. .. .. + dtrace + toolkit + .. + .. examples BSD_daemon .. From owner-svn-src-stable@FreeBSD.ORG Fri Jun 14 18:30:44 2013 Return-Path: Delivered-To: svn-src-stable@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by hub.freebsd.org (Postfix) with ESMTP id F133363A; Fri, 14 Jun 2013 18:30:43 +0000 (UTC) (envelope-from jhb@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) by mx1.freebsd.org (Postfix) with ESMTP id C8A2C117C; Fri, 14 Jun 2013 18:30:43 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.7/8.14.7) with ESMTP id r5EIUhQJ025394; Fri, 14 Jun 2013 18:30:43 GMT (envelope-from jhb@svn.freebsd.org) Received: (from jhb@localhost) by svn.freebsd.org (8.14.7/8.14.5/Submit) id r5EIUhcw025390; Fri, 14 Jun 2013 18:30:43 GMT (envelope-from jhb@svn.freebsd.org) Message-Id: <201306141830.r5EIUhcw025390@svn.freebsd.org> From: John Baldwin Date: Fri, 14 Jun 2013 18:30:43 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-9@freebsd.org Subject: svn commit: r251754 - stable/9/sys/dev/acpica X-SVN-Group: stable-9 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 14 Jun 2013 18:30:44 -0000 Author: jhb Date: Fri Jun 14 18:30:43 2013 New Revision: 251754 URL: http://svnweb.freebsd.org/changeset/base/251754 Log: MFC 249767: - Some BIOSes use an Extended IRQ resource descriptor in _PRS for a link that uses non-ISA IRQs but use a plain IRQ resource in _CRS. However, a non-ISA IRQ can't fit into a plain IRQ resource. If we encounter a link like this, build the resource buffer from _PRS instead of _CRS. - Set the correct size of the end tag in a resource buffer. Modified: stable/9/sys/dev/acpica/acpi.c stable/9/sys/dev/acpica/acpi_pci_link.c Directory Properties: stable/9/sys/ (props changed) stable/9/sys/dev/ (props changed) Modified: stable/9/sys/dev/acpica/acpi.c ============================================================================== --- stable/9/sys/dev/acpica/acpi.c Fri Jun 14 18:26:57 2013 (r251753) +++ stable/9/sys/dev/acpica/acpi.c Fri Jun 14 18:30:43 2013 (r251754) @@ -2332,7 +2332,7 @@ acpi_AppendBufferResource(ACPI_BUFFER *b return (AE_NO_MEMORY); rp = (ACPI_RESOURCE *)buf->Pointer; rp->Type = ACPI_RESOURCE_TYPE_END_TAG; - rp->Length = 0; + rp->Length = ACPI_RS_SIZE_MIN; } if (res == NULL) return (AE_OK); @@ -2382,7 +2382,7 @@ acpi_AppendBufferResource(ACPI_BUFFER *b /* And add the terminator. */ rp = ACPI_NEXT_RESOURCE(rp); rp->Type = ACPI_RESOURCE_TYPE_END_TAG; - rp->Length = 0; + rp->Length = ACPI_RS_SIZE_MIN; return (AE_OK); } Modified: stable/9/sys/dev/acpica/acpi_pci_link.c ============================================================================== --- stable/9/sys/dev/acpica/acpi_pci_link.c Fri Jun 14 18:26:57 2013 (r251753) +++ stable/9/sys/dev/acpica/acpi_pci_link.c Fri Jun 14 18:30:43 2013 (r251754) @@ -99,6 +99,7 @@ struct link { uint8_t l_bios_irq; uint8_t l_irq; uint8_t l_initial_irq; + UINT32 l_crs_type; int l_res_index; int l_num_irqs; int *l_irqs; @@ -236,6 +237,7 @@ link_add_crs(ACPI_RESOURCE *res, void *c ("%s: array boundary violation", __func__)); link = &req->sc->pl_links[req->link_index]; link->l_res_index = req->res_index; + link->l_crs_type = res->Type; req->link_index++; req->res_index++; @@ -364,6 +366,14 @@ link_add_prs(ACPI_RESOURCE *res, void *c link->l_isa_irq = FALSE; } } + + /* + * If this is not an ISA IRQ but _CRS used a non-extended + * IRQ descriptor, don't use _CRS as a template for _SRS. + */ + if (!req->sc->pl_crs_bad && !link->l_isa_irq && + link->l_crs_type == ACPI_RESOURCE_TYPE_IRQ) + req->sc->pl_crs_bad = TRUE; break; default: if (req->in_dpf == DPF_IGNORE) From owner-svn-src-stable@FreeBSD.ORG Fri Jun 14 18:42:09 2013 Return-Path: Delivered-To: svn-src-stable@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by hub.freebsd.org (Postfix) with ESMTP id C60E4913; Fri, 14 Jun 2013 18:42:09 +0000 (UTC) (envelope-from jhb@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) by mx1.freebsd.org (Postfix) with ESMTP id 9FDD911F5; Fri, 14 Jun 2013 18:42:09 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.7/8.14.7) with ESMTP id r5EIg9cE030123; Fri, 14 Jun 2013 18:42:09 GMT (envelope-from jhb@svn.freebsd.org) Received: (from jhb@localhost) by svn.freebsd.org (8.14.7/8.14.5/Submit) id r5EIg9KV030121; Fri, 14 Jun 2013 18:42:09 GMT (envelope-from jhb@svn.freebsd.org) Message-Id: <201306141842.r5EIg9KV030121@svn.freebsd.org> From: John Baldwin Date: Fri, 14 Jun 2013 18:42:09 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-8@freebsd.org Subject: svn commit: r251755 - stable/8/sys/dev/acpica X-SVN-Group: stable-8 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 14 Jun 2013 18:42:09 -0000 Author: jhb Date: Fri Jun 14 18:42:08 2013 New Revision: 251755 URL: http://svnweb.freebsd.org/changeset/base/251755 Log: MFC 249767: - Some BIOSes use an Extended IRQ resource descriptor in _PRS for a link that uses non-ISA IRQs but use a plain IRQ resource in _CRS. However, a non-ISA IRQ can't fit into a plain IRQ resource. If we encounter a link like this, build the resource buffer from _PRS instead of _CRS. - Set the correct size of the end tag in a resource buffer. Modified: stable/8/sys/dev/acpica/acpi.c stable/8/sys/dev/acpica/acpi_pci_link.c Directory Properties: stable/8/sys/ (props changed) stable/8/sys/dev/ (props changed) stable/8/sys/dev/acpica/ (props changed) Modified: stable/8/sys/dev/acpica/acpi.c ============================================================================== --- stable/8/sys/dev/acpica/acpi.c Fri Jun 14 18:30:43 2013 (r251754) +++ stable/8/sys/dev/acpica/acpi.c Fri Jun 14 18:42:08 2013 (r251755) @@ -2198,7 +2198,7 @@ acpi_AppendBufferResource(ACPI_BUFFER *b return (AE_NO_MEMORY); rp = (ACPI_RESOURCE *)buf->Pointer; rp->Type = ACPI_RESOURCE_TYPE_END_TAG; - rp->Length = 0; + rp->Length = ACPI_RS_SIZE_MIN; } if (res == NULL) return (AE_OK); @@ -2248,7 +2248,7 @@ acpi_AppendBufferResource(ACPI_BUFFER *b /* And add the terminator. */ rp = ACPI_NEXT_RESOURCE(rp); rp->Type = ACPI_RESOURCE_TYPE_END_TAG; - rp->Length = 0; + rp->Length = ACPI_RS_SIZE_MIN; return (AE_OK); } Modified: stable/8/sys/dev/acpica/acpi_pci_link.c ============================================================================== --- stable/8/sys/dev/acpica/acpi_pci_link.c Fri Jun 14 18:30:43 2013 (r251754) +++ stable/8/sys/dev/acpica/acpi_pci_link.c Fri Jun 14 18:42:08 2013 (r251755) @@ -99,6 +99,7 @@ struct link { uint8_t l_bios_irq; uint8_t l_irq; uint8_t l_initial_irq; + UINT32 l_crs_type; int l_res_index; int l_num_irqs; int *l_irqs; @@ -236,6 +237,7 @@ link_add_crs(ACPI_RESOURCE *res, void *c ("%s: array boundary violation", __func__)); link = &req->sc->pl_links[req->link_index]; link->l_res_index = req->res_index; + link->l_crs_type = res->Type; req->link_index++; req->res_index++; @@ -364,6 +366,14 @@ link_add_prs(ACPI_RESOURCE *res, void *c link->l_isa_irq = FALSE; } } + + /* + * If this is not an ISA IRQ but _CRS used a non-extended + * IRQ descriptor, don't use _CRS as a template for _SRS. + */ + if (!req->sc->pl_crs_bad && !link->l_isa_irq && + link->l_crs_type == ACPI_RESOURCE_TYPE_IRQ) + req->sc->pl_crs_bad = TRUE; break; default: if (req->in_dpf == DPF_IGNORE) From owner-svn-src-stable@FreeBSD.ORG Fri Jun 14 18:56:39 2013 Return-Path: Delivered-To: svn-src-stable@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [8.8.178.115]) by hub.freebsd.org (Postfix) with ESMTP id 19408C28; Fri, 14 Jun 2013 18:56:39 +0000 (UTC) (envelope-from ghelmer@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) by mx1.freebsd.org (Postfix) with ESMTP id 0A4EE1276; Fri, 14 Jun 2013 18:56:39 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.7/8.14.7) with ESMTP id r5EIuc5I033872; Fri, 14 Jun 2013 18:56:38 GMT (envelope-from ghelmer@svn.freebsd.org) Received: (from ghelmer@localhost) by svn.freebsd.org (8.14.7/8.14.5/Submit) id r5EIuc71033867; Fri, 14 Jun 2013 18:56:38 GMT (envelope-from ghelmer@svn.freebsd.org) Message-Id: <201306141856.r5EIuc71033867@svn.freebsd.org> From: Guy Helmer Date: Fri, 14 Jun 2013 18:56:38 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-9@freebsd.org Subject: svn commit: r251756 - stable/9/sys/net X-SVN-Group: stable-9 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 14 Jun 2013 18:56:39 -0000 Author: ghelmer Date: Fri Jun 14 18:56:37 2013 New Revision: 251756 URL: http://svnweb.freebsd.org/changeset/base/251756 Log: MFC r244090, r250945 Changes to resolve races in bpfread() and catchpacket() that, at worst, cause kernel panics. Add a flag to the bpf descriptor to indicate whether the hold buffer is in use. In bpfread(), set the "hold buffer in use" flag before dropping the descriptor lock during the call to bpf_uiomove(). Everywhere else the hold buffer is used or changed, wait while the hold buffer is in use by bpfread(). Add a KASSERT in bpfread() after re-acquiring the descriptor lock to assist uncovering any additional hold buffer races. While waiting for the bpf hold buffer to become idle, check the return value from mtx_sleep() and exit bpfread() on errors such as EINTR. Modified: stable/9/sys/net/bpf.c stable/9/sys/net/bpf.h stable/9/sys/net/bpf_buffer.c stable/9/sys/net/bpfdesc.h Directory Properties: stable/9/sys/ (props changed) stable/9/sys/net/ (props changed) Modified: stable/9/sys/net/bpf.c ============================================================================== --- stable/9/sys/net/bpf.c Fri Jun 14 18:42:08 2013 (r251755) +++ stable/9/sys/net/bpf.c Fri Jun 14 18:56:37 2013 (r251756) @@ -819,6 +819,7 @@ bpfopen(struct cdev *dev, int flags, int * particular buffer method. */ bpf_buffer_init(d); + d->bd_hbuf_in_use = 0; d->bd_bufmode = BPF_BUFMODE_BUFFER; d->bd_sig = SIGIO; d->bd_direction = BPF_D_INOUT; @@ -872,6 +873,14 @@ bpfread(struct cdev *dev, struct uio *ui callout_stop(&d->bd_callout); timed_out = (d->bd_state == BPF_TIMED_OUT); d->bd_state = BPF_IDLE; + while (d->bd_hbuf_in_use) { + error = mtx_sleep(&d->bd_hbuf_in_use, &d->bd_lock, + PRINET|PCATCH, "bd_hbuf", 0); + if (error != 0) { + BPFD_UNLOCK(d); + return (error); + } + } /* * If the hold buffer is empty, then do a timed sleep, which * ends when the timeout expires or when enough packets @@ -940,24 +949,27 @@ bpfread(struct cdev *dev, struct uio *ui /* * At this point, we know we have something in the hold slot. */ + d->bd_hbuf_in_use = 1; BPFD_UNLOCK(d); /* * Move data from hold buffer into user space. * We know the entire buffer is transferred since * we checked above that the read buffer is bpf_bufsize bytes. - * - * XXXRW: More synchronization needed here: what if a second thread - * issues a read on the same fd at the same time? Don't want this - * getting invalidated. + * + * We do not have to worry about simultaneous reads because + * we waited for sole access to the hold buffer above. */ error = bpf_uiomove(d, d->bd_hbuf, d->bd_hlen, uio); BPFD_LOCK(d); + KASSERT(d->bd_hbuf != NULL, ("bpfread: lost bd_hbuf")); d->bd_fbuf = d->bd_hbuf; d->bd_hbuf = NULL; d->bd_hlen = 0; bpf_buf_reclaimed(d); + d->bd_hbuf_in_use = 0; + wakeup(&d->bd_hbuf_in_use); BPFD_UNLOCK(d); return (error); @@ -1111,6 +1123,9 @@ reset_d(struct bpf_d *d) BPFD_LOCK_ASSERT(d); + while (d->bd_hbuf_in_use) + mtx_sleep(&d->bd_hbuf_in_use, &d->bd_lock, PRINET, + "bd_hbuf", 0); if ((d->bd_hbuf != NULL) && (d->bd_bufmode != BPF_BUFMODE_ZBUF || bpf_canfreebuf(d))) { /* Free the hold buffer. */ @@ -1251,6 +1266,9 @@ bpfioctl(struct cdev *dev, u_long cmd, c BPFD_LOCK(d); n = d->bd_slen; + while (d->bd_hbuf_in_use) + mtx_sleep(&d->bd_hbuf_in_use, &d->bd_lock, + PRINET, "bd_hbuf", 0); if (d->bd_hbuf) n += d->bd_hlen; BPFD_UNLOCK(d); @@ -1964,6 +1982,9 @@ filt_bpfread(struct knote *kn, long hint ready = bpf_ready(d); if (ready) { kn->kn_data = d->bd_slen; + while (d->bd_hbuf_in_use) + mtx_sleep(&d->bd_hbuf_in_use, &d->bd_lock, + PRINET, "bd_hbuf", 0); if (d->bd_hbuf) kn->kn_data += d->bd_hlen; } else if (d->bd_rtout > 0 && d->bd_state == BPF_IDLE) { @@ -2296,6 +2317,9 @@ catchpacket(struct bpf_d *d, u_char *pkt * spot to do it. */ if (d->bd_fbuf == NULL && bpf_canfreebuf(d)) { + while (d->bd_hbuf_in_use) + mtx_sleep(&d->bd_hbuf_in_use, &d->bd_lock, + PRINET, "bd_hbuf", 0); d->bd_fbuf = d->bd_hbuf; d->bd_hbuf = NULL; d->bd_hlen = 0; @@ -2338,6 +2362,9 @@ catchpacket(struct bpf_d *d, u_char *pkt ++d->bd_dcount; return; } + while (d->bd_hbuf_in_use) + mtx_sleep(&d->bd_hbuf_in_use, &d->bd_lock, + PRINET, "bd_hbuf", 0); ROTATE_BUFFERS(d); do_wakeup = 1; curlen = 0; Modified: stable/9/sys/net/bpf.h ============================================================================== --- stable/9/sys/net/bpf.h Fri Jun 14 18:42:08 2013 (r251755) +++ stable/9/sys/net/bpf.h Fri Jun 14 18:56:37 2013 (r251756) @@ -1235,7 +1235,8 @@ SYSCTL_DECL(_net_bpf); /* * Rotate the packet buffers in descriptor d. Move the store buffer into the * hold slot, and the free buffer ino the store slot. Zero the length of the - * new store buffer. Descriptor lock should be held. + * new store buffer. Descriptor lock should be held. Hold buffer must + * not be marked "in use". */ #define ROTATE_BUFFERS(d) do { \ (d)->bd_hbuf = (d)->bd_sbuf; \ Modified: stable/9/sys/net/bpf_buffer.c ============================================================================== --- stable/9/sys/net/bpf_buffer.c Fri Jun 14 18:42:08 2013 (r251755) +++ stable/9/sys/net/bpf_buffer.c Fri Jun 14 18:56:37 2013 (r251756) @@ -79,6 +79,8 @@ __FBSDID("$FreeBSD$"); #include #include +#define PRINET 26 /* interruptible */ + /* * Implement historical kernel memory buffering model for BPF: two malloc(9) * kernel buffers are hung off of the descriptor. The size is fixed prior to @@ -189,6 +191,9 @@ bpf_buffer_ioctl_sblen(struct bpf_d *d, return (EINVAL); } + while (d->bd_hbuf_in_use) + mtx_sleep(&d->bd_hbuf_in_use, &d->bd_lock, + PRINET, "bd_hbuf", 0); /* Free old buffers if set */ if (d->bd_fbuf != NULL) free(d->bd_fbuf, M_BPF); Modified: stable/9/sys/net/bpfdesc.h ============================================================================== --- stable/9/sys/net/bpfdesc.h Fri Jun 14 18:42:08 2013 (r251755) +++ stable/9/sys/net/bpfdesc.h Fri Jun 14 18:56:37 2013 (r251756) @@ -63,6 +63,7 @@ struct bpf_d { caddr_t bd_sbuf; /* store slot */ caddr_t bd_hbuf; /* hold slot */ caddr_t bd_fbuf; /* free slot */ + int bd_hbuf_in_use; /* don't rotate buffers */ int bd_slen; /* current length of store buffer */ int bd_hlen; /* current length of hold buffer */ From owner-svn-src-stable@FreeBSD.ORG Fri Jun 14 19:26:34 2013 Return-Path: Delivered-To: svn-src-stable@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by hub.freebsd.org (Postfix) with ESMTP id 130A246E; Fri, 14 Jun 2013 19:26:34 +0000 (UTC) (envelope-from mm@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) by mx1.freebsd.org (Postfix) with ESMTP id 01A1813A4; Fri, 14 Jun 2013 19:26:34 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.7/8.14.7) with ESMTP id r5EJQXVq043657; Fri, 14 Jun 2013 19:26:33 GMT (envelope-from mm@svn.freebsd.org) Received: (from mm@localhost) by svn.freebsd.org (8.14.7/8.14.5/Submit) id r5EJQXBs043651; Fri, 14 Jun 2013 19:26:33 GMT (envelope-from mm@svn.freebsd.org) Message-Id: <201306141926.r5EJQXBs043651@svn.freebsd.org> From: Martin Matuska Date: Fri, 14 Jun 2013 19:26:33 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-8@freebsd.org Subject: svn commit: r251757 - in stable/8: . cddl/contrib/opensolaris/cmd/zdb cddl/contrib/opensolaris/cmd/zfs cddl/contrib/opensolaris/cmd/zhack cddl/contrib/opensolaris/cmd/zpool cddl/contrib/opensolaris... X-SVN-Group: stable-8 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 14 Jun 2013 19:26:34 -0000 Author: mm Date: Fri Jun 14 19:26:32 2013 New Revision: 251757 URL: http://svnweb.freebsd.org/changeset/base/251757 Log: MFC 246619,247187,247265,247348,247398,247540,247585,248265,248267,248571, 248976,249004,249042,249047,249188,249195,249196,249206,249207,249319, 249326,249356,249357,249787,249883,249858 Merge libzfs_core, zfs deadman thread and other ZFS bugfixes and improvements. MFC r246619: Correct spelling of "daemon". No .Dd bump. Noticed by: Nathan Rich MFC r247187: Import vendor change to avoid "unitialized variable" warnings. Illumos ZFS issues: 3522 zfs module should not allow uninitialized variables MFC r247265: Merge the ZFS I/O deadman thread from vendor (illumos). This feature panics the system on hanging ZFS I/O, helps debugging and resumes failed service. The panic behavior can be controlled with the loader-only tunables: vfs.zfs.deadman_enabled (enable or disable panic on stalled ZFS I/O) vfs.zfs.deadman_synctime (expiration time for stalled ZFS I/O) By default, ZFS I/O deadman is enabled by default on amd64 and i386 excluding virtual guest machines. MFC r247348: Be more verbose on ZFS deadman I/O panic Patch suggested upstream. MFC r247398: Import metaslab_sync() speedup from vendor (illumos). Illumos ZFS issues: 3552 condensing one space map burns 3 seconds of CPU in spa_sync() thread 3564 spa_sync() spends 5-10% of its time in metaslab_sync() (when not condensing) 3578 transferring the freed map to the defer map should be constant time 3579 ztest trips assertion in metaslab_weight() MFC r247540: Fix the zfs_ioctl compat layer to support zfs_cmd size change introduced in r247265 (ZFS deadman thread). Both new utilities now support the old kernel and new kernel properly detects old utilities. For future backwards compatibility, the vfs.zfs.version.ioctl read-only sysctl has been introduced. With this sysctl zfs utilities will be able to detect the ioctl interface version of the currently loaded zfs module. MFC r247585: Merge new read-only zfs properties from vendor (illumos) Illumos ZFS issues: 3588 provide zfs properties for logical (uncompressed) space used and referenced MFC r248265: Update zfs.8 manpage date (missing in r247585) MFC r248267: Import minor ZFS changes from vendor Illumos ZFS issues: 3604 zdb should print bpobjs more verbosely (fix zdb hang) 3606 zpool status -x shouldn't warn about old on-disk format MFC r248571: MFV 238590, 238592: In the first zfs ioctl restructuring phase, the libzfs_core library was introduced. It is a new thin library that wraps around kernel ioctl's. The idea is to provide a forward-compatible way of dealing with new features. Arguments are passed in nvlists and not random zfs_cmd fields, new-style ioctls are logged to pool history using a new method of history logging. http://blog.delphix.com/matt/2012/01/17/the-future-of-libzfs/ MFV 247580 [1]: To address issues of several deadlocks and race conditions the locking code around dsl_dataset was rewritten and the interface to synctasks was changed. User-Visible Changes: "zfs snapshot" can create more arbitrary snapshots at once (atomically) "zfs destroy" destroys multiple snapshots at once "zfs recv" has improved performance Backward Compatibility: I have extended the compatibility layer to support full backward compatibility by remapping or rewriting the responsible ioctl arguments. Old utilities are fully supported by the new kernel module. Forward Compatibility: New utilities work with old kernels with the following restrictions: - creating, destroying, holding and releasing of multiple snapshots at once is not supported, this includes recursive (-r) commands Illumos ZFS issues: 2882 implement libzfs_core 2900 "zfs snapshot" should be able to create multiple, arbitrary snapshots at once 3464 zfs synctask code needs restructuring MFC r248976: Call dmu_snapshot_list_next() in zvol.c with dsl_pool_config lock held MFC r249004: Do not check against uninitialized rc and comment out vendor code MFC r249042: Fix possible pool hold leak in dmu_send_impl() Illumos ZFS issues: 3645 dmu_send_impl: possibilty of pool hold leak MFC r249047 (avg): spa_open_common: fix argument to zvol_create_minors Prior to r248571 spa_open was always called with a bare pool name, but now it is called with a dataset name instead (spa_lookup handles that). So, when a ZFS root is mounted spa_open is called with a name of a root dataset, which can very well be different from the pool name. But zvol_create_minors should be called with the pool name, because it performs a recursive traversal of all datasets under the name to find all those that are volumes. MFC r249188: Import vendor change to reduce diff, no effect on FreeBSD. Illumos ZFS issues: 3517 importing pool with autoreplace=on and "hole" vdevs crashes syseventd MFC r249195: Merge change from vendor to reduce diff only. ZFS dtrace probes are not supported on FreeBSD yet. Illumos ZFS issues: 3598 want to dtrace when errors are generated in zfs MFC r249196: Provide a fix for kernel panic if receiving recursive deduplicated streams. Problem reported to vendor. Illumos ZFS issues: 3692 Panic on zfs receive of a recursive deduplicated stream MFC r249206: Merge vendor change - modify time processing in deadman thread. Illumos ZFS issues: 3618 ::zio dcmd does not show timestamp data MFC r249207: Allow zdb to output a histogram of compressed block sizes. Illumos ZFS issues: 3641 want a histogram of compressed block sizes MFC r249319: ZFS expects a copyout of zfs_cmd_t on an ioctl error. Our sys_ioctl() doesn't copyout in this case. To solve this a new struct zfs_iocparm_t is introduced consisting of: - zfs_ioctl_version (future backwards compatibility purposes) - user space pointer to zfs_cmd_t (copyin and copyout) - size of zfs_cmd_t (verification purposes) The copyin and copyout of zfs_cmd_t is now done the illumos (vendor) way what makes porting of new changes easier and ensures correct behavior if returning an error. MFC r249326: Cast (void *)(uintptr_t) on copyout and copyin of zfs_iocparm_t.zfs_cmd MFC r249356: Merge bugfixes accepted and integrated by vendor. Underlying problems have been reported by us and fixed in r240942 and r249196. Illumos ZFS issues: 3645 dmu_send_impl: possibilty of pool hold leak 3692 Panic on zfs receive of a recursive deduplicated stream MFC r249357: Fix libzfs to report error instead of returning zero if trying to hold or release a non-existing snapshot of a existing dataset. In recursive case error is reported if no snapshots with the requested name have been found. Illumos ZFS issues: 3699 zfs hold or release of a non-existent snapshot does not output error MFC r249787: The zfs synctask code restructuring introduced a new bug that makes it impossible to set quota and reservation on pools lower than version 22. Problem has been reported and a solution discussed with vendor. Illumos ZFS issues: 3739 cannot set zfs quota or reservation on pool version < 22 MFC r249883: Respect the enoent_ok flag if reporting error for holding an non-existing snapshot. Related illumos ZFS issue: 3699 zfs hold or release of a non-existent snapshot does not output error MFC r249858: Merge vendor bugfix for a possible deadlock related to async destroy and improve write performance by introducing a new lock protecting tx_open_txg. Illumos ZFS issues: 3642 dsl_scan_active() should not issue I/O to determine if async destroying is active 3643 txg_delay should not hold the tc_lock Added: stable/8/cddl/contrib/opensolaris/lib/libzfs/common/libzfs_compat.c - copied, changed from r248571, head/cddl/contrib/opensolaris/lib/libzfs/common/libzfs_compat.c stable/8/cddl/contrib/opensolaris/lib/libzfs/common/libzfs_compat.h - copied unchanged from r248571, head/cddl/contrib/opensolaris/lib/libzfs/common/libzfs_compat.h stable/8/cddl/contrib/opensolaris/lib/libzfs_core/ - copied from r248571, head/cddl/contrib/opensolaris/lib/libzfs_core/ stable/8/cddl/contrib/opensolaris/lib/libzpool/common/zfs.d - copied unchanged from r249195, head/cddl/contrib/opensolaris/lib/libzpool/common/zfs.d stable/8/cddl/lib/libzfs_core/ - copied from r248571, head/cddl/lib/libzfs_core/ stable/8/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/dsl_destroy.c - copied, changed from r248571, head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/dsl_destroy.c stable/8/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/dsl_userhold.c - copied, changed from r248571, head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/dsl_userhold.c stable/8/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/sys/dmu_send.h - copied unchanged from r248571, head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/sys/dmu_send.h stable/8/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/sys/dsl_destroy.h - copied unchanged from r248571, head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/sys/dsl_destroy.h stable/8/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/sys/dsl_userhold.h - copied unchanged from r248571, head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/sys/dsl_userhold.h Modified: stable/8/Makefile.inc1 (contents, props changed) stable/8/cddl/contrib/opensolaris/cmd/zdb/zdb.c stable/8/cddl/contrib/opensolaris/cmd/zfs/zfs.8 stable/8/cddl/contrib/opensolaris/cmd/zfs/zfs_main.c stable/8/cddl/contrib/opensolaris/cmd/zhack/zhack.c stable/8/cddl/contrib/opensolaris/cmd/zpool/zpool_main.c stable/8/cddl/contrib/opensolaris/cmd/ztest/ztest.c stable/8/cddl/contrib/opensolaris/lib/libzfs/common/libzfs.h stable/8/cddl/contrib/opensolaris/lib/libzfs/common/libzfs_dataset.c stable/8/cddl/contrib/opensolaris/lib/libzfs/common/libzfs_impl.h stable/8/cddl/contrib/opensolaris/lib/libzfs/common/libzfs_iter.c stable/8/cddl/contrib/opensolaris/lib/libzfs/common/libzfs_pool.c stable/8/cddl/contrib/opensolaris/lib/libzfs/common/libzfs_sendrecv.c stable/8/cddl/contrib/opensolaris/lib/libzfs/common/libzfs_util.c stable/8/cddl/contrib/opensolaris/lib/libzpool/common/kernel.c stable/8/cddl/contrib/opensolaris/lib/libzpool/common/sys/zfs_context.h stable/8/cddl/lib/Makefile stable/8/cddl/lib/libzfs/Makefile stable/8/cddl/sbin/zfs/Makefile stable/8/cddl/sbin/zpool/Makefile stable/8/cddl/usr.bin/zinject/Makefile stable/8/cddl/usr.bin/ztest/Makefile stable/8/cddl/usr.sbin/zdb/Makefile stable/8/cddl/usr.sbin/zhack/Makefile stable/8/rescue/rescue/Makefile stable/8/share/mk/bsd.libnames.mk stable/8/sys/cddl/compat/opensolaris/sys/cred.h stable/8/sys/cddl/compat/opensolaris/sys/sdt.h stable/8/sys/cddl/compat/opensolaris/sys/time.h stable/8/sys/cddl/contrib/opensolaris/common/nvpair/fnvpair.c stable/8/sys/cddl/contrib/opensolaris/common/zfs/zfs_comutil.c stable/8/sys/cddl/contrib/opensolaris/common/zfs/zfs_comutil.h stable/8/sys/cddl/contrib/opensolaris/common/zfs/zfs_ioctl_compat.c stable/8/sys/cddl/contrib/opensolaris/common/zfs/zfs_ioctl_compat.h stable/8/sys/cddl/contrib/opensolaris/common/zfs/zfs_prop.c stable/8/sys/cddl/contrib/opensolaris/common/zfs/zprop_common.c stable/8/sys/cddl/contrib/opensolaris/uts/common/Makefile.files stable/8/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/arc.c stable/8/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/bplist.c stable/8/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/bpobj.c stable/8/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/dbuf.c stable/8/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/ddt.c stable/8/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/dmu.c stable/8/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/dmu_diff.c stable/8/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/dmu_object.c stable/8/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/dmu_objset.c stable/8/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/dmu_send.c stable/8/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/dmu_traverse.c stable/8/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/dmu_tx.c stable/8/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/dnode.c stable/8/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/dnode_sync.c stable/8/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/dsl_dataset.c stable/8/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/dsl_deleg.c stable/8/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/dsl_dir.c stable/8/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/dsl_pool.c stable/8/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/dsl_prop.c stable/8/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/dsl_scan.c stable/8/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/dsl_synctask.c stable/8/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/lzjb.c stable/8/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/metaslab.c stable/8/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/refcount.c stable/8/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/rrwlock.c stable/8/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/sa.c stable/8/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/spa.c stable/8/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/spa_errlog.c stable/8/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/spa_history.c stable/8/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/spa_misc.c stable/8/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/space_map.c stable/8/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/sys/arc.h stable/8/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/sys/dbuf.h stable/8/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/sys/dmu.h stable/8/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/sys/dmu_objset.h stable/8/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/sys/dmu_tx.h stable/8/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/sys/dsl_dataset.h stable/8/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/sys/dsl_deleg.h stable/8/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/sys/dsl_dir.h stable/8/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/sys/dsl_pool.h stable/8/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/sys/dsl_prop.h stable/8/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/sys/dsl_scan.h stable/8/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/sys/dsl_synctask.h stable/8/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/sys/metaslab.h stable/8/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/sys/metaslab_impl.h stable/8/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/sys/refcount.h stable/8/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/sys/rrwlock.h stable/8/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/sys/spa.h stable/8/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/sys/spa_boot.h stable/8/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/sys/spa_impl.h stable/8/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/sys/space_map.h stable/8/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/sys/txg.h stable/8/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/sys/txg_impl.h stable/8/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/sys/vdev.h stable/8/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/sys/vdev_impl.h stable/8/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/sys/zfeature.h stable/8/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/sys/zfs_context.h stable/8/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/sys/zfs_debug.h stable/8/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/sys/zfs_ioctl.h stable/8/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/sys/zfs_znode.h stable/8/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/sys/zil.h stable/8/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/sys/zio.h stable/8/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/txg.c stable/8/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/uberblock.c stable/8/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/vdev.c stable/8/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/vdev_cache.c stable/8/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/vdev_disk.c stable/8/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/vdev_file.c stable/8/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/vdev_label.c stable/8/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/vdev_mirror.c stable/8/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/vdev_missing.c stable/8/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/vdev_queue.c stable/8/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/vdev_raidz.c stable/8/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/vdev_root.c stable/8/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zap.c stable/8/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zap_leaf.c stable/8/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zap_micro.c stable/8/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zfeature.c stable/8/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_acl.c stable/8/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_byteswap.c stable/8/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_ctldir.c stable/8/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_dir.c stable/8/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_fuid.c stable/8/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_ioctl.c stable/8/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_log.c stable/8/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_onexit.c stable/8/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_replay.c stable/8/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_rlock.c stable/8/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_vfsops.c stable/8/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_vnops.c stable/8/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_znode.c stable/8/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zil.c stable/8/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zio.c stable/8/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zio_checksum.c stable/8/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zio_compress.c stable/8/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zio_inject.c stable/8/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zvol.c stable/8/sys/cddl/contrib/opensolaris/uts/common/sys/feature_tests.h stable/8/sys/cddl/contrib/opensolaris/uts/common/sys/fs/zfs.h stable/8/sys/cddl/contrib/opensolaris/uts/common/sys/nvpair.h Directory Properties: stable/8/cddl/ (props changed) stable/8/cddl/contrib/opensolaris/ (props changed) stable/8/cddl/contrib/opensolaris/cmd/zfs/ (props changed) stable/8/cddl/contrib/opensolaris/lib/libzfs/ (props changed) stable/8/cddl/lib/ (props changed) stable/8/cddl/sbin/ (props changed) stable/8/cddl/usr.bin/ (props changed) stable/8/cddl/usr.sbin/ (props changed) stable/8/rescue/rescue/ (props changed) stable/8/share/mk/ (props changed) stable/8/sys/ (props changed) stable/8/sys/cddl/ (props changed) stable/8/sys/cddl/contrib/opensolaris/ (props changed) Modified: stable/8/Makefile.inc1 ============================================================================== --- stable/8/Makefile.inc1 Fri Jun 14 18:56:37 2013 (r251756) +++ stable/8/Makefile.inc1 Fri Jun 14 19:26:32 2013 (r251757) @@ -1140,6 +1140,7 @@ _prebuild_libs= ${_kerberos5_lib_libasn1 lib/libopie lib/libpam ${_lib_libthr} \ lib/libradius lib/libsbuf lib/libtacplus \ ${_cddl_lib_libumem} ${_cddl_lib_libnvpair} \ + ${_cddl_lib_libzfs_core} \ lib/libutil ${_lib_libypclnt} lib/libz lib/msun \ ${_secure_lib_libcrypto} ${_secure_lib_libssh} \ ${_secure_lib_libssl} @@ -1155,7 +1156,9 @@ lib/libopie__L lib/libtacplus__L: lib/li .if ${MK_CDDL} != "no" _cddl_lib_libumem= cddl/lib/libumem _cddl_lib_libnvpair= cddl/lib/libnvpair +_cddl_lib_libzfs_core= cddl/lib/libzfs_core _cddl_lib= cddl/lib +cddl/lib/libzfs_core__L: cddl/lib/libnvpair__L .endif .if ${MK_CRYPT} != "no" Modified: stable/8/cddl/contrib/opensolaris/cmd/zdb/zdb.c ============================================================================== --- stable/8/cddl/contrib/opensolaris/cmd/zdb/zdb.c Fri Jun 14 18:56:37 2013 (r251756) +++ stable/8/cddl/contrib/opensolaris/cmd/zdb/zdb.c Fri Jun 14 19:26:32 2013 (r251757) @@ -21,10 +21,11 @@ /* * Copyright (c) 2005, 2010, Oracle and/or its affiliates. All rights reserved. - * Copyright (c) 2012 by Delphix. All rights reserved. + * Copyright (c) 2013 by Delphix. All rights reserved. */ #include +#include #include #include #include @@ -57,6 +58,7 @@ #include #include #include +#include #undef ZFS_MAXNAMELEN #undef verify #include @@ -206,6 +208,27 @@ dump_packed_nvlist(objset_t *os, uint64_ nvlist_free(nv); } +/* ARGSUSED */ +static void +dump_history_offsets(objset_t *os, uint64_t object, void *data, size_t size) +{ + spa_history_phys_t *shp = data; + + if (shp == NULL) + return; + + (void) printf("\t\tpool_create_len = %llu\n", + (u_longlong_t)shp->sh_pool_create_len); + (void) printf("\t\tphys_max_off = %llu\n", + (u_longlong_t)shp->sh_phys_max_off); + (void) printf("\t\tbof = %llu\n", + (u_longlong_t)shp->sh_bof); + (void) printf("\t\teof = %llu\n", + (u_longlong_t)shp->sh_eof); + (void) printf("\t\trecords_lost = %llu\n", + (u_longlong_t)shp->sh_records_lost); +} + static void zdb_nicenum(uint64_t num, char *buf) { @@ -215,18 +238,18 @@ zdb_nicenum(uint64_t num, char *buf) nicenum(num, buf); } -const char dump_zap_stars[] = "****************************************"; -const int dump_zap_width = sizeof (dump_zap_stars) - 1; +const char histo_stars[] = "****************************************"; +const int histo_width = sizeof (histo_stars) - 1; static void -dump_zap_histogram(uint64_t histo[ZAP_HISTOGRAM_SIZE]) +dump_histogram(const uint64_t *histo, int size) { int i; - int minidx = ZAP_HISTOGRAM_SIZE - 1; + int minidx = size - 1; int maxidx = 0; uint64_t max = 0; - for (i = 0; i < ZAP_HISTOGRAM_SIZE; i++) { + for (i = 0; i < size; i++) { if (histo[i] > max) max = histo[i]; if (histo[i] > 0 && i > maxidx) @@ -235,12 +258,14 @@ dump_zap_histogram(uint64_t histo[ZAP_HI minidx = i; } - if (max < dump_zap_width) - max = dump_zap_width; + if (max < histo_width) + max = histo_width; - for (i = minidx; i <= maxidx; i++) - (void) printf("\t\t\t%u: %6llu %s\n", i, (u_longlong_t)histo[i], - &dump_zap_stars[(max - histo[i]) * dump_zap_width / max]); + for (i = minidx; i <= maxidx; i++) { + (void) printf("\t\t\t%3u: %6llu %s\n", + i, (u_longlong_t)histo[i], + &histo_stars[(max - histo[i]) * histo_width / max]); + } } static void @@ -291,19 +316,19 @@ dump_zap_stats(objset_t *os, uint64_t ob (u_longlong_t)zs.zs_salt); (void) printf("\t\tLeafs with 2^n pointers:\n"); - dump_zap_histogram(zs.zs_leafs_with_2n_pointers); + dump_histogram(zs.zs_leafs_with_2n_pointers, ZAP_HISTOGRAM_SIZE); (void) printf("\t\tBlocks with n*5 entries:\n"); - dump_zap_histogram(zs.zs_blocks_with_n5_entries); + dump_histogram(zs.zs_blocks_with_n5_entries, ZAP_HISTOGRAM_SIZE); (void) printf("\t\tBlocks n/10 full:\n"); - dump_zap_histogram(zs.zs_blocks_n_tenths_full); + dump_histogram(zs.zs_blocks_n_tenths_full, ZAP_HISTOGRAM_SIZE); (void) printf("\t\tEntries with n chunks:\n"); - dump_zap_histogram(zs.zs_entries_using_n_chunks); + dump_histogram(zs.zs_entries_using_n_chunks, ZAP_HISTOGRAM_SIZE); (void) printf("\t\tBuckets with n entries:\n"); - dump_zap_histogram(zs.zs_buckets_with_n_entries); + dump_histogram(zs.zs_buckets_with_n_entries, ZAP_HISTOGRAM_SIZE); } /*ARGSUSED*/ @@ -545,7 +570,7 @@ static void dump_metaslab_stats(metaslab_t *msp) { char maxbuf[32]; - space_map_t *sm = &msp->ms_map; + space_map_t *sm = msp->ms_map; avl_tree_t *t = sm->sm_pp_root; int free_pct = sm->sm_space * 100 / sm->sm_size; @@ -561,7 +586,7 @@ dump_metaslab(metaslab_t *msp) { vdev_t *vd = msp->ms_group->mg_vd; spa_t *spa = vd->vdev_spa; - space_map_t *sm = &msp->ms_map; + space_map_t *sm = msp->ms_map; space_map_obj_t *smo = &msp->ms_smo; char freebuf[32]; @@ -857,21 +882,22 @@ dump_history(spa_t *spa) for (int i = 0; i < num; i++) { uint64_t time, txg, ievent; char *cmd, *intstr; + boolean_t printed = B_FALSE; if (nvlist_lookup_uint64(events[i], ZPOOL_HIST_TIME, &time) != 0) - continue; + goto next; if (nvlist_lookup_string(events[i], ZPOOL_HIST_CMD, &cmd) != 0) { if (nvlist_lookup_uint64(events[i], ZPOOL_HIST_INT_EVENT, &ievent) != 0) - continue; + goto next; verify(nvlist_lookup_uint64(events[i], ZPOOL_HIST_TXG, &txg) == 0); verify(nvlist_lookup_string(events[i], ZPOOL_HIST_INT_STR, &intstr) == 0); - if (ievent >= LOG_END) - continue; + if (ievent >= ZFS_NUM_LEGACY_HISTORY_EVENTS) + goto next; (void) snprintf(internalstr, sizeof (internalstr), @@ -884,6 +910,14 @@ dump_history(spa_t *spa) (void) localtime_r(&tsec, &t); (void) strftime(tbuf, sizeof (tbuf), "%F.%T", &t); (void) printf("%s %s\n", tbuf, cmd); + printed = B_TRUE; + +next: + if (dump_opt['h'] > 1) { + if (!printed) + (void) printf("unrecognized record:\n"); + dump_nvlist(events[i], 2); + } } } @@ -916,7 +950,7 @@ sprintf_blkptr_compact(char *blkbuf, con const dva_t *dva = bp->blk_dva; int ndvas = dump_opt['d'] > 5 ? BP_GET_NDVAS(bp) : 1; - if (dump_opt['b'] >= 5) { + if (dump_opt['b'] >= 6) { sprintf_blkptr(blkbuf, bp); return; } @@ -1496,7 +1530,7 @@ static object_viewer_t *object_viewer[DM dump_zap, /* other ZAP */ dump_zap, /* persistent error log */ dump_uint8, /* SPA history */ - dump_uint64, /* SPA history offsets */ + dump_history_offsets, /* SPA history offsets */ dump_zap, /* Pool properties */ dump_zap, /* DSL permissions */ dump_acl, /* ZFS ACL */ @@ -1661,7 +1695,9 @@ dump_dir(objset_t *os) int print_header = 1; int i, error; + dsl_pool_config_enter(dmu_objset_pool(os), FTAG); dmu_objset_fast_stat(os, &dds); + dsl_pool_config_exit(dmu_objset_pool(os), FTAG); if (dds.dds_type < DMU_OST_NUMTYPES) type = objset_types[dds.dds_type]; @@ -1953,11 +1989,13 @@ dump_one_dir(const char *dsname, void *a /* * Block statistics. */ +#define PSIZE_HISTO_SIZE (SPA_MAXBLOCKSIZE / SPA_MINBLOCKSIZE + 1) typedef struct zdb_blkstats { - uint64_t zb_asize; - uint64_t zb_lsize; - uint64_t zb_psize; - uint64_t zb_count; + uint64_t zb_asize; + uint64_t zb_lsize; + uint64_t zb_psize; + uint64_t zb_count; + uint64_t zb_psize_histogram[PSIZE_HISTO_SIZE]; } zdb_blkstats_t; /* @@ -1981,6 +2019,9 @@ typedef struct zdb_cb { zdb_blkstats_t zcb_type[ZB_TOTAL + 1][ZDB_OT_TOTAL + 1]; uint64_t zcb_dedup_asize; uint64_t zcb_dedup_blocks; + uint64_t zcb_start; + uint64_t zcb_lastprint; + uint64_t zcb_totalasize; uint64_t zcb_errors[256]; int zcb_readfails; int zcb_haderrors; @@ -2007,6 +2048,7 @@ zdb_count_block(zdb_cb_t *zcb, zilog_t * zb->zb_lsize += BP_GET_LSIZE(bp); zb->zb_psize += BP_GET_PSIZE(bp); zb->zb_count++; + zb->zb_psize_histogram[BP_GET_PSIZE(bp) >> SPA_MINBLOCKSHIFT]++; } if (dump_opt['L']) @@ -2070,7 +2112,6 @@ zdb_blkptr_cb(spa_t *spa, zilog_t *zilog NULL, NULL, ZIO_PRIORITY_ASYNC_READ, flags, zb)); free(data); - if (ioerr && !(flags & ZIO_FLAG_SPECULATIVE)) { zcb->zcb_haderrors = 1; zcb->zcb_errors[ioerr]++; @@ -2094,7 +2135,7 @@ zdb_blkptr_cb(spa_t *spa, zilog_t *zilog zcb->zcb_readfails = 0; - if (dump_opt['b'] >= 4) { + if (dump_opt['b'] >= 5) { sprintf_blkptr(blkbuf, bp); (void) printf("objset %llu object %llu " "level %lld offset 0x%llx %s\n", @@ -2105,6 +2146,28 @@ zdb_blkptr_cb(spa_t *spa, zilog_t *zilog blkbuf); } + if (dump_opt['b'] < 5 && isatty(STDERR_FILENO) && + gethrtime() > zcb->zcb_lastprint + NANOSEC) { + uint64_t now = gethrtime(); + char buf[10]; + uint64_t bytes = zcb->zcb_type[ZB_TOTAL][ZDB_OT_TOTAL].zb_asize; + int kb_per_sec = + 1 + bytes / (1 + ((now - zcb->zcb_start) / 1000 / 1000)); + int sec_remaining = + (zcb->zcb_totalasize - bytes) / 1024 / kb_per_sec; + + zfs_nicenum(bytes, buf, sizeof (buf)); + (void) fprintf(stderr, + "\r%5s completed (%4dMB/s) " + "estimated time remaining: %uhr %02umin %02usec ", + buf, kb_per_sec / 1024, + sec_remaining / 60 / 60, + sec_remaining / 60 % 60, + sec_remaining % 60); + + zcb->zcb_lastprint = now; + } + return (0); } @@ -2196,11 +2259,11 @@ zdb_leak_init(spa_t *spa, zdb_cb_t *zcb) for (int m = 0; m < vd->vdev_ms_count; m++) { metaslab_t *msp = vd->vdev_ms[m]; mutex_enter(&msp->ms_lock); - space_map_unload(&msp->ms_map); - VERIFY(space_map_load(&msp->ms_map, + space_map_unload(msp->ms_map); + VERIFY(space_map_load(msp->ms_map, &zdb_space_map_ops, SM_ALLOC, &msp->ms_smo, spa->spa_meta_objset) == 0); - msp->ms_map.sm_ppd = vd; + msp->ms_map->sm_ppd = vd; mutex_exit(&msp->ms_lock); } } @@ -2223,7 +2286,7 @@ zdb_leak_fini(spa_t *spa) for (int m = 0; m < vd->vdev_ms_count; m++) { metaslab_t *msp = vd->vdev_ms[m]; mutex_enter(&msp->ms_lock); - space_map_unload(&msp->ms_map); + space_map_unload(msp->ms_map); mutex_exit(&msp->ms_lock); } } @@ -2236,7 +2299,7 @@ count_block_cb(void *arg, const blkptr_t { zdb_cb_t *zcb = arg; - if (dump_opt['b'] >= 4) { + if (dump_opt['b'] >= 5) { char blkbuf[BP_SPRINTF_LEN]; sprintf_blkptr(blkbuf, bp); (void) printf("[%s] %s\n", @@ -2255,7 +2318,7 @@ dump_block_stats(spa_t *spa) int flags = TRAVERSE_PRE | TRAVERSE_PREFETCH_METADATA | TRAVERSE_HARD; int leaks = 0; - (void) printf("\nTraversing all blocks %s%s%s%s%s...\n", + (void) printf("\nTraversing all blocks %s%s%s%s%s...\n\n", (dump_opt['c'] || !dump_opt['L']) ? "to verify " : "", (dump_opt['c'] == 1) ? "metadata " : "", dump_opt['c'] ? "checksums " : "", @@ -2291,6 +2354,8 @@ dump_block_stats(spa_t *spa) if (dump_opt['c'] > 1) flags |= TRAVERSE_PREFETCH_DATA; + zcb.zcb_totalasize = metaslab_class_get_alloc(spa_normal_class(spa)); + zcb.zcb_start = zcb.zcb_lastprint = gethrtime(); zcb.zcb_haderrors |= traverse_pool(spa, 0, flags, zdb_blkptr_cb, &zcb); if (zcb.zcb_haderrors) { @@ -2418,6 +2483,14 @@ dump_block_stats(spa_t *spa) else (void) printf(" L%d %s\n", level, typename); + + if (dump_opt['b'] >= 4) { + (void) printf("psize " + "(in 512-byte sectors): " + "number of blocks\n"); + dump_histogram(zb->zb_psize_histogram, + PSIZE_HISTO_SIZE); + } } } } Modified: stable/8/cddl/contrib/opensolaris/cmd/zfs/zfs.8 ============================================================================== --- stable/8/cddl/contrib/opensolaris/cmd/zfs/zfs.8 Fri Jun 14 18:56:37 2013 (r251756) +++ stable/8/cddl/contrib/opensolaris/cmd/zfs/zfs.8 Fri Jun 14 19:26:32 2013 (r251757) @@ -27,7 +27,7 @@ .\" .\" $FreeBSD$ .\" -.Dd February 10, 2013 +.Dd March 21, 2013 .Dt ZFS 8 .Os .Sh NAME @@ -64,6 +64,7 @@ .Op Fl r .Oo Fl o Ar property Ns = Ns Ar value Oc Ns ... .Ar filesystem@snapname Ns | Ns Ar volume@snapname +.Ar filesystem@snapname Ns | Ns Ar volume@snapname Ns ... .Nm .Cm rollback .Op Fl rRf @@ -519,6 +520,39 @@ if the snapshot has been marked for defe .Qq Nm Cm destroy -d command. Otherwise, the property is .Cm off . +.It Sy logicalreferenced +The amount of space that is +.Qq logically +accessible by this dataset. +See the +.Sy referenced +property. +The logical space ignores the effect of the +.Sy compression +and +.Sy copies +properties, giving a quantity closer to the amount of data that applications +see. +However, it does include space consumed by metadata. +.Pp +This property can also be referred to by its shortened column name, +.Sy lrefer . +.It Sy logicalused +The amount of space that is +.Qq logically +consumed by this dataset and all its descendents. +See the +.Sy used +property. +The logical space ignores the effect of the +.Sy compression +and +.Sy copies +properties, giving a quantity closer to the amount of data that applications +see. +.Pp +This property can also be referred to by its shortened column name, +.Sy lused . .It Sy mounted For file systems, indicates whether the file system is currently mounted. This property can be either @@ -1158,7 +1192,7 @@ When the .Sy sharenfs property is changed for a dataset, the .Xr mountd 8 -dameon is reloaded. +daemon is reloaded. .It Sy logbias Ns = Ns Cm latency | throughput Provide a hint to .Tn ZFS @@ -1575,7 +1609,11 @@ multiple snapshots. Destroy (or mark for deferred deletion) all snapshots with this name in descendent file systems. .It Fl R -Recursively destroy all dependents. +Recursively destroy all clones of these snapshots, including the clones, +snapshots, and children. +If this flag is specified, the +.Op fl d +flag will have no effect. .It Fl n Do a dry-run ("No-op") deletion. No data will be deleted. This is useful in conjunction with the @@ -1603,17 +1641,18 @@ behavior for mounted file systems in use .Op Fl r .Oo Fl o Ar property Ns = Ns Ar value Oc Ns ... .Ar filesystem@snapname Ns | Ns volume@snapname +.Ar filesystem@snapname Ns | Ns volume@snapname Ns ... .Xc .Pp -Creates a snapshot with the given name. All previous modifications by -successful system calls to the file system are part of the snapshot. See the +Creates snapshots with the given names. All previous modifications by +successful system calls to the file system are part of the snapshots. +Snapshots are taken atomically, so that all snapshots correspond to the same +moment in time. See the .Qq Sx Snapshots section for details. .Bl -tag -width indent .It Fl r -Recursively create snapshots of all descendent datasets. Snapshots are taken -atomically, so that all recursive snapshots correspond to the same moment in -time. +Recursively create snapshots of all descendent datasets .It Fl o Ar property Ns = Ns Ar value Sets the specified property; see .Qq Nm Cm create Modified: stable/8/cddl/contrib/opensolaris/cmd/zfs/zfs_main.c ============================================================================== --- stable/8/cddl/contrib/opensolaris/cmd/zfs/zfs_main.c Fri Jun 14 18:56:37 2013 (r251756) +++ stable/8/cddl/contrib/opensolaris/cmd/zfs/zfs_main.c Fri Jun 14 19:26:32 2013 (r251757) @@ -58,6 +58,7 @@ #include #include +#include #include #include #include @@ -74,6 +75,7 @@ libzfs_handle_t *g_zfs; static FILE *mnttab_file; static char history_str[HIS_MAX_RECORD_LEN]; +static boolean_t log_history = B_TRUE; static int zfs_do_clone(int argc, char **argv); static int zfs_do_create(int argc, char **argv); @@ -276,7 +278,7 @@ get_usage(zfs_help_t idx) return (gettext("\tshare <-a | filesystem>\n")); case HELP_SNAPSHOT: return (gettext("\tsnapshot [-r] [-o property=value] ... " - "\n")); + " ...\n")); case HELP_UNMOUNT: return (gettext("\tunmount [-f] " "<-a | filesystem|mountpoint>\n")); @@ -903,11 +905,12 @@ typedef struct destroy_cbdata { boolean_t cb_parsable; boolean_t cb_dryrun; nvlist_t *cb_nvl; + nvlist_t *cb_batchedsnaps; /* first snap in contiguous run */ - zfs_handle_t *cb_firstsnap; + char *cb_firstsnap; /* previous snap in contiguous run */ - zfs_handle_t *cb_prevsnap; + char *cb_prevsnap; int64_t cb_snapused; char *cb_snapspec; } destroy_cbdata_t; @@ -999,9 +1002,27 @@ destroy_callback(zfs_handle_t *zhp, void zfs_close(zhp); return (0); } + if (cb->cb_dryrun) { + zfs_close(zhp); + return (0); + } + + /* + * We batch up all contiguous snapshots (even of different + * filesystems) and destroy them with one ioctl. We can't + * simply do all snap deletions and then all fs deletions, + * because we must delete a clone before its origin. + */ + if (zfs_get_type(zhp) == ZFS_TYPE_SNAPSHOT) { + fnvlist_add_boolean(cb->cb_batchedsnaps, name); + } else { + int error = zfs_destroy_snaps_nvl(g_zfs, + cb->cb_batchedsnaps, B_FALSE); + fnvlist_free(cb->cb_batchedsnaps); + cb->cb_batchedsnaps = fnvlist_alloc(); - if (!cb->cb_dryrun) { - if (zfs_unmount(zhp, NULL, cb->cb_force ? MS_FORCE : 0) != 0 || + if (error != 0 || + zfs_unmount(zhp, NULL, cb->cb_force ? MS_FORCE : 0) != 0 || zfs_destroy(zhp, cb->cb_defer_destroy) != 0) { zfs_close(zhp); return (-1); @@ -1021,11 +1042,13 @@ destroy_print_cb(zfs_handle_t *zhp, void if (nvlist_exists(cb->cb_nvl, name)) { if (cb->cb_firstsnap == NULL) - cb->cb_firstsnap = zfs_handle_dup(zhp); + cb->cb_firstsnap = strdup(name); if (cb->cb_prevsnap != NULL) - zfs_close(cb->cb_prevsnap); + free(cb->cb_prevsnap); /* this snap continues the current range */ - cb->cb_prevsnap = zfs_handle_dup(zhp); + cb->cb_prevsnap = strdup(name); + if (cb->cb_firstsnap == NULL || cb->cb_prevsnap == NULL) + nomem(); if (cb->cb_verbose) { if (cb->cb_parsable) { (void) printf("destroy\t%s\n", name); @@ -1040,12 +1063,12 @@ destroy_print_cb(zfs_handle_t *zhp, void } else if (cb->cb_firstsnap != NULL) { /* end of this range */ uint64_t used = 0; - err = zfs_get_snapused_int(cb->cb_firstsnap, + err = lzc_snaprange_space(cb->cb_firstsnap, cb->cb_prevsnap, &used); cb->cb_snapused += used; - zfs_close(cb->cb_firstsnap); + free(cb->cb_firstsnap); cb->cb_firstsnap = NULL; - zfs_close(cb->cb_prevsnap); + free(cb->cb_prevsnap); cb->cb_prevsnap = NULL; } zfs_close(zhp); @@ -1062,13 +1085,13 @@ destroy_print_snapshots(zfs_handle_t *fs if (cb->cb_firstsnap != NULL) { uint64_t used = 0; if (err == 0) { - err = zfs_get_snapused_int(cb->cb_firstsnap, + err = lzc_snaprange_space(cb->cb_firstsnap, cb->cb_prevsnap, &used); } cb->cb_snapused += used; - zfs_close(cb->cb_firstsnap); + free(cb->cb_firstsnap); cb->cb_firstsnap = NULL; - zfs_close(cb->cb_prevsnap); + free(cb->cb_prevsnap); cb->cb_prevsnap = NULL; } return (err); @@ -1155,8 +1178,10 @@ static int zfs_do_destroy(int argc, char **argv) { destroy_cbdata_t cb = { 0 }; + int rv = 0; + int err = 0; int c; - zfs_handle_t *zhp; + zfs_handle_t *zhp = NULL; char *at; zfs_type_t type = ZFS_TYPE_DATASET; @@ -1210,11 +1235,9 @@ zfs_do_destroy(int argc, char **argv) at = strchr(argv[0], '@'); if (at != NULL) { - int err = 0; /* Build the list of snaps to destroy in cb_nvl. */ - if (nvlist_alloc(&cb.cb_nvl, NV_UNIQUE_NAME, 0) != 0) - nomem(); + cb.cb_nvl = fnvlist_alloc(); *at = '\0'; zhp = zfs_open(g_zfs, argv[0], @@ -1225,17 +1248,15 @@ zfs_do_destroy(int argc, char **argv) cb.cb_snapspec = at + 1; if (gather_snapshots(zfs_handle_dup(zhp), &cb) != 0 || cb.cb_error) { - zfs_close(zhp); - nvlist_free(cb.cb_nvl); - return (1); + rv = 1; + goto out; } if (nvlist_empty(cb.cb_nvl)) { (void) fprintf(stderr, gettext("could not find any " "snapshots to destroy; check snapshot names.\n")); - zfs_close(zhp); - nvlist_free(cb.cb_nvl); - return (1); + rv = 1; + goto out; } if (cb.cb_verbose) { @@ -1254,18 +1275,26 @@ zfs_do_destroy(int argc, char **argv) } if (!cb.cb_dryrun) { - if (cb.cb_doclones) + if (cb.cb_doclones) { + cb.cb_batchedsnaps = fnvlist_alloc(); err = destroy_clones(&cb); + if (err == 0) { + err = zfs_destroy_snaps_nvl(g_zfs, + cb.cb_batchedsnaps, B_FALSE); + } + if (err != 0) { + rv = 1; + goto out; + } + } if (err == 0) { - err = zfs_destroy_snaps_nvl(zhp, cb.cb_nvl, + err = zfs_destroy_snaps_nvl(g_zfs, cb.cb_nvl, cb.cb_defer_destroy); } } - zfs_close(zhp); - nvlist_free(cb.cb_nvl); if (err != 0) - return (1); + rv = 1; } else { /* Open the given dataset */ if ((zhp = zfs_open(g_zfs, argv[0], type)) == NULL) @@ -1286,8 +1315,8 @@ zfs_do_destroy(int argc, char **argv) zfs_get_name(zhp)); (void) fprintf(stderr, gettext("use 'zpool destroy %s' " "to destroy the pool itself\n"), zfs_get_name(zhp)); - zfs_close(zhp); - return (1); + rv = 1; + goto out; } /* @@ -1297,30 +1326,42 @@ zfs_do_destroy(int argc, char **argv) if (!cb.cb_doclones && zfs_iter_dependents(zhp, B_TRUE, destroy_check_dependent, &cb) != 0) { - zfs_close(zhp); - return (1); + rv = 1; + goto out; } if (cb.cb_error) { - zfs_close(zhp); - return (1); + rv = 1; + goto out; } + cb.cb_batchedsnaps = fnvlist_alloc(); if (zfs_iter_dependents(zhp, B_FALSE, destroy_callback, &cb) != 0) { - zfs_close(zhp); - return (1); + rv = 1; + goto out; } /* * Do the real thing. The callback will close the * handle regardless of whether it succeeds or not. */ - if (destroy_callback(zhp, &cb) != 0) - return (1); + err = destroy_callback(zhp, &cb); + zhp = NULL; + if (err == 0) { + err = zfs_destroy_snaps_nvl(g_zfs, + cb.cb_batchedsnaps, cb.cb_defer_destroy); + } + if (err != 0) + rv = 1; } - return (0); +out: + fnvlist_free(cb.cb_batchedsnaps); + fnvlist_free(cb.cb_nvl); + if (zhp != NULL) + zfs_close(zhp); + return (rv); } static boolean_t @@ -1921,9 +1962,11 @@ upgrade_set_callback(zfs_handle_t *zhp, /* * If they did "zfs upgrade -a", then we could * be doing ioctls to different pools. We need - * to log this history once to each pool. + * to log this history once to each pool, and bypass + * the normal history logging that happens in main(). */ - verify(zpool_stage_history(g_zfs, history_str) == 0); + (void) zpool_log_history(g_zfs, history_str); + log_history = B_FALSE; } if (zfs_prop_set(zhp, "version", verstr) == 0) cb->cb_numupgraded++; @@ -3461,6 +3504,32 @@ zfs_do_set(int argc, char **argv) return (ret); } +typedef struct snap_cbdata { + nvlist_t *sd_nvl; + boolean_t sd_recursive; + const char *sd_snapname; +} snap_cbdata_t; + +static int +zfs_snapshot_cb(zfs_handle_t *zhp, void *arg) +{ + snap_cbdata_t *sd = arg; + char *name; + int rv = 0; + int error; + + error = asprintf(&name, "%s@%s", zfs_get_name(zhp), sd->sd_snapname); + if (error == -1) + nomem(); + fnvlist_add_boolean(sd->sd_nvl, name); + free(name); + + if (sd->sd_recursive) + rv = zfs_iter_filesystems(zhp, zfs_snapshot_cb, sd); + zfs_close(zhp); + return (rv); +} + /* * zfs snapshot [-r] [-o prop=value] ... * @@ -3470,13 +3539,16 @@ zfs_do_set(int argc, char **argv) static int zfs_do_snapshot(int argc, char **argv) { - boolean_t recursive = B_FALSE; int ret = 0; char c; nvlist_t *props; + snap_cbdata_t sd = { 0 }; + boolean_t multiple_snaps = B_FALSE; if (nvlist_alloc(&props, NV_UNIQUE_NAME, 0) != 0) nomem(); + if (nvlist_alloc(&sd.sd_nvl, NV_UNIQUE_NAME, 0) != 0) + nomem(); /* check options */ while ((c = getopt(argc, argv, "ro:")) != -1) { @@ -3486,7 +3558,8 @@ zfs_do_snapshot(int argc, char **argv) return (1); break; case 'r': - recursive = B_TRUE; + sd.sd_recursive = B_TRUE; + multiple_snaps = B_TRUE; break; case '?': (void) fprintf(stderr, gettext("invalid option '%c'\n"), @@ -3503,18 +3576,35 @@ zfs_do_snapshot(int argc, char **argv) (void) fprintf(stderr, gettext("missing snapshot argument\n")); goto usage; } - if (argc > 1) { - (void) fprintf(stderr, gettext("too many arguments\n")); - goto usage; + + if (argc > 1) + multiple_snaps = B_TRUE; + for (; argc > 0; argc--, argv++) { + char *atp; + zfs_handle_t *zhp; + + atp = strchr(argv[0], '@'); + if (atp == NULL) + goto usage; + *atp = '\0'; + sd.sd_snapname = atp + 1; + zhp = zfs_open(g_zfs, argv[0], + ZFS_TYPE_FILESYSTEM | ZFS_TYPE_VOLUME); + if (zhp == NULL) + goto usage; + if (zfs_snapshot_cb(zhp, &sd) != 0) + goto usage; } - ret = zfs_snapshot(g_zfs, argv[0], recursive, props); + ret = zfs_snapshot_nvl(g_zfs, sd.sd_nvl, props); + nvlist_free(sd.sd_nvl); nvlist_free(props); - if (ret && recursive) + if (ret != 0 && multiple_snaps) (void) fprintf(stderr, gettext("no snapshots were created\n")); return (ret != 0); usage: + nvlist_free(sd.sd_nvl); nvlist_free(props); usage(B_FALSE); return (-1); @@ -5057,28 +5147,12 @@ cleanup2: return (error); } -/* - * zfs allow [-r] [-t] ... - * - * -r Recursively hold - * -t Temporary hold (hidden option) - * - * Apply a user-hold with the given tag to the list of snapshots. - */ static int zfs_do_allow(int argc, char **argv) { return (zfs_do_allow_unallow_impl(argc, argv, B_FALSE)); } -/* - * zfs unallow [-r] [-t] ... - * - * -r Recursively hold - * -t Temporary hold (hidden option) - * - * Apply a user-hold with the given tag to the list of snapshots. - */ static int zfs_do_unallow(int argc, char **argv) { @@ -5092,7 +5166,6 @@ zfs_do_hold_rele_impl(int argc, char **a int i; const char *tag; boolean_t recursive = B_FALSE; - boolean_t temphold = B_FALSE; const char *opts = holding ? "rt" : "r"; int c; @@ -5102,9 +5175,6 @@ zfs_do_hold_rele_impl(int argc, char **a case 'r': recursive = B_TRUE; break; - case 't': - temphold = B_TRUE; - break; case '?': (void) fprintf(stderr, gettext("invalid option '%c'\n"), optopt); @@ -5153,7 +5223,7 @@ zfs_do_hold_rele_impl(int argc, char **a } if (holding) { if (zfs_hold(zhp, delim+1, tag, recursive, - temphold, B_FALSE, -1, 0, 0) != 0) + B_FALSE, -1) != 0) ++errors; } else { if (zfs_release(zhp, delim+1, tag, recursive) != 0) @@ -5169,7 +5239,6 @@ zfs_do_hold_rele_impl(int argc, char **a * zfs hold [-r] [-t] ... * * -r Recursively hold - * -t Temporary hold (hidden option) * * Apply a user-hold with the given tag to the list of snapshots. */ @@ -6591,8 +6660,7 @@ main(int argc, char **argv) return (1); } - zpool_set_history_str("zfs", argc, argv, history_str); - verify(zpool_stage_history(g_zfs, history_str) == 0); + zfs_save_arguments(argc, argv, history_str, sizeof (history_str)); libzfs_print_on_error(g_zfs, B_TRUE); @@ -6661,6 +6729,9 @@ main(int argc, char **argv) (void) fclose(mnttab_file); + if (ret == 0 && log_history) + (void) zpool_log_history(g_zfs, history_str); + libzfs_fini(g_zfs); /* Modified: stable/8/cddl/contrib/opensolaris/cmd/zhack/zhack.c ============================================================================== --- stable/8/cddl/contrib/opensolaris/cmd/zhack/zhack.c Fri Jun 14 18:56:37 2013 (r251756) +++ stable/8/cddl/contrib/opensolaris/cmd/zhack/zhack.c Fri Jun 14 19:26:32 2013 (r251757) @@ -46,6 +46,7 @@ #include #include #include +#include #undef ZFS_MAXNAMELEN #undef verify #include @@ -273,12 +274,15 @@ zhack_do_feature_stat(int argc, char **a } static void -feature_enable_sync(void *arg1, void *arg2, dmu_tx_t *tx) +feature_enable_sync(void *arg, dmu_tx_t *tx) { - spa_t *spa = arg1; - zfeature_info_t *feature = arg2; + spa_t *spa = dmu_tx_pool(tx)->dp_spa; + zfeature_info_t *feature = arg; spa_feature_enable(spa, feature, tx); + spa_history_log_internal(spa, "zhack enable feature", tx, + "name=%s can_readonly=%u", + feature->fi_guid, feature->fi_can_readonly); } static void @@ -341,8 +345,8 @@ zhack_do_feature_enable(int argc, char * if (0 == zap_contains(mos, spa->spa_feat_desc_obj, feature.fi_guid)) fatal("feature already enabled: %s", feature.fi_guid); - VERIFY3U(0, ==, dsl_sync_task_do(spa->spa_dsl_pool, NULL, - feature_enable_sync, spa, &feature, 5)); + VERIFY0(dsl_sync_task(spa_name(spa), NULL, + feature_enable_sync, &feature, 5)); spa_close(spa, FTAG); @@ -350,21 +354,25 @@ zhack_do_feature_enable(int argc, char * } static void -feature_incr_sync(void *arg1, void *arg2, dmu_tx_t *tx) +feature_incr_sync(void *arg, dmu_tx_t *tx) { - spa_t *spa = arg1; - zfeature_info_t *feature = arg2; + spa_t *spa = dmu_tx_pool(tx)->dp_spa; + zfeature_info_t *feature = arg; spa_feature_incr(spa, feature, tx); + spa_history_log_internal(spa, "zhack feature incr", tx, + "name=%s", feature->fi_guid); *** DIFF OUTPUT TRUNCATED AT 1000 LINES *** From owner-svn-src-stable@FreeBSD.ORG Fri Jun 14 20:32:33 2013 Return-Path: Delivered-To: svn-src-stable@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by hub.freebsd.org (Postfix) with ESMTP id A22C1357; Fri, 14 Jun 2013 20:32:33 +0000 (UTC) (envelope-from jhb@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) by mx1.freebsd.org (Postfix) with ESMTP id 93835179A; Fri, 14 Jun 2013 20:32:33 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.7/8.14.7) with ESMTP id r5EKWXus065054; Fri, 14 Jun 2013 20:32:33 GMT (envelope-from jhb@svn.freebsd.org) Received: (from jhb@localhost) by svn.freebsd.org (8.14.7/8.14.5/Submit) id r5EKWXFi065053; Fri, 14 Jun 2013 20:32:33 GMT (envelope-from jhb@svn.freebsd.org) Message-Id: <201306142032.r5EKWXFi065053@svn.freebsd.org> From: John Baldwin Date: Fri, 14 Jun 2013 20:32:33 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-9@freebsd.org Subject: svn commit: r251759 - stable/9/sys/dev/acpi_support X-SVN-Group: stable-9 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 14 Jun 2013 20:32:33 -0000 Author: jhb Date: Fri Jun 14 20:32:33 2013 New Revision: 251759 URL: http://svnweb.freebsd.org/changeset/base/251759 Log: MFC 250053: Only cleanup CMI-related state on detach if the system supports CMI. Modified: stable/9/sys/dev/acpi_support/acpi_hp.c Directory Properties: stable/9/sys/ (props changed) stable/9/sys/dev/ (props changed) Modified: stable/9/sys/dev/acpi_support/acpi_hp.c ============================================================================== --- stable/9/sys/dev/acpi_support/acpi_hp.c Fri Jun 14 19:35:30 2013 (r251758) +++ stable/9/sys/dev/acpi_support/acpi_hp.c Fri Jun 14 20:32:33 2013 (r251759) @@ -573,28 +573,26 @@ acpi_hp_attach(device_t dev) static int acpi_hp_detach(device_t dev) { - int ret; + struct acpi_hp_softc *sc; ACPI_FUNCTION_TRACE((char *)(uintptr_t) __func__); - struct acpi_hp_softc *sc = device_get_softc(dev); - if (sc->has_cmi && sc->hpcmi_open_pid != 0) { - ret = EBUSY; - } - else { - if (sc->has_notify) { - ACPI_WMI_REMOVE_EVENT_HANDLER(dev, - ACPI_HP_WMI_EVENT_GUID); - } + sc = device_get_softc(dev); + if (sc->has_cmi && sc->hpcmi_open_pid != 0) + return (EBUSY); + + if (sc->has_notify) + ACPI_WMI_REMOVE_EVENT_HANDLER(dev, ACPI_HP_WMI_EVENT_GUID); + + if (sc->has_cmi) { if (sc->hpcmi_bufptr != -1) { sbuf_delete(&sc->hpcmi_sbuf); sc->hpcmi_bufptr = -1; } sc->hpcmi_open_pid = 0; destroy_dev(sc->hpcmi_dev_t); - ret = 0; } - return (ret); + return (0); } static int From owner-svn-src-stable@FreeBSD.ORG Fri Jun 14 20:44:24 2013 Return-Path: Delivered-To: svn-src-stable@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [8.8.178.115]) by hub.freebsd.org (Postfix) with ESMTP id 3BDBE6C6; Fri, 14 Jun 2013 20:44:24 +0000 (UTC) (envelope-from jhb@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) by mx1.freebsd.org (Postfix) with ESMTP id 2D8241820; Fri, 14 Jun 2013 20:44:24 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.7/8.14.7) with ESMTP id r5EKiOO5068472; Fri, 14 Jun 2013 20:44:24 GMT (envelope-from jhb@svn.freebsd.org) Received: (from jhb@localhost) by svn.freebsd.org (8.14.7/8.14.5/Submit) id r5EKiOPD068471; Fri, 14 Jun 2013 20:44:24 GMT (envelope-from jhb@svn.freebsd.org) Message-Id: <201306142044.r5EKiOPD068471@svn.freebsd.org> From: John Baldwin Date: Fri, 14 Jun 2013 20:44:24 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-8@freebsd.org Subject: svn commit: r251760 - stable/8/sys/dev/acpi_support X-SVN-Group: stable-8 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 14 Jun 2013 20:44:24 -0000 Author: jhb Date: Fri Jun 14 20:44:23 2013 New Revision: 251760 URL: http://svnweb.freebsd.org/changeset/base/251760 Log: MFC 250053: Only cleanup CMI-related state on detach if the system supports CMI. Modified: stable/8/sys/dev/acpi_support/acpi_hp.c Directory Properties: stable/8/sys/ (props changed) stable/8/sys/dev/ (props changed) stable/8/sys/dev/acpi_support/ (props changed) Modified: stable/8/sys/dev/acpi_support/acpi_hp.c ============================================================================== --- stable/8/sys/dev/acpi_support/acpi_hp.c Fri Jun 14 20:32:33 2013 (r251759) +++ stable/8/sys/dev/acpi_support/acpi_hp.c Fri Jun 14 20:44:23 2013 (r251760) @@ -573,28 +573,26 @@ acpi_hp_attach(device_t dev) static int acpi_hp_detach(device_t dev) { - int ret; + struct acpi_hp_softc *sc; ACPI_FUNCTION_TRACE((char *)(uintptr_t) __func__); - struct acpi_hp_softc *sc = device_get_softc(dev); - if (sc->has_cmi && sc->hpcmi_open_pid != 0) { - ret = EBUSY; - } - else { - if (sc->has_notify) { - ACPI_WMI_REMOVE_EVENT_HANDLER(dev, - ACPI_HP_WMI_EVENT_GUID); - } + sc = device_get_softc(dev); + if (sc->has_cmi && sc->hpcmi_open_pid != 0) + return (EBUSY); + + if (sc->has_notify) + ACPI_WMI_REMOVE_EVENT_HANDLER(dev, ACPI_HP_WMI_EVENT_GUID); + + if (sc->has_cmi) { if (sc->hpcmi_bufptr != -1) { sbuf_delete(&sc->hpcmi_sbuf); sc->hpcmi_bufptr = -1; } sc->hpcmi_open_pid = 0; destroy_dev(sc->hpcmi_dev_t); - ret = 0; } - return (ret); + return (0); } static int From owner-svn-src-stable@FreeBSD.ORG Fri Jun 14 21:56:10 2013 Return-Path: Delivered-To: svn-src-stable@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by hub.freebsd.org (Postfix) with ESMTP id 9723B898; Fri, 14 Jun 2013 21:56:10 +0000 (UTC) (envelope-from jhb@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) by mx1.freebsd.org (Postfix) with ESMTP id 894211AB1; Fri, 14 Jun 2013 21:56:10 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.7/8.14.7) with ESMTP id r5ELuAme090774; Fri, 14 Jun 2013 21:56:10 GMT (envelope-from jhb@svn.freebsd.org) Received: (from jhb@localhost) by svn.freebsd.org (8.14.7/8.14.5/Submit) id r5ELuAbm090773; Fri, 14 Jun 2013 21:56:10 GMT (envelope-from jhb@svn.freebsd.org) Message-Id: <201306142156.r5ELuAbm090773@svn.freebsd.org> From: John Baldwin Date: Fri, 14 Jun 2013 21:56:10 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-9@freebsd.org Subject: svn commit: r251762 - stable/9/sys/kern X-SVN-Group: stable-9 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 14 Jun 2013 21:56:10 -0000 Author: jhb Date: Fri Jun 14 21:56:10 2013 New Revision: 251762 URL: http://svnweb.freebsd.org/changeset/base/251762 Log: MFC 250220: Fix FIONREAD on regular files. The computed result was being ignored and it was being passed down to VOP_IOCTL() where it promptly resulted in ENOTTY due to a missing else for the past 8 years. While here, use a shared vnode lock while fetching the current file's size. Modified: stable/9/sys/kern/vfs_vnops.c Directory Properties: stable/9/sys/ (props changed) Modified: stable/9/sys/kern/vfs_vnops.c ============================================================================== --- stable/9/sys/kern/vfs_vnops.c Fri Jun 14 21:14:36 2013 (r251761) +++ stable/9/sys/kern/vfs_vnops.c Fri Jun 14 21:56:10 2013 (r251762) @@ -1333,13 +1333,12 @@ vn_ioctl(fp, com, data, active_cred, td) case VREG: case VDIR: if (com == FIONREAD) { - vn_lock(vp, LK_EXCLUSIVE | LK_RETRY); + vn_lock(vp, LK_SHARED | LK_RETRY); error = VOP_GETATTR(vp, &vattr, active_cred); VOP_UNLOCK(vp, 0); if (!error) *(int *)data = vattr.va_size - fp->f_offset; - } - if (com == FIONBIO || com == FIOASYNC) /* XXX */ + } else if (com == FIONBIO || com == FIOASYNC) /* XXX */ error = 0; else error = VOP_IOCTL(vp, com, data, fp->f_flag, From owner-svn-src-stable@FreeBSD.ORG Fri Jun 14 22:06:45 2013 Return-Path: Delivered-To: svn-src-stable@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by hub.freebsd.org (Postfix) with ESMTP id CDFF4D2D; Fri, 14 Jun 2013 22:06:45 +0000 (UTC) (envelope-from jhb@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) by mx1.freebsd.org (Postfix) with ESMTP id C04C31B11; Fri, 14 Jun 2013 22:06:45 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.7/8.14.7) with ESMTP id r5EM6j0T094235; Fri, 14 Jun 2013 22:06:45 GMT (envelope-from jhb@svn.freebsd.org) Received: (from jhb@localhost) by svn.freebsd.org (8.14.7/8.14.5/Submit) id r5EM6jYc094234; Fri, 14 Jun 2013 22:06:45 GMT (envelope-from jhb@svn.freebsd.org) Message-Id: <201306142206.r5EM6jYc094234@svn.freebsd.org> From: John Baldwin Date: Fri, 14 Jun 2013 22:06:45 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-8@freebsd.org Subject: svn commit: r251764 - stable/8/sys/kern X-SVN-Group: stable-8 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 14 Jun 2013 22:06:45 -0000 Author: jhb Date: Fri Jun 14 22:06:45 2013 New Revision: 251764 URL: http://svnweb.freebsd.org/changeset/base/251764 Log: MFC 250220: Fix FIONREAD on regular files. The computed result was being ignored and it was being passed down to VOP_IOCTL() where it promptly resulted in ENOTTY due to a missing else for the past 8 years. While here, use a shared vnode lock while fetching the current file's size. Modified: stable/8/sys/kern/vfs_vnops.c Directory Properties: stable/8/sys/ (props changed) stable/8/sys/kern/ (props changed) Modified: stable/8/sys/kern/vfs_vnops.c ============================================================================== --- stable/8/sys/kern/vfs_vnops.c Fri Jun 14 22:06:18 2013 (r251763) +++ stable/8/sys/kern/vfs_vnops.c Fri Jun 14 22:06:45 2013 (r251764) @@ -952,13 +952,12 @@ vn_ioctl(fp, com, data, active_cred, td) case VREG: case VDIR: if (com == FIONREAD) { - vn_lock(vp, LK_EXCLUSIVE | LK_RETRY); + vn_lock(vp, LK_SHARED | LK_RETRY); error = VOP_GETATTR(vp, &vattr, active_cred); VOP_UNLOCK(vp, 0); if (!error) *(int *)data = vattr.va_size - fp->f_offset; - } - if (com == FIONBIO || com == FIOASYNC) /* XXX */ + } else if (com == FIONBIO || com == FIOASYNC) /* XXX */ error = 0; else error = VOP_IOCTL(vp, com, data, fp->f_flag, From owner-svn-src-stable@FreeBSD.ORG Sat Jun 15 01:35:52 2013 Return-Path: Delivered-To: svn-src-stable@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [8.8.178.115]) by hub.freebsd.org (Postfix) with ESMTP id D382FE6C; Sat, 15 Jun 2013 01:35:52 +0000 (UTC) (envelope-from rmacklem@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) by mx1.freebsd.org (Postfix) with ESMTP id C42521142; Sat, 15 Jun 2013 01:35:52 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.7/8.14.7) with ESMTP id r5F1Zqa9060661; Sat, 15 Jun 2013 01:35:52 GMT (envelope-from rmacklem@svn.freebsd.org) Received: (from rmacklem@localhost) by svn.freebsd.org (8.14.7/8.14.5/Submit) id r5F1Zqpw060659; Sat, 15 Jun 2013 01:35:52 GMT (envelope-from rmacklem@svn.freebsd.org) Message-Id: <201306150135.r5F1Zqpw060659@svn.freebsd.org> From: Rick Macklem Date: Sat, 15 Jun 2013 01:35:52 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-8@freebsd.org Subject: svn commit: r251768 - in stable/8/sys: fs/nfsclient nfsclient X-SVN-Group: stable-8 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 15 Jun 2013 01:35:52 -0000 Author: rmacklem Date: Sat Jun 15 01:35:52 2013 New Revision: 251768 URL: http://svnweb.freebsd.org/changeset/base/251768 Log: MFC: r249623 Both NFS clients can deadlock when using the "rdirplus" mount option. This can occur when an nfsiod thread that already holds a buffer lock attempts to acquire a vnode lock on an entry in the directory (a LOR) when another thread holding the vnode lock is waiting on an nfsiod thread. This patch avoids the deadlock by disabling readahead for this case, so the nfsiod threads never do readdirplus. Since readaheads for directories need the directory offset cookie from the previous read, they cannot normally happen in parallel. As such, testing by jhb@ and myself didn't find any performance degredation when this patch is applied. If there is a case where this results in a significant performance degradation, mounting without the "rdirplus" option can be done to re-enable readahead for directories. Modified: stable/8/sys/fs/nfsclient/nfs_clbio.c stable/8/sys/nfsclient/nfs_bio.c Directory Properties: stable/8/sys/ (props changed) stable/8/sys/fs/ (props changed) stable/8/sys/nfsclient/ (props changed) Modified: stable/8/sys/fs/nfsclient/nfs_clbio.c ============================================================================== --- stable/8/sys/fs/nfsclient/nfs_clbio.c Fri Jun 14 23:43:44 2013 (r251767) +++ stable/8/sys/fs/nfsclient/nfs_clbio.c Sat Jun 15 01:35:52 2013 (r251768) @@ -1368,10 +1368,18 @@ ncl_asyncio(struct nfsmount *nmp, struct * Commits are usually short and sweet so lets save some cpu and * leave the async daemons for more important rpc's (such as reads * and writes). + * + * Readdirplus RPCs do vget()s to acquire the vnodes for entries + * in the directory in order to update attributes. This can deadlock + * with another thread that is waiting for async I/O to be done by + * an nfsiod thread while holding a lock on one of these vnodes. + * To avoid this deadlock, don't allow the async nfsiod threads to + * perform Readdirplus RPCs. */ mtx_lock(&ncl_iod_mutex); - if (bp->b_iocmd == BIO_WRITE && (bp->b_flags & B_NEEDCOMMIT) && - (nmp->nm_bufqiods > ncl_numasync / 2)) { + if ((bp->b_iocmd == BIO_WRITE && (bp->b_flags & B_NEEDCOMMIT) && + (nmp->nm_bufqiods > ncl_numasync / 2)) || + (bp->b_vp->v_type == VDIR && (nmp->nm_flag & NFSMNT_RDIRPLUS))) { mtx_unlock(&ncl_iod_mutex); return(EIO); } Modified: stable/8/sys/nfsclient/nfs_bio.c ============================================================================== --- stable/8/sys/nfsclient/nfs_bio.c Fri Jun 14 23:43:44 2013 (r251767) +++ stable/8/sys/nfsclient/nfs_bio.c Sat Jun 15 01:35:52 2013 (r251768) @@ -1360,10 +1360,18 @@ nfs_asyncio(struct nfsmount *nmp, struct * Commits are usually short and sweet so lets save some cpu and * leave the async daemons for more important rpc's (such as reads * and writes). + * + * Readdirplus RPCs do vget()s to acquire the vnodes for entries + * in the directory in order to update attributes. This can deadlock + * with another thread that is waiting for async I/O to be done by + * an nfsiod thread while holding a lock on one of these vnodes. + * To avoid this deadlock, don't allow the async nfsiod threads to + * perform Readdirplus RPCs. */ mtx_lock(&nfs_iod_mtx); - if (bp->b_iocmd == BIO_WRITE && (bp->b_flags & B_NEEDCOMMIT) && - (nmp->nm_bufqiods > nfs_numasync / 2)) { + if ((bp->b_iocmd == BIO_WRITE && (bp->b_flags & B_NEEDCOMMIT) && + (nmp->nm_bufqiods > nfs_numasync / 2)) || + (bp->b_vp->v_type == VDIR && (nmp->nm_flag & NFSMNT_RDIRPLUS))) { mtx_unlock(&nfs_iod_mtx); return(EIO); } From owner-svn-src-stable@FreeBSD.ORG Sat Jun 15 08:06:23 2013 Return-Path: Delivered-To: svn-src-stable@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [8.8.178.115]) by hub.freebsd.org (Postfix) with ESMTP id 15AED9EB; Sat, 15 Jun 2013 08:06:23 +0000 (UTC) (envelope-from trociny@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) by mx1.freebsd.org (Postfix) with ESMTP id 076741D78; Sat, 15 Jun 2013 08:06:23 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.7/8.14.7) with ESMTP id r5F86MCo083428; Sat, 15 Jun 2013 08:06:22 GMT (envelope-from trociny@svn.freebsd.org) Received: (from trociny@localhost) by svn.freebsd.org (8.14.7/8.14.5/Submit) id r5F86MGJ083427; Sat, 15 Jun 2013 08:06:22 GMT (envelope-from trociny@svn.freebsd.org) Message-Id: <201306150806.r5F86MGJ083427@svn.freebsd.org> From: Mikolaj Golub Date: Sat, 15 Jun 2013 08:06:22 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-9@freebsd.org Subject: svn commit: r251779 - stable/9/sys/net X-SVN-Group: stable-9 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 15 Jun 2013 08:06:23 -0000 Author: trociny Date: Sat Jun 15 08:06:22 2013 New Revision: 251779 URL: http://svnweb.freebsd.org/changeset/base/251779 Log: MFC r251490: Properly set curvnet context in lagg_port_setlladdr() task handler. Reported by: Nikos Vassiliadis Submitted by: zec Tested by: Nikos Vassiliadis Modified: stable/9/sys/net/if_lagg.c Directory Properties: stable/9/sys/ (props changed) stable/9/sys/net/ (props changed) Modified: stable/9/sys/net/if_lagg.c ============================================================================== --- stable/9/sys/net/if_lagg.c Sat Jun 15 06:45:17 2013 (r251778) +++ stable/9/sys/net/if_lagg.c Sat Jun 15 08:06:22 2013 (r251779) @@ -494,7 +494,9 @@ lagg_port_setlladdr(void *arg, int pendi ifp = llq->llq_ifp; /* Set the link layer address */ + CURVNET_SET(ifp->if_vnet); error = if_setlladdr(ifp, llq->llq_lladdr, ETHER_ADDR_LEN); + CURVNET_RESTORE(); if (error) printf("%s: setlladdr failed on %s\n", __func__, ifp->if_xname); From owner-svn-src-stable@FreeBSD.ORG Sat Jun 15 08:07:48 2013 Return-Path: Delivered-To: svn-src-stable@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [8.8.178.115]) by hub.freebsd.org (Postfix) with ESMTP id 56F2FB6D; Sat, 15 Jun 2013 08:07:48 +0000 (UTC) (envelope-from trociny@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) by mx1.freebsd.org (Postfix) with ESMTP id 48DAD1D83; Sat, 15 Jun 2013 08:07:48 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.7/8.14.7) with ESMTP id r5F87mhL083730; Sat, 15 Jun 2013 08:07:48 GMT (envelope-from trociny@svn.freebsd.org) Received: (from trociny@localhost) by svn.freebsd.org (8.14.7/8.14.5/Submit) id r5F87mwk083729; Sat, 15 Jun 2013 08:07:48 GMT (envelope-from trociny@svn.freebsd.org) Message-Id: <201306150807.r5F87mwk083729@svn.freebsd.org> From: Mikolaj Golub Date: Sat, 15 Jun 2013 08:07:48 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-8@freebsd.org Subject: svn commit: r251780 - stable/8/sys/net X-SVN-Group: stable-8 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 15 Jun 2013 08:07:48 -0000 Author: trociny Date: Sat Jun 15 08:07:47 2013 New Revision: 251780 URL: http://svnweb.freebsd.org/changeset/base/251780 Log: MFC r251490: Properly set curvnet context in lagg_port_setlladdr() task handler. Reported by: Nikos Vassiliadis Submitted by: zec Tested by: Nikos Vassiliadis Modified: stable/8/sys/net/if_lagg.c Directory Properties: stable/8/sys/ (props changed) stable/8/sys/net/ (props changed) Modified: stable/8/sys/net/if_lagg.c ============================================================================== --- stable/8/sys/net/if_lagg.c Sat Jun 15 08:06:22 2013 (r251779) +++ stable/8/sys/net/if_lagg.c Sat Jun 15 08:07:47 2013 (r251780) @@ -487,7 +487,9 @@ lagg_port_setlladdr(void *arg, int pendi ifp = llq->llq_ifp; /* Set the link layer address */ + CURVNET_SET(ifp->if_vnet); error = if_setlladdr(ifp, llq->llq_lladdr, ETHER_ADDR_LEN); + CURVNET_RESTORE(); if (error) printf("%s: setlladdr failed on %s\n", __func__, ifp->if_xname);