From owner-svn-src-head@FreeBSD.ORG Sun Jan 12 11:44:28 2014 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) (using TLSv1 with cipher ADH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id C4826BF9; Sun, 12 Jan 2014 11:44:28 +0000 (UTC) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mx1.freebsd.org (Postfix) with ESMTPS id A363B1A5D; Sun, 12 Jan 2014 11:44:28 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.7/8.14.7) with ESMTP id s0CBiSt0087283; Sun, 12 Jan 2014 11:44:28 GMT (envelope-from hselasky@svn.freebsd.org) Received: (from hselasky@localhost) by svn.freebsd.org (8.14.7/8.14.7/Submit) id s0CBiS8B087282; Sun, 12 Jan 2014 11:44:28 GMT (envelope-from hselasky@svn.freebsd.org) Message-Id: <201401121144.s0CBiS8B087282@svn.freebsd.org> From: Hans Petter Selasky Date: Sun, 12 Jan 2014 11:44:28 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r260559 - head/sys/dev/usb/serial X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.17 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 12 Jan 2014 11:44:28 -0000 Author: hselasky Date: Sun Jan 12 11:44:28 2014 New Revision: 260559 URL: http://svnweb.freebsd.org/changeset/base/260559 Log: Don't do synchronous USB requests inside USB transfer callbacks. It is technically OK, but not recommended. MFC after: 1 weeks Modified: head/sys/dev/usb/serial/umcs.c Modified: head/sys/dev/usb/serial/umcs.c ============================================================================== --- head/sys/dev/usb/serial/umcs.c Sat Jan 11 23:10:59 2014 (r260558) +++ head/sys/dev/usb/serial/umcs.c Sun Jan 12 11:44:28 2014 (r260559) @@ -121,8 +121,6 @@ struct umcs7840_softc_oneport { uint8_t sc_lcr; /* local line control register */ uint8_t sc_mcr; /* local modem control register */ - uint8_t sc_lsr; /* local line status register */ - uint8_t sc_msr; /* local modem status register */ }; struct umcs7840_softc { @@ -535,12 +533,7 @@ umcs7840_cfg_open(struct ucom_softc *uco if (umcs7840_set_reg_sync(sc, umcs7840_port_registers[pn].reg_control, data)) return; - /* Read LSR & MSR */ - if (umcs7840_get_UART_reg_sync(sc, pn, MCS7840_UART_REG_LSR, &sc->sc_ports[pn].sc_lsr)) - return; - if (umcs7840_get_UART_reg_sync(sc, pn, MCS7840_UART_REG_MSR, &sc->sc_ports[pn].sc_msr)) - return; - DPRINTF("Port %d has been opened, LSR=%02x MSR=%02x\n", pn, sc->sc_ports[pn].sc_lsr, sc->sc_ports[pn].sc_msr); + DPRINTF("Port %d has been opened\n", pn); } static void @@ -748,9 +741,17 @@ static void umcs7840_cfg_get_status(struct ucom_softc *ucom, uint8_t *lsr, uint8_t *msr) { struct umcs7840_softc *sc = ucom->sc_parent; + uint8_t pn = ucom->sc_portno; + uint8_t hw_lsr = 0; /* local line status register */ + uint8_t hw_msr = 0; /* local modem status register */ + + /* Read LSR & MSR */ + umcs7840_get_UART_reg_sync(sc, pn, MCS7840_UART_REG_LSR, &hw_lsr); + umcs7840_get_UART_reg_sync(sc, pn, MCS7840_UART_REG_MSR, &hw_msr); + + *lsr = hw_lsr; + *msr = hw_msr; - *lsr = sc->sc_ports[ucom->sc_portno].sc_lsr; - *msr = sc->sc_ports[ucom->sc_portno].sc_msr; DPRINTF("Port %d status: LSR=%02x MSR=%02x\n", ucom->sc_portno, *lsr, *msr); } @@ -781,21 +782,11 @@ umcs7840_intr_callback(struct usb_xfer * case MCS7840_UART_ISR_RXERR: case MCS7840_UART_ISR_RXHASDATA: case MCS7840_UART_ISR_RXTIMEOUT: - /* Read new LSR */ - if (umcs7840_get_UART_reg_sync(sc, pn, MCS7840_UART_REG_LSR, &sc->sc_ports[pn].sc_lsr)) - break; /* Inner switch */ + case MCS7840_UART_ISR_MSCHANGE: ucom_status_change(&sc->sc_ucom[subunit]); - /* Inner switch */ break; - case MCS7840_UART_ISR_TXEMPTY: + default: /* Do nothing */ - break; /* Inner switch */ - case MCS7840_UART_ISR_MSCHANGE: - /* Read new MSR */ - if (umcs7840_get_UART_reg_sync(sc, pn, MCS7840_UART_REG_MSR, &sc->sc_ports[pn].sc_msr)) - break; /* Inner switch */ - DPRINTF("Port %d: new MSR %02x\n", pn, sc->sc_ports[pn].sc_msr); - ucom_status_change(&sc->sc_ucom[subunit]); break; } } From owner-svn-src-head@FreeBSD.ORG Sun Jan 12 13:16:26 2014 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) (using TLSv1 with cipher ADH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id 86D2E50B; Sun, 12 Jan 2014 13:16:26 +0000 (UTC) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mx1.freebsd.org (Postfix) with ESMTPS id 72F8E10F3; Sun, 12 Jan 2014 13:16:26 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.7/8.14.7) with ESMTP id s0CDGQwD022272; Sun, 12 Jan 2014 13:16:26 GMT (envelope-from hselasky@svn.freebsd.org) Received: (from hselasky@localhost) by svn.freebsd.org (8.14.7/8.14.7/Submit) id s0CDGQSf022271; Sun, 12 Jan 2014 13:16:26 GMT (envelope-from hselasky@svn.freebsd.org) Message-Id: <201401121316.s0CDGQSf022271@svn.freebsd.org> From: Hans Petter Selasky Date: Sun, 12 Jan 2014 13:16:26 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r260563 - head/sys/dev/usb/controller X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.17 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 12 Jan 2014 13:16:26 -0000 Author: hselasky Date: Sun Jan 12 13:16:25 2014 New Revision: 260563 URL: http://svnweb.freebsd.org/changeset/base/260563 Log: Make sure reserved fields of the EHCI DMA descriptors are not dirty after previous transfers. MFC after: 1 week Modified: head/sys/dev/usb/controller/ehci.c Modified: head/sys/dev/usb/controller/ehci.c ============================================================================== --- head/sys/dev/usb/controller/ehci.c Sun Jan 12 12:48:50 2014 (r260562) +++ head/sys/dev/usb/controller/ehci.c Sun Jan 12 13:16:25 2014 (r260563) @@ -1654,12 +1654,17 @@ restart: } td->len = 0; + /* properly reset reserved fields */ td->qtd_buffer[0] = 0; - td->qtd_buffer_hi[0] = 0; - td->qtd_buffer[1] = 0; + td->qtd_buffer[2] = 0; + td->qtd_buffer[3] = 0; + td->qtd_buffer[4] = 0; + td->qtd_buffer_hi[0] = 0; td->qtd_buffer_hi[1] = 0; - + td->qtd_buffer_hi[2] = 0; + td->qtd_buffer_hi[3] = 0; + td->qtd_buffer_hi[4] = 0; } else { uint8_t x; @@ -1714,6 +1719,12 @@ restart: htohc32(temp->sc, buf_res.physaddr & (~0xFFF)); td->qtd_buffer_hi[x] = 0; + + /* properly reset reserved fields */ + while (++x < EHCI_QTD_NBUFFERS) { + td->qtd_buffer[x] = 0; + td->qtd_buffer_hi[x] = 0; + } } if (td_next) { @@ -2001,6 +2012,18 @@ ehci_setup_standard_chain(struct usb_xfe qh->qh_qtd.qtd_altnext = htohc32(temp.sc, EHCI_LINK_TERMINATE); + /* properly reset reserved fields */ + qh->qh_qtd.qtd_buffer[0] = 0; + qh->qh_qtd.qtd_buffer[1] = 0; + qh->qh_qtd.qtd_buffer[2] = 0; + qh->qh_qtd.qtd_buffer[3] = 0; + qh->qh_qtd.qtd_buffer[4] = 0; + qh->qh_qtd.qtd_buffer_hi[0] = 0; + qh->qh_qtd.qtd_buffer_hi[1] = 0; + qh->qh_qtd.qtd_buffer_hi[2] = 0; + qh->qh_qtd.qtd_buffer_hi[3] = 0; + qh->qh_qtd.qtd_buffer_hi[4] = 0; + usb_pc_cpu_flush(qh->page_cache); if (xfer->xroot->udev->flags.self_suspended == 0) { From owner-svn-src-head@FreeBSD.ORG Sun Jan 12 15:35:04 2014 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [8.8.178.115]) (using TLSv1 with cipher ADH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id 7DADD527; Sun, 12 Jan 2014 15:35:04 +0000 (UTC) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mx1.freebsd.org (Postfix) with ESMTPS id 6A3D91A10; Sun, 12 Jan 2014 15:35: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 s0CFZ4RH077054; Sun, 12 Jan 2014 15:35:04 GMT (envelope-from andrew@svn.freebsd.org) Received: (from andrew@localhost) by svn.freebsd.org (8.14.7/8.14.7/Submit) id s0CFZ4Hd077053; Sun, 12 Jan 2014 15:35:04 GMT (envelope-from andrew@svn.freebsd.org) Message-Id: <201401121535.s0CFZ4Hd077053@svn.freebsd.org> From: Andrew Turner Date: Sun, 12 Jan 2014 15:35:04 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r260565 - head/contrib/gcc/config/arm X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.17 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 12 Jan 2014 15:35:04 -0000 Author: andrew Date: Sun Jan 12 15:35:03 2014 New Revision: 260565 URL: http://svnweb.freebsd.org/changeset/base/260565 Log: Fix gcc with EABI on big-endian ARM by setting the endian correctly. Without this gcc would generate byte loads for a little-endian core. MFC after: 1 week Modified: head/contrib/gcc/config/arm/freebsd.h Modified: head/contrib/gcc/config/arm/freebsd.h ============================================================================== --- head/contrib/gcc/config/arm/freebsd.h Sun Jan 12 14:37:39 2014 (r260564) +++ head/contrib/gcc/config/arm/freebsd.h Sun Jan 12 15:35:03 2014 (r260565) @@ -72,6 +72,9 @@ #undef TARGET_DEFAULT_FLOAT_ABI #define TARGET_DEFAULT_FLOAT_ABI ARM_FLOAT_ABI_SOFT +#undef TARGET_DEFAULT +#define TARGET_DEFAULT (MASK_INTERWORK | TARGET_ENDIAN_DEFAULT) + #undef ARM_DEFAULT_ABI #define ARM_DEFAULT_ABI ARM_ABI_AAPCS_LINUX From owner-svn-src-head@FreeBSD.ORG Sun Jan 12 15:45:45 2014 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [8.8.178.115]) (using TLSv1 with cipher ADH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id A97798ED; Sun, 12 Jan 2014 15:45:45 +0000 (UTC) Received: from mail-qc0-x232.google.com (mail-qc0-x232.google.com [IPv6:2607:f8b0:400d:c01::232]) (using TLSv1 with cipher ECDHE-RSA-RC4-SHA (128/128 bits)) (No client certificate requested) by mx1.freebsd.org (Postfix) with ESMTPS id 3316F1AC8; Sun, 12 Jan 2014 15:45:45 +0000 (UTC) Received: by mail-qc0-f178.google.com with SMTP id m20so850951qcx.9 for ; Sun, 12 Jan 2014 07:45:44 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:sender:in-reply-to:references:date:message-id:subject :from:to:cc:content-type; bh=O67OZtW0Hng/4FzNEjgdMdzf9H68xrRDKTmPcl6MFOE=; b=ShXOCwumOqQabCmQgyuyDe1zoTcia4Ek+GEDWRlI7rRbBAMAmSerbvhOkLFSUS3VLJ AYrvs+dnTzrLiIaF0gdgaajMArYcAXb9TL4oU03WVsdw39lEQDdqVJCJlAW5IhGPd+zu T95zd0EW0qfk8wRvdSdV3liv1FJ75gQmvL2AIBuaIc+nq124/U/Vvkdz3nEuzRibzY50 1Dvxr9rkJQYd6bK5dZpEOWytBbO8ssZFl6zPyZSplJ2s9iRq+HAL1JeCnAPj9406Ryb3 tqtW0i6l/uFxYETARY0NVqYp4dlZHzlagfSf2PufEdLojknXIcmmclxEfuFvjf3jbzlu sPsQ== MIME-Version: 1.0 X-Received: by 10.49.24.211 with SMTP id w19mr30857750qef.9.1389541544344; Sun, 12 Jan 2014 07:45:44 -0800 (PST) Sender: adrian.chadd@gmail.com Received: by 10.224.52.8 with HTTP; Sun, 12 Jan 2014 07:45:44 -0800 (PST) In-Reply-To: <201401121535.s0CFZ4Hd077053@svn.freebsd.org> References: <201401121535.s0CFZ4Hd077053@svn.freebsd.org> Date: Sun, 12 Jan 2014 07:45:44 -0800 X-Google-Sender-Auth: 9entjHJoVbzxnzCsk9QCMNYquIA Message-ID: Subject: Re: svn commit: r260565 - head/contrib/gcc/config/arm From: Adrian Chadd To: Andrew Turner Content-Type: text/plain; charset=ISO-8859-1 Cc: "svn-src-head@freebsd.org" , "svn-src-all@freebsd.org" , "src-committers@freebsd.org" X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.17 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 12 Jan 2014 15:45:45 -0000 Woo! -a On 12 January 2014 07:35, Andrew Turner wrote: > Author: andrew > Date: Sun Jan 12 15:35:03 2014 > New Revision: 260565 > URL: http://svnweb.freebsd.org/changeset/base/260565 > > Log: > Fix gcc with EABI on big-endian ARM by setting the endian correctly. > Without this gcc would generate byte loads for a little-endian core. > > MFC after: 1 week > > Modified: > head/contrib/gcc/config/arm/freebsd.h > > Modified: head/contrib/gcc/config/arm/freebsd.h > ============================================================================== > --- head/contrib/gcc/config/arm/freebsd.h Sun Jan 12 14:37:39 2014 (r260564) > +++ head/contrib/gcc/config/arm/freebsd.h Sun Jan 12 15:35:03 2014 (r260565) > @@ -72,6 +72,9 @@ > #undef TARGET_DEFAULT_FLOAT_ABI > #define TARGET_DEFAULT_FLOAT_ABI ARM_FLOAT_ABI_SOFT > > +#undef TARGET_DEFAULT > +#define TARGET_DEFAULT (MASK_INTERWORK | TARGET_ENDIAN_DEFAULT) > + > #undef ARM_DEFAULT_ABI > #define ARM_DEFAULT_ABI ARM_ABI_AAPCS_LINUX > From owner-svn-src-head@FreeBSD.ORG Sun Jan 12 17:40:47 2014 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) (using TLSv1 with cipher ADH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id C25E7D37; Sun, 12 Jan 2014 17:40:47 +0000 (UTC) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mx1.freebsd.org (Postfix) with ESMTPS id AD5E91260; Sun, 12 Jan 2014 17:40:47 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.7/8.14.7) with ESMTP id s0CHelB4032374; Sun, 12 Jan 2014 17:40:47 GMT (envelope-from bryanv@svn.freebsd.org) Received: (from bryanv@localhost) by svn.freebsd.org (8.14.7/8.14.7/Submit) id s0CHelGk032373; Sun, 12 Jan 2014 17:40:47 GMT (envelope-from bryanv@svn.freebsd.org) Message-Id: <201401121740.s0CHelGk032373@svn.freebsd.org> From: Bryan Venteicher Date: Sun, 12 Jan 2014 17:40:47 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r260566 - head/sys/dev/virtio/scsi X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.17 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 12 Jan 2014 17:40:47 -0000 Author: bryanv Date: Sun Jan 12 17:40:47 2014 New Revision: 260566 URL: http://svnweb.freebsd.org/changeset/base/260566 Log: Remove incorrect bit shift when assigning the LUN request field This caused duplicate targets appearing on Google Compute Engine instances. PR: kern/185626 Submitted by: Venkatesh Srinivas MFC after: 3 days Modified: head/sys/dev/virtio/scsi/virtio_scsi.c Modified: head/sys/dev/virtio/scsi/virtio_scsi.c ============================================================================== --- head/sys/dev/virtio/scsi/virtio_scsi.c Sun Jan 12 15:35:03 2014 (r260565) +++ head/sys/dev/virtio/scsi/virtio_scsi.c Sun Jan 12 17:40:47 2014 (r260566) @@ -1539,7 +1539,7 @@ vtscsi_set_request_lun(struct ccb_hdr *c lun[0] = 1; lun[1] = ccbh->target_id; lun[2] = 0x40 | ((ccbh->target_lun >> 8) & 0x3F); - lun[3] = (ccbh->target_lun >> 8) & 0xFF; + lun[3] = ccbh->target_lun & 0xFF; } static void From owner-svn-src-head@FreeBSD.ORG Sun Jan 12 19:04:21 2014 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [8.8.178.115]) (using TLSv1 with cipher ADH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id 64CEC47F; Sun, 12 Jan 2014 19:04:21 +0000 (UTC) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mx1.freebsd.org (Postfix) with ESMTPS id 509EA18C1; Sun, 12 Jan 2014 19:04:21 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.7/8.14.7) with ESMTP id s0CJ4Lae063571; Sun, 12 Jan 2014 19:04:21 GMT (envelope-from alc@svn.freebsd.org) Received: (from alc@localhost) by svn.freebsd.org (8.14.7/8.14.7/Submit) id s0CJ4LnM063570; Sun, 12 Jan 2014 19:04:21 GMT (envelope-from alc@svn.freebsd.org) Message-Id: <201401121904.s0CJ4LnM063570@svn.freebsd.org> From: Alan Cox Date: Sun, 12 Jan 2014 19:04:21 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r260567 - head/sys/vm X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.17 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 12 Jan 2014 19:04:21 -0000 Author: alc Date: Sun Jan 12 19:04:20 2014 New Revision: 260567 URL: http://svnweb.freebsd.org/changeset/base/260567 Log: Correctly update the count of stuck pages, "addl_page_shortage", in vm_pageout_scan(). There were missing increments in two less common cases. Don't conflate the count of stuck pages and the pageout deficit provided by vm_page_alloc{,_contig}(). (A proposed fix to the OOM code depends on this.) Handle held pages consistently in the inactive queue scan. In the more common case, we did not move the page to the tail of the queue. Whereas, in the less common case, we did. There's no particular reason to move the page in the less common case, so remove it. Perform the calculation of the page shortage for the active queue scan a little earlier, before the active queue lock is acquired. The correctness of this calculation doesn't depend on the active queue lock being held. Eliminate a redundant variable, "pcount". Use the more descriptive variable, "maxscan", in its place. Apply a few nearby style fixes, e.g., eliminate stray whitespace and excess parentheses. Reviewed by: kib Sponsored by: EMC / Isilon Storage Division Modified: head/sys/vm/vm_pageout.c Modified: head/sys/vm/vm_pageout.c ============================================================================== --- head/sys/vm/vm_pageout.c Sun Jan 12 17:40:47 2014 (r260566) +++ head/sys/vm/vm_pageout.c Sun Jan 12 19:04:20 2014 (r260567) @@ -909,10 +909,8 @@ vm_pageout_scan(struct vm_domain *vmd, i { vm_page_t m, next; struct vm_pagequeue *pq; - int page_shortage, maxscan, pcount; - int addl_page_shortage; vm_object_t object; - int act_delta; + int act_delta, addl_page_shortage, deficit, maxscan, page_shortage; int vnodes_skipped = 0; int maxlaunder; int lockmode; @@ -942,13 +940,15 @@ vm_pageout_scan(struct vm_domain *vmd, i * number of pages from the inactive count that should be * discounted in setting the target for the active queue scan. */ - addl_page_shortage = atomic_readandclear_int(&vm_pageout_deficit); + addl_page_shortage = 0; + + deficit = atomic_readandclear_int(&vm_pageout_deficit); /* * Calculate the number of pages we want to either free or move * to the cache. */ - page_shortage = vm_paging_target() + addl_page_shortage; + page_shortage = vm_paging_target() + deficit; /* * maxlaunder limits the number of dirty pages we flush per scan. @@ -1245,6 +1245,7 @@ vm_pageout_scan(struct vm_domain *vmd, i */ if (vm_page_busied(m)) { vm_page_unlock(m); + addl_page_shortage++; goto unlock_and_continue; } @@ -1252,9 +1253,9 @@ vm_pageout_scan(struct vm_domain *vmd, i * If the page has become held it might * be undergoing I/O, so skip it */ - if (m->hold_count) { + if (m->hold_count != 0) { vm_page_unlock(m); - vm_page_requeue_locked(m); + addl_page_shortage++; if (object->flags & OBJ_MIGHTBEDIRTY) vnodes_skipped++; goto unlock_and_continue; @@ -1309,19 +1310,20 @@ relock_queues: * Compute the number of pages we want to try to move from the * active queue to the inactive queue. */ + page_shortage = cnt.v_inactive_target - cnt.v_inactive_count + + vm_paging_target() + deficit + addl_page_shortage; + pq = &vmd->vmd_pagequeues[PQ_ACTIVE]; vm_pagequeue_lock(pq); - pcount = pq->pq_cnt; - page_shortage = vm_paging_target() + - cnt.v_inactive_target - cnt.v_inactive_count; - page_shortage += addl_page_shortage; + maxscan = pq->pq_cnt; + /* * If we're just idle polling attempt to visit every * active page within 'update_period' seconds. */ - if (pass == 0 && vm_pageout_update_period != 0) { - pcount /= vm_pageout_update_period; - page_shortage = pcount; + if (pass == 0 && vm_pageout_update_period != 0) { + maxscan /= vm_pageout_update_period; + page_shortage = maxscan; } /* @@ -1330,7 +1332,7 @@ relock_queues: * deactivation candidates. */ m = TAILQ_FIRST(&pq->pq_pl); - while ((m != NULL) && (pcount-- > 0) && (page_shortage > 0)) { + while (m != NULL && maxscan-- > 0 && page_shortage > 0) { KASSERT(m->queue == PQ_ACTIVE, ("vm_pageout_scan: page %p isn't active", m)); From owner-svn-src-head@FreeBSD.ORG Sun Jan 12 20:30:56 2014 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [8.8.178.115]) (using TLSv1 with cipher ADH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id 4AE93FD3; Sun, 12 Jan 2014 20:30:56 +0000 (UTC) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mx1.freebsd.org (Postfix) with ESMTPS id 083131F02; Sun, 12 Jan 2014 20:30: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 s0CKUtuY099522; Sun, 12 Jan 2014 20:30:55 GMT (envelope-from jilles@svn.freebsd.org) Received: (from jilles@localhost) by svn.freebsd.org (8.14.7/8.14.7/Submit) id s0CKUtTi099521; Sun, 12 Jan 2014 20:30:55 GMT (envelope-from jilles@svn.freebsd.org) Message-Id: <201401122030.s0CKUtTi099521@svn.freebsd.org> From: Jilles Tjoelker Date: Sun, 12 Jan 2014 20:30:55 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r260571 - head/lib/libc/gen X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.17 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 12 Jan 2014 20:30:56 -0000 Author: jilles Date: Sun Jan 12 20:30:55 2014 New Revision: 260571 URL: http://svnweb.freebsd.org/changeset/base/260571 Log: fts: Stat things relative to the directory fd, if possible. As a result, the kernel needs to process shorter pathnames if fts is not changing directories (if fts follows symlinks (-L option to utilities), fts cannot open "." or FTS_NOCHDIR was specified). Side effect: If pathnames exceed PATH_MAX, [ENAMETOOLONG] is not hit at the stat stage but later (opendir or application fts_accpath) or not at all. Modified: head/lib/libc/gen/fts.c Modified: head/lib/libc/gen/fts.c ============================================================================== --- head/lib/libc/gen/fts.c Sun Jan 12 20:18:12 2014 (r260570) +++ head/lib/libc/gen/fts.c Sun Jan 12 20:30:55 2014 (r260571) @@ -62,7 +62,7 @@ static size_t fts_maxarglen(char * cons static void fts_padjust(FTS *, FTSENT *); static int fts_palloc(FTS *, size_t); static FTSENT *fts_sort(FTS *, FTSENT *, size_t); -static int fts_stat(FTS *, FTSENT *, int); +static int fts_stat(FTS *, FTSENT *, int, int); static int fts_safe_changedir(FTS *, FTSENT *, int, char *); static int fts_ufslinks(FTS *, const FTSENT *); @@ -171,7 +171,7 @@ fts_open(argv, options, compar) p->fts_level = FTS_ROOTLEVEL; p->fts_parent = parent; p->fts_accpath = p->fts_name; - p->fts_info = fts_stat(sp, p, ISSET(FTS_COMFOLLOW)); + p->fts_info = fts_stat(sp, p, ISSET(FTS_COMFOLLOW), -1); /* Command-line "." and ".." are real directories. */ if (p->fts_info == FTS_DOT) @@ -326,7 +326,7 @@ fts_read(FTS *sp) /* Any type of file may be re-visited; re-stat and re-turn. */ if (instr == FTS_AGAIN) { - p->fts_info = fts_stat(sp, p, 0); + p->fts_info = fts_stat(sp, p, 0, -1); return (p); } @@ -338,7 +338,7 @@ fts_read(FTS *sp) */ if (instr == FTS_FOLLOW && (p->fts_info == FTS_SL || p->fts_info == FTS_SLNONE)) { - p->fts_info = fts_stat(sp, p, 1); + p->fts_info = fts_stat(sp, p, 1, -1); if (p->fts_info == FTS_D && !ISSET(FTS_NOCHDIR)) { if ((p->fts_symfd = _open(".", O_RDONLY | O_CLOEXEC, 0)) < 0) { @@ -429,7 +429,7 @@ next: tmp = p; if (p->fts_instr == FTS_SKIP) goto next; if (p->fts_instr == FTS_FOLLOW) { - p->fts_info = fts_stat(sp, p, 1); + p->fts_info = fts_stat(sp, p, 1, -1); if (p->fts_info == FTS_D && !ISSET(FTS_NOCHDIR)) { if ((p->fts_symfd = _open(".", O_RDONLY | O_CLOEXEC, 0)) < 0) { @@ -800,10 +800,11 @@ mem1: saved_errno = errno; if (ISSET(FTS_NOCHDIR)) { p->fts_accpath = p->fts_path; memmove(cp, p->fts_name, p->fts_namelen + 1); - } else + p->fts_info = fts_stat(sp, p, 0, _dirfd(dirp)); + } else { p->fts_accpath = p->fts_name; - /* Stat it. */ - p->fts_info = fts_stat(sp, p, 0); + p->fts_info = fts_stat(sp, p, 0, -1); + } /* Decrement link count if applicable. */ if (nlinks > 0 && (p->fts_info == FTS_D || @@ -868,13 +869,19 @@ mem1: saved_errno = errno; } static int -fts_stat(FTS *sp, FTSENT *p, int follow) +fts_stat(FTS *sp, FTSENT *p, int follow, int dfd) { FTSENT *t; dev_t dev; ino_t ino; struct stat *sbp, sb; int saved_errno; + const char *path; + + if (dfd == -1) + path = p->fts_accpath, dfd = AT_FDCWD; + else + path = p->fts_name; /* If user needs stat info, stat buffer already allocated. */ sbp = ISSET(FTS_NOSTAT) ? &sb : p->fts_statp; @@ -896,16 +903,16 @@ fts_stat(FTS *sp, FTSENT *p, int follow) * fail, set the errno from the stat call. */ if (ISSET(FTS_LOGICAL) || follow) { - if (stat(p->fts_accpath, sbp)) { + if (fstatat(dfd, path, sbp, 0)) { saved_errno = errno; - if (!lstat(p->fts_accpath, sbp)) { + if (!fstatat(dfd, path, sbp, AT_SYMLINK_NOFOLLOW)) { errno = 0; return (FTS_SLNONE); } p->fts_errno = saved_errno; goto err; } - } else if (lstat(p->fts_accpath, sbp)) { + } else if (fstatat(dfd, path, sbp, AT_SYMLINK_NOFOLLOW)) { p->fts_errno = errno; err: memset(sbp, 0, sizeof(struct stat)); return (FTS_NS); From owner-svn-src-head@FreeBSD.ORG Sun Jan 12 20:47:08 2014 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [8.8.178.115]) (using TLSv1 with cipher ADH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id EECA7516; Sun, 12 Jan 2014 20:47:08 +0000 (UTC) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mx1.freebsd.org (Postfix) with ESMTPS id DAFCA1FAB; Sun, 12 Jan 2014 20:47: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 s0CKl8bq004416; Sun, 12 Jan 2014 20:47:08 GMT (envelope-from jilles@svn.freebsd.org) Received: (from jilles@localhost) by svn.freebsd.org (8.14.7/8.14.7/Submit) id s0CKl85B004415; Sun, 12 Jan 2014 20:47:08 GMT (envelope-from jilles@svn.freebsd.org) Message-Id: <201401122047.s0CKl85B004415@svn.freebsd.org> From: Jilles Tjoelker Date: Sun, 12 Jan 2014 20:47:08 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r260572 - head/lib/libc/gen X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.17 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 12 Jan 2014 20:47:09 -0000 Author: jilles Date: Sun Jan 12 20:47:08 2014 New Revision: 260572 URL: http://svnweb.freebsd.org/changeset/base/260572 Log: fts(3): Remove stray mentions of the obsolete fts_bignum. Modified: head/lib/libc/gen/fts.3 Modified: head/lib/libc/gen/fts.3 ============================================================================== --- head/lib/libc/gen/fts.3 Sun Jan 12 20:30:55 2014 (r260571) +++ head/lib/libc/gen/fts.3 Sun Jan 12 20:47:08 2014 (r260572) @@ -28,7 +28,7 @@ .\" @(#)fts.3 8.5 (Berkeley) 4/16/94 .\" $FreeBSD$ .\" -.Dd May 21, 2013 +.Dd January 12, 2014 .Dt FTS 3 .Os .Sh NAME @@ -304,7 +304,6 @@ file is a member. A parent structure for the initial entry point is provided as well, however, only the .Fa fts_level , -.Fa fts_bignum , .Fa fts_number and .Fa fts_pointer @@ -366,13 +365,6 @@ The .Fa fts_name field is always .Dv NUL Ns -terminated . -.Pp -Note that the use of -.Fa fts_bignum -is mutually exclusive with the use of -.Fa fts_number -or -.Fa fts_pointer . .Sh FTS_OPEN The .Fn fts_open From owner-svn-src-head@FreeBSD.ORG Sun Jan 12 21:56:27 2014 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [8.8.178.115]) (using TLSv1 with cipher ADH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id B6667A89; Sun, 12 Jan 2014 21:56:27 +0000 (UTC) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mx1.freebsd.org (Postfix) with ESMTPS id 9FF241477; Sun, 12 Jan 2014 21:56: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 s0CLuRkx031628; Sun, 12 Jan 2014 21:56:27 GMT (envelope-from jmmv@svn.freebsd.org) Received: (from jmmv@localhost) by svn.freebsd.org (8.14.7/8.14.7/Submit) id s0CLuQR7031624; Sun, 12 Jan 2014 21:56:26 GMT (envelope-from jmmv@svn.freebsd.org) Message-Id: <201401122156.s0CLuQR7031624@svn.freebsd.org> From: Julio Merino Date: Sun, 12 Jan 2014 21:56:26 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r260576 - in head: lib/atf lib/atf/libatf-c lib/atf/libatf-c++ usr.bin/atf/atf-sh X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.17 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 12 Jan 2014 21:56:27 -0000 Author: jmmv Date: Sun Jan 12 21:56:26 2014 New Revision: 260576 URL: http://svnweb.freebsd.org/changeset/base/260576 Log: Generate and install pkg-config files for atf. These files are required to get packages in ports to build against atf and also to get a couple of currently-failing tests to pass. I'm following the approach already used by the libusb pkg-config files installed by the system regarding the location and the install rules. MFC after: 5 days Added: head/lib/atf/common.mk (contents, props changed) Modified: head/lib/atf/libatf-c++/Makefile head/lib/atf/libatf-c/Makefile head/usr.bin/atf/atf-sh/Makefile Added: head/lib/atf/common.mk ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ head/lib/atf/common.mk Sun Jan 12 21:56:26 2014 (r260576) @@ -0,0 +1,19 @@ +# $FreeBSD$ +# +# Common Makefile code for all components of ATF. +# + +.if !defined(ATF) +.error "ATF must be defined and point to the contrib/atf directory" +.endif + +# Depend on the atf-version target to generate a file that contains the +# version number of the currently imported ATF release and that only +# changes on new imports. +atf-version: atf-version-real + @cmp -s atf-version atf-version-real \ + || cp atf-version-real atf-version +atf-version-real: .PHONY + @grep 'define VERSION' ${ATF}/bconfig.h \ + | cut -d '"' -f 2 >atf-version-real +CLEANFILES+= atf-version atf-version-real Modified: head/lib/atf/libatf-c++/Makefile ============================================================================== --- head/lib/atf/libatf-c++/Makefile Sun Jan 12 21:21:19 2014 (r260575) +++ head/lib/atf/libatf-c++/Makefile Sun Jan 12 21:56:26 2014 (r260576) @@ -76,8 +76,21 @@ INCSDIR_atf-c++.hpp= ${INCLUDEDIR} MAN= atf-c++-api.3 +all: atf-c++.pc +atf-c++.pc: atf-c++.pc.in atf-version + sed -e 's,__CXX__,${CXX},g' \ + -e 's,__INCLUDEDIR__,${INCLUDEDIR},g' \ + -e 's,__LIBDIR__,${LIBDIR},g' \ + -e "s,__ATF_VERSION__,$$(cat atf-version),g" \ + <${ATF}/atf-c++/atf-c++.pc.in >atf-c++.pc + +beforeinstall: + ${INSTALL} -C -o ${LIBOWN} -g ${LIBGRP} -m ${LIBMODE} \ + atf-c++.pc ${DESTDIR}${LIBDATADIR}/pkgconfig + .if ${MK_TESTS} != "no" SUBDIR= tests .endif +.include "../common.mk" .include Modified: head/lib/atf/libatf-c/Makefile ============================================================================== --- head/lib/atf/libatf-c/Makefile Sun Jan 12 21:21:19 2014 (r260575) +++ head/lib/atf/libatf-c/Makefile Sun Jan 12 21:56:26 2014 (r260576) @@ -74,8 +74,21 @@ INCSDIR_atf-c.h= ${INCLUDEDIR} MAN= atf-c-api.3 +all: atf-c.pc +atf-c.pc: atf-c.pc.in atf-version + sed -e 's,__CC__,${CC},g' \ + -e 's,__INCLUDEDIR__,${INCLUDEDIR},g' \ + -e 's,__LIBDIR__,${LIBDIR},g' \ + -e "s,__ATF_VERSION__,$$(cat atf-version),g" \ + <${ATF}/atf-c/atf-c.pc.in >atf-c.pc + +beforeinstall: + ${INSTALL} -C -o ${LIBOWN} -g ${LIBGRP} -m ${LIBMODE} \ + atf-c.pc ${DESTDIR}${LIBDATADIR}/pkgconfig + .if ${MK_TESTS} != "no" SUBDIR= tests .endif +.include "../common.mk" .include Modified: head/usr.bin/atf/atf-sh/Makefile ============================================================================== --- head/usr.bin/atf/atf-sh/Makefile Sun Jan 12 21:21:19 2014 (r260575) +++ head/usr.bin/atf/atf-sh/Makefile Sun Jan 12 21:56:26 2014 (r260576) @@ -45,8 +45,19 @@ FILESGROUPS= SUBR SUBRDIR= ${SHAREDIR}/atf SUBR= libatf-sh.subr +all: atf-sh.pc +atf-sh.pc: atf-sh.pc.in atf-version + sed -e 's,__EXEC_PREFIX__,/usr,g' \ + -e "s,__ATF_VERSION__,$$(cat atf-version),g" \ + <${ATF}/atf-sh/atf-sh.pc.in >atf-sh.pc + +beforeinstall: + ${INSTALL} -C -o ${LIBOWN} -g ${LIBGRP} -m ${LIBMODE} \ + atf-sh.pc ${DESTDIR}${LIBDATADIR}/pkgconfig + .if ${MK_TESTS} != "no" SUBDIR+= tests .endif +.include "../../../lib/atf/common.mk" .include From owner-svn-src-head@FreeBSD.ORG Sun Jan 12 22:15:18 2014 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [8.8.178.115]) (using TLSv1 with cipher ADH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id 9B9AD1F2; Sun, 12 Jan 2014 22:15:18 +0000 (UTC) Received: from smtpauth3.wiscmail.wisc.edu (wmauth3.doit.wisc.edu [144.92.197.226]) (using TLSv1 with cipher RC4-MD5 (128/128 bits)) (No client certificate requested) by mx1.freebsd.org (Postfix) with ESMTPS id 687E415E1; Sun, 12 Jan 2014 22:15:17 +0000 (UTC) MIME-version: 1.0 Content-transfer-encoding: 7BIT Content-type: text/plain; CHARSET=US-ASCII Received: from avs-daemon.smtpauth3.wiscmail.wisc.edu by smtpauth3.wiscmail.wisc.edu (Oracle Communications Messaging Server 7u4-27.01(7.0.4.27.0) 64bit (built Aug 30 2012)) id <0MZB00C006ENE900@smtpauth3.wiscmail.wisc.edu>; Sun, 12 Jan 2014 16:15:16 -0600 (CST) X-Spam-PmxInfo: Server=avs-3, Version=6.0.3.2322014, Antispam-Engine: 2.7.2.2107409, Antispam-Data: 2014.1.12.220616, SenderIP=0.0.0.0 X-Spam-Report: AuthenticatedSender=yes, SenderIP=0.0.0.0 Received: from wanderer.tachypleus.net (pool-72-66-107-173.washdc.fios.verizon.net [72.66.107.173]) by smtpauth3.wiscmail.wisc.edu (Oracle Communications Messaging Server 7u4-27.01(7.0.4.27.0) 64bit (built Aug 30 2012)) with ESMTPSA id <0MZB00K4G75D9E20@smtpauth3.wiscmail.wisc.edu>; Sun, 12 Jan 2014 16:15:16 -0600 (CST) Message-id: <52D313F1.9010005@freebsd.org> Date: Sun, 12 Jan 2014 17:15:13 -0500 From: Nathan Whitehorn User-Agent: Mozilla/5.0 (X11; FreeBSD amd64; rv:24.0) Gecko/20100101 Thunderbird/24.2.0 To: Bryan Venteicher , src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: Re: svn commit: r260566 - head/sys/dev/virtio/scsi References: <201401121740.s0CHelGk032373@svn.freebsd.org> In-reply-to: <201401121740.s0CHelGk032373@svn.freebsd.org> X-Enigmail-Version: 1.6 X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.17 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 12 Jan 2014 22:15:18 -0000 This looks like it is uses a two-level set of hierarchical LUNs. Does REPORT_LUNS not work? The new extended LUN support in CAM should be able to handle this kind of thing now without virtio knowing anything about it. -Nathan On 01/12/14 12:40, Bryan Venteicher wrote: > Author: bryanv > Date: Sun Jan 12 17:40:47 2014 > New Revision: 260566 > URL: http://svnweb.freebsd.org/changeset/base/260566 > > Log: > Remove incorrect bit shift when assigning the LUN request field > > This caused duplicate targets appearing on Google Compute Engine > instances. > > PR: kern/185626 > Submitted by: Venkatesh Srinivas > MFC after: 3 days > > Modified: > head/sys/dev/virtio/scsi/virtio_scsi.c > > Modified: head/sys/dev/virtio/scsi/virtio_scsi.c > ============================================================================== > --- head/sys/dev/virtio/scsi/virtio_scsi.c Sun Jan 12 15:35:03 2014 (r260565) > +++ head/sys/dev/virtio/scsi/virtio_scsi.c Sun Jan 12 17:40:47 2014 (r260566) > @@ -1539,7 +1539,7 @@ vtscsi_set_request_lun(struct ccb_hdr *c > lun[0] = 1; > lun[1] = ccbh->target_id; > lun[2] = 0x40 | ((ccbh->target_lun >> 8) & 0x3F); > - lun[3] = (ccbh->target_lun >> 8) & 0xFF; > + lun[3] = ccbh->target_lun & 0xFF; > } > > static void From owner-svn-src-head@FreeBSD.ORG Sun Jan 12 22:17:11 2014 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) (using TLSv1 with cipher ADH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id 663BF42C; Sun, 12 Jan 2014 22:17:11 +0000 (UTC) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mx1.freebsd.org (Postfix) with ESMTPS id 45E5A162C; Sun, 12 Jan 2014 22:17:11 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.7/8.14.7) with ESMTP id s0CMHBrl039823; Sun, 12 Jan 2014 22:17:11 GMT (envelope-from jmmv@svn.freebsd.org) Received: (from jmmv@localhost) by svn.freebsd.org (8.14.7/8.14.7/Submit) id s0CMHAXJ039818; Sun, 12 Jan 2014 22:17:10 GMT (envelope-from jmmv@svn.freebsd.org) Message-Id: <201401122217.s0CMHAXJ039818@svn.freebsd.org> From: Julio Merino Date: Sun, 12 Jan 2014 22:17:10 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r260577 - in head/contrib/atf: . atf-c atf-c++ atf-sh X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.17 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 12 Jan 2014 22:17:11 -0000 Author: jmmv Date: Sun Jan 12 22:17:10 2014 New Revision: 260577 URL: http://svnweb.freebsd.org/changeset/base/260577 Log: Add atf pkg-config files from the vendor branch. These were originally deleted by mistake (because they were not yet being installed) and are actually necessary. This should have been part of r260576 but I missed committing this directory. MFC after: 5 days Added: head/contrib/atf/atf-c++/atf-c++.pc.in - copied unchanged from r260517, vendor/atf/dist/atf-c++/atf-c++.pc.in head/contrib/atf/atf-c/atf-c.pc.in - copied unchanged from r260517, vendor/atf/dist/atf-c/atf-c.pc.in head/contrib/atf/atf-sh/atf-sh.pc.in - copied unchanged from r260517, vendor/atf/dist/atf-sh/atf-sh.pc.in Modified: head/contrib/atf/FREEBSD-Xlist Modified: head/contrib/atf/FREEBSD-Xlist ============================================================================== --- head/contrib/atf/FREEBSD-Xlist Sun Jan 12 21:56:26 2014 (r260576) +++ head/contrib/atf/FREEBSD-Xlist Sun Jan 12 22:17:10 2014 (r260577) @@ -8,7 +8,6 @@ Makefile* aclocal.m4 admin/ atf-*/atf-*.m4 -atf-*/atf-*.pc.in atf-config/ atf-report/ atf-run/ Copied: head/contrib/atf/atf-c++/atf-c++.pc.in (from r260517, vendor/atf/dist/atf-c++/atf-c++.pc.in) ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ head/contrib/atf/atf-c++/atf-c++.pc.in Sun Jan 12 22:17:10 2014 (r260577, copy of r260517, vendor/atf/dist/atf-c++/atf-c++.pc.in) @@ -0,0 +1,11 @@ +# ATF pkg-config file + +cxx=__CXX__ +includedir=__INCLUDEDIR__ +libdir=__LIBDIR__ + +Name: atf-c++ +Description: Automated Testing Framework (C++ binding) +Version: __ATF_VERSION__ +Cflags: -I${includedir} +Libs: -L${libdir} -latf-c++ -latf-c Copied: head/contrib/atf/atf-c/atf-c.pc.in (from r260517, vendor/atf/dist/atf-c/atf-c.pc.in) ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ head/contrib/atf/atf-c/atf-c.pc.in Sun Jan 12 22:17:10 2014 (r260577, copy of r260517, vendor/atf/dist/atf-c/atf-c.pc.in) @@ -0,0 +1,11 @@ +# ATF pkg-config file + +cc=__CC__ +includedir=__INCLUDEDIR__ +libdir=__LIBDIR__ + +Name: atf-c +Description: Automated Testing Framework (C binding) +Version: __ATF_VERSION__ +Cflags: -I${includedir} +Libs: -L${libdir} -latf-c Copied: head/contrib/atf/atf-sh/atf-sh.pc.in (from r260517, vendor/atf/dist/atf-sh/atf-sh.pc.in) ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ head/contrib/atf/atf-sh/atf-sh.pc.in Sun Jan 12 22:17:10 2014 (r260577, copy of r260517, vendor/atf/dist/atf-sh/atf-sh.pc.in) @@ -0,0 +1,8 @@ +# ATF pkg-config file + +exec_prefix=__EXEC_PREFIX__ +interpreter=${exec_prefix}/bin/atf-sh + +Name: atf-sh +Description: Automated Testing Framework (POSIX shell binding) +Version: __ATF_VERSION__ From owner-svn-src-head@FreeBSD.ORG Mon Jan 13 01:03:20 2014 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) (using TLSv1 with cipher ADH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id DBCBA3B4; Mon, 13 Jan 2014 01:03:19 +0000 (UTC) Received: from mail-ig0-x22a.google.com (mail-ig0-x22a.google.com [IPv6:2607:f8b0:4001:c05::22a]) (using TLSv1 with cipher ECDHE-RSA-RC4-SHA (128/128 bits)) (No client certificate requested) by mx1.freebsd.org (Postfix) with ESMTPS id 805FB1164; Mon, 13 Jan 2014 01:03:19 +0000 (UTC) Received: by mail-ig0-f170.google.com with SMTP id m12so3177430iga.1 for ; Sun, 12 Jan 2014 17:03:18 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:sender:in-reply-to:references:from:date:message-id :subject:to:cc:content-type; bh=gSOSTt3WeE+FSwuH+GJE5CmkiXzH8Z/7juITgc8q2Rc=; b=zFpxkgGSc5IpuOg2p4+HNt3qEkln0u5mn7uAi1vHNZYarJzv/1efgkWxVaopyFY8M3 iJPLD4Dc1gqrJUYgDk5Br9YU94UQWPFuc8crL9Zna8UhhQVpt1VUPsudANN5yTjF9OBq MFrD0LULll0TPm6HN2RXMZQKxBYzKu8F66M/JweBPoZ6dBpWQ5vZqUhK3UuRtqLXirqZ aCc4dtFNL69s4t6HUZylxtINh32xKOMnfIkI8nNZ9bA34kj1wxrOTU/g1UdaBBX7eXoK 1GOrO8kHpHBc5jlVar0oRAAr7COVJSHos27oGt68qmFWPEuqZyWBan+LM/tq6d+3PsWj 1RDw== X-Received: by 10.43.158.72 with SMTP id lt8mr18632908icc.33.1389574998867; Sun, 12 Jan 2014 17:03:18 -0800 (PST) MIME-Version: 1.0 Sender: mr.kodiak@gmail.com Received: by 10.64.6.134 with HTTP; Sun, 12 Jan 2014 17:02:48 -0800 (PST) In-Reply-To: <52D313F1.9010005@freebsd.org> References: <201401121740.s0CHelGk032373@svn.freebsd.org> <52D313F1.9010005@freebsd.org> From: Bryan Venteicher Date: Sun, 12 Jan 2014 19:02:48 -0600 X-Google-Sender-Auth: k0xBZyVysuStXagQngNOb1b2uJ4 Message-ID: Subject: Re: svn commit: r260566 - head/sys/dev/virtio/scsi To: Nathan Whitehorn Content-Type: text/plain; charset=ISO-8859-1 X-Content-Filtered-By: Mailman/MimeDel 2.1.17 Cc: svn-src-head@freebsd.org, Bryan Venteicher , svn-src-all@freebsd.org, src-committers@freebsd.org X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.17 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 13 Jan 2014 01:03:20 -0000 On Sun, Jan 12, 2014 at 4:15 PM, Nathan Whitehorn wrote: > This looks like it is uses a two-level set of hierarchical LUNs. Does > REPORT_LUNS not work? The new extended LUN support in CAM should be able > to handle this kind of thing now without virtio knowing anything about it. > Details from the PR seem to suggest the Google Compute Engine hypervisor (I'd guess it is some QEMU fork) doesn't support REPORT_LUNS. -Nathan > > On 01/12/14 12:40, Bryan Venteicher wrote: > > Author: bryanv > > Date: Sun Jan 12 17:40:47 2014 > > New Revision: 260566 > > URL: http://svnweb.freebsd.org/changeset/base/260566 > > > > Log: > > Remove incorrect bit shift when assigning the LUN request field > > > > This caused duplicate targets appearing on Google Compute Engine > > instances. > > > > PR: kern/185626 > > Submitted by: Venkatesh Srinivas > > MFC after: 3 days > > > > Modified: > > head/sys/dev/virtio/scsi/virtio_scsi.c > > > > Modified: head/sys/dev/virtio/scsi/virtio_scsi.c > > > ============================================================================== > > --- head/sys/dev/virtio/scsi/virtio_scsi.c Sun Jan 12 15:35:03 2014 > (r260565) > > +++ head/sys/dev/virtio/scsi/virtio_scsi.c Sun Jan 12 17:40:47 2014 > (r260566) > > @@ -1539,7 +1539,7 @@ vtscsi_set_request_lun(struct ccb_hdr *c > > lun[0] = 1; > > lun[1] = ccbh->target_id; > > lun[2] = 0x40 | ((ccbh->target_lun >> 8) & 0x3F); > > - lun[3] = (ccbh->target_lun >> 8) & 0xFF; > > + lun[3] = ccbh->target_lun & 0xFF; > > } > > > > static void > > From owner-svn-src-head@FreeBSD.ORG Mon Jan 13 03:27:20 2014 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) (using TLSv1 with cipher ADH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id E043E8DD; Mon, 13 Jan 2014 03:27:20 +0000 (UTC) Received: from felyko.com (felyko.com [IPv6:2607:f2f8:a528::3:1337:ca7]) by mx1.freebsd.org (Postfix) with ESMTP id C8B211CBF; Mon, 13 Jan 2014 03:27:20 +0000 (UTC) Received: from [10.0.1.3] (c-24-6-115-18.hsd1.ca.comcast.net [24.6.115.18]) (using TLSv1 with cipher ECDHE-RSA-AES256-SHA (256/256 bits)) (No client certificate requested) by felyko.com (Postfix) with ESMTPSA id 022523983B; Sun, 12 Jan 2014 19:27:19 -0800 (PST) Content-Type: text/plain; charset=us-ascii Mime-Version: 1.0 (Mac OS X Mail 7.1 \(1827\)) Subject: Re: svn commit: r260463 - head/sys/dev/usb/wlan From: Rui Paulo In-Reply-To: <201401090148.s091mYZx073572@svn.freebsd.org> Date: Sun, 12 Jan 2014 19:27:18 -0800 Content-Transfer-Encoding: 7bit Message-Id: References: <201401090148.s091mYZx073572@svn.freebsd.org> To: Kevin Lo X-Mailer: Apple Mail (2.1827) Cc: svn-src-head@freebsd.org, svn-src-all@freebsd.org, src-committers@freebsd.org X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.17 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 13 Jan 2014 03:27:21 -0000 On 8 Jan 2014, at 17:48, Kevin Lo wrote: > Replace deprecated M_DONTWAIT with M_NOWAIT. Argh, just remove M_DONTWAIT already! -- Rui Paulo From owner-svn-src-head@FreeBSD.ORG Mon Jan 13 03:47:30 2014 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [8.8.178.115]) (using TLSv1 with cipher ADH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id 1772DB2C; Mon, 13 Jan 2014 03:47:30 +0000 (UTC) Received: from smtpauth3.wiscmail.wisc.edu (wmauth3.doit.wisc.edu [144.92.197.226]) (using TLSv1 with cipher RC4-MD5 (128/128 bits)) (No client certificate requested) by mx1.freebsd.org (Postfix) with ESMTPS id D66141E0E; Mon, 13 Jan 2014 03:47:29 +0000 (UTC) MIME-version: 1.0 Content-transfer-encoding: 7BIT Content-type: text/plain; CHARSET=US-ASCII Received: from avs-daemon.smtpauth3.wiscmail.wisc.edu by smtpauth3.wiscmail.wisc.edu (Oracle Communications Messaging Server 7u4-27.01(7.0.4.27.0) 64bit (built Aug 30 2012)) id <0MZB00G00LKZU400@smtpauth3.wiscmail.wisc.edu>; Sun, 12 Jan 2014 21:47:22 -0600 (CST) X-Spam-PmxInfo: Server=avs-3, Version=6.0.3.2322014, Antispam-Engine: 2.7.2.2107409, Antispam-Data: 2014.1.13.33915, SenderIP=0.0.0.0 X-Spam-Report: AuthenticatedSender=yes, SenderIP=0.0.0.0 Received: from wanderer.tachypleus.net (pool-72-66-107-173.washdc.fios.verizon.net [72.66.107.173]) by smtpauth3.wiscmail.wisc.edu (Oracle Communications Messaging Server 7u4-27.01(7.0.4.27.0) 64bit (built Aug 30 2012)) with ESMTPSA id <0MZB008QJMIUO120@smtpauth3.wiscmail.wisc.edu>; Sun, 12 Jan 2014 21:47:22 -0600 (CST) Message-id: <52D361C5.2030507@freebsd.org> Date: Sun, 12 Jan 2014 22:47:17 -0500 From: Nathan Whitehorn User-Agent: Mozilla/5.0 (X11; FreeBSD amd64; rv:24.0) Gecko/20100101 Thunderbird/24.2.0 To: Bryan Venteicher Subject: Re: svn commit: r260566 - head/sys/dev/virtio/scsi References: <201401121740.s0CHelGk032373@svn.freebsd.org> <52D313F1.9010005@freebsd.org> In-reply-to: X-Enigmail-Version: 1.6 Cc: svn-src-head@freebsd.org, svn-src-all@freebsd.org, src-committers@freebsd.org X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.17 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 13 Jan 2014 03:47:30 -0000 On 01/12/14 20:02, Bryan Venteicher wrote: > > > On Sun, Jan 12, 2014 at 4:15 PM, Nathan Whitehorn > > wrote: > > This looks like it is uses a two-level set of hierarchical LUNs. Does > REPORT_LUNS not work? The new extended LUN support in CAM should > be able > to handle this kind of thing now without virtio knowing anything > about it. > > > > Details from the PR seem to suggest the Google Compute Engine > hypervisor (I'd guess it is some QEMU fork) doesn't support REPORT_LUNS. > Indeed. It's unfortunate their implementation is broken, but I guess we have to work around it. -Nathan From owner-svn-src-head@FreeBSD.ORG Mon Jan 13 04:41:09 2014 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [8.8.178.115]) (using TLSv1 with cipher ADH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id E5F74161; Mon, 13 Jan 2014 04:41:09 +0000 (UTC) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mx1.freebsd.org (Postfix) with ESMTPS id D1A711156; Mon, 13 Jan 2014 04: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 s0D4f9jh087738; Mon, 13 Jan 2014 04:41:09 GMT (envelope-from bryanv@svn.freebsd.org) Received: (from bryanv@localhost) by svn.freebsd.org (8.14.7/8.14.7/Submit) id s0D4f9Tb087732; Mon, 13 Jan 2014 04:41:09 GMT (envelope-from bryanv@svn.freebsd.org) Message-Id: <201401130441.s0D4f9Tb087732@svn.freebsd.org> From: Bryan Venteicher Date: Mon, 13 Jan 2014 04:41:09 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r260581 - in head: share/man/man9 sys/kern sys/sys X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.17 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 13 Jan 2014 04:41:10 -0000 Author: bryanv Date: Mon Jan 13 04:41:08 2014 New Revision: 260581 URL: http://svnweb.freebsd.org/changeset/base/260581 Log: Add sglist_append_bio(9) to append a struct bio's data to a sglist Reviewed by: jhb, kib (long ago) Modified: head/share/man/man9/Makefile head/share/man/man9/sglist.9 head/sys/kern/subr_sglist.c head/sys/sys/sglist.h Modified: head/share/man/man9/Makefile ============================================================================== --- head/share/man/man9/Makefile Mon Jan 13 00:22:37 2014 (r260580) +++ head/share/man/man9/Makefile Mon Jan 13 04:41:08 2014 (r260581) @@ -1185,6 +1185,7 @@ MLINKS+=sf_buf.9 sf_buf_alloc.9 \ sf_buf.9 sf_buf_page.9 MLINKS+=sglist.9 sglist_alloc.9 \ sglist.9 sglist_append.9 \ + sglist.9 sglist_append_bio.9 \ sglist.9 sglist_append_mbuf.9 \ sglist.9 sglist_append_phys.9 \ sglist.9 sglist_append_uio.9 \ Modified: head/share/man/man9/sglist.9 ============================================================================== --- head/share/man/man9/sglist.9 Mon Jan 13 00:22:37 2014 (r260580) +++ head/share/man/man9/sglist.9 Mon Jan 13 04:41:08 2014 (r260581) @@ -26,13 +26,14 @@ .\" .\" $FreeBSD$ .\" -.Dd May 15, 2009 +.Dd January 12, 2014 .Dt SGLIST 9 .Os .Sh NAME .Nm sglist , .Nm sglist_alloc , .Nm sglist_append , +.Nm sglist_append_bio , .Nm sglist_append_mbuf , .Nm sglist_append_phys , .Nm sglist_append_uio , @@ -58,6 +59,8 @@ .Ft int .Fn sglist_append "struct sglist *sg" "void *buf" "size_t len" .Ft int +.Fn sglist_append_bio "struct sglist *sg" "struct bio *bp" +.Ft int .Fn sglist_append_mbuf "struct sglist *sg" "struct mbuf *m" .Ft int .Fn sglist_append_phys "struct sglist *sg" "vm_paddr_t paddr" "size_t len" @@ -206,6 +209,13 @@ and is bytes long. .Pp The +.Nm sglist_append_bio +function appends the physical address ranges described by a single bio +.Fa bp +to the scatter/gather list +.Fa sg . +.Pp +The .Nm sglist_append_mbuf function appends the physical address ranges described by an entire mbuf chain @@ -499,6 +509,7 @@ list in to describe the requested physical address ranges. .El .Sh SEE ALSO +.Xr g_bio 9 , .Xr malloc 9 , .Xr mbuf 9 , .Xr uio 9 Modified: head/sys/kern/subr_sglist.c ============================================================================== --- head/sys/kern/subr_sglist.c Mon Jan 13 00:22:37 2014 (r260580) +++ head/sys/kern/subr_sglist.c Mon Jan 13 04:41:08 2014 (r260581) @@ -33,6 +33,7 @@ __FBSDID("$FreeBSD$"); #include #include +#include #include #include #include @@ -40,6 +41,7 @@ __FBSDID("$FreeBSD$"); #include #include +#include #include #include @@ -239,6 +241,44 @@ sglist_append(struct sglist *sg, void *b } /* + * Append the segments to describe a bio's data to a scatter/gather list. + * If there are insufficient segments, then this fails with EFBIG. + * + * NOTE: This function expects bio_bcount to be initialized. + */ +int +sglist_append_bio(struct sglist *sg, struct bio *bp) +{ + struct sgsave save; + vm_paddr_t paddr; + size_t len, tlen; + int error, i, ma_offs; + + if ((bp->bio_flags & BIO_UNMAPPED) == 0) { + error = sglist_append(sg, bp->bio_data, bp->bio_bcount); + return (error); + } + + if (sg->sg_maxseg == 0) + return (EINVAL); + + SGLIST_SAVE(sg, save); + tlen = bp->bio_bcount; + ma_offs = bp->bio_ma_offset; + for (i = 0; tlen > 0; i++, tlen -= len) { + len = min(PAGE_SIZE - ma_offs, tlen); + paddr = VM_PAGE_TO_PHYS(bp->bio_ma[i]) + ma_offs; + error = sglist_append_phys(sg, paddr, len); + if (error) { + SGLIST_RESTORE(sg, save); + return (error); + } + ma_offs = 0; + } + return (0); +} + +/* * Append a single physical address range to a scatter/gather list. * If there are insufficient segments, then this fails with EFBIG. */ Modified: head/sys/sys/sglist.h ============================================================================== --- head/sys/sys/sglist.h Mon Jan 13 00:22:37 2014 (r260580) +++ head/sys/sys/sglist.h Mon Jan 13 04:41:08 2014 (r260581) @@ -53,6 +53,7 @@ struct sglist { u_short sg_maxseg; }; +struct bio; struct mbuf; struct uio; @@ -83,6 +84,7 @@ sglist_hold(struct sglist *sg) struct sglist *sglist_alloc(int nsegs, int mflags); int sglist_append(struct sglist *sg, void *buf, size_t len); +int sglist_append_bio(struct sglist *sg, struct bio *bp); int sglist_append_mbuf(struct sglist *sg, struct mbuf *m0); int sglist_append_phys(struct sglist *sg, vm_paddr_t paddr, size_t len); From owner-svn-src-head@FreeBSD.ORG Mon Jan 13 04:43:02 2014 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) (using TLSv1 with cipher ADH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id 2F0952B0; Mon, 13 Jan 2014 04:43:02 +0000 (UTC) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mx1.freebsd.org (Postfix) with ESMTPS id 1BA971161; Mon, 13 Jan 2014 04:43: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 s0D4h1Mx090096; Mon, 13 Jan 2014 04:43:01 GMT (envelope-from bryanv@svn.freebsd.org) Received: (from bryanv@localhost) by svn.freebsd.org (8.14.7/8.14.7/Submit) id s0D4h1nS090095; Mon, 13 Jan 2014 04:43:01 GMT (envelope-from bryanv@svn.freebsd.org) Message-Id: <201401130443.s0D4h1nS090095@svn.freebsd.org> From: Bryan Venteicher Date: Mon, 13 Jan 2014 04:43:01 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r260582 - head/sys/dev/virtio/block X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.17 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 13 Jan 2014 04:43:02 -0000 Author: bryanv Date: Mon Jan 13 04:43:01 2014 New Revision: 260582 URL: http://svnweb.freebsd.org/changeset/base/260582 Log: Add unmapped IO support to virtio_blk(4) Modified: head/sys/dev/virtio/block/virtio_blk.c Modified: head/sys/dev/virtio/block/virtio_blk.c ============================================================================== --- head/sys/dev/virtio/block/virtio_blk.c Mon Jan 13 04:41:08 2014 (r260581) +++ head/sys/dev/virtio/block/virtio_blk.c Mon Jan 13 04:43:01 2014 (r260582) @@ -726,7 +726,7 @@ vtblk_alloc_disk(struct vtblk_softc *sc, dp->d_name = VTBLK_DISK_NAME; dp->d_unit = device_get_unit(dev); dp->d_drv1 = sc; - dp->d_flags = DISKFLAG_CANFLUSHCACHE; + dp->d_flags = DISKFLAG_CANFLUSHCACHE | DISKFLAG_UNMAPPED_BIO; dp->d_hba_vendor = virtio_get_vendor(dev); dp->d_hba_device = virtio_get_device(dev); dp->d_hba_subvendor = virtio_get_subvendor(dev); @@ -931,10 +931,11 @@ vtblk_execute_request(struct vtblk_softc sglist_append(sg, &req->vbr_hdr, sizeof(struct virtio_blk_outhdr)); if (bp->bio_cmd == BIO_READ || bp->bio_cmd == BIO_WRITE) { - error = sglist_append(sg, bp->bio_data, bp->bio_bcount); - if (error || sg->sg_nseg == sg->sg_maxseg) + error = sglist_append_bio(sg, bp); + if (error || sg->sg_nseg == sg->sg_maxseg) { panic("%s: data buffer too big bio:%p error:%d", __func__, bp, error); + } /* BIO_READ means the host writes into our buffer. */ if (bp->bio_cmd == BIO_READ) From owner-svn-src-head@FreeBSD.ORG Mon Jan 13 04:46:49 2014 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [8.8.178.115]) (using TLSv1 with cipher ADH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id 42F7940D; Mon, 13 Jan 2014 04:46:49 +0000 (UTC) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mx1.freebsd.org (Postfix) with ESMTPS id 2EF131170; Mon, 13 Jan 2014 04:46:49 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.7/8.14.7) with ESMTP id s0D4knbx090577; Mon, 13 Jan 2014 04:46:49 GMT (envelope-from bryanv@svn.freebsd.org) Received: (from bryanv@localhost) by svn.freebsd.org (8.14.7/8.14.7/Submit) id s0D4knGQ090576; Mon, 13 Jan 2014 04:46:49 GMT (envelope-from bryanv@svn.freebsd.org) Message-Id: <201401130446.s0D4knGQ090576@svn.freebsd.org> From: Bryan Venteicher Date: Mon, 13 Jan 2014 04:46:49 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r260583 - head/sys/dev/virtio/scsi X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.17 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 13 Jan 2014 04:46:49 -0000 Author: bryanv Date: Mon Jan 13 04:46:48 2014 New Revision: 260583 URL: http://svnweb.freebsd.org/changeset/base/260583 Log: Add unmapped IO support to virtio_scsi(4) Modified: head/sys/dev/virtio/scsi/virtio_scsi.c Modified: head/sys/dev/virtio/scsi/virtio_scsi.c ============================================================================== --- head/sys/dev/virtio/scsi/virtio_scsi.c Mon Jan 13 04:43:01 2014 (r260582) +++ head/sys/dev/virtio/scsi/virtio_scsi.c Mon Jan 13 04:46:48 2014 (r260583) @@ -878,7 +878,7 @@ vtscsi_cam_path_inquiry(struct vtscsi_so cpi->version_num = 1; cpi->hba_inquiry = PI_TAG_ABLE; cpi->target_sprt = 0; - cpi->hba_misc = PIM_SEQSCAN; + cpi->hba_misc = PIM_SEQSCAN | PIM_UNMAPPED; if (vtscsi_bus_reset_disable != 0) cpi->hba_misc |= PIM_NOBUSRESET; cpi->hba_eng_cnt = 0; @@ -946,6 +946,9 @@ vtscsi_sg_append_scsi_buf(struct vtscsi_ (vm_paddr_t) dseg->ds_addr, dseg->ds_len); } break; + case CAM_DATA_BIO: + error = sglist_append_bio(sg, (struct bio *) csio->data_ptr); + break; default: error = EINVAL; break; From owner-svn-src-head@FreeBSD.ORG Mon Jan 13 08:03:49 2014 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [8.8.178.115]) (using TLSv1 with cipher ADH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id 49B906A9; Mon, 13 Jan 2014 08:03:49 +0000 (UTC) Received: from cell.glebius.int.ru (glebius.int.ru [81.19.69.10]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mx1.freebsd.org (Postfix) with ESMTPS id C19841EEC; Mon, 13 Jan 2014 08:03:47 +0000 (UTC) Received: from cell.glebius.int.ru (localhost [127.0.0.1]) by cell.glebius.int.ru (8.14.7/8.14.7) with ESMTP id s0D83ekD017488 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=NO); Mon, 13 Jan 2014 12:03:40 +0400 (MSK) (envelope-from glebius@FreeBSD.org) Received: (from glebius@localhost) by cell.glebius.int.ru (8.14.7/8.14.7/Submit) id s0D83edf017487; Mon, 13 Jan 2014 12:03:40 +0400 (MSK) (envelope-from glebius@FreeBSD.org) X-Authentication-Warning: cell.glebius.int.ru: glebius set sender to glebius@FreeBSD.org using -f Date: Mon, 13 Jan 2014 12:03:40 +0400 From: Gleb Smirnoff To: Rui Paulo Subject: Re: svn commit: r260463 - head/sys/dev/usb/wlan Message-ID: <20140113080340.GG8472@FreeBSD.org> References: <201401090148.s091mYZx073572@svn.freebsd.org> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: User-Agent: Mutt/1.5.22 (2013-10-16) Cc: svn-src-head@freebsd.org, Kevin Lo , svn-src-all@freebsd.org, src-committers@freebsd.org X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.17 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 13 Jan 2014 08:03:49 -0000 On Sun, Jan 12, 2014 at 07:27:18PM -0800, Rui Paulo wrote: R> > Replace deprecated M_DONTWAIT with M_NOWAIT. R> R> Argh, just remove M_DONTWAIT already! Yes, I'd like to do that in head, if no objections arise during a week. -- Totus tuus, Glebius. From owner-svn-src-head@FreeBSD.ORG Mon Jan 13 10:47:27 2014 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [8.8.178.115]) (using TLSv1 with cipher ADH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id 09B5BF6B; Mon, 13 Jan 2014 10:47:27 +0000 (UTC) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mx1.freebsd.org (Postfix) with ESMTPS id E9BCC1F53; Mon, 13 Jan 2014 10:47:26 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.7/8.14.7) with ESMTP id s0DAlQFu025359; Mon, 13 Jan 2014 10:47:26 GMT (envelope-from jmmv@svn.freebsd.org) Received: (from jmmv@localhost) by svn.freebsd.org (8.14.7/8.14.7/Submit) id s0DAlQXF025358; Mon, 13 Jan 2014 10:47:26 GMT (envelope-from jmmv@svn.freebsd.org) Message-Id: <201401131047.s0DAlQXF025358@svn.freebsd.org> From: Julio Merino Date: Mon, 13 Jan 2014 10:47:26 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r260584 - head/usr.bin/atf/atf-sh/tests X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.17 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 13 Jan 2014 10:47:27 -0000 Author: jmmv Date: Mon Jan 13 10:47:26 2014 New Revision: 260584 URL: http://svnweb.freebsd.org/changeset/base/260584 Log: Prevent misc_helpers from running as a test. Do this by generating misc_helpers explicitly, without using the ATF_TESTS_SH functionality. While this script is technically an atf-sh test program, it is not intended to be run as a test and therefore it mustn't end up in the Kyuafile. Using ATF_TESTS_SH means that misc_helpers ended up registered in the Kyuafile and then failed to run as a test. The alternative would be to supply an explicit Kyuafile from this directory that lists the known test files, but doing it the way described above will be easier to maintain. MFC after: 3 days Modified: head/usr.bin/atf/atf-sh/tests/Makefile Modified: head/usr.bin/atf/atf-sh/tests/Makefile ============================================================================== --- head/usr.bin/atf/atf-sh/tests/Makefile Mon Jan 13 04:46:48 2014 (r260583) +++ head/usr.bin/atf/atf-sh/tests/Makefile Mon Jan 13 10:47:26 2014 (r260584) @@ -10,9 +10,17 @@ ATF= ${.CURDIR:H:H:H:H}/contrib/atf ATF_TESTS_SH+= atf_check_test ATF_TESTS_SH+= config_test ATF_TESTS_SH+= integration_test -ATF_TESTS_SH+= misc_helpers ATF_TESTS_SH+= normalize_test ATF_TESTS_SH+= tc_test ATF_TESTS_SH+= tp_test +SCRIPTS+= misc_helpers +SCRIPTSDIR_misc_helpers=${TESTSDIR} +CLEANFILES+= misc_helpers misc_helpers.tmp +misc_helpers: misc_helpers.sh + echo '#! /usr/bin/atf-sh' >${.TARGET}.tmp + cat ${.ALLSRC} >>${.TARGET}.tmp + chmod +x ${.TARGET}.tmp + mv ${.TARGET}.tmp ${.TARGET} + .include From owner-svn-src-head@FreeBSD.ORG Mon Jan 13 12:17:42 2014 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [8.8.178.115]) (using TLSv1 with cipher ADH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id 2197070; Mon, 13 Jan 2014 12:17:42 +0000 (UTC) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mx1.freebsd.org (Postfix) with ESMTPS id 0D6E6181D; Mon, 13 Jan 2014 12:17: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 s0DCHfw5060496; Mon, 13 Jan 2014 12:17:41 GMT (envelope-from jmmv@svn.freebsd.org) Received: (from jmmv@localhost) by svn.freebsd.org (8.14.7/8.14.7/Submit) id s0DCHflD060494; Mon, 13 Jan 2014 12:17:41 GMT (envelope-from jmmv@svn.freebsd.org) Message-Id: <201401131217.s0DCHflD060494@svn.freebsd.org> From: Julio Merino Date: Mon, 13 Jan 2014 12:17:41 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r260586 - head/bin/pax/tests X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.17 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 13 Jan 2014 12:17:42 -0000 Author: jmmv Date: Mon Jan 13 12:17:41 2014 New Revision: 260586 URL: http://svnweb.freebsd.org/changeset/base/260586 Log: Mark the bin/pax tests as requiring perl. The effect of this is that the test program is marked as skipped when perl is missing, instead of marking it as broken due to an execution failure. MFC after: 3 days Added: head/bin/pax/tests/Kyuafile (contents, props changed) Modified: head/bin/pax/tests/Makefile Added: head/bin/pax/tests/Kyuafile ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ head/bin/pax/tests/Kyuafile Mon Jan 13 12:17:41 2014 (r260586) @@ -0,0 +1,7 @@ +-- $FreeBSD$ + +syntax(2) + +test_suite("FreeBSD") + +tap_test_program{name="legacy_test", required_programs="/usr/bin/perl"} Modified: head/bin/pax/tests/Makefile ============================================================================== --- head/bin/pax/tests/Makefile Mon Jan 13 11:51:12 2014 (r260585) +++ head/bin/pax/tests/Makefile Mon Jan 13 12:17:41 2014 (r260586) @@ -3,6 +3,7 @@ .include TESTSDIR= ${TESTSBASE}/bin/pax +KYUAFILE= yes TAP_TESTS_SH= legacy_test From owner-svn-src-head@FreeBSD.ORG Mon Jan 13 13:27:01 2014 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) (using TLSv1 with cipher ADH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id 6987BF61; Mon, 13 Jan 2014 13:27:01 +0000 (UTC) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mx1.freebsd.org (Postfix) with ESMTPS id 49A5D1F87; Mon, 13 Jan 2014 13:27:01 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.7/8.14.7) with ESMTP id s0DDR1Yk086746; Mon, 13 Jan 2014 13:27:01 GMT (envelope-from hselasky@svn.freebsd.org) Received: (from hselasky@localhost) by svn.freebsd.org (8.14.7/8.14.7/Submit) id s0DDR0Nn086741; Mon, 13 Jan 2014 13:27:00 GMT (envelope-from hselasky@svn.freebsd.org) Message-Id: <201401131327.s0DDR0Nn086741@svn.freebsd.org> From: Hans Petter Selasky Date: Mon, 13 Jan 2014 13:27:00 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r260587 - head/tools/tools/usbtest X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.17 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 13 Jan 2014 13:27:01 -0000 Author: hselasky Date: Mon Jan 13 13:27:00 2014 New Revision: 260587 URL: http://svnweb.freebsd.org/changeset/base/260587 Log: Add new testcase for USB mass storage. Modified: head/tools/tools/usbtest/usb_msc_test.c head/tools/tools/usbtest/usb_msc_test.h Modified: head/tools/tools/usbtest/usb_msc_test.c ============================================================================== --- head/tools/tools/usbtest/usb_msc_test.c Mon Jan 13 12:17:41 2014 (r260586) +++ head/tools/tools/usbtest/usb_msc_test.c Mon Jan 13 13:27:00 2014 (r260587) @@ -255,6 +255,35 @@ do_msc_cmd(uint8_t *pcmd, uint8_t cmdlen } } +static void +do_msc_shorter_cmd(uint8_t lun) +{ + uint8_t buffer[sizeof(umass_bbb_cbw_t)]; + int actlen; + int error; + int x; + + memset(buffer, 0, sizeof(buffer)); + + for (x = 0; x != (sizeof(buffer) - 1); x++) { + error = libusb20_tr_bulk_intr_sync(xfer_out, + buffer, x, &actlen, 250); + + printf("Sent short %d of %d bytes wrapper block, " + "status = %d\n", x, (int)(sizeof(buffer) - 1), + error); + + do_msc_reset(lun); + + if (error != 0) { + printf("ERROR: Too short command wrapper " + "was not accepted\n"); + stats.xfer_error++; + break; + } + } +} + static uint8_t do_read_10(uint32_t lba, uint32_t len, void *buf, uint8_t lun) { @@ -564,6 +593,11 @@ usb_msc_test(struct usb_msc_params *p) if (capacity_bs != 512) printf("INFO: Blocksize is not 512 bytes\n"); + if (p->try_shorter_wrapper_block) { + printf("Trying too short command wrapper:\n"); + do_msc_shorter_cmd(lun); + } + if (p->try_invalid_scsi_command) { int status; @@ -1195,6 +1229,7 @@ show_host_msc_test(uint8_t level, uint16 "14) Toggle try aborted write transfer: <%s>\n" "15) Toggle request sense on error: <%s>\n" "16) Toggle try all LUN: <%s>\n" + "17) Toggle try too short wrapper block: <%s>\n" "20) Reset parameters\n" "30) Start test (VID=0x%04x, PID=0x%04x)\n" "40) Select another device\n" @@ -1215,6 +1250,7 @@ show_host_msc_test(uint8_t level, uint16 (params.try_abort_data_write ? "YES" : "NO"), (params.try_sense_on_error ? "YES" : "NO"), (params.try_all_lun ? "YES" : "NO"), + (params.try_shorter_wrapper_block ? "YES" : "NO"), vid, pid); switch (retval) { case 0: @@ -1274,6 +1310,9 @@ show_host_msc_test(uint8_t level, uint16 case 16: params.try_all_lun ^= 1; break; + case 17: + params.try_shorter_wrapper_block ^= 1; + break; case 20: set_defaults(¶ms); break; Modified: head/tools/tools/usbtest/usb_msc_test.h ============================================================================== --- head/tools/tools/usbtest/usb_msc_test.h Mon Jan 13 12:17:41 2014 (r260586) +++ head/tools/tools/usbtest/usb_msc_test.h Mon Jan 13 13:27:00 2014 (r260587) @@ -109,6 +109,7 @@ struct usb_msc_params { uint8_t try_invalid_scsi_command; uint8_t try_invalid_wrapper_block; uint8_t try_invalid_max_packet_size; + uint8_t try_shorter_wrapper_block; uint8_t try_last_lba; uint8_t try_abort_data_write; uint8_t try_sense_on_error; From owner-svn-src-head@FreeBSD.ORG Mon Jan 13 13:59:35 2014 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [8.8.178.115]) (using TLSv1 with cipher ADH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id AE2394BA; Mon, 13 Jan 2014 13:59:35 +0000 (UTC) Received: from mail-wi0-x22a.google.com (mail-wi0-x22a.google.com [IPv6:2a00:1450:400c:c05::22a]) (using TLSv1 with cipher ECDHE-RSA-RC4-SHA (128/128 bits)) (No client certificate requested) by mx1.freebsd.org (Postfix) with ESMTPS id C709211AA; Mon, 13 Jan 2014 13:59:34 +0000 (UTC) Received: by mail-wi0-f170.google.com with SMTP id hq4so3062243wib.5 for ; Mon, 13 Jan 2014 05:59:33 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=sender:date:from:to:cc:subject:message-id:references:mime-version :content-type:content-disposition:in-reply-to:user-agent; bh=0SdArSLie1nYYVnO1d71xTy9Lu4a8oZwIUhRYv4KPS0=; b=nXBbFfgYt7kx3VSSOcYI/S4yoMY3FdWnFnIjzZF0xJKQ0cJ4+qG/YAo+tGhRp1Hi66 O8hLztgHy5YOCYkGsSs99PclediYKzzrqu+Dcp4Py5fQzMCD+Js6pXsSImKatUtYiYFu 5w5G73Eaz7G7VmjSGfDypqy5PjZgbcdnHoErSf7iA0sOVP6oOlDnYZa/EdSU4yx2/PQg Mgilzdt4JGVi6lr4mfwbOTTRtP9FP3I0Hkhe+l2a1SBEq3X5M1sJMpQa6Iw/eDmh9end 8kkUoysqEcxoxsEet0ZUyTjk/hVK3nHwdwOqqDBfmP4/iTZPRl/pnq+PIp3tt9Idq05Z tOPQ== X-Received: by 10.180.212.98 with SMTP id nj2mr15660930wic.52.1389621573032; Mon, 13 Jan 2014 05:59:33 -0800 (PST) Received: from ithaqua.etoilebsd.net (ithaqua.etoilebsd.net. [37.59.37.188]) by mx.google.com with ESMTPSA id cy10sm11548795wjb.6.2014.01.13.05.59.31 for (version=TLSv1 cipher=RC4-SHA bits=128/128); Mon, 13 Jan 2014 05:59:32 -0800 (PST) Sender: Baptiste Daroussin Date: Mon, 13 Jan 2014 14:59:30 +0100 From: Baptiste Daroussin To: Julio Merino Subject: Re: svn commit: r260586 - head/bin/pax/tests Message-ID: <20140113135930.GR97375@ithaqua.etoilebsd.net> References: <201401131217.s0DCHflD060494@svn.freebsd.org> MIME-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha1; protocol="application/pgp-signature"; boundary="CPn8Wy5ME997YUMW" Content-Disposition: inline In-Reply-To: <201401131217.s0DCHflD060494@svn.freebsd.org> User-Agent: Mutt/1.5.21 (2010-09-15) Cc: svn-src-head@freebsd.org, svn-src-all@freebsd.org, src-committers@freebsd.org X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.17 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 13 Jan 2014 13:59:35 -0000 --CPn8Wy5ME997YUMW Content-Type: text/plain; charset=us-ascii Content-Disposition: inline Content-Transfer-Encoding: quoted-printable On Mon, Jan 13, 2014 at 12:17:41PM +0000, Julio Merino wrote: > Author: jmmv > Date: Mon Jan 13 12:17:41 2014 > New Revision: 260586 > URL: http://svnweb.freebsd.org/changeset/base/260586 >=20 > Log: > Mark the bin/pax tests as requiring perl. > =20 > The effect of this is that the test program is marked as skipped when p= erl > is missing, instead of marking it as broken due to an execution failure. > =20 > MFC after: 3 days >=20 > Added: > head/bin/pax/tests/Kyuafile (contents, props changed) > Modified: > head/bin/pax/tests/Makefile >=20 > Added: head/bin/pax/tests/Kyuafile > =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D > --- /dev/null 00:00:00 1970 (empty, because file is newly added) > +++ head/bin/pax/tests/Kyuafile Mon Jan 13 12:17:41 2014 (r260586) > @@ -0,0 +1,7 @@ > +-- $FreeBSD$ > + > +syntax(2) > + > +test_suite("FreeBSD") > + > +tap_test_program{name=3D"legacy_test", required_programs=3D"/usr/bin/per= l"} Shouldn't that be /usr/local/bin/perl or ${LOCALBASE}/bin/perl, we are tryi= ng hard on ports to remove by default /usr/bin/perl which is a legacy from the removal of perl from base. regards, Bapt --CPn8Wy5ME997YUMW Content-Type: application/pgp-signature -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.4.15 (FreeBSD) iEYEARECAAYFAlLT8UIACgkQ8kTtMUmk6Ew9oQCdHwNufQ93ocKq/LPh6tnRBdkf GZkAnjeW8OITn1LUCKjYeN/MQjXdvvPM =eVta -----END PGP SIGNATURE----- --CPn8Wy5ME997YUMW-- From owner-svn-src-head@FreeBSD.ORG Mon Jan 13 14:40:58 2014 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) (using TLSv1 with cipher ADH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id 84972370 for ; Mon, 13 Jan 2014 14:40:58 +0000 (UTC) Received: from mail-wi0-f176.google.com (mail-wi0-f176.google.com [209.85.212.176]) (using TLSv1 with cipher ECDHE-RSA-RC4-SHA (128/128 bits)) (No client certificate requested) by mx1.freebsd.org (Postfix) with ESMTPS id 179B71574 for ; Mon, 13 Jan 2014 14:40:57 +0000 (UTC) Received: by mail-wi0-f176.google.com with SMTP id hq4so2303854wib.15 for ; Mon, 13 Jan 2014 06:40:56 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:content-type:mime-version:subject:from :in-reply-to:date:cc:content-transfer-encoding:message-id:references :to; bh=gWgRAoyE2qWfSRteMbVtgWYa7WN7Osec6yN8Z8dma+I=; b=nA4+/Ur7mEASXS75Pp8y+Jl7LvOCF4gvychXYagpVWsRyStnmsCEYsaMCbVUbzf6JG jilNDWwGTjtyEVFCX/s/U+HuClNDYC4qyj+Yc4xTYEEXD1N220bu+x0i3zpCAhuAm/EU tZv0JBMHyqZuFHnUsx5oue1Esl4B9Siz+GCb4BXFoNwQ1lt4nAeSpQKf3qIdk8X9/J6G 8UsSBvuZXoCxjpb8p94lXCTwoeuh3pRt8QpZIkAR1penMUo2IZuP5GvVR5pmVMc6vTQq 5iQCrtUaSuiLJwrU4LMKupegSqykoDZqGUX4+dXcfkMR5Y/HTykBAx9QyuZjjLXk6ZTB ZKlA== X-Gm-Message-State: ALoCoQlcWfONdCSeff3f4wLlMIFVceQGMpkYjKAyyXvJKh7HHV1B8z+ydySATv8TtoBWiHLfBu38 X-Received: by 10.194.133.34 with SMTP id oz2mr22284090wjb.14.1389623677278; Mon, 13 Jan 2014 06:34:37 -0800 (PST) Received: from [192.168.1.118] (62.57.0.127.dyn.user.ono.com. [62.57.0.127]) by mx.google.com with ESMTPSA id 5sm3464684wjw.17.2014.01.13.06.34.32 for (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Mon, 13 Jan 2014 06:34:33 -0800 (PST) Content-Type: text/plain; charset=us-ascii Mime-Version: 1.0 (Mac OS X Mail 7.1 \(1827\)) Subject: Re: svn commit: r260586 - head/bin/pax/tests From: Julio Merino In-Reply-To: <20140113135930.GR97375@ithaqua.etoilebsd.net> Date: Mon, 13 Jan 2014 15:34:31 +0100 Content-Transfer-Encoding: quoted-printable Message-Id: <01D805C2-AB9D-48F5-A972-FC7E801DC21E@meroh.net> References: <201401131217.s0DCHflD060494@svn.freebsd.org> <20140113135930.GR97375@ithaqua.etoilebsd.net> To: Baptiste Daroussin X-Mailer: Apple Mail (2.1827) Cc: svn-src-head@freebsd.org, svn-src-all@freebsd.org, Julio Merino , src-committers@freebsd.org X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.17 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 13 Jan 2014 14:40:58 -0000 On Jan 13, 2014, at 14:59, Baptiste Daroussin wrote: > On Mon, Jan 13, 2014 at 12:17:41PM +0000, Julio Merino wrote: >> +tap_test_program{name=3D"legacy_test", = required_programs=3D"/usr/bin/perl"} >=20 > Shouldn't that be /usr/local/bin/perl or ${LOCALBASE}/bin/perl, we are = trying > hard on ports to remove by default /usr/bin/perl which is a legacy = from the > removal of perl from base. Only if legacy_test.sh is also modified to use /usr/local/bin/perl. (I = don't think using LOCALBASE is possible given that it's not accessible = from share/mk/.) If it's the right thing to do, I can change it.= From owner-svn-src-head@FreeBSD.ORG Mon Jan 13 15:06:04 2014 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [8.8.178.115]) (using TLSv1 with cipher ADH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id 53EF78A5; Mon, 13 Jan 2014 15:06:04 +0000 (UTC) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mx1.freebsd.org (Postfix) with ESMTPS id 3F4841781; Mon, 13 Jan 2014 15:06: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 s0DF64IA024948; Mon, 13 Jan 2014 15:06:04 GMT (envelope-from hselasky@svn.freebsd.org) Received: (from hselasky@localhost) by svn.freebsd.org (8.14.7/8.14.7/Submit) id s0DF633w024946; Mon, 13 Jan 2014 15:06:03 GMT (envelope-from hselasky@svn.freebsd.org) Message-Id: <201401131506.s0DF633w024946@svn.freebsd.org> From: Hans Petter Selasky Date: Mon, 13 Jan 2014 15:06:03 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r260588 - head/sys/dev/usb/controller X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.17 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 13 Jan 2014 15:06:04 -0000 Author: hselasky Date: Mon Jan 13 15:06:03 2014 New Revision: 260588 URL: http://svnweb.freebsd.org/changeset/base/260588 Log: Separate I/O errors from reception of STALL PID. MFC after: 1 week Modified: head/sys/dev/usb/controller/ehci.c head/sys/dev/usb/controller/uhci.c Modified: head/sys/dev/usb/controller/ehci.c ============================================================================== --- head/sys/dev/usb/controller/ehci.c Mon Jan 13 13:27:00 2014 (r260587) +++ head/sys/dev/usb/controller/ehci.c Mon Jan 13 15:06:03 2014 (r260588) @@ -1198,9 +1198,16 @@ ehci_non_isoc_done_sub(struct usb_xfer * (status & EHCI_QTD_PINGSTATE) ? "[PING]" : ""); } #endif - - return ((status & EHCI_QTD_HALTED) ? - USB_ERR_STALLED : USB_ERR_NORMAL_COMPLETION); + if (status & EHCI_QTD_HALTED) { + if ((xfer->xroot->udev->parent_hs_hub != NULL) || + (xfer->xroot->udev->address != 0)) { + /* try to separate I/O errors from STALL */ + if (EHCI_QTD_GET_CERR(status) == 0) + return (USB_ERR_IOERROR); + } + return (USB_ERR_STALLED); + } + return (USB_ERR_NORMAL_COMPLETION); } static void Modified: head/sys/dev/usb/controller/uhci.c ============================================================================== --- head/sys/dev/usb/controller/uhci.c Mon Jan 13 13:27:00 2014 (r260587) +++ head/sys/dev/usb/controller/uhci.c Mon Jan 13 15:06:03 2014 (r260588) @@ -1179,8 +1179,13 @@ uhci_non_isoc_done_sub(struct usb_xfer * (status & UHCI_TD_SPD) ? "[SPD]" : ""); } #endif - return (status & UHCI_TD_STALLED) ? - USB_ERR_STALLED : USB_ERR_NORMAL_COMPLETION; + if (status & UHCI_TD_STALLED) { + /* try to separate I/O errors from STALL */ + if (UHCI_TD_GET_ERRCNT(status) == 0) + return (USB_ERR_IOERROR); + return (USB_ERR_STALLED); + } + return (USB_ERR_NORMAL_COMPLETION); } static void From owner-svn-src-head@FreeBSD.ORG Mon Jan 13 15:21:13 2014 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) (using TLSv1 with cipher ADH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id 267ABC97; Mon, 13 Jan 2014 15:21:13 +0000 (UTC) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mx1.freebsd.org (Postfix) with ESMTPS id 1170318D9; Mon, 13 Jan 2014 15:21:13 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.7/8.14.7) with ESMTP id s0DFLD5c031747; Mon, 13 Jan 2014 15:21:13 GMT (envelope-from hselasky@svn.freebsd.org) Received: (from hselasky@localhost) by svn.freebsd.org (8.14.7/8.14.7/Submit) id s0DFLBcO031738; Mon, 13 Jan 2014 15:21:11 GMT (envelope-from hselasky@svn.freebsd.org) Message-Id: <201401131521.s0DFLBcO031738@svn.freebsd.org> From: Hans Petter Selasky Date: Mon, 13 Jan 2014 15:21:11 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r260589 - head/sys/dev/usb X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.17 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 13 Jan 2014 15:21:13 -0000 Author: hselasky Date: Mon Jan 13 15:21:11 2014 New Revision: 260589 URL: http://svnweb.freebsd.org/changeset/base/260589 Log: Implement better error recovery for Transaction Translators, TTs, found in High Speed USB HUBs which translate from High Speed USB into FULL or LOW speed USB. In some rare cases SPLIT transactions might get lost, which might leave the TT in an unknown state. Whenever we detect such an error try to issue either a clear TT buffer request, or if that is not possible reset the whole TT. MFC after: 1 week Modified: head/sys/dev/usb/usb_device.c head/sys/dev/usb/usb_device.h head/sys/dev/usb/usb_hub.c head/sys/dev/usb/usb_hub.h head/sys/dev/usb/usb_request.c head/sys/dev/usb/usb_transfer.c Modified: head/sys/dev/usb/usb_device.c ============================================================================== --- head/sys/dev/usb/usb_device.c Mon Jan 13 15:06:03 2014 (r260588) +++ head/sys/dev/usb/usb_device.c Mon Jan 13 15:21:11 2014 (r260589) @@ -98,7 +98,7 @@ static void usb_init_attach_arg(struct u struct usb_attach_arg *); static void usb_suspend_resume_sub(struct usb_device *, device_t, uint8_t); -static void usbd_clear_stall_proc(struct usb_proc_msg *_pm); +static usb_proc_callback_t usbd_clear_stall_proc; static usb_error_t usb_config_parse(struct usb_device *, uint8_t, uint8_t); static void usbd_set_device_strings(struct usb_device *); #if USB_HAVE_DEVCTL @@ -1474,7 +1474,7 @@ usb_suspend_resume(struct usb_device *ud static void usbd_clear_stall_proc(struct usb_proc_msg *_pm) { - struct usb_clear_stall_msg *pm = (void *)_pm; + struct usb_udev_msg *pm = (void *)_pm; struct usb_device *udev = pm->udev; /* Change lock */ Modified: head/sys/dev/usb/usb_device.h ============================================================================== --- head/sys/dev/usb/usb_device.h Mon Jan 13 15:06:03 2014 (r260588) +++ head/sys/dev/usb/usb_device.h Mon Jan 13 15:21:11 2014 (r260589) @@ -53,7 +53,7 @@ struct usb_symlink; /* UGEN */ #define USB_UNCFG_FLAG_NONE 0x00 #define USB_UNCFG_FLAG_FREE_EP0 0x02 /* endpoint zero is freed */ -struct usb_clear_stall_msg { +struct usb_udev_msg { struct usb_proc_msg hdr; struct usb_device *udev; }; @@ -179,8 +179,8 @@ union usb_device_scratch { * these structures for every USB device. */ struct usb_device { - struct usb_clear_stall_msg cs_msg[2]; /* generic clear stall - * messages */ + /* generic clear stall message */ + struct usb_udev_msg cs_msg[2]; struct sx enum_sx; struct sx sr_sx; struct mtx device_mtx; @@ -316,4 +316,10 @@ void usbd_sr_lock(struct usb_device *); void usbd_sr_unlock(struct usb_device *); uint8_t usbd_enum_is_locked(struct usb_device *); +#if USB_HAVE_TT_SUPPORT +void uhub_tt_buffer_reset_async_locked(struct usb_device *, struct usb_endpoint *); +#endif + +uint8_t uhub_count_active_host_ports(struct usb_device *, enum usb_dev_speed); + #endif /* _USB_DEVICE_H_ */ Modified: head/sys/dev/usb/usb_hub.c ============================================================================== --- head/sys/dev/usb/usb_hub.c Mon Jan 13 15:06:03 2014 (r260588) +++ head/sys/dev/usb/usb_hub.c Mon Jan 13 15:21:11 2014 (r260589) @@ -74,7 +74,13 @@ #endif /* USB_GLOBAL_INCLUDE_FILE */ #define UHUB_INTR_INTERVAL 250 /* ms */ -#define UHUB_N_TRANSFER 1 +enum { + UHUB_INTR_TRANSFER, +#if USB_HAVE_TT_SUPPORT + UHUB_RESET_TT_TRANSFER, +#endif + UHUB_N_TRANSFER, +}; #ifdef USB_DEBUG static int uhub_debug = 0; @@ -129,6 +135,9 @@ static bus_child_location_str_t uhub_chi static bus_child_pnpinfo_str_t uhub_child_pnpinfo_string; static usb_callback_t uhub_intr_callback; +#if USB_HAVE_TT_SUPPORT +static usb_callback_t uhub_reset_tt_callback; +#endif static void usb_dev_resume_peer(struct usb_device *udev); static void usb_dev_suspend_peer(struct usb_device *udev); @@ -136,7 +145,7 @@ static uint8_t usb_peer_should_wakeup(st static const struct usb_config uhub_config[UHUB_N_TRANSFER] = { - [0] = { + [UHUB_INTR_TRANSFER] = { .type = UE_INTERRUPT, .endpoint = UE_ADDR_ANY, .direction = UE_DIR_ANY, @@ -146,6 +155,17 @@ static const struct usb_config uhub_conf .callback = &uhub_intr_callback, .interval = UHUB_INTR_INTERVAL, }, +#if USB_HAVE_TT_SUPPORT + [UHUB_RESET_TT_TRANSFER] = { + .type = UE_CONTROL, + .endpoint = 0x00, /* Control pipe */ + .direction = UE_DIR_ANY, + .bufsize = sizeof(struct usb_device_request), + .callback = &uhub_reset_tt_callback, + .timeout = 1000, /* 1 second */ + .usb_mode = USB_MODE_HOST, + }, +#endif }; /* @@ -215,6 +235,199 @@ uhub_intr_callback(struct usb_xfer *xfer } /*------------------------------------------------------------------------* + * uhub_reset_tt_proc + * + * This function starts the TT reset USB request + *------------------------------------------------------------------------*/ +#if USB_HAVE_TT_SUPPORT +static void +uhub_reset_tt_proc(struct usb_proc_msg *_pm) +{ + struct usb_udev_msg *pm = (void *)_pm; + struct usb_device *udev = pm->udev; + struct usb_hub *hub; + struct uhub_softc *sc; + + hub = udev->hub; + if (hub == NULL) + return; + sc = hub->hubsoftc; + if (sc == NULL) + return; + + /* Change lock */ + USB_BUS_UNLOCK(udev->bus); + mtx_lock(&sc->sc_mtx); + /* Start transfer */ + usbd_transfer_start(sc->sc_xfer[UHUB_RESET_TT_TRANSFER]); + /* Change lock */ + mtx_unlock(&sc->sc_mtx); + USB_BUS_LOCK(udev->bus); +} +#endif + +/*------------------------------------------------------------------------* + * uhub_tt_buffer_reset_async_locked + * + * This function queues a TT reset for the given USB device and endpoint. + *------------------------------------------------------------------------*/ +#if USB_HAVE_TT_SUPPORT +void +uhub_tt_buffer_reset_async_locked(struct usb_device *child, struct usb_endpoint *ep) +{ + struct usb_device_request req; + struct usb_device *udev; + struct usb_hub *hub; + struct usb_port *up; + uint16_t wValue; + uint8_t port; + + if (child == NULL || ep == NULL) + return; + + udev = child->parent_hs_hub; + port = child->hs_port_no; + + if (udev == NULL) + return; + + hub = udev->hub; + if ((hub == NULL) || + (udev->speed != USB_SPEED_HIGH) || + (child->speed != USB_SPEED_LOW && + child->speed != USB_SPEED_FULL) || + (child->flags.usb_mode != USB_MODE_HOST) || + (port == 0) || (ep->edesc == NULL)) { + /* not applicable */ + return; + } + + USB_BUS_LOCK_ASSERT(udev->bus, MA_OWNED); + + up = hub->ports + port - 1; + + if (udev->ddesc.bDeviceClass == UDCLASS_HUB && + udev->ddesc.bDeviceProtocol == UDPROTO_HSHUBSTT) + port = 1; + + /* if we already received a clear buffer request, reset the whole TT */ + if (up->req_reset_tt.bRequest != 0) { + req.bmRequestType = UT_WRITE_CLASS_OTHER; + req.bRequest = UR_RESET_TT; + USETW(req.wValue, 0); + req.wIndex[0] = port; + req.wIndex[1] = 0; + USETW(req.wLength, 0); + } else { + wValue = (ep->edesc->bEndpointAddress & 0xF) | + ((child->address & 0x7F) << 4) | + ((ep->edesc->bEndpointAddress & 0x80) << 8) | + ((ep->edesc->bmAttributes & 3) << 12); + + req.bmRequestType = UT_WRITE_CLASS_OTHER; + req.bRequest = UR_CLEAR_TT_BUFFER; + USETW(req.wValue, wValue); + req.wIndex[0] = port; + req.wIndex[1] = 0; + USETW(req.wLength, 0); + } + up->req_reset_tt = req; + /* get reset transfer started */ + usb_proc_msignal(USB_BUS_NON_GIANT_PROC(udev->bus), + &hub->tt_msg[0], &hub->tt_msg[1]); +} +#endif + +#if USB_HAVE_TT_SUPPORT +static void +uhub_reset_tt_callback(struct usb_xfer *xfer, usb_error_t error) +{ + struct uhub_softc *sc; + struct usb_device *udev; + struct usb_port *up; + uint8_t x; + + DPRINTF("TT buffer reset\n"); + + sc = usbd_xfer_softc(xfer); + udev = sc->sc_udev; + + switch (USB_GET_STATE(xfer)) { + case USB_ST_TRANSFERRED: + case USB_ST_SETUP: +tr_setup: + USB_BUS_LOCK(udev->bus); + /* find first port which needs a TT reset */ + for (x = 0; x != udev->hub->nports; x++) { + up = udev->hub->ports + x; + + if (up->req_reset_tt.bRequest == 0) + continue; + + /* copy in the transfer */ + usbd_copy_in(xfer->frbuffers, 0, &up->req_reset_tt, + sizeof(up->req_reset_tt)); + /* reset buffer */ + memset(&up->req_reset_tt, 0, sizeof(up->req_reset_tt)); + + /* set length */ + usbd_xfer_set_frame_len(xfer, 0, sizeof(up->req_reset_tt)); + xfer->nframes = 1; + USB_BUS_UNLOCK(udev->bus); + + usbd_transfer_submit(xfer); + return; + } + USB_BUS_UNLOCK(udev->bus); + break; + + default: + if (error == USB_ERR_CANCELLED) + break; + + DPRINTF("TT buffer reset failed (%s)\n", usbd_errstr(error)); + goto tr_setup; + } +} +#endif + +/*------------------------------------------------------------------------* + * uhub_count_active_host_ports + * + * This function counts the number of active ports at the given speed. + *------------------------------------------------------------------------*/ +uint8_t +uhub_count_active_host_ports(struct usb_device *udev, enum usb_dev_speed speed) +{ + struct uhub_softc *sc; + struct usb_device *child; + struct usb_hub *hub; + struct usb_port *up; + uint8_t retval = 0; + uint8_t x; + + if (udev == NULL) + goto done; + hub = udev->hub; + if (hub == NULL) + goto done; + sc = hub->hubsoftc; + if (sc == NULL) + goto done; + + for (x = 0; x != hub->nports; x++) { + up = hub->ports + x; + child = usb_bus_port_get_device(udev->bus, up); + if (child != NULL && + child->flags.usb_mode == USB_MODE_HOST && + child->speed == speed) + retval++; + } +done: + return (retval); +} + +/*------------------------------------------------------------------------* * uhub_explore_sub - subroutine * * Return values: @@ -1114,7 +1327,12 @@ uhub_attach(device_t dev) hub->explore = &uhub_explore; hub->nports = nports; hub->hubudev = udev; - +#if USB_HAVE_TT_SUPPORT + hub->tt_msg[0].hdr.pm_callback = &uhub_reset_tt_proc; + hub->tt_msg[0].udev = udev; + hub->tt_msg[1].hdr.pm_callback = &uhub_reset_tt_proc; + hub->tt_msg[1].udev = udev; +#endif /* if self powered hub, give ports maximum current */ if (udev->flags.self_powered) { hub->portpower = USB_MAX_POWER; @@ -1216,11 +1434,9 @@ uhub_attach(device_t dev) /* Start the interrupt endpoint, if any */ - if (sc->sc_xfer[0] != NULL) { - mtx_lock(&sc->sc_mtx); - usbd_transfer_start(sc->sc_xfer[0]); - mtx_unlock(&sc->sc_mtx); - } + mtx_lock(&sc->sc_mtx); + usbd_transfer_start(sc->sc_xfer[UHUB_INTR_TRANSFER]); + mtx_unlock(&sc->sc_mtx); /* Enable automatic power save on all USB HUBs */ @@ -1250,6 +1466,7 @@ uhub_detach(device_t dev) { struct uhub_softc *sc = device_get_softc(dev); struct usb_hub *hub = sc->sc_udev->hub; + struct usb_bus *bus = sc->sc_udev->bus; struct usb_device *child; uint8_t x; @@ -1262,7 +1479,7 @@ uhub_detach(device_t dev) /* Detach all ports */ for (x = 0; x != hub->nports; x++) { - child = usb_bus_port_get_device(sc->sc_udev->bus, hub->ports + x); + child = usb_bus_port_get_device(bus, hub->ports + x); if (child == NULL) { continue; @@ -1274,6 +1491,14 @@ uhub_detach(device_t dev) usb_free_device(child, 0); } +#if USB_HAVE_TT_SUPPORT + /* Make sure our TT messages are not queued anywhere */ + USB_BUS_LOCK(bus); + usb_proc_mwait(USB_BUS_NON_GIANT_PROC(bus), + &hub->tt_msg[0], &hub->tt_msg[1]); + USB_BUS_UNLOCK(bus); +#endif + #if (USB_HAVE_FIXED_PORT == 0) free(hub, M_USBDEV); #endif Modified: head/sys/dev/usb/usb_hub.h ============================================================================== --- head/sys/dev/usb/usb_hub.h Mon Jan 13 15:06:03 2014 (r260588) +++ head/sys/dev/usb/usb_hub.h Mon Jan 13 15:21:11 2014 (r260589) @@ -35,6 +35,9 @@ struct usb_port { #define USB_RESTART_MAX 5 uint8_t device_index; /* zero means not valid */ enum usb_hc_mode usb_mode; /* host or device mode */ +#if USB_HAVE_TT_SUPPORT + struct usb_device_request req_reset_tt __aligned(4); +#endif }; /* @@ -44,6 +47,9 @@ struct usb_hub { struct usb_device *hubudev; /* the HUB device */ usb_error_t (*explore) (struct usb_device *hub); void *hubsoftc; +#if USB_HAVE_TT_SUPPORT + struct usb_udev_msg tt_msg[2]; +#endif usb_size_t uframe_usage[USB_HS_MICRO_FRAMES_MAX]; uint16_t portpower; /* mA per USB port */ uint8_t isoc_last_time; Modified: head/sys/dev/usb/usb_request.c ============================================================================== --- head/sys/dev/usb/usb_request.c Mon Jan 13 15:06:03 2014 (r260588) +++ head/sys/dev/usb/usb_request.c Mon Jan 13 15:21:11 2014 (r260589) @@ -721,6 +721,17 @@ done: if ((mtx != NULL) && (mtx != &Giant)) mtx_lock(mtx); + switch (err) { + case USB_ERR_NORMAL_COMPLETION: + case USB_ERR_SHORT_XFER: + case USB_ERR_STALLED: + case USB_ERR_CANCELLED: + break; + default: + DPRINTF("I/O error - waiting a bit for TT cleanup\n"); + usb_pause_mtx(mtx, hz / 16); + break; + } return ((usb_error_t)err); } @@ -2010,6 +2021,7 @@ usbd_req_re_enumerate(struct usb_device return (USB_ERR_INVAL); } retry: +#if USB_HAVE_TT_SUPPORT /* * Try to reset the High Speed parent HUB of a LOW- or FULL- * speed device, if any. @@ -2017,15 +2029,24 @@ retry: if (udev->parent_hs_hub != NULL && udev->speed != USB_SPEED_HIGH) { DPRINTF("Trying to reset parent High Speed TT.\n"); - err = usbd_req_reset_tt(udev->parent_hs_hub, NULL, - udev->hs_port_no); + if (udev->parent_hs_hub == parent_hub && + (uhub_count_active_host_ports(parent_hub, USB_SPEED_LOW) + + uhub_count_active_host_ports(parent_hub, USB_SPEED_FULL)) == 1) { + /* we can reset the whole TT */ + err = usbd_req_reset_tt(parent_hub, NULL, + udev->hs_port_no); + } else { + /* only reset a particular device and endpoint */ + err = usbd_req_clear_tt_buffer(udev->parent_hs_hub, NULL, + udev->hs_port_no, old_addr, UE_CONTROL, 0); + } if (err) { DPRINTF("Resetting parent High " "Speed TT failed (%s).\n", usbd_errstr(err)); } } - +#endif /* Try to warm reset first */ if (parent_hub->speed == USB_SPEED_SUPER) usbd_req_warm_reset_port(parent_hub, mtx, udev->port_no); Modified: head/sys/dev/usb/usb_transfer.c ============================================================================== --- head/sys/dev/usb/usb_transfer.c Mon Jan 13 15:06:03 2014 (r260588) +++ head/sys/dev/usb/usb_transfer.c Mon Jan 13 15:21:11 2014 (r260589) @@ -2432,7 +2432,9 @@ usbd_transfer_enqueue(struct usb_xfer_qu void usbd_transfer_done(struct usb_xfer *xfer, usb_error_t error) { - USB_BUS_LOCK_ASSERT(xfer->xroot->bus, MA_OWNED); + struct usb_xfer_root *info = xfer->xroot; + + USB_BUS_LOCK_ASSERT(info->bus, MA_OWNED); DPRINTF("err=%s\n", usbd_errstr(error)); @@ -2446,10 +2448,10 @@ usbd_transfer_done(struct usb_xfer *xfer xfer->flags_int.control_act = 0; return; } - /* only set transfer error if not already set */ - if (!xfer->error) { + /* only set transfer error, if not already set */ + if (xfer->error == USB_ERR_NORMAL_COMPLETION) xfer->error = error; - } + /* stop any callouts */ usb_callout_stop(&xfer->timeout_handle); @@ -2461,14 +2463,14 @@ usbd_transfer_done(struct usb_xfer *xfer usbd_transfer_dequeue(xfer); #if USB_HAVE_BUSDMA - if (mtx_owned(xfer->xroot->xfer_mtx)) { + if (mtx_owned(info->xfer_mtx)) { struct usb_xfer_queue *pq; /* * If the private USB lock is not locked, then we assume * that the BUS-DMA load stage has been passed: */ - pq = &xfer->xroot->dma_q; + pq = &info->dma_q; if (pq->curr == xfer) { /* start the next BUS-DMA load, if any */ @@ -2478,10 +2480,10 @@ usbd_transfer_done(struct usb_xfer *xfer #endif /* keep some statistics */ if (xfer->error) { - xfer->xroot->bus->stats_err.uds_requests + info->bus->stats_err.uds_requests [xfer->endpoint->edesc->bmAttributes & UE_XFERTYPE]++; } else { - xfer->xroot->bus->stats_ok.uds_requests + info->bus->stats_ok.uds_requests [xfer->endpoint->edesc->bmAttributes & UE_XFERTYPE]++; } @@ -2847,6 +2849,22 @@ usbd_callback_wrapper_sub(struct usb_xfe /* end of control transfer, if any */ xfer->flags_int.control_act = 0; +#if USB_HAVE_TT_SUPPORT + switch (xfer->error) { + case USB_ERR_NORMAL_COMPLETION: + case USB_ERR_SHORT_XFER: + case USB_ERR_STALLED: + case USB_ERR_CANCELLED: + /* nothing to do */ + break; + default: + /* try to reset the TT, if any */ + USB_BUS_LOCK(bus); + uhub_tt_buffer_reset_async_locked(xfer->xroot->udev, xfer->endpoint); + USB_BUS_UNLOCK(bus); + break; + } +#endif /* check if we should block the execution queue */ if ((xfer->error != USB_ERR_CANCELLED) && (xfer->flags.pipe_bof)) { From owner-svn-src-head@FreeBSD.ORG Mon Jan 13 16:23:10 2014 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) (using TLSv1 with cipher ADH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id 007C6198; Mon, 13 Jan 2014 16:23:09 +0000 (UTC) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mx1.freebsd.org (Postfix) with ESMTPS id E06701EF3; Mon, 13 Jan 2014 16:23: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 s0DGN9xE055829; Mon, 13 Jan 2014 16:23:09 GMT (envelope-from bapt@svn.freebsd.org) Received: (from bapt@localhost) by svn.freebsd.org (8.14.7/8.14.7/Submit) id s0DGN9Cv055828; Mon, 13 Jan 2014 16:23:09 GMT (envelope-from bapt@svn.freebsd.org) Message-Id: <201401131623.s0DGN9Cv055828@svn.freebsd.org> From: Baptiste Daroussin Date: Mon, 13 Jan 2014 16:23:09 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r260594 - head/sbin/kldload X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.17 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 13 Jan 2014 16:23:10 -0000 Author: bapt Date: Mon Jan 13 16:23:09 2014 New Revision: 260594 URL: http://svnweb.freebsd.org/changeset/base/260594 Log: Point the user to dmesg(1) to get informations about why loading a module did fail instead of printing the cryptic "Exec format error" MFC after: 1 week Modified: head/sbin/kldload/kldload.c Modified: head/sbin/kldload/kldload.c ============================================================================== --- head/sbin/kldload/kldload.c Mon Jan 13 16:05:18 2014 (r260593) +++ head/sbin/kldload/kldload.c Mon Jan 13 16:23:09 2014 (r260594) @@ -181,12 +181,22 @@ main(int argc, char** argv) printf("%s is already " "loaded\n", argv[0]); } else { - if (errno == EEXIST) + switch (errno) { + case EEXIST: warnx("can't load %s: module " "already loaded or " "in kernel", argv[0]); - else + break; + case ENOEXEC: + warnx("an error occured while " + "loading the module. " + "Please check dmesg(1) for " + "more details."); + break; + default: warn("can't load %s", argv[0]); + break; + } errors++; } } else { From owner-svn-src-head@FreeBSD.ORG Mon Jan 13 16:45:44 2014 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) (using TLSv1 with cipher ADH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id 73C76614; Mon, 13 Jan 2014 16:45:44 +0000 (UTC) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mx1.freebsd.org (Postfix) with ESMTPS id 5F90910BC; Mon, 13 Jan 2014 16:45: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 s0DGjiGn063480; Mon, 13 Jan 2014 16:45:44 GMT (envelope-from bapt@svn.freebsd.org) Received: (from bapt@localhost) by svn.freebsd.org (8.14.7/8.14.7/Submit) id s0DGjiDH063479; Mon, 13 Jan 2014 16:45:44 GMT (envelope-from bapt@svn.freebsd.org) Message-Id: <201401131645.s0DGjiDH063479@svn.freebsd.org> From: Baptiste Daroussin Date: Mon, 13 Jan 2014 16:45:44 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r260595 - head/share/man/man4 X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.17 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 13 Jan 2014 16:45:44 -0000 Author: bapt Date: Mon Jan 13 16:45:43 2014 New Revision: 260595 URL: http://svnweb.freebsd.org/changeset/base/260595 Log: Update the BUGS section according the recent changes in kldload(8) Reviewed by: bdrewery MFC after: 1 week Modified: head/share/man/man4/kld.4 Modified: head/share/man/man4/kld.4 ============================================================================== --- head/share/man/man4/kld.4 Mon Jan 13 16:23:09 2014 (r260594) +++ head/share/man/man4/kld.4 Mon Jan 13 16:45:43 2014 (r260595) @@ -25,7 +25,7 @@ .\" .\" $FreeBSD$ .\" -.Dd November 8, 1998 +.Dd January 13, 2014 .Dt KLD 4 .Os .Sh NAME @@ -166,8 +166,8 @@ binary, then fails to execute the entry point. .Pp .Xr kldload 8 -returns the cryptic message -.Sq Li "ENOEXEC (Exec format error)" +points the user to read +.Xr dmesg 1 for any error encountered while loading a module. .Pp When system internal interfaces change, old modules often cannot From owner-svn-src-head@FreeBSD.ORG Mon Jan 13 16:47:25 2014 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [8.8.178.115]) (using TLSv1 with cipher ADH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id D424476E; Mon, 13 Jan 2014 16:47:25 +0000 (UTC) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mx1.freebsd.org (Postfix) with ESMTPS id C018410CC; Mon, 13 Jan 2014 16:47: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 s0DGlPBv063713; Mon, 13 Jan 2014 16:47:25 GMT (envelope-from bapt@svn.freebsd.org) Received: (from bapt@localhost) by svn.freebsd.org (8.14.7/8.14.7/Submit) id s0DGlPCM063712; Mon, 13 Jan 2014 16:47:25 GMT (envelope-from bapt@svn.freebsd.org) Message-Id: <201401131647.s0DGlPCM063712@svn.freebsd.org> From: Baptiste Daroussin Date: Mon, 13 Jan 2014 16:47:25 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r260596 - head/sbin/kldload X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.17 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 13 Jan 2014 16:47:25 -0000 Author: bapt Date: Mon Jan 13 16:47:25 2014 New Revision: 260596 URL: http://svnweb.freebsd.org/changeset/base/260596 Log: Fix typo Reported by: dumbbell Modified: head/sbin/kldload/kldload.c Modified: head/sbin/kldload/kldload.c ============================================================================== --- head/sbin/kldload/kldload.c Mon Jan 13 16:45:43 2014 (r260595) +++ head/sbin/kldload/kldload.c Mon Jan 13 16:47:25 2014 (r260596) @@ -188,7 +188,7 @@ main(int argc, char** argv) "in kernel", argv[0]); break; case ENOEXEC: - warnx("an error occured while " + warnx("an error occurred while " "loading the module. " "Please check dmesg(1) for " "more details."); From owner-svn-src-head@FreeBSD.ORG Mon Jan 13 17:14:11 2014 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) (using TLSv1 with cipher ADH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id 24D4BFEF; Mon, 13 Jan 2014 17:14:11 +0000 (UTC) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mx1.freebsd.org (Postfix) with ESMTPS id 105E31330; Mon, 13 Jan 2014 17:14:11 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.7/8.14.7) with ESMTP id s0DHEAf4075661; Mon, 13 Jan 2014 17:14:10 GMT (envelope-from bapt@svn.freebsd.org) Received: (from bapt@localhost) by svn.freebsd.org (8.14.7/8.14.7/Submit) id s0DHEA4o075656; Mon, 13 Jan 2014 17:14:10 GMT (envelope-from bapt@svn.freebsd.org) Message-Id: <201401131714.s0DHEA4o075656@svn.freebsd.org> From: Baptiste Daroussin Date: Mon, 13 Jan 2014 17:14:10 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r260597 - in head: sbin/kldload share/man/man4 X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.17 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 13 Jan 2014 17:14:11 -0000 Author: bapt Date: Mon Jan 13 17:14:10 2014 New Revision: 260597 URL: http://svnweb.freebsd.org/changeset/base/260597 Log: Fix dmesg(1) -> dmesg(8) Reported by: trasz Modified: head/sbin/kldload/kldload.c head/share/man/man4/kld.4 Modified: head/sbin/kldload/kldload.c ============================================================================== --- head/sbin/kldload/kldload.c Mon Jan 13 16:47:25 2014 (r260596) +++ head/sbin/kldload/kldload.c Mon Jan 13 17:14:10 2014 (r260597) @@ -190,7 +190,7 @@ main(int argc, char** argv) case ENOEXEC: warnx("an error occurred while " "loading the module. " - "Please check dmesg(1) for " + "Please check dmesg(8) for " "more details."); break; default: Modified: head/share/man/man4/kld.4 ============================================================================== --- head/share/man/man4/kld.4 Mon Jan 13 16:47:25 2014 (r260596) +++ head/share/man/man4/kld.4 Mon Jan 13 17:14:10 2014 (r260597) @@ -167,7 +167,7 @@ fails to execute the entry point. .Pp .Xr kldload 8 points the user to read -.Xr dmesg 1 +.Xr dmesg 8 for any error encountered while loading a module. .Pp When system internal interfaces change, old modules often cannot From owner-svn-src-head@FreeBSD.ORG Mon Jan 13 19:01:15 2014 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [8.8.178.115]) (using TLSv1 with cipher ADH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id 62E8DA21; Mon, 13 Jan 2014 19:01:15 +0000 (UTC) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mx1.freebsd.org (Postfix) with ESMTPS id 369EC1D1E; Mon, 13 Jan 2014 19:01:15 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.7/8.14.7) with ESMTP id s0DJ1FUw020127; Mon, 13 Jan 2014 19:01:15 GMT (envelope-from marcel@svn.freebsd.org) Received: (from marcel@localhost) by svn.freebsd.org (8.14.7/8.14.7/Submit) id s0DJ1F6g020125; Mon, 13 Jan 2014 19:01:15 GMT (envelope-from marcel@svn.freebsd.org) Message-Id: <201401131901.s0DJ1F6g020125@svn.freebsd.org> From: Marcel Moolenaar Date: Mon, 13 Jan 2014 19:01:15 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r260599 - head/lib/libkvm X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.17 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 13 Jan 2014 19:01:15 -0000 Author: marcel Date: Mon Jan 13 19:01:14 2014 New Revision: 260599 URL: http://svnweb.freebsd.org/changeset/base/260599 Log: Re-apply the part of r260022 that was reverted by r260030 with one significant difference: for LIB32 builds both TARGET_ARCH and MACHINE_ARCH are defined. TARGET_ARCH confusingly holds the architecture of the host (e.g. amd64), while MACHINE_ARCH holds the architecture were trying to build (e.g. i386). With both set and different, r260022 changed the behaviour to interpret the condition as building a cross-amd64 libkvm on i386, when obviously we're trying to build an i386 version on amd64. When COMPAT_32BIT is defined, we're building LIB32 and ignore the value of TARGET_ARCH as we did before. Modified: head/lib/libkvm/Makefile Modified: head/lib/libkvm/Makefile ============================================================================== --- head/lib/libkvm/Makefile Mon Jan 13 18:57:30 2014 (r260598) +++ head/lib/libkvm/Makefile Mon Jan 13 19:01:14 2014 (r260599) @@ -1,23 +1,36 @@ # @(#)Makefile 8.1 (Berkeley) 6/4/93 # $FreeBSD$ +.if defined(TARGET_ARCH) && !defined(COMPAT_32BIT) +KVM_XARCH=${TARGET_ARCH} +KVM_XCPUARCH=${KVM_XARCH:C/mips(n32|64)?(el)?/mips/:C/arm(v6)?(eb)?/arm/:C/powerpc64/powerpc/} +.else +KVM_XARCH=${MACHINE_ARCH} +KVM_XCPUARCH=${MACHINE_CPUARCH} +.endif + +.if ${KVM_XARCH} != ${MACHINE_ARCH} +LIB= kvm-${KVM_XARCH} +CFLAGS+=-DCROSS_LIBKVM +.else LIB= kvm +.endif + SHLIBDIR?= /lib SHLIB_MAJOR= 6 CFLAGS+=-DLIBC_SCCS -I${.CURDIR} -.if exists(${.CURDIR}/kvm_${MACHINE_ARCH}.c) -KVM_ARCH=${MACHINE_ARCH} +.if exists(${.CURDIR}/kvm_${KVM_XARCH}.c) +KVM_ARCH=${KVM_XARCH} .else -KVM_ARCH=${MACHINE_CPUARCH} +KVM_ARCH=${KVM_XCPUARCH} .endif WARNS?= 3 SRCS= kvm.c kvm_${KVM_ARCH}.c kvm_cptime.c kvm_file.c kvm_getloadavg.c \ kvm_getswapinfo.c kvm_pcpu.c kvm_proc.c kvm_vnet.c -.if ${MACHINE_CPUARCH} == "amd64" || ${MACHINE_CPUARCH} == "i386" || \ - ${MACHINE_CPUARCH} == "arm" || ${MACHINE_CPUARCH} == "mips" +.if exists(${.CURDIR}/kvm_minidump_${KVM_ARCH}.c) SRCS+= kvm_minidump_${KVM_ARCH}.c .endif INCS= kvm.h From owner-svn-src-head@FreeBSD.ORG Mon Jan 13 19:02:31 2014 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [8.8.178.115]) (using TLSv1 with cipher ADH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id E0FEAB71; Mon, 13 Jan 2014 19:02:31 +0000 (UTC) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mx1.freebsd.org (Postfix) with ESMTPS id CD5071D2C; Mon, 13 Jan 2014 19:02: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 s0DJ2VCa020394; Mon, 13 Jan 2014 19:02:31 GMT (envelope-from marcel@svn.freebsd.org) Received: (from marcel@localhost) by svn.freebsd.org (8.14.7/8.14.7/Submit) id s0DJ2VZa020393; Mon, 13 Jan 2014 19:02:31 GMT (envelope-from marcel@svn.freebsd.org) Message-Id: <201401131902.s0DJ2VZa020393@svn.freebsd.org> From: Marcel Moolenaar Date: Mon, 13 Jan 2014 19:02:31 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r260600 - head/lib/libkvm X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.17 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 13 Jan 2014 19:02:32 -0000 Author: marcel Date: Mon Jan 13 19:02:31 2014 New Revision: 260600 URL: http://svnweb.freebsd.org/changeset/base/260600 Log: We don't have to worry about page sizes when working on virtual cores (i.e. minidumps). Every segment is virtually contiguous. Modified: head/lib/libkvm/kvm_ia64.c Modified: head/lib/libkvm/kvm_ia64.c ============================================================================== --- head/lib/libkvm/kvm_ia64.c Mon Jan 13 19:01:14 2014 (r260599) +++ head/lib/libkvm/kvm_ia64.c Mon Jan 13 19:02:31 2014 (r260600) @@ -245,7 +245,7 @@ static size_t virt_kvatop(kvm_t *kd, uint64_t va, off_t *ofs) { - return (virt_addr2off(kd, va, ofs, kd->vmst->pagesize)); + return (virt_addr2off(kd, va, ofs, 0)); } /* From owner-svn-src-head@FreeBSD.ORG Mon Jan 13 19:08:26 2014 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [8.8.178.115]) (using TLSv1 with cipher ADH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id 20EE4DD8; Mon, 13 Jan 2014 19:08:26 +0000 (UTC) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mx1.freebsd.org (Postfix) with ESMTPS id 0CAEF1D5C; Mon, 13 Jan 2014 19:08:26 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.7/8.14.7) with ESMTP id s0DJ8PoK021499; Mon, 13 Jan 2014 19:08:25 GMT (envelope-from marcel@svn.freebsd.org) Received: (from marcel@localhost) by svn.freebsd.org (8.14.7/8.14.7/Submit) id s0DJ8P6B021498; Mon, 13 Jan 2014 19:08:25 GMT (envelope-from marcel@svn.freebsd.org) Message-Id: <201401131908.s0DJ8P6B021498@svn.freebsd.org> From: Marcel Moolenaar Date: Mon, 13 Jan 2014 19:08:25 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r260601 - head/gnu/usr.bin/gdb/kgdb X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.17 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 13 Jan 2014 19:08:26 -0000 Author: marcel Date: Mon Jan 13 19:08:25 2014 New Revision: 260601 URL: http://svnweb.freebsd.org/changeset/base/260601 Log: When building a cross-kgdb, suppress the registration of the standard core target by declaring coreops_suppress_target with initializer. This is also happening for non-cross kgdb, by virtue of having fbsd-threads.c in libgdb and having it do the exact same thing. Since fbsd-threads.c is not included in in libgdb when building a cross debugger, we ended up with more than 1 core file targets (the standard gdb core file target and kgdb's libkvm based core file target) and this behaves the same as not having a core target at all. Modified: head/gnu/usr.bin/gdb/kgdb/trgt.c Modified: head/gnu/usr.bin/gdb/kgdb/trgt.c ============================================================================== --- head/gnu/usr.bin/gdb/kgdb/trgt.c Mon Jan 13 19:02:31 2014 (r260600) +++ head/gnu/usr.bin/gdb/kgdb/trgt.c Mon Jan 13 19:08:25 2014 (r260601) @@ -53,6 +53,18 @@ __FBSDID("$FreeBSD$"); #include "kgdb.h" +#ifdef CROSS_DEBUGGER +/* + * We suppress the call to add_target() of core_ops in corelow.c because if + * there are multiple core_stratum targets, the find_core_target() function + * won't know which one to return and returns none. We need it to return + * our target. We only have to do that when we're building a cross-debugger + * because fbsd-threads.c is part of a native debugger and it too defines + * coreops_suppress_target with 1 as the initializer. + */ +int coreops_suppress_target = 1; +#endif + static CORE_ADDR stoppcbs; static void kgdb_core_cleanup(void *); From owner-svn-src-head@FreeBSD.ORG Mon Jan 13 20:55:16 2014 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [8.8.178.115]) (using TLSv1 with cipher ADH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id 49CAD67E; Mon, 13 Jan 2014 20:55:16 +0000 (UTC) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mx1.freebsd.org (Postfix) with ESMTPS id 359801719; Mon, 13 Jan 2014 20:55: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 s0DKtG9R064765; Mon, 13 Jan 2014 20:55:16 GMT (envelope-from bdrewery@svn.freebsd.org) Received: (from bdrewery@localhost) by svn.freebsd.org (8.14.7/8.14.7/Submit) id s0DKtGBO064764; Mon, 13 Jan 2014 20:55:16 GMT (envelope-from bdrewery@svn.freebsd.org) Message-Id: <201401132055.s0DKtGBO064764@svn.freebsd.org> From: Bryan Drewery Date: Mon, 13 Jan 2014 20:55:16 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r260605 - head/share/keys/pkg/trusted X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.17 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 13 Jan 2014 20:55:16 -0000 Author: bdrewery Date: Mon Jan 13 20:55:15 2014 New Revision: 260605 URL: http://svnweb.freebsd.org/changeset/base/260605 Log: Remove scary comment about this being a test key. There has been no need to regenerate the signing key. Reported by: mat Approved by: bapt (mentor) MFC after: 3 days Modified: head/share/keys/pkg/trusted/pkg.freebsd.org.2013102301 Modified: head/share/keys/pkg/trusted/pkg.freebsd.org.2013102301 ============================================================================== --- head/share/keys/pkg/trusted/pkg.freebsd.org.2013102301 Mon Jan 13 19:42:37 2014 (r260604) +++ head/share/keys/pkg/trusted/pkg.freebsd.org.2013102301 Mon Jan 13 20:55:15 2014 (r260605) @@ -1,5 +1,4 @@ # $FreeBSD$ -# This key is for testing purposes only and will be revoked before 10.0-RELEASE function: "sha256" fingerprint: "b0170035af3acc5f3f3ae1859dc717101b4e6c1d0a794ad554928ca0cbb2f438" From owner-svn-src-head@FreeBSD.ORG Mon Jan 13 21:44:18 2014 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [8.8.178.115]) (using TLSv1 with cipher ADH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id 15458F6E; Mon, 13 Jan 2014 21:44:18 +0000 (UTC) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mx1.freebsd.org (Postfix) with ESMTPS id F24941B24; Mon, 13 Jan 2014 21:44: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 s0DLiHim002998; Mon, 13 Jan 2014 21:44:17 GMT (envelope-from andreast@svn.freebsd.org) Received: (from andreast@localhost) by svn.freebsd.org (8.14.7/8.14.7/Submit) id s0DLiHPp002997; Mon, 13 Jan 2014 21:44:17 GMT (envelope-from andreast@svn.freebsd.org) Message-Id: <201401132144.s0DLiHPp002997@svn.freebsd.org> From: Andreas Tobler Date: Mon, 13 Jan 2014 21:44:17 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r260607 - head/sys/modules/sound/driver/ai2s X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.17 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 13 Jan 2014 21:44:18 -0000 Author: andreast Date: Mon Jan 13 21:44:17 2014 New Revision: 260607 URL: http://svnweb.freebsd.org/changeset/base/260607 Log: The onyx codec works also as module, so add it. MFC after: 1 month Modified: head/sys/modules/sound/driver/ai2s/Makefile Modified: head/sys/modules/sound/driver/ai2s/Makefile ============================================================================== --- head/sys/modules/sound/driver/ai2s/Makefile Mon Jan 13 21:29:34 2014 (r260606) +++ head/sys/modules/sound/driver/ai2s/Makefile Mon Jan 13 21:44:17 2014 (r260607) @@ -5,6 +5,6 @@ KMOD= snd_ai2s SRCS= device_if.h bus_if.h ofw_bus_if.h SRCS+= channel_if.h feeder_if.h mixer_if.h -SRCS+= snapper.c tumbler.c aoa.c i2s.c +SRCS+= onyx.c snapper.c tumbler.c aoa.c i2s.c .include From owner-svn-src-head@FreeBSD.ORG Mon Jan 13 22:21:29 2014 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) (using TLSv1 with cipher ADH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id D690DE34; Mon, 13 Jan 2014 22:21:29 +0000 (UTC) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mx1.freebsd.org (Postfix) with ESMTPS id C202B1EF4; Mon, 13 Jan 2014 22:21: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 s0DMLT7G019224; Mon, 13 Jan 2014 22:21:29 GMT (envelope-from andreast@svn.freebsd.org) Received: (from andreast@localhost) by svn.freebsd.org (8.14.7/8.14.7/Submit) id s0DMLTMB019223; Mon, 13 Jan 2014 22:21:29 GMT (envelope-from andreast@svn.freebsd.org) Message-Id: <201401132221.s0DMLTMB019223@svn.freebsd.org> From: Andreas Tobler Date: Mon, 13 Jan 2014 22:21:29 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r260610 - head/sys/powerpc/include X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.17 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 13 Jan 2014 22:21:29 -0000 Author: andreast Date: Mon Jan 13 22:21:29 2014 New Revision: 260610 URL: http://svnweb.freebsd.org/changeset/base/260610 Log: Described in the man page but not implemented. Here it comes, atomic_swap_32/64. The latter only for powerpc64. MFC after: 1 month Modified: head/sys/powerpc/include/atomic.h Modified: head/sys/powerpc/include/atomic.h ============================================================================== --- head/sys/powerpc/include/atomic.h Mon Jan 13 22:15:57 2014 (r260609) +++ head/sys/powerpc/include/atomic.h Mon Jan 13 22:21:29 2014 (r260610) @@ -684,10 +684,47 @@ atomic_fetchadd_long(volatile u_long *p, return (value); } +static __inline u_int +atomic_swap_32(volatile u_int *p, u_int v) +{ + u_int prev; + + __asm __volatile( + "1: lwarx %0,0,%2\n" + " stwcx. %3,0,%2\n" + " bne- 1b\n" + : "=&r" (prev), "+m" (*(volatile u_int *)p) + : "r" (p), "r" (v) + : "cc", "memory"); + + return (prev); +} + +#ifdef __powerpc64__ +static __inline u_long +atomic_swap_64(volatile u_long *p, u_long v) +{ + u_long prev; + + __asm __volatile( + "1: ldarx %0,0,%2\n" + " stdcx. %3,0,%2\n" + " bne- 1b\n" + : "=&r" (prev), "+m" (*(volatile u_long *)p) + : "r" (p), "r" (v) + : "cc", "memory"); + + return (prev); +} +#endif + #define atomic_fetchadd_32 atomic_fetchadd_int +#define atomic_swap_int atomic_swap_32 #ifdef __powerpc64__ #define atomic_fetchadd_64 atomic_fetchadd_long +#define atomic_swap_long atomic_swap_64 +#define atomic_swap_ptr atomic_swap_64 #endif #undef __ATOMIC_REL From owner-svn-src-head@FreeBSD.ORG Mon Jan 13 23:27:25 2014 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [8.8.178.115]) (using TLSv1 with cipher ADH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id 0FDF7B90; Mon, 13 Jan 2014 23:27:25 +0000 (UTC) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mx1.freebsd.org (Postfix) with ESMTPS id EF72A1357; Mon, 13 Jan 2014 23:27: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 s0DNRObV044140; Mon, 13 Jan 2014 23:27:24 GMT (envelope-from bmah@svn.freebsd.org) Received: (from bmah@localhost) by svn.freebsd.org (8.14.7/8.14.7/Submit) id s0DNROhu044139; Mon, 13 Jan 2014 23:27:24 GMT (envelope-from bmah@svn.freebsd.org) Message-Id: <201401132327.s0DNROhu044139@svn.freebsd.org> From: "Bruce A. Mah" Date: Mon, 13 Jan 2014 23:27:24 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r260612 - head/share/misc X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.17 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 13 Jan 2014 23:27:25 -0000 Author: bmah (ports committer) Date: Mon Jan 13 23:27:24 2014 New Revision: 260612 URL: http://svnweb.freebsd.org/changeset/base/260612 Log: Move myself from ports alumni to active ports committer section. Add an edge indicating mat as my ports mentor. Approved by: mat (mentor) Modified: head/share/misc/committers-ports.dot Modified: head/share/misc/committers-ports.dot ============================================================================== --- head/share/misc/committers-ports.dot Mon Jan 13 23:15:51 2014 (r260611) +++ head/share/misc/committers-ports.dot Mon Jan 13 23:27:24 2014 (r260612) @@ -32,7 +32,6 @@ node [color=grey62, style=filled, bgcolo adamw [label="Adam Weinberger\nadamw@FreeBSD.org\n2002/10/16\n2006/09/25"] asami [label="Satoshi Asami\nasami@FreeBSD.org\n1994/11/18\n2001/09/11"] billf [label="Bill Fumerola\nbillf@FreeBSD.org\n1998/11/11\n2006/12/14"] -bmah [label="Bruce A. Mah\nbmah@FreeBSD.org\n2000/08/23\n2006/12/19"] jmallett [label="Juli Mallett\njmallett@FreeBSD.org\n2003/01/16\n2006/08/10"] marcel [label="Marcel Moolenaar\nmarcel@FreeBSD.org\n1999/07/03\n2007/07/01"] steve [label="Steve Price\nsteve@FreeBSD.org\nxxxx/xx/xx\nxxxx/xx/xx"] @@ -66,6 +65,7 @@ beat [label="Beat Gaetzi\nbeat@FreeBSD.o beech [label="Beech Rintoul\nbeech@FreeBSD.org\n2007/05/30"] bf [label="Brendan Fabeny\nbf@FreeBSD.org\n2010/06/02"] bland [label="Alexander Nedotsukov\nbland@FreeBSD.org\n2003/08/14"] +bmah [label="Bruce A. Mah\nbmah@FreeBSD.org\n2000/08/23"] brix [label="Henrik Brix Andersen\nbrix@FreeBSD.org\n2007/10/31"] brooks [label="Brooks Davies\nbrooks@FreeBSD.org\n2004/05/03"] bsam [label="Boris Samorodov\nbsam@FreeBSD.org\n2006/07/20"] @@ -413,6 +413,7 @@ makc -> bf makc -> jhale makc -> rakuco +mat -> bmah mat -> thierry mezz -> tmclaugh From owner-svn-src-head@FreeBSD.ORG Tue Jan 14 01:52:35 2014 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [8.8.178.115]) (using TLSv1 with cipher ADH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id 0A30EDC5; Tue, 14 Jan 2014 01:52:35 +0000 (UTC) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mx1.freebsd.org (Postfix) with ESMTPS id EAE3A1004; Tue, 14 Jan 2014 01:52: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 s0E1qYrY003003; Tue, 14 Jan 2014 01:52:34 GMT (envelope-from delphij@svn.freebsd.org) Received: (from delphij@localhost) by svn.freebsd.org (8.14.7/8.14.7/Submit) id s0E1qYlp003002; Tue, 14 Jan 2014 01:52:34 GMT (envelope-from delphij@svn.freebsd.org) Message-Id: <201401140152.s0E1qYlp003002@svn.freebsd.org> From: Xin LI Date: Tue, 14 Jan 2014 01:52:34 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r260618 - head/lib/libc/stdlib X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.17 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 14 Jan 2014 01:52:35 -0000 Author: delphij Date: Tue Jan 14 01:52:34 2014 New Revision: 260618 URL: http://svnweb.freebsd.org/changeset/base/260618 Log: ANSI-fy prototype. MFC after: 2 weeks Modified: head/lib/libc/stdlib/getsubopt.c Modified: head/lib/libc/stdlib/getsubopt.c ============================================================================== --- head/lib/libc/stdlib/getsubopt.c Tue Jan 14 01:28:08 2014 (r260617) +++ head/lib/libc/stdlib/getsubopt.c Tue Jan 14 01:52:34 2014 (r260618) @@ -45,9 +45,7 @@ __FBSDID("$FreeBSD$"); char *suboptarg; int -getsubopt(optionp, tokens, valuep) - char **optionp, **valuep; - char * const *tokens; +getsubopt(char **optionp, char * const *tokens, char **valuep) { int cnt; char *p; From owner-svn-src-head@FreeBSD.ORG Tue Jan 14 01:56:00 2014 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) (using TLSv1 with cipher ADH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id 4A34596; Tue, 14 Jan 2014 01:56:00 +0000 (UTC) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mx1.freebsd.org (Postfix) with ESMTPS id 342B21034; Tue, 14 Jan 2014 01:56: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 s0E1u0Nv003593; Tue, 14 Jan 2014 01:56:00 GMT (envelope-from neel@svn.freebsd.org) Received: (from neel@localhost) by svn.freebsd.org (8.14.7/8.14.7/Submit) id s0E1twAx003577; Tue, 14 Jan 2014 01:55:58 GMT (envelope-from neel@svn.freebsd.org) Message-Id: <201401140155.s0E1twAx003577@svn.freebsd.org> From: Neel Natu Date: Tue, 14 Jan 2014 01:55:58 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r260619 - in head/sys/amd64: include vmm vmm/amd vmm/intel vmm/io X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.17 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 14 Jan 2014 01:56:00 -0000 Author: neel Date: Tue Jan 14 01:55:58 2014 New Revision: 260619 URL: http://svnweb.freebsd.org/changeset/base/260619 Log: Add an API to rendezvous all active vcpus in a virtual machine. The rendezvous can be initiated in the context of a vcpu thread or from the bhyve(8) control process. The first use of this functionality is to update the vlapic trigger-mode register when the IOAPIC pin configuration is changed. Prior to this change we would update the TMR in the virtual-APIC page at the time of interrupt delivery. But this doesn't work with Posted Interrupts because there is no way to program the EOI_exit_bitmap[] in the VMCS of the target at the time of interrupt delivery. Discussed with: grehan@ Modified: head/sys/amd64/include/vmm.h head/sys/amd64/vmm/amd/amdv.c head/sys/amd64/vmm/intel/vmx.c head/sys/amd64/vmm/io/vioapic.c head/sys/amd64/vmm/io/vlapic.c head/sys/amd64/vmm/io/vlapic.h head/sys/amd64/vmm/vmm.c head/sys/amd64/vmm/vmm_stat.c head/sys/amd64/vmm/vmm_stat.h Modified: head/sys/amd64/include/vmm.h ============================================================================== --- head/sys/amd64/include/vmm.h Tue Jan 14 01:52:34 2014 (r260618) +++ head/sys/amd64/include/vmm.h Tue Jan 14 01:55:58 2014 (r260619) @@ -52,7 +52,7 @@ typedef int (*vmm_cleanup_func_t)(void); typedef void (*vmm_resume_func_t)(void); typedef void * (*vmi_init_func_t)(struct vm *vm, struct pmap *pmap); typedef int (*vmi_run_func_t)(void *vmi, int vcpu, register_t rip, - struct pmap *pmap); + struct pmap *pmap, void *rendezvous_cookie); typedef void (*vmi_cleanup_func_t)(void *vmi); typedef int (*vmi_get_register_t)(void *vmi, int vcpu, int num, uint64_t *retval); @@ -136,6 +136,31 @@ cpuset_t vm_active_cpus(struct vm *vm); struct vm_exit *vm_exitinfo(struct vm *vm, int vcpuid); /* + * Rendezvous all vcpus specified in 'dest' and execute 'func(arg)'. + * The rendezvous 'func(arg)' is not allowed to do anything that will + * cause the thread to be put to sleep. + * + * If the rendezvous is being initiated from a vcpu context then the + * 'vcpuid' must refer to that vcpu, otherwise it should be set to -1. + * + * The caller cannot hold any locks when initiating the rendezvous. + * + * The implementation of this API may cause vcpus other than those specified + * by 'dest' to be stalled. The caller should not rely on any vcpus making + * forward progress when the rendezvous is in progress. + */ +typedef void (*vm_rendezvous_func_t)(struct vm *vm, int vcpuid, void *arg); +void vm_smp_rendezvous(struct vm *vm, int vcpuid, cpuset_t dest, + vm_rendezvous_func_t func, void *arg); + +static __inline int +vcpu_rendezvous_pending(void *rendezvous_cookie) +{ + + return (*(uintptr_t *)rendezvous_cookie != 0); +} + +/* * Return 1 if device indicated by bus/slot/func is supposed to be a * pci passthrough device. * @@ -272,6 +297,7 @@ enum vm_exitcode { VM_EXITCODE_INST_EMUL, VM_EXITCODE_SPINUP_AP, VM_EXITCODE_SPINDOWN_CPU, + VM_EXITCODE_RENDEZVOUS, VM_EXITCODE_MAX }; Modified: head/sys/amd64/vmm/amd/amdv.c ============================================================================== --- head/sys/amd64/vmm/amd/amdv.c Tue Jan 14 01:52:34 2014 (r260618) +++ head/sys/amd64/vmm/amd/amdv.c Tue Jan 14 01:55:58 2014 (r260619) @@ -67,7 +67,7 @@ amdv_vminit(struct vm *vm, struct pmap * } static int -amdv_vmrun(void *arg, int vcpu, register_t rip, struct pmap *pmap) +amdv_vmrun(void *arg, int vcpu, register_t rip, struct pmap *pmap, void *cookie) { printf("amdv_vmrun: not implemented\n"); Modified: head/sys/amd64/vmm/intel/vmx.c ============================================================================== --- head/sys/amd64/vmm/intel/vmx.c Tue Jan 14 01:52:34 2014 (r260618) +++ head/sys/amd64/vmm/intel/vmx.c Tue Jan 14 01:55:58 2014 (r260619) @@ -1669,6 +1669,18 @@ vmx_exit_astpending(struct vmx *vmx, int } static __inline int +vmx_exit_rendezvous(struct vmx *vmx, int vcpu, struct vm_exit *vmexit) +{ + + vmexit->rip = vmcs_guest_rip(); + vmexit->inst_length = 0; + vmexit->exitcode = VM_EXITCODE_RENDEZVOUS; + vmm_stat_incr(vmx->vm, vcpu, VMEXIT_RENDEZVOUS, 1); + + return (UNHANDLED); +} + +static __inline int vmx_exit_inst_error(struct vmxctx *vmxctx, int rc, struct vm_exit *vmexit) { @@ -1697,10 +1709,12 @@ vmx_exit_inst_error(struct vmxctx *vmxct } static int -vmx_run(void *arg, int vcpu, register_t startrip, pmap_t pmap) +vmx_run(void *arg, int vcpu, register_t startrip, pmap_t pmap, + void *rendezvous_cookie) { int rc, handled, launched; struct vmx *vmx; + struct vm *vm; struct vmxctx *vmxctx; struct vmcs *vmcs; struct vm_exit *vmexit; @@ -1709,10 +1723,11 @@ vmx_run(void *arg, int vcpu, register_t uint32_t exit_reason; vmx = arg; + vm = vmx->vm; vmcs = &vmx->vmcs[vcpu]; vmxctx = &vmx->ctx[vcpu]; - vlapic = vm_lapic(vmx->vm, vcpu); - vmexit = vm_exitinfo(vmx->vm, vcpu); + vlapic = vm_lapic(vm, vcpu); + vmexit = vm_exitinfo(vm, vcpu); launched = 0; KASSERT(vmxctx->pmap == pmap, @@ -1760,6 +1775,12 @@ vmx_run(void *arg, int vcpu, register_t break; } + if (vcpu_rendezvous_pending(rendezvous_cookie)) { + enable_intr(); + handled = vmx_exit_rendezvous(vmx, vcpu, vmexit); + break; + } + vmx_inject_interrupts(vmx, vcpu, vlapic); vmx_run_trace(vmx, vcpu); rc = vmx_enter_guest(vmxctx, launched); @@ -1793,9 +1814,9 @@ vmx_run(void *arg, int vcpu, register_t } if (!handled) - vmm_stat_incr(vmx->vm, vcpu, VMEXIT_USERSPACE, 1); + vmm_stat_incr(vm, vcpu, VMEXIT_USERSPACE, 1); - VCPU_CTR1(vmx->vm, vcpu, "returning from vmx_run: exitcode %d", + VCPU_CTR1(vm, vcpu, "returning from vmx_run: exitcode %d", vmexit->exitcode); VMCLEAR(vmcs); Modified: head/sys/amd64/vmm/io/vioapic.c ============================================================================== --- head/sys/amd64/vmm/io/vioapic.c Tue Jan 14 01:52:34 2014 (r260618) +++ head/sys/amd64/vmm/io/vioapic.c Tue Jan 14 01:55:58 2014 (r260619) @@ -222,8 +222,52 @@ vioapic_pulse_irq(struct vm *vm, int irq return (vioapic_set_irqstate(vm, irq, IRQSTATE_PULSE)); } +/* + * Reset the vlapic's trigger-mode register to reflect the ioapic pin + * configuration. + */ +static void +vioapic_update_tmr(struct vm *vm, int vcpuid, void *arg) +{ + struct vioapic *vioapic; + struct vlapic *vlapic; + uint32_t low, high, dest; + int delmode, pin, vector; + bool level, phys; + + vlapic = vm_lapic(vm, vcpuid); + vioapic = vm_ioapic(vm); + + VIOAPIC_LOCK(vioapic); + /* + * Reset all vectors to be edge-triggered. + */ + vlapic_reset_tmr(vlapic); + for (pin = 0; pin < REDIR_ENTRIES; pin++) { + low = vioapic->rtbl[pin].reg; + high = vioapic->rtbl[pin].reg >> 32; + + level = low & IOART_TRGRLVL ? true : false; + if (!level) + continue; + + /* + * For a level-triggered 'pin' let the vlapic figure out if + * an assertion on this 'pin' would result in an interrupt + * being delivered to it. If yes, then it will modify the + * TMR bit associated with this vector to level-triggered. + */ + phys = ((low & IOART_DESTMOD) == IOART_DESTPHY); + delmode = low & IOART_DELMOD; + vector = low & IOART_INTVEC; + dest = high >> APIC_ID_SHIFT; + vlapic_set_tmr_level(vlapic, dest, phys, delmode, vector); + } + VIOAPIC_UNLOCK(vioapic); +} + static uint32_t -vioapic_read(struct vioapic *vioapic, uint32_t addr) +vioapic_read(struct vioapic *vioapic, int vcpuid, uint32_t addr) { int regnum, pin, rshift; @@ -258,10 +302,12 @@ vioapic_read(struct vioapic *vioapic, ui } static void -vioapic_write(struct vioapic *vioapic, uint32_t addr, uint32_t data) +vioapic_write(struct vioapic *vioapic, int vcpuid, uint32_t addr, uint32_t data) { uint64_t data64, mask64; + uint64_t last, changed; int regnum, pin, lshift; + cpuset_t allvcpus; regnum = addr & 0xff; switch (regnum) { @@ -285,6 +331,8 @@ vioapic_write(struct vioapic *vioapic, u else lshift = 0; + last = vioapic->rtbl[pin].reg; + data64 = (uint64_t)data << lshift; mask64 = (uint64_t)0xffffffff << lshift; vioapic->rtbl[pin].reg &= ~mask64 | RTBL_RO_BITS; @@ -294,6 +342,22 @@ vioapic_write(struct vioapic *vioapic, u pin, vioapic->rtbl[pin].reg); /* + * If any fields in the redirection table entry (except mask + * or polarity) have changed then rendezvous all the vcpus + * to update their vlapic trigger-mode registers. + */ + changed = last ^ vioapic->rtbl[pin].reg; + if (changed & ~(IOART_INTMASK | IOART_INTPOL)) { + VIOAPIC_CTR1(vioapic, "ioapic pin%d: recalculate " + "vlapic trigger-mode register", pin); + VIOAPIC_UNLOCK(vioapic); + allvcpus = vm_active_cpus(vioapic->vm); + vm_smp_rendezvous(vioapic->vm, vcpuid, allvcpus, + vioapic_update_tmr, NULL); + VIOAPIC_LOCK(vioapic); + } + + /* * Generate an interrupt if the following conditions are met: * - pin is not masked * - previous interrupt has been EOIed @@ -310,8 +374,8 @@ vioapic_write(struct vioapic *vioapic, u } static int -vioapic_mmio_rw(struct vioapic *vioapic, uint64_t gpa, uint64_t *data, - int size, bool doread) +vioapic_mmio_rw(struct vioapic *vioapic, int vcpuid, uint64_t gpa, + uint64_t *data, int size, bool doread) { uint64_t offset; @@ -334,10 +398,13 @@ vioapic_mmio_rw(struct vioapic *vioapic, else vioapic->ioregsel = *data; } else { - if (doread) - *data = vioapic_read(vioapic, vioapic->ioregsel); - else - vioapic_write(vioapic, vioapic->ioregsel, *data); + if (doread) { + *data = vioapic_read(vioapic, vcpuid, + vioapic->ioregsel); + } else { + vioapic_write(vioapic, vcpuid, vioapic->ioregsel, + *data); + } } VIOAPIC_UNLOCK(vioapic); @@ -352,7 +419,7 @@ vioapic_mmio_read(void *vm, int vcpuid, struct vioapic *vioapic; vioapic = vm_ioapic(vm); - error = vioapic_mmio_rw(vioapic, gpa, rval, size, true); + error = vioapic_mmio_rw(vioapic, vcpuid, gpa, rval, size, true); return (error); } @@ -364,7 +431,7 @@ vioapic_mmio_write(void *vm, int vcpuid, struct vioapic *vioapic; vioapic = vm_ioapic(vm); - error = vioapic_mmio_rw(vioapic, gpa, &wval, size, false); + error = vioapic_mmio_rw(vioapic, vcpuid, gpa, &wval, size, false); return (error); } Modified: head/sys/amd64/vmm/io/vlapic.c ============================================================================== --- head/sys/amd64/vmm/io/vlapic.c Tue Jan 14 01:52:34 2014 (r260618) +++ head/sys/amd64/vmm/io/vlapic.c Tue Jan 14 01:55:58 2014 (r260619) @@ -285,15 +285,13 @@ vlapic_set_intr_ready(struct vlapic *vla atomic_set_int(&irrptr[idx], mask); /* - * Upon acceptance of an interrupt into the IRR the corresponding - * TMR bit is cleared for edge-triggered interrupts and set for - * level-triggered interrupts. + * Verify that the trigger-mode of the interrupt matches with + * the vlapic TMR registers. */ tmrptr = &lapic->tmr0; - if (level) - atomic_set_int(&tmrptr[idx], mask); - else - atomic_clear_int(&tmrptr[idx], mask); + KASSERT((tmrptr[idx] & mask) == (level ? mask : 0), + ("vlapic TMR[%d] is 0x%08x but interrupt is %s-triggered", + idx / 4, tmrptr[idx], level ? "level" : "edge")); VLAPIC_CTR_IRR(vlapic, "vlapic_set_intr_ready"); return (1); @@ -1458,3 +1456,57 @@ vlapic_enabled(struct vlapic *vlapic) else return (false); } + +void +vlapic_reset_tmr(struct vlapic *vlapic) +{ + struct LAPIC *lapic; + + VLAPIC_CTR0(vlapic, "vlapic resetting all vectors to edge-triggered"); + + lapic = vlapic->apic_page; + lapic->tmr0 = 0; + lapic->tmr1 = 0; + lapic->tmr2 = 0; + lapic->tmr3 = 0; + lapic->tmr4 = 0; + lapic->tmr5 = 0; + lapic->tmr6 = 0; + lapic->tmr7 = 0; +} + +void +vlapic_set_tmr_level(struct vlapic *vlapic, uint32_t dest, bool phys, + int delmode, int vector) +{ + struct LAPIC *lapic; + uint32_t *tmrptr, mask; + cpuset_t dmask; + int idx; + bool lowprio; + + KASSERT(vector >= 0 && vector <= 255, ("invalid vector %d", vector)); + + /* + * A level trigger is valid only for fixed and lowprio delivery modes. + */ + if (delmode != APIC_DELMODE_FIXED && delmode != APIC_DELMODE_LOWPRIO) { + VLAPIC_CTR1(vlapic, "Ignoring level trigger-mode for " + "delivery-mode %d", delmode); + return; + } + + lowprio = (delmode == APIC_DELMODE_LOWPRIO); + vlapic_calcdest(vlapic->vm, &dmask, dest, phys, lowprio, false); + + if (!CPU_ISSET(vlapic->vcpuid, &dmask)) + return; + + lapic = vlapic->apic_page; + tmrptr = &lapic->tmr0; + idx = (vector / 32) * 4; + mask = 1 << (vector % 32); + tmrptr[idx] |= mask; + + VLAPIC_CTR1(vlapic, "vector %d set to level-triggered", vector); +} Modified: head/sys/amd64/vmm/io/vlapic.h ============================================================================== --- head/sys/amd64/vmm/io/vlapic.h Tue Jan 14 01:52:34 2014 (r260618) +++ head/sys/amd64/vmm/io/vlapic.h Tue Jan 14 01:55:58 2014 (r260619) @@ -81,6 +81,17 @@ bool vlapic_enabled(struct vlapic *vlapi void vlapic_deliver_intr(struct vm *vm, bool level, uint32_t dest, bool phys, int delmode, int vec); +/* Reset the trigger-mode bits for all vectors to be edge-triggered */ +void vlapic_reset_tmr(struct vlapic *vlapic); + +/* + * Set the trigger-mode bit associated with 'vector' to level-triggered if + * the (dest,phys,delmode) tuple resolves to an interrupt being delivered to + * this 'vlapic'. + */ +void vlapic_set_tmr_level(struct vlapic *vlapic, uint32_t dest, bool phys, + int delmode, int vector); + /* APIC write handlers */ void vlapic_id_write_handler(struct vlapic *vlapic); void vlapic_ldr_write_handler(struct vlapic *vlapic); Modified: head/sys/amd64/vmm/vmm.c ============================================================================== --- head/sys/amd64/vmm/vmm.c Tue Jan 14 01:52:34 2014 (r260618) +++ head/sys/amd64/vmm/vmm.c Tue Jan 14 01:55:58 2014 (r260619) @@ -125,6 +125,12 @@ struct vm { * explicitly (AP) by sending it a startup ipi. */ cpuset_t active_cpus; + + struct mtx rendezvous_mtx; + cpuset_t rendezvous_req_cpus; + cpuset_t rendezvous_done_cpus; + void *rendezvous_arg; + vm_rendezvous_func_t rendezvous_func; }; static int vmm_initialized; @@ -135,8 +141,8 @@ static struct vmm_ops *ops; #define VMM_RESUME() (ops != NULL ? (*ops->resume)() : 0) #define VMINIT(vm, pmap) (ops != NULL ? (*ops->vminit)(vm, pmap): NULL) -#define VMRUN(vmi, vcpu, rip, pmap) \ - (ops != NULL ? (*ops->vmrun)(vmi, vcpu, rip, pmap) : ENXIO) +#define VMRUN(vmi, vcpu, rip, pmap, rptr) \ + (ops != NULL ? (*ops->vmrun)(vmi, vcpu, rip, pmap, rptr) : ENXIO) #define VMCLEANUP(vmi) (ops != NULL ? (*ops->vmcleanup)(vmi) : NULL) #define VMSPACE_ALLOC(min, max) \ (ops != NULL ? (*ops->vmspace_alloc)(min, max) : NULL) @@ -176,6 +182,8 @@ static int vmm_ipinum; SYSCTL_INT(_hw_vmm, OID_AUTO, ipinum, CTLFLAG_RD, &vmm_ipinum, 0, "IPI vector used for vcpu notifications"); +static void vm_deactivate_cpu(struct vm *vm, int vcpuid); + static void vcpu_cleanup(struct vm *vm, int i) { @@ -330,6 +338,7 @@ vm_create(const char *name, struct vm ** vm = malloc(sizeof(struct vm), M_VM, M_WAITOK | M_ZERO); strcpy(vm->name, name); vm->vmspace = vmspace; + mtx_init(&vm->rendezvous_mtx, "vm rendezvous lock", 0, MTX_DEF); vm->cookie = VMINIT(vm, vmspace_pmap(vmspace)); vm->vioapic = vioapic_init(vm); vm->vhpet = vhpet_init(vm); @@ -896,6 +905,59 @@ vcpu_require_state_locked(struct vcpu *v panic("Error %d setting state to %d", error, newstate); } +static void +vm_set_rendezvous_func(struct vm *vm, vm_rendezvous_func_t func) +{ + + KASSERT(mtx_owned(&vm->rendezvous_mtx), ("rendezvous_mtx not locked")); + + /* + * Update 'rendezvous_func' and execute a write memory barrier to + * ensure that it is visible across all host cpus. This is not needed + * for correctness but it does ensure that all the vcpus will notice + * that the rendezvous is requested immediately. + */ + vm->rendezvous_func = func; + wmb(); +} + +#define RENDEZVOUS_CTR0(vm, vcpuid, fmt) \ + do { \ + if (vcpuid >= 0) \ + VCPU_CTR0(vm, vcpuid, fmt); \ + else \ + VM_CTR0(vm, fmt); \ + } while (0) + +static void +vm_handle_rendezvous(struct vm *vm, int vcpuid) +{ + + KASSERT(vcpuid == -1 || (vcpuid >= 0 && vcpuid < VM_MAXCPU), + ("vm_handle_rendezvous: invalid vcpuid %d", vcpuid)); + + mtx_lock(&vm->rendezvous_mtx); + while (vm->rendezvous_func != NULL) { + if (vcpuid != -1 && + CPU_ISSET(vcpuid, &vm->rendezvous_req_cpus)) { + VCPU_CTR0(vm, vcpuid, "Calling rendezvous func"); + (*vm->rendezvous_func)(vm, vcpuid, vm->rendezvous_arg); + CPU_SET(vcpuid, &vm->rendezvous_done_cpus); + } + if (CPU_CMP(&vm->rendezvous_req_cpus, + &vm->rendezvous_done_cpus) == 0) { + VCPU_CTR0(vm, vcpuid, "Rendezvous completed"); + vm_set_rendezvous_func(vm, NULL); + wakeup(&vm->rendezvous_func); + break; + } + RENDEZVOUS_CTR0(vm, vcpuid, "Wait for rendezvous completion"); + mtx_sleep(&vm->rendezvous_func, &vm->rendezvous_mtx, 0, + "vmrndv", 0); + } + mtx_unlock(&vm->rendezvous_mtx); +} + /* * Emulate a guest 'hlt' by sleeping until the vcpu is ready to run. */ @@ -936,6 +998,7 @@ vm_handle_hlt(struct vm *vm, int vcpuid, *retu = true; vmexit = vm_exitinfo(vm, vcpuid); vmexit->exitcode = VM_EXITCODE_SPINDOWN_CPU; + vm_deactivate_cpu(vm, vcpuid); VCPU_CTR0(vm, vcpuid, "spinning down cpu"); } vcpu_require_state_locked(vcpu, VCPU_FROZEN); @@ -1072,7 +1135,7 @@ restart: vcpu_require_state(vm, vcpuid, VCPU_RUNNING); vcpu->hostcpu = curcpu; - error = VMRUN(vm->cookie, vcpuid, rip, pmap); + error = VMRUN(vm->cookie, vcpuid, rip, pmap, &vm->rendezvous_func); vcpu->hostcpu = NOCPU; vcpu_require_state(vm, vcpuid, VCPU_FROZEN); @@ -1086,6 +1149,10 @@ restart: if (error == 0) { retu = false; switch (vme->exitcode) { + case VM_EXITCODE_RENDEZVOUS: + vm_handle_rendezvous(vm, vcpuid); + error = 0; + break; case VM_EXITCODE_HLT: intr_disabled = ((vme->u.hlt.rflags & PSL_I) == 0); error = vm_handle_hlt(vm, vcpuid, intr_disabled, &retu); @@ -1321,6 +1388,14 @@ vm_activate_cpu(struct vm *vm, int vcpui CPU_SET(vcpuid, &vm->active_cpus); } +static void +vm_deactivate_cpu(struct vm *vm, int vcpuid) +{ + + if (vcpuid >= 0 && vcpuid < VM_MAXCPU) + CPU_CLR(vcpuid, &vm->active_cpus); +} + cpuset_t vm_active_cpus(struct vm *vm) { @@ -1411,3 +1486,40 @@ vm_apicid2vcpuid(struct vm *vm, int apic */ return (apicid); } + +void +vm_smp_rendezvous(struct vm *vm, int vcpuid, cpuset_t dest, + vm_rendezvous_func_t func, void *arg) +{ + /* + * Enforce that this function is called without any locks + */ + WITNESS_WARN(WARN_PANIC, NULL, "vm_smp_rendezvous"); + KASSERT(vcpuid == -1 || (vcpuid >= 0 && vcpuid < VM_MAXCPU), + ("vm_smp_rendezvous: invalid vcpuid %d", vcpuid)); + +restart: + mtx_lock(&vm->rendezvous_mtx); + if (vm->rendezvous_func != NULL) { + /* + * If a rendezvous is already in progress then we need to + * call the rendezvous handler in case this 'vcpuid' is one + * of the targets of the rendezvous. + */ + RENDEZVOUS_CTR0(vm, vcpuid, "Rendezvous already in progress"); + mtx_unlock(&vm->rendezvous_mtx); + vm_handle_rendezvous(vm, vcpuid); + goto restart; + } + KASSERT(vm->rendezvous_func == NULL, ("vm_smp_rendezvous: previous " + "rendezvous is still in progress")); + + RENDEZVOUS_CTR0(vm, vcpuid, "Initiating rendezvous"); + vm->rendezvous_req_cpus = dest; + CPU_ZERO(&vm->rendezvous_done_cpus); + vm->rendezvous_arg = arg; + vm_set_rendezvous_func(vm, func); + mtx_unlock(&vm->rendezvous_mtx); + + vm_handle_rendezvous(vm, vcpuid); +} Modified: head/sys/amd64/vmm/vmm_stat.c ============================================================================== --- head/sys/amd64/vmm/vmm_stat.c Tue Jan 14 01:52:34 2014 (r260618) +++ head/sys/amd64/vmm/vmm_stat.c Tue Jan 14 01:55:58 2014 (r260619) @@ -150,3 +150,4 @@ VMM_STAT(VMEXIT_EPT_FAULT, "vm exits due VMM_STAT(VMEXIT_UNKNOWN, "number of vm exits for unknown reason"); VMM_STAT(VMEXIT_ASTPENDING, "number of times astpending at exit"); VMM_STAT(VMEXIT_USERSPACE, "number of vm exits handled in userspace"); +VMM_STAT(VMEXIT_RENDEZVOUS, "number of times rendezvous pending at exit"); Modified: head/sys/amd64/vmm/vmm_stat.h ============================================================================== --- head/sys/amd64/vmm/vmm_stat.h Tue Jan 14 01:52:34 2014 (r260618) +++ head/sys/amd64/vmm/vmm_stat.h Tue Jan 14 01:55:58 2014 (r260619) @@ -120,4 +120,5 @@ VMM_STAT_DECLARE(VMEXIT_EPT_FAULT); VMM_STAT_DECLARE(VMEXIT_UNKNOWN); VMM_STAT_DECLARE(VMEXIT_ASTPENDING); VMM_STAT_DECLARE(VMEXIT_USERSPACE); +VMM_STAT_DECLARE(VMEXIT_RENDEZVOUS); #endif From owner-svn-src-head@FreeBSD.ORG Tue Jan 14 04:28:42 2014 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [8.8.178.115]) (using TLSv1 with cipher ADH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id 16D9A1A6; Tue, 14 Jan 2014 04:28:42 +0000 (UTC) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mx1.freebsd.org (Postfix) with ESMTPS id 043E21B0B; Tue, 14 Jan 2014 04:28: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 s0E4SfVG064805; Tue, 14 Jan 2014 04:28:41 GMT (envelope-from jhibbits@svn.freebsd.org) Received: (from jhibbits@localhost) by svn.freebsd.org (8.14.7/8.14.7/Submit) id s0E4Sfxk064804; Tue, 14 Jan 2014 04:28:41 GMT (envelope-from jhibbits@svn.freebsd.org) Message-Id: <201401140428.s0E4Sfxk064804@svn.freebsd.org> From: Justin Hibbits Date: Tue, 14 Jan 2014 04:28:41 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r260621 - head/usr.bin/elfdump X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.17 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 14 Jan 2014 04:28:42 -0000 Author: jhibbits Date: Tue Jan 14 04:28:41 2014 New Revision: 260621 URL: http://svnweb.freebsd.org/changeset/base/260621 Log: Add missing EM_PPC64 to e_machine header display. MFC after: 1 week Modified: head/usr.bin/elfdump/elfdump.c Modified: head/usr.bin/elfdump/elfdump.c ============================================================================== --- head/usr.bin/elfdump/elfdump.c Tue Jan 14 03:18:29 2014 (r260620) +++ head/usr.bin/elfdump/elfdump.c Tue Jan 14 04:28:41 2014 (r260621) @@ -255,6 +255,7 @@ e_machines(u_int mach) case EM_860: return "EM_860"; case EM_MIPS: return "EM_MIPS"; case EM_PPC: return "EM_PPC"; + case EM_PPC64: return "EM_PPC64"; case EM_ARM: return "EM_ARM"; case EM_ALPHA: return "EM_ALPHA (legacy)"; case EM_SPARCV9:return "EM_SPARCV9"; From owner-svn-src-head@FreeBSD.ORG Tue Jan 14 08:43:38 2014 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [8.8.178.115]) (using TLSv1 with cipher ADH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id D439D283; Tue, 14 Jan 2014 08:43:38 +0000 (UTC) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mx1.freebsd.org (Postfix) with ESMTPS id BFF391DA7; Tue, 14 Jan 2014 08:43:38 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.7/8.14.7) with ESMTP id s0E8hcEQ062831; Tue, 14 Jan 2014 08:43:38 GMT (envelope-from hselasky@svn.freebsd.org) Received: (from hselasky@localhost) by svn.freebsd.org (8.14.7/8.14.7/Submit) id s0E8hcpg062830; Tue, 14 Jan 2014 08:43:38 GMT (envelope-from hselasky@svn.freebsd.org) Message-Id: <201401140843.s0E8hcpg062830@svn.freebsd.org> From: Hans Petter Selasky Date: Tue, 14 Jan 2014 08:43:38 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r260622 - head/sys/dev/usb/input X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.17 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 14 Jan 2014 08:43:38 -0000 Author: hselasky Date: Tue Jan 14 08:43:38 2014 New Revision: 260622 URL: http://svnweb.freebsd.org/changeset/base/260622 Log: Don't output any modifier keys before we see a valid non-modifier key press. This prevents so-called "ghost keyboards" keeping modifier keys pressed while not actually seen as a real keyboard. MFC after: 2 weeks Modified: head/sys/dev/usb/input/ukbd.c Modified: head/sys/dev/usb/input/ukbd.c ============================================================================== --- head/sys/dev/usb/input/ukbd.c Tue Jan 14 04:28:41 2014 (r260621) +++ head/sys/dev/usb/input/ukbd.c Tue Jan 14 08:43:38 2014 (r260622) @@ -197,6 +197,7 @@ struct ukbd_softc { #define UKBD_FLAG_NUMLOCK 0x00080000 #define UKBD_FLAG_CAPSLOCK 0x00100000 #define UKBD_FLAG_SCROLLLOCK 0x00200000 +#define UKBD_FLAG_VALID_KEYS 0x00400000 int sc_mode; /* input mode (K_XLATE,K_RAW,K_CODE) */ int sc_state; /* shift/lock key state */ @@ -512,6 +513,41 @@ ukbd_interrupt(struct ukbd_softc *sc) n_mod = sc->sc_ndata.modifiers; o_mod = sc->sc_odata.modifiers; + + /* + * Don't output any modifier keys before we see a valid + * non-modifier key press. This prevents so-called "ghost + * keyboards" keeping modifier keys pressed while not actually + * seen as a real keyboard. + */ + if (sc->sc_flags & UKBD_FLAG_VALID_KEYS) + goto kfound; + + for (i = 0; i != UKBD_NKEYCODE; i++) { + key = sc->sc_ndata.keycode[i]; + switch (key) { + case 0xe0: + case 0xe4: + case 0xe1: + case 0xe5: + case 0xe2: + case 0xe6: + case 0xe3: + case 0xe7: + case 0x00: + case KEY_ERROR: + break; + default: + sc->sc_flags |= UKBD_FLAG_VALID_KEYS; + goto kfound; + } + } + DPRINTF("Keeping modifiers buffered\n"); + + /* keep modifiers in buffer */ + sc->sc_ndata.modifiers = n_mod = 0; + +kfound: if (n_mod != o_mod) { for (i = 0; i < UKBD_NMOD; i++) { if ((n_mod & ukbd_mods[i].mask) != From owner-svn-src-head@FreeBSD.ORG Tue Jan 14 18:32:48 2014 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [8.8.178.115]) (using TLSv1 with cipher ADH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id 8EF8EC7B; Tue, 14 Jan 2014 18:32:48 +0000 (UTC) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mx1.freebsd.org (Postfix) with ESMTPS id 635721212; Tue, 14 Jan 2014 18:32: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 s0EIWmqJ091753; Tue, 14 Jan 2014 18:32:48 GMT (envelope-from jmmv@svn.freebsd.org) Received: (from jmmv@localhost) by svn.freebsd.org (8.14.7/8.14.7/Submit) id s0EIWm10091752; Tue, 14 Jan 2014 18:32:48 GMT (envelope-from jmmv@svn.freebsd.org) Message-Id: <201401141832.s0EIWm10091752@svn.freebsd.org> From: Julio Merino Date: Tue, 14 Jan 2014 18:32:48 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r260632 - head/share/mk X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.17 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 14 Jan 2014 18:32:48 -0000 Author: jmmv Date: Tue Jan 14 18:32:47 2014 New Revision: 260632 URL: http://svnweb.freebsd.org/changeset/base/260632 Log: Support defining test program metadata from the Makefiles. Introduce a new, per-test-program TEST_METADATA. variable that contains a list of key/value paris describing metadata properties for that test program. These properties are later written into the auto-generated Kyuafile when using the KYUAFILE=auto functionality. This is to avoid having to supply hand-crafted Kyuafiles when the needs for metadata overrides are trivial. While doing this, and because I am documenting TEST_METADATA, take the chance to document the TEST_INTERFACE setting as well. MFC after: 5 days Modified: head/share/mk/bsd.test.mk Modified: head/share/mk/bsd.test.mk ============================================================================== --- head/share/mk/bsd.test.mk Tue Jan 14 16:18:45 2014 (r260631) +++ head/share/mk/bsd.test.mk Tue Jan 14 18:32:47 2014 (r260632) @@ -41,6 +41,20 @@ TESTS_SUBDIRS?= # If 'no', no Kyuafile is installed. KYUAFILE?= auto +# Per-test program interface definition. +# +# The name provided here must match one of the interface names supported by +# Kyua as this is later encoded in the Kyuafile test program definitions. +#TEST_INTERFACE.= interface-name + +# Per-test program metadata properties as a list of key/value pairs. +# +# All the variables for a particular program are appended to the program's +# definition in the Kyuafile. This feature can be used to avoid having to +# explicitly supply a Kyuafile in the source directory, allowing the caller +# Makefile to rely on the KYUAFILE=auto behavior defined here. +#TEST_METADATA.+= key="value" + # List of variables to pass to the tests at run-time via the environment. TESTS_ENV?= @@ -102,7 +116,7 @@ Kyuafile.auto: Makefile echo; \ } >Kyuafile.auto.tmp .for _T in ${_TESTS} - @echo "${TEST_INTERFACE.${_T}}_test_program{name=\"${_T}\"}" \ + @echo '${TEST_INTERFACE.${_T}}_test_program{name="${_T}"${TEST_METADATA.${_T}:C/$/,/:tW:C/^/, /W:C/,$//W}}' \ >>Kyuafile.auto.tmp .endfor .for _T in ${TESTS_SUBDIRS:N.WAIT} From owner-svn-src-head@FreeBSD.ORG Tue Jan 14 18:35:57 2014 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [8.8.178.115]) (using TLSv1 with cipher ADH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id 420B4E29; Tue, 14 Jan 2014 18:35:57 +0000 (UTC) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mx1.freebsd.org (Postfix) with ESMTPS id 14AFA1254; Tue, 14 Jan 2014 18: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 s0EIZuG1092206; Tue, 14 Jan 2014 18:35:56 GMT (envelope-from jmmv@svn.freebsd.org) Received: (from jmmv@localhost) by svn.freebsd.org (8.14.7/8.14.7/Submit) id s0EIZuRP092205; Tue, 14 Jan 2014 18:35:56 GMT (envelope-from jmmv@svn.freebsd.org) Message-Id: <201401141835.s0EIZuRP092205@svn.freebsd.org> From: Julio Merino Date: Tue, 14 Jan 2014 18:35:56 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r260633 - head/share/mk X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.17 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 14 Jan 2014 18:35:57 -0000 Author: jmmv Date: Tue Jan 14 18:35:56 2014 New Revision: 260633 URL: http://svnweb.freebsd.org/changeset/base/260633 Log: Support perl-based TAP-compliant test programs. Introduce a TAP_TESTS_PERL primitive to list test programs written in perl. Only do this in tap.test.mk because I only expect perl-based test programs with this interface. This is very similar to TAP_TESTS_SH but the difference is that we record in the Kyuafile that the test program requires a perl interpreter. This in turn makes Kyua mark the test as skipped if the perl package is not yet installed, instead of mysteriously failing to run the program. MFC after: 5 days Modified: head/share/mk/tap.test.mk Modified: head/share/mk/tap.test.mk ============================================================================== --- head/share/mk/tap.test.mk Tue Jan 14 18:32:47 2014 (r260632) +++ head/share/mk/tap.test.mk Tue Jan 14 18:35:56 2014 (r260633) @@ -18,8 +18,12 @@ # manpage. TAP_TESTS_C?= TAP_TESTS_CXX?= +TAP_TESTS_PERL?= TAP_TESTS_SH?= +# Perl interpreter to use for test programs written in this language. +TAP_PERL_INTERPRETER?= /usr/local/bin/perl + .if !empty(TAP_TESTS_C) PROGS+= ${TAP_TESTS_C} _TESTS+= ${TAP_TESTS_C} @@ -42,6 +46,29 @@ TEST_INTERFACE.${_T}= tap .endfor .endif +.if !empty(TAP_TESTS_PERL) +SCRIPTS+= ${TAP_TESTS_PERL} +_TESTS+= ${TAP_TESTS_PERL} +.for _T in ${TAP_TESTS_PERL} +SCRIPTSDIR_${_T}= ${TESTSDIR} +TEST_INTERFACE.${_T}= tap +TEST_METADATA.${_T}+= required_programs="${TAP_PERL_INTERPRETER}" +CLEANFILES+= ${_T} ${_T}.tmp +# TODO(jmmv): It seems to me that this SED and SRC functionality should +# exist in bsd.prog.mk along the support for SCRIPTS. Move it there if +# this proves to be useful within the tests. +TAP_TESTS_PERL_SED_${_T}?= # empty +TAP_TESTS_PERL_SRC_${_T}?= ${_T}.pl +${_T}: ${TAP_TESTS_PERL_SRC_${_T}} + { \ + echo '#! ${TAP_PERL_INTERPRETER}'; \ + cat ${.ALLSRC} | sed ${TAP_TESTS_PERL_SED_${_T}}; \ + } >${.TARGET}.tmp + chmod +x ${.TARGET}.tmp + mv ${.TARGET}.tmp ${.TARGET} +.endfor +.endif + .if !empty(TAP_TESTS_SH) SCRIPTS+= ${TAP_TESTS_SH} _TESTS+= ${TAP_TESTS_SH} From owner-svn-src-head@FreeBSD.ORG Tue Jan 14 18:39:31 2014 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) (using TLSv1 with cipher ADH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id 9846F90; Tue, 14 Jan 2014 18:39:31 +0000 (UTC) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mx1.freebsd.org (Postfix) with ESMTPS id 847581283; Tue, 14 Jan 2014 18:39: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 s0EIdVpm092683; Tue, 14 Jan 2014 18:39:31 GMT (envelope-from jmmv@svn.freebsd.org) Received: (from jmmv@localhost) by svn.freebsd.org (8.14.7/8.14.7/Submit) id s0EIdVsI092681; Tue, 14 Jan 2014 18:39:31 GMT (envelope-from jmmv@svn.freebsd.org) Message-Id: <201401141839.s0EIdVsI092681@svn.freebsd.org> From: Julio Merino Date: Tue, 14 Jan 2014 18:39:31 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r260634 - head/bin/pax/tests X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.17 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 14 Jan 2014 18:39:31 -0000 Author: jmmv Date: Tue Jan 14 18:39:30 2014 New Revision: 260634 URL: http://svnweb.freebsd.org/changeset/base/260634 Log: Use TAP_TESTS_PERL to register the legacy_test in bin/pax. Redo r260586 by using the new functionality in tap.test.mk to transparently support perl-based test programs. As a side-effect, we get rid of an explicit path to /usr/bin/perl by replacing it with /usr/local/bin/perl (or as defined in tap.test.mk). This also fixes the name of the legacy_test source file because this should have always been legacy_test.pl and not legacy_test.sh. My mistake when originally moving the code around without realizing that this was a perl script. MFC after: 5 days Added: head/bin/pax/tests/legacy_test.pl - copied, changed from r260625, head/bin/pax/tests/legacy_test.sh Deleted: head/bin/pax/tests/Kyuafile head/bin/pax/tests/legacy_test.sh Modified: head/bin/pax/tests/Makefile Modified: head/bin/pax/tests/Makefile ============================================================================== --- head/bin/pax/tests/Makefile Tue Jan 14 18:35:56 2014 (r260633) +++ head/bin/pax/tests/Makefile Tue Jan 14 18:39:30 2014 (r260634) @@ -3,8 +3,7 @@ .include TESTSDIR= ${TESTSBASE}/bin/pax -KYUAFILE= yes -TAP_TESTS_SH= legacy_test +TAP_TESTS_PERL= legacy_test .include Copied and modified: head/bin/pax/tests/legacy_test.pl (from r260625, head/bin/pax/tests/legacy_test.sh) ============================================================================== --- head/bin/pax/tests/legacy_test.sh Tue Jan 14 10:03:31 2014 (r260625, copy source) +++ head/bin/pax/tests/legacy_test.pl Tue Jan 14 18:39:30 2014 (r260634) @@ -1,5 +1,3 @@ -#! /usr/bin/perl -# # $FreeBSD$ use strict; From owner-svn-src-head@FreeBSD.ORG Tue Jan 14 18:45:33 2014 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) (using TLSv1 with cipher ADH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id 2942F302; Tue, 14 Jan 2014 18:45:33 +0000 (UTC) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mx1.freebsd.org (Postfix) with ESMTPS id EF44812F9; Tue, 14 Jan 2014 18:45: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 s0EIjWAO096047; Tue, 14 Jan 2014 18:45:32 GMT (envelope-from jmmv@svn.freebsd.org) Received: (from jmmv@localhost) by svn.freebsd.org (8.14.7/8.14.7/Submit) id s0EIjWeg096045; Tue, 14 Jan 2014 18:45:32 GMT (envelope-from jmmv@svn.freebsd.org) Message-Id: <201401141845.s0EIjWeg096045@svn.freebsd.org> From: Julio Merino Date: Tue, 14 Jan 2014 18:45:32 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r260635 - in head/bin: sh/tests test/tests X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.17 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 14 Jan 2014 18:45:33 -0000 Author: jmmv Date: Tue Jan 14 18:45:32 2014 New Revision: 260635 URL: http://svnweb.freebsd.org/changeset/base/260635 Log: Replace hand-crafted Kyuafiles with automatic generation. Redo r260506 by using the new TEST_METADATA functionality of bsd.test.mk to mark the sh(1) and test(1) tests as not supporting root. This is to get rid of hand-crafted Kyuafiles for these very simple cases. MFC after: 5 days Deleted: head/bin/sh/tests/Kyuafile head/bin/test/tests/Kyuafile Modified: head/bin/sh/tests/Makefile head/bin/test/tests/Makefile Modified: head/bin/sh/tests/Makefile ============================================================================== --- head/bin/sh/tests/Makefile Tue Jan 14 18:39:30 2014 (r260634) +++ head/bin/sh/tests/Makefile Tue Jan 14 18:45:32 2014 (r260635) @@ -3,10 +3,15 @@ .include TESTSDIR= ${TESTSBASE}/bin/sh -KYUAFILE= yes TAP_TESTS_SH= legacy_test TAP_TESTS_SH_SED_legacy_test= -e 's,__SH__,/bin/sh,g' +# Some tests in here are silently not run when the tests are executed as +# root. Explicitly tell Kyua to drop privileges. +# +# TODO(jmmv): Kyua needs to do this by default, not only when explicitly +# requested. See https://code.google.com/p/kyua/issues/detail?id=6 +TEST_METADATA.legacy_test+= required_user="unprivileged" SUBDIR+= builtins errors execution expansion parameters parser set-e Modified: head/bin/test/tests/Makefile ============================================================================== --- head/bin/test/tests/Makefile Tue Jan 14 18:39:30 2014 (r260634) +++ head/bin/test/tests/Makefile Tue Jan 14 18:45:32 2014 (r260635) @@ -3,8 +3,13 @@ .include TESTSDIR= ${TESTSBASE}/bin/test -KYUAFILE= yes TAP_TESTS_SH= legacy_test +# Some tests in here are silently not run when the tests are executed as +# root. Explicitly tell Kyua to drop privileges. +# +# TODO(jmmv): Kyua needs to do this by default, not only when explicitly +# requested. See https://code.google.com/p/kyua/issues/detail?id=6 +TEST_METADATA.legacy_test+= required_user="unprivileged" .include From owner-svn-src-head@FreeBSD.ORG Tue Jan 14 18:58:58 2014 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) (using TLSv1 with cipher ADH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id 5F3E4799; Tue, 14 Jan 2014 18:58:58 +0000 (UTC) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mx1.freebsd.org (Postfix) with ESMTPS id 4B12113E2; Tue, 14 Jan 2014 18:58:58 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.7/8.14.7) with ESMTP id s0EIwwHZ000334; Tue, 14 Jan 2014 18:58:58 GMT (envelope-from delphij@svn.freebsd.org) Received: (from delphij@localhost) by svn.freebsd.org (8.14.7/8.14.7/Submit) id s0EIwwGK000333; Tue, 14 Jan 2014 18:58:58 GMT (envelope-from delphij@svn.freebsd.org) Message-Id: <201401141858.s0EIwwGK000333@svn.freebsd.org> From: Xin LI Date: Tue, 14 Jan 2014 18:58:58 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r260636 - head/contrib/bsnmp/lib X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.17 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 14 Jan 2014 18:58:58 -0000 Author: delphij Date: Tue Jan 14 18:58:57 2014 New Revision: 260636 URL: http://svnweb.freebsd.org/changeset/base/260636 Log: Fix bsnmpd remote denial of service vulnerability. Reported by: dinoex Submitted by: harti Security: FreeBSD-SA-14:01.bsnmpd Security: CVE-2014-1452 Modified: head/contrib/bsnmp/lib/snmpagent.c Modified: head/contrib/bsnmp/lib/snmpagent.c ============================================================================== --- head/contrib/bsnmp/lib/snmpagent.c Tue Jan 14 18:45:32 2014 (r260635) +++ head/contrib/bsnmp/lib/snmpagent.c Tue Jan 14 18:58:57 2014 (r260636) @@ -510,6 +510,11 @@ snmp_getbulk(struct snmp_pdu *pdu, struc for (cnt = 0; cnt < pdu->error_index; cnt++) { eomib = 1; for (i = non_rep; i < pdu->nbindings; i++) { + + if (resp->nbindings == SNMP_MAX_BINDINGS) + /* PDU is full */ + goto done; + if (cnt == 0) result = do_getnext(&context, &pdu->bindings[i], &resp->bindings[resp->nbindings], pdu); From owner-svn-src-head@FreeBSD.ORG Tue Jan 14 18:59:00 2014 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) (using TLSv1 with cipher ADH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id AB95379A; Tue, 14 Jan 2014 18:59:00 +0000 (UTC) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mx1.freebsd.org (Postfix) with ESMTPS id 9795713E3; Tue, 14 Jan 2014 18:59: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 s0EIx0BC000382; Tue, 14 Jan 2014 18:59:00 GMT (envelope-from delphij@svn.freebsd.org) Received: (from delphij@localhost) by svn.freebsd.org (8.14.7/8.14.7/Submit) id s0EIx0gY000381; Tue, 14 Jan 2014 18:59:00 GMT (envelope-from delphij@svn.freebsd.org) Message-Id: <201401141859.s0EIx0gY000381@svn.freebsd.org> From: Xin LI Date: Tue, 14 Jan 2014 18:59:00 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r260637 - head/contrib/ntp/ntpd X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.17 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 14 Jan 2014 18:59:00 -0000 Author: delphij Date: Tue Jan 14 18:59:00 2014 New Revision: 260637 URL: http://svnweb.freebsd.org/changeset/base/260637 Log: Disable 'monitor' feature in ntpd by default. Security: FreeBSD-SA-14:02.ntpd Approved by: so Modified: head/contrib/ntp/ntpd/ntp_config.c Modified: head/contrib/ntp/ntpd/ntp_config.c ============================================================================== --- head/contrib/ntp/ntpd/ntp_config.c Tue Jan 14 18:58:57 2014 (r260636) +++ head/contrib/ntp/ntpd/ntp_config.c Tue Jan 14 18:59:00 2014 (r260637) @@ -597,6 +597,8 @@ getconfig( #endif /* not SYS_WINNT */ } + proto_config(PROTO_MONITOR, 0, 0., NULL); + for (;;) { if (tok == CONFIG_END) break; From owner-svn-src-head@FreeBSD.ORG Tue Jan 14 20:18:39 2014 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [8.8.178.115]) (using TLSv1 with cipher ADH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id 6A7E0672; Tue, 14 Jan 2014 20:18:39 +0000 (UTC) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mx1.freebsd.org (Postfix) with ESMTPS id 3E9C811F0; Tue, 14 Jan 2014 20:18: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 s0EKIdfW044334; Tue, 14 Jan 2014 20:18:39 GMT (envelope-from mav@svn.freebsd.org) Received: (from mav@localhost) by svn.freebsd.org (8.14.7/8.14.7/Submit) id s0EKIca5044331; Tue, 14 Jan 2014 20:18:38 GMT (envelope-from mav@svn.freebsd.org) Message-Id: <201401142018.s0EKIca5044331@svn.freebsd.org> From: Alexander Motin Date: Tue, 14 Jan 2014 20:18:38 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r260648 - in head/sys/fs: nfs nfsserver X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.17 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 14 Jan 2014 20:18:39 -0000 Author: mav Date: Tue Jan 14 20:18:38 2014 New Revision: 260648 URL: http://svnweb.freebsd.org/changeset/base/260648 Log: Fix lock leak in purely hypothetical case of TCP connection without SVC_ACK method. This change should be NOP now, but it is better to be future safe. Reported by: rmacklem Modified: head/sys/fs/nfs/nfs_var.h head/sys/fs/nfsserver/nfs_nfsdcache.c head/sys/fs/nfsserver/nfs_nfsdkrpc.c Modified: head/sys/fs/nfs/nfs_var.h ============================================================================== --- head/sys/fs/nfs/nfs_var.h Tue Jan 14 19:42:28 2014 (r260647) +++ head/sys/fs/nfs/nfs_var.h Tue Jan 14 20:18:38 2014 (r260648) @@ -220,7 +220,7 @@ void nfsrvd_dorpc(struct nfsrv_descript void nfsrvd_initcache(void); int nfsrvd_getcache(struct nfsrv_descript *); struct nfsrvcache *nfsrvd_updatecache(struct nfsrv_descript *); -void nfsrvd_sentcache(struct nfsrvcache *, uint32_t); +void nfsrvd_sentcache(struct nfsrvcache *, int, uint32_t); void nfsrvd_cleancache(void); void nfsrvd_refcache(struct nfsrvcache *); void nfsrvd_derefcache(struct nfsrvcache *); Modified: head/sys/fs/nfsserver/nfs_nfsdcache.c ============================================================================== --- head/sys/fs/nfsserver/nfs_nfsdcache.c Tue Jan 14 19:42:28 2014 (r260647) +++ head/sys/fs/nfsserver/nfs_nfsdcache.c Tue Jan 14 20:18:38 2014 (r260648) @@ -576,18 +576,20 @@ nfsrvd_delcache(struct nfsrvcache *rp) * the pointer returned by nfsrvd_updatecache(). */ APPLESTATIC void -nfsrvd_sentcache(struct nfsrvcache *rp, uint32_t seq) +nfsrvd_sentcache(struct nfsrvcache *rp, int have_seq, uint32_t seq) { struct nfsrchash_bucket *hbp; KASSERT(rp->rc_flag & RC_LOCKED, ("nfsrvd_sentcache not locked")); - hbp = NFSRCAHASH(rp->rc_sockref); - mtx_lock(&hbp->mtx); - rp->rc_tcpseq = seq; - if (rp->rc_acked != RC_NO_ACK) - LIST_INSERT_HEAD(&hbp->tbl, rp, rc_ahash); - rp->rc_acked = RC_NO_ACK; - mtx_unlock(&hbp->mtx); + if (have_seq) { + hbp = NFSRCAHASH(rp->rc_sockref); + mtx_lock(&hbp->mtx); + rp->rc_tcpseq = seq; + if (rp->rc_acked != RC_NO_ACK) + LIST_INSERT_HEAD(&hbp->tbl, rp, rc_ahash); + rp->rc_acked = RC_NO_ACK; + mtx_unlock(&hbp->mtx); + } nfsrc_unlock(rp); } Modified: head/sys/fs/nfsserver/nfs_nfsdkrpc.c ============================================================================== --- head/sys/fs/nfsserver/nfs_nfsdkrpc.c Tue Jan 14 19:42:28 2014 (r260647) +++ head/sys/fs/nfsserver/nfs_nfsdkrpc.c Tue Jan 14 20:18:38 2014 (r260648) @@ -287,8 +287,8 @@ nfssvc_program(struct svc_req *rqst, SVC svcerr_systemerr(rqst); } if (rp != NULL) { - if (rqst->rq_reply_seq != 0 || SVC_ACK(xprt, NULL)) - nfsrvd_sentcache(rp, rqst->rq_reply_seq); + nfsrvd_sentcache(rp, (rqst->rq_reply_seq != 0 || + SVC_ACK(xprt, NULL)), rqst->rq_reply_seq); } svc_freereq(rqst); From owner-svn-src-head@FreeBSD.ORG Tue Jan 14 20:37:21 2014 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [8.8.178.115]) (using TLSv1 with cipher ADH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id 09C48534 for ; Tue, 14 Jan 2014 20:37:21 +0000 (UTC) Received: from mail-wi0-f172.google.com (mail-wi0-f172.google.com [209.85.212.172]) (using TLSv1 with cipher ECDHE-RSA-RC4-SHA (128/128 bits)) (No client certificate requested) by mx1.freebsd.org (Postfix) with ESMTPS id 9162C1687 for ; Tue, 14 Jan 2014 20:37:20 +0000 (UTC) Received: by mail-wi0-f172.google.com with SMTP id ex4so2437289wid.11 for ; Tue, 14 Jan 2014 12:37:18 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:content-type:mime-version:subject:from :in-reply-to:date:cc:content-transfer-encoding:message-id:references :to; bh=mY8lvjZuUWppvLeus932K0w7eXIAYlXy8XV+cfAXKBE=; b=kXMp52jkCTMxjiRyWGMaNui6xIP42jYzMskurBfToJ13bw68nsXMyp9mkfg/93RKZI Od0OJdzrl4ayD4mKKoP704LKlxAbo3SKm+ntroL2aFy3VczVLcOGJ5h8CxMacPAiL97K 4nUzCnx1nLLrhyooi3STgsiYnN3TLI27ZX7yaeKO0mE50mq7MzvmpOjyiyMN3ub6axZS 7jQ30hcRGv9ehmzGXhIgu8g9q7REbeaEozvROONHHp3US0fAl8vkafqVWHLT0fWaWp0l 6Mgiwru38f+W0OC+t4RYLgkouuXyZhGtL6OYVui73hiEdg/qBU3z1vbQm7pY2PDgaqBi XBTg== X-Gm-Message-State: ALoCoQkGnfLz5b3BI66+8wSt2+zySnWq63ESUfGp/RNVxsb+suY4SaRhQrIOx4Vs8qxyb2XQioWL X-Received: by 10.194.82.105 with SMTP id h9mr375628wjy.52.1389731344231; Tue, 14 Jan 2014 12:29:04 -0800 (PST) Received: from [192.168.1.118] (62.57.0.127.dyn.user.ono.com. [62.57.0.127]) by mx.google.com with ESMTPSA id ks3sm1492182wjc.10.2014.01.14.12.28.59 for (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Tue, 14 Jan 2014 12:28:59 -0800 (PST) Content-Type: text/plain; charset=us-ascii Mime-Version: 1.0 (Mac OS X Mail 7.1 \(1827\)) Subject: Re: svn commit: r260586 - head/bin/pax/tests From: Julio Merino In-Reply-To: <01D805C2-AB9D-48F5-A972-FC7E801DC21E@meroh.net> Date: Tue, 14 Jan 2014 21:28:55 +0100 Content-Transfer-Encoding: quoted-printable Message-Id: References: <201401131217.s0DCHflD060494@svn.freebsd.org> <20140113135930.GR97375@ithaqua.etoilebsd.net> <01D805C2-AB9D-48F5-A972-FC7E801DC21E@meroh.net> To: Baptiste Daroussin X-Mailer: Apple Mail (2.1827) Cc: svn-src-head@freebsd.org, svn-src-all@freebsd.org, Julio Merino , src-committers@freebsd.org X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.17 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 14 Jan 2014 20:37:21 -0000 On Jan 13, 2014, at 15:34, Julio Merino wrote: > On Jan 13, 2014, at 14:59, Baptiste Daroussin = wrote: >=20 >> On Mon, Jan 13, 2014 at 12:17:41PM +0000, Julio Merino wrote: >>> +tap_test_program{name=3D"legacy_test", = required_programs=3D"/usr/bin/perl"} >>=20 >> Shouldn't that be /usr/local/bin/perl or ${LOCALBASE}/bin/perl, we = are trying >> hard on ports to remove by default /usr/bin/perl which is a legacy = from the >> removal of perl from base. >=20 > Only if legacy_test.sh is also modified to use /usr/local/bin/perl. = (I don't think using LOCALBASE is possible given that it's not = accessible from share/mk/.) >=20 > If it's the right thing to do, I can change it. FTR, I did this change as part of some other generalizations and = cleanups. Test programs that use the new TAP_TESTS_PERL feature of = tap.test.mk should get the right path to the perl interpreter.= From owner-svn-src-head@FreeBSD.ORG Tue Jan 14 22:05:33 2014 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [8.8.178.115]) (using TLSv1 with cipher ADH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id D599E25C; Tue, 14 Jan 2014 22:05:33 +0000 (UTC) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mx1.freebsd.org (Postfix) with ESMTPS id C17FD1ECF; Tue, 14 Jan 2014 22:05: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 s0EM5Xbp088144; Tue, 14 Jan 2014 22:05:33 GMT (envelope-from jilles@svn.freebsd.org) Received: (from jilles@localhost) by svn.freebsd.org (8.14.7/8.14.7/Submit) id s0EM5XCL088142; Tue, 14 Jan 2014 22:05:33 GMT (envelope-from jilles@svn.freebsd.org) Message-Id: <201401142205.s0EM5XCL088142@svn.freebsd.org> From: Jilles Tjoelker Date: Tue, 14 Jan 2014 22:05:33 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r260652 - in head/lib/libc: include resolv X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.17 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 14 Jan 2014 22:05:33 -0000 Author: jilles Date: Tue Jan 14 22:05:33 2014 New Revision: 260652 URL: http://svnweb.freebsd.org/changeset/base/260652 Log: libc/resolv: Use poll() instead of kqueue(). The resolver in libc creates a kqueue for watching a single file descriptor. This can be done using poll() which should be lighter on the kernel and reduce possible problems with rlimits (file descriptors, kqueues). Reviewed by: jhb Modified: head/lib/libc/include/port_before.h head/lib/libc/resolv/res_send.c Modified: head/lib/libc/include/port_before.h ============================================================================== --- head/lib/libc/include/port_before.h Tue Jan 14 21:35:25 2014 (r260651) +++ head/lib/libc/include/port_before.h Tue Jan 14 22:05:33 2014 (r260652) @@ -5,7 +5,7 @@ #define _LIBC 1 #define DO_PTHREADS 1 -#define USE_KQUEUE 1 +#define USE_POLL 1 #define ISC_SOCKLEN_T socklen_t #define ISC_FORMAT_PRINTF(fmt, args) \ Modified: head/lib/libc/resolv/res_send.c ============================================================================== --- head/lib/libc/resolv/res_send.c Tue Jan 14 21:35:25 2014 (r260651) +++ head/lib/libc/resolv/res_send.c Tue Jan 14 22:05:33 2014 (r260652) @@ -77,7 +77,7 @@ __FBSDID("$FreeBSD$"); */ #include "port_before.h" -#ifndef USE_KQUEUE +#if !defined(USE_KQUEUE) && !defined(USE_POLL) #include "fd_setsize.h" #endif @@ -963,7 +963,7 @@ send_dg(res_state statp, timeout.tv_nsec/1000000; pollfd.fd = s; pollfd.events = POLLRDNORM; - n = poll(&pollfd, 1, polltimeout); + n = _poll(&pollfd, 1, polltimeout); #endif /* USE_POLL */ if (n == 0) { From owner-svn-src-head@FreeBSD.ORG Tue Jan 14 22:46:25 2014 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [8.8.178.115]) (using TLSv1 with cipher ADH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id 46DC8C57; Tue, 14 Jan 2014 22:46:25 +0000 (UTC) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mx1.freebsd.org (Postfix) with ESMTPS id 2FC731224; Tue, 14 Jan 2014 22:46: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 s0EMkPeP004057; Tue, 14 Jan 2014 22:46:25 GMT (envelope-from hrs@svn.freebsd.org) Received: (from hrs@localhost) by svn.freebsd.org (8.14.7/8.14.7/Submit) id s0EMkOiE004052; Tue, 14 Jan 2014 22:46:24 GMT (envelope-from hrs@svn.freebsd.org) Message-Id: <201401142246.s0EMkOiE004052@svn.freebsd.org> From: Hiroki Sato Date: Tue, 14 Jan 2014 22:46:24 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r260653 - in head/release/doc: de_DE.ISO8859-1 en_US.ISO8859-1/share/xml fr_FR.ISO8859-1 ja_JP.eucJP ru_RU.KOI8-R share/mk share/xml zh_CN.GB2312 X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.17 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 14 Jan 2014 22:46:25 -0000 Author: hrs Date: Tue Jan 14 22:46:23 2014 New Revision: 260653 URL: http://svnweb.freebsd.org/changeset/base/260653 Log: - Purge old translations. - Add missing footer due to DSSSL->XSLT migration and use XML catalog to resolve URI[*]. Based on the work by: gabor [*] Added: head/release/doc/en_US.ISO8859-1/share/xml/catalog.xml (contents, props changed) head/release/doc/en_US.ISO8859-1/share/xml/release.xsl (contents, props changed) head/release/doc/share/xml/release.xsl (contents, props changed) Deleted: head/release/doc/de_DE.ISO8859-1/ head/release/doc/en_US.ISO8859-1/share/xml/catalog head/release/doc/en_US.ISO8859-1/share/xml/release.dsl head/release/doc/fr_FR.ISO8859-1/ head/release/doc/ja_JP.eucJP/ head/release/doc/ru_RU.KOI8-R/ head/release/doc/share/xml/catalog head/release/doc/share/xml/default.dsl head/release/doc/share/xml/release.dsl head/release/doc/zh_CN.GB2312/ Modified: head/release/doc/share/mk/doc.relnotes.mk head/release/doc/share/xml/catalog.xml Added: head/release/doc/en_US.ISO8859-1/share/xml/catalog.xml ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ head/release/doc/en_US.ISO8859-1/share/xml/catalog.xml Tue Jan 14 22:46:23 2014 (r260653) @@ -0,0 +1,12 @@ + + + + + + + + + Added: head/release/doc/en_US.ISO8859-1/share/xml/release.xsl ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ head/release/doc/en_US.ISO8859-1/share/xml/release.xsl Tue Jan 14 22:46:23 2014 (r260653) @@ -0,0 +1,27 @@ + + + + + + + + +

This file, and other release-related documents, + can be downloaded from .

+ +

For questions about FreeBSD, read the + documentation before + contacting <questions@FreeBSD.org>.

+ +

All users of FreeBSD should + subscribe to the <current@FreeBSD.org> + mailing list.

+ +

For questions about this documentation, + e-mail <doc@FreeBSD.org>.

+
+
Modified: head/release/doc/share/mk/doc.relnotes.mk ============================================================================== --- head/release/doc/share/mk/doc.relnotes.mk Tue Jan 14 22:05:33 2014 (r260652) +++ head/release/doc/share/mk/doc.relnotes.mk Tue Jan 14 22:46:23 2014 (r260653) @@ -4,6 +4,8 @@ DOC_PREFIX?= ${RELN_ROOT}/../../../doc # XXX RELEASETYPE!= grep -o 'release.type "[a-z]*"' ${RELN_ROOT}/share/xml/release.ent | sed 's|[a-z.]* "\([a-z]*\)"|\1|' +RELEASEURL!= grep -o 'release.url \"[^\"]*\"' ${RELN_ROOT}/share/xml/release.ent | sed 's|[^ ]* "\([^"]*\)"|\1|' +RELEASEBRANCH!= grep -o 'release.branch "\([^"]*\)"' ${RELN_ROOT}/share/xml/release.ent | sed 's|[^ ]* "\([^"]*\)"|\1|' .if ${RELEASETYPE} == "current" PROFILING+= --param profile.attribute "'releasetype'" --param profile.value "'current'" .elif ${RELEASETYPE} == "snapshot" @@ -11,13 +13,14 @@ PROFILING+= --param profile.attribute "' .elif ${RELEASETYPE} == "release" PROFILING+= --param profile.attribute "'releasetype'" --param profile.value "'release'" .endif +XSLTPROCFLAGS+= --param release.url "'${RELEASEURL}'" +XSLTPROCFLAGS+= --param release.branch "'${RELEASEBRANCH}'" # Find the RELNOTESng document catalogs EXTRA_CATALOGS+= file://${RELN_ROOT}/${LANGCODE}/share/xml/catalog.xml \ - file://${RELN_ROOT}/share/xml/catalog.xml + file://${RELN_ROOT}/share/xml/catalog.xml -# Use the appropriate architecture-dependent RELNOTESng stylesheet -DSLPRINT?= ${RELN_ROOT}/share/xml/default.dsl +XSLXHTML= http://www.FreeBSD.org/release/XML/share/xml/release.xsl # # Automatic device list generation: Modified: head/release/doc/share/xml/catalog.xml ============================================================================== --- head/release/doc/share/xml/catalog.xml Tue Jan 14 22:05:33 2014 (r260652) +++ head/release/doc/share/xml/catalog.xml Tue Jan 14 22:46:23 2014 (r260653) @@ -1,6 +1,11 @@ + + + Added: head/release/doc/share/xml/release.xsl ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ head/release/doc/share/xml/release.xsl Tue Jan 14 22:46:23 2014 (r260653) @@ -0,0 +1,15 @@ + + + + + + + + + + + From owner-svn-src-head@FreeBSD.ORG Tue Jan 14 22:56:26 2014 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) (using TLSv1 with cipher ADH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id 7C68AE99; Tue, 14 Jan 2014 22:56:26 +0000 (UTC) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mx1.freebsd.org (Postfix) with ESMTPS id 5C5D212CB; Tue, 14 Jan 2014 22:56:26 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.7/8.14.7) with ESMTP id s0EMuQP4007800; Tue, 14 Jan 2014 22:56:26 GMT (envelope-from jilles@svn.freebsd.org) Received: (from jilles@localhost) by svn.freebsd.org (8.14.7/8.14.7/Submit) id s0EMuPOi007794; Tue, 14 Jan 2014 22:56:25 GMT (envelope-from jilles@svn.freebsd.org) Message-Id: <201401142256.s0EMuPOi007794@svn.freebsd.org> From: Jilles Tjoelker Date: Tue, 14 Jan 2014 22:56:25 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r260654 - head/bin/sh X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.17 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 14 Jan 2014 22:56:26 -0000 Author: jilles Date: Tue Jan 14 22:56:25 2014 New Revision: 260654 URL: http://svnweb.freebsd.org/changeset/base/260654 Log: sh: Remove SIGWINCH handler and just check for resize before every read. The SIGWINCH handler triggers breakage in libedit which is hard to fix; see PR bin/169773. Also, window size changes while a program is in foreground (and it rather than sh will receive SIGWINCH) will now be picked up automatically. Downside: it is now certain that a resize is only processed after pressing . If libedit is fixed, sh will most likely have to be changed also. PR: bin/180146 Modified: head/bin/sh/input.c head/bin/sh/trap.c head/bin/sh/trap.h Modified: head/bin/sh/input.c ============================================================================== --- head/bin/sh/input.c Tue Jan 14 22:46:23 2014 (r260653) +++ head/bin/sh/input.c Tue Jan 14 22:56:25 2014 (r260654) @@ -162,20 +162,16 @@ preadfd(void) int nr; parsenextc = parsefile->buf; -#ifndef NO_HISTORY - if (el != NULL && gotwinch) { - gotwinch = 0; - el_resize(el); - } -#endif retry: #ifndef NO_HISTORY if (parsefile->fd == 0 && el) { static const char *rl_cp; static int el_len; - if (rl_cp == NULL) + if (rl_cp == NULL) { + el_resize(el); rl_cp = el_gets(el, &el_len); + } if (rl_cp == NULL) nr = el_len == 0 ? 0 : -1; else { Modified: head/bin/sh/trap.c ============================================================================== --- head/bin/sh/trap.c Tue Jan 14 22:46:23 2014 (r260653) +++ head/bin/sh/trap.c Tue Jan 14 22:56:25 2014 (r260654) @@ -80,7 +80,6 @@ static char *volatile trap[NSIG]; /* tra static volatile sig_atomic_t gotsig[NSIG]; /* indicates specified signal received */ static int ignore_sigchld; /* Used while handling SIGCHLD traps. */ -volatile sig_atomic_t gotwinch; static int last_trapsig; static int exiting; /* exitshell() has been called */ @@ -293,12 +292,6 @@ setsignal(int signo) action = S_IGN; break; #endif -#ifndef NO_HISTORY - case SIGWINCH: - if (rootshell && iflag) - action = S_CATCH; - break; -#endif } } @@ -400,11 +393,6 @@ onsig(int signo) gotsig[signo] = 1; pendingsig = signo; } - -#ifndef NO_HISTORY - if (signo == SIGWINCH) - gotwinch = 1; -#endif } @@ -490,9 +478,6 @@ setinteractive(int on) setsignal(SIGINT); setsignal(SIGQUIT); setsignal(SIGTERM); -#ifndef NO_HISTORY - setsignal(SIGWINCH); -#endif is_interactive = on; } Modified: head/bin/sh/trap.h ============================================================================== --- head/bin/sh/trap.h Tue Jan 14 22:46:23 2014 (r260653) +++ head/bin/sh/trap.h Tue Jan 14 22:56:25 2014 (r260654) @@ -36,7 +36,6 @@ extern volatile sig_atomic_t pendingsig; extern volatile sig_atomic_t pendingsig_waitcmd; extern int in_dotrap; -extern volatile sig_atomic_t gotwinch; void clear_traps(void); int have_traps(void); From owner-svn-src-head@FreeBSD.ORG Tue Jan 14 23:04:32 2014 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [8.8.178.115]) (using TLSv1 with cipher ADH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id 50417203; Tue, 14 Jan 2014 23:04:32 +0000 (UTC) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mx1.freebsd.org (Postfix) with ESMTPS id 3C0511379; Tue, 14 Jan 2014 23:04: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 s0EN4W0G011579; Tue, 14 Jan 2014 23:04:32 GMT (envelope-from hrs@svn.freebsd.org) Received: (from hrs@localhost) by svn.freebsd.org (8.14.7/8.14.7/Submit) id s0EN4WTn011578; Tue, 14 Jan 2014 23:04:32 GMT (envelope-from hrs@svn.freebsd.org) Message-Id: <201401142304.s0EN4WTn011578@svn.freebsd.org> From: Hiroki Sato Date: Tue, 14 Jan 2014 23:04:32 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r260655 - head/release/doc/share/xml X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.17 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 14 Jan 2014 23:04:32 -0000 Author: hrs Date: Tue Jan 14 23:04:31 2014 New Revision: 260655 URL: http://svnweb.freebsd.org/changeset/base/260655 Log: Add missing arch= and revision= support. Modified: head/release/doc/share/xml/release.xsl Modified: head/release/doc/share/xml/release.xsl ============================================================================== --- head/release/doc/share/xml/release.xsl Tue Jan 14 22:56:25 2014 (r260654) +++ head/release/doc/share/xml/release.xsl Tue Jan 14 23:04:31 2014 (r260655) @@ -12,4 +12,49 @@ + + + + + + +

+ + + + + + + + + + + + + + + + + + + + + + + + +

+
+ + + + + + + + + + + +
From owner-svn-src-head@FreeBSD.ORG Wed Jan 15 03:57:41 2014 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [8.8.178.115]) (using TLSv1 with cipher ADH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id E86E938B; Wed, 15 Jan 2014 03:57:41 +0000 (UTC) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mx1.freebsd.org (Postfix) with ESMTPS id D5C511152; Wed, 15 Jan 2014 03:57:41 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.7/8.14.7) with ESMTP id s0F3vfAl026163; Wed, 15 Jan 2014 03:57:41 GMT (envelope-from marcel@svn.freebsd.org) Received: (from marcel@localhost) by svn.freebsd.org (8.14.7/8.14.7/Submit) id s0F3vf73026162; Wed, 15 Jan 2014 03:57:41 GMT (envelope-from marcel@svn.freebsd.org) Message-Id: <201401150357.s0F3vf73026162@svn.freebsd.org> From: Marcel Moolenaar Date: Wed, 15 Jan 2014 03:57:41 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r260666 - head/sys/ia64/ia64 X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.17 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 15 Jan 2014 03:57:42 -0000 Author: marcel Date: Wed Jan 15 03:57:41 2014 New Revision: 260666 URL: http://svnweb.freebsd.org/changeset/base/260666 Log: In the nested TLB fault handler, for a direct-mapped address, make sure to clear the lower 12 bits. We're adding the translation attributes to the physical address and non-zero bits in the first 12 bits would give us something unexpected, including invalid bit values. Those trigger nested general protection faults. We do not have to clear the region bits, because they are ignored anyway, so we can replace an existing dep instruction with the one we need. This fixes GP faults for the swapper thread, as it's the only thread that has a direct-mapped stack. Since the bug is in the nested TLB fault handler, the frequency of hitting the GP is in the order of hours/days under load. Modified: head/sys/ia64/ia64/exception.S Modified: head/sys/ia64/ia64/exception.S ============================================================================== --- head/sys/ia64/ia64/exception.S Wed Jan 15 01:27:01 2014 (r260665) +++ head/sys/ia64/ia64/exception.S Wed Jan 15 03:57:41 2014 (r260666) @@ -1026,7 +1026,7 @@ IVT_ENTRY(Data_Nested_TLB, 0x1400) } { .mii mov cr.itir=r26 -(p12) dep r28=0,r30,61,3 +(p12) dep r28=0,r30,0,12 (p13) extr.u r28=r30,3*PAGE_SHIFT-8, PAGE_SHIFT-3 // dir L0 index ;; } From owner-svn-src-head@FreeBSD.ORG Wed Jan 15 12:35:29 2014 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) (using TLSv1 with cipher ADH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id 8F67EDF; Wed, 15 Jan 2014 12:35:29 +0000 (UTC) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mx1.freebsd.org (Postfix) with ESMTPS id 7BB3D1F8F; Wed, 15 Jan 2014 12:35: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 s0FCZT32028019; Wed, 15 Jan 2014 12:35:29 GMT (envelope-from ray@svn.freebsd.org) Received: (from ray@localhost) by svn.freebsd.org (8.14.7/8.14.7/Submit) id s0FCZTX1028018; Wed, 15 Jan 2014 12:35:29 GMT (envelope-from ray@svn.freebsd.org) Message-Id: <201401151235.s0FCZTX1028018@svn.freebsd.org> From: Aleksandr Rybalko Date: Wed, 15 Jan 2014 12:35:29 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r260688 - head/sys/dev/vt/hw/xboxfb X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.17 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 15 Jan 2014 12:35:29 -0000 Author: ray Date: Wed Jan 15 12:35:28 2014 New Revision: 260688 URL: http://svnweb.freebsd.org/changeset/base/260688 Log: Update xboxfb driver to actual state. NOTE: Not tested. Sponsored by: The FreeBSD Foundation Modified: head/sys/dev/vt/hw/xboxfb/xboxfb.c Modified: head/sys/dev/vt/hw/xboxfb/xboxfb.c ============================================================================== --- head/sys/dev/vt/hw/xboxfb/xboxfb.c Wed Jan 15 09:01:04 2014 (r260687) +++ head/sys/dev/vt/hw/xboxfb/xboxfb.c Wed Jan 15 12:35:28 2014 (r260688) @@ -1,12 +1,9 @@ /*- - * Copyright (c) 2005 Rink Springer + * Copyright (c) 2013 The FreeBSD Foundation * All rights reserved. * - * Copyright (c) 2009 The FreeBSD Foundation - * All rights reserved. - * - * Portions of this software were developed by Ed Schouten - * under sponsorship from the FreeBSD Foundation. + * This software was developed by Aleksandr Rybalko under sponsorship from the + * FreeBSD Foundation. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions @@ -28,16 +25,23 @@ * 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$ */ #include __FBSDID("$FreeBSD$"); #include -#include #include +#include +#include + +#include "opt_platform.h" #include +#include +#include #include #include @@ -47,110 +51,32 @@ __FBSDID("$FreeBSD$"); #include #include -struct xbox_softc { - bus_space_tag_t xbox_fb_tag; - bus_space_handle_t xbox_fb_handle; -}; - -/* Convenience macros. */ -#define MEM_WRITE4(sc, ofs, val) \ - bus_space_write_4(sc->xbox_fb_tag, sc->xbox_fb_handle, ofs, val) - #define VT_XBOX_WIDTH 640 #define VT_XBOX_HEIGHT 480 -static vd_init_t xbox_init; -static vd_blank_t xbox_blank; -static vd_bitbltchr_t xbox_bitbltchr; - -static const struct vt_driver vt_xbox_driver = { - .vd_init = xbox_init, - .vd_blank = xbox_blank, - .vd_bitbltchr = xbox_bitbltchr, - .vd_priority = VD_PRIORITY_GENERIC+1, -}; +static vd_init_t xboxfb_init; -static struct xbox_softc xbox_conssoftc; -VT_CONSDEV_DECLARE(vt_xbox_driver, PIXEL_WIDTH(VT_XBOX_WIDTH), - PIXEL_HEIGHT(VT_XBOX_HEIGHT), &xbox_conssoftc); - -static const uint32_t colormap[] = { - 0x00000000, /* Black */ - 0x00ff0000, /* Red */ - 0x0000ff00, /* Green */ - 0x00c0c000, /* Brown */ - 0x000000ff, /* Blue */ - 0x00c000c0, /* Magenta */ - 0x0000c0c0, /* Cyan */ - 0x00c0c0c0, /* Light grey */ - 0x00808080, /* Dark grey */ - 0x00ff8080, /* Light red */ - 0x0080ff80, /* Light green */ - 0x00ffff80, /* Yellow */ - 0x008080ff, /* Light blue */ - 0x00ff80ff, /* Light magenta */ - 0x0080ffff, /* Light cyan */ - 0x00ffffff, /* White */ +static struct vt_driver xboxfb_driver = { + .vd_init = xboxfb_init, + .vd_blank = vt_fb_blank, + .vd_bitbltchr = vt_fb_bitbltchr, + .vd_priority = VD_PRIORITY_GENERIC, }; -static void -xbox_blank(struct vt_device *vd, term_color_t color) -{ - struct xbox_softc *sc = vd->vd_softc; - u_int ofs; - uint32_t c; - - c = colormap[color]; - for (ofs = 0; ofs < (VT_XBOX_WIDTH * VT_XBOX_HEIGHT) * 4; ofs += 4) - MEM_WRITE4(sc, ofs, c); -} - -static void -xbox_bitbltchr(struct vt_device *vd, const uint8_t *src, const uint8_t *mask, - int bpl, vt_axis_t top, vt_axis_t left, unsigned int width, - unsigned int height, term_color_t fg, term_color_t bg) -{ - struct xbox_softc *sc = vd->vd_softc; - u_long line; - uint32_t fgc, bgc; - int c; - uint8_t b, m; - - fgc = colormap[fg]; - bgc = colormap[bg]; - - /* Don't try to put off screen pixels */ - if (((left + width) > info->fb_width) || ((top + height) > - info->fb_height)) - return; - - line = (VT_XBOX_WIDTH * top + left) * 4; - for (; height > 0; height--) { - for (c = 0; c < width; c++) { - if (c % 8 == 0) - b = *src++; - else - b <<= 1; - if (mask != NULL) { - if (c % 8 == 0) - m = *mask++; - else - m <<= 1; - /* Skip pixel write, if mask has no bit set. */ - if ((m & 0x80) == 0) - continue; - } - MEM_WRITE4(sc, line + c * 4, b & 0x80 ? fgc : bgc); - } - line += VT_XBOX_WIDTH * 4; - } -} +static struct fb_info xboxfb_info; +VT_CONSDEV_DECLARE(xboxfb_driver, PIXEL_WIDTH(VT_XBOX_WIDTH), + PIXEL_HEIGHT(VT_XBOX_HEIGHT), &xboxfb_info); -static void -xbox_initialize(struct vt_device *vd) +static int +xboxfb_init(struct vt_device *vd) { + struct fb_info *info; int i; + if (!arch_i386_is_xbox) + return (CN_DEAD); + + info = &xboxfb_info; /* * We must make a mapping from video framebuffer memory * to real. This is very crude: we map the entire @@ -175,25 +101,27 @@ xbox_initialize(struct vt_device *vd) *(uint32_t *)((i + 1) * PAGE_SIZE + XBOX_FB_START_PTR % PAGE_SIZE) = XBOX_FB_START; - /* Clear the screen. */ - xbox_blank(vd, TC_BLACK); -} - -static int -xbox_init(struct vt_device *vd) -{ - struct xbox_softc *sc = vd->vd_softc; - - if (!arch_i386_is_xbox) - return (CN_DEAD); + /* Initialize fb_info. */ + info = vd->vd_softc; - sc->xbox_fb_tag = X86_BUS_SPACE_MEM; - sc->xbox_fb_handle = PAGE_SIZE; + info->fb_width = VT_XBOX_WIDTH; + info->fb_height = VT_XBOX_HEIGHT; - vd->vd_width = VT_XBOX_WIDTH; - vd->vd_height = VT_XBOX_HEIGHT; + info->fb_size = XBOX_FB_SIZE; + info->fb_stride = VT_XBOX_WIDTH * 4; /* 32bits per pixel. */ - xbox_initialize(vd); + info->fb_vbase = PAGE_SIZE; + info->fb_pbase = XBOX_FB_START_PTR; + + /* Get pixel storage size. */ + info->fb_bpp = 32; + /* Get color depth. */ + info->fb_depth = 24; + + vt_generate_vga_palette(info->fb_cmap, COLOR_FORMAT_RGB, 255, 0, 255, + 8, 255, 16); + fb_probe(info); + vt_fb_init(vd); return (CN_INTERNAL); } @@ -201,12 +129,13 @@ xbox_init(struct vt_device *vd) static void xbox_remap(void *unused) { + struct fb_info *info; if (!arch_i386_is_xbox) return; - xbox_conssoftc.xbox_fb_handle = - (bus_space_handle_t)pmap_mapdev(XBOX_FB_START, XBOX_FB_SIZE); + info = &xboxfb_info; + info->fb_vbase = (intptr_t)pmap_mapdev(info->fb_pbase, info->fb_size); } SYSINIT(xboxfb, SI_SUB_DRIVERS, SI_ORDER_ANY, xbox_remap, NULL); From owner-svn-src-head@FreeBSD.ORG Wed Jan 15 15:16:12 2014 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [8.8.178.115]) (using TLSv1 with cipher ADH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id 449E0A9C; Wed, 15 Jan 2014 15:16:12 +0000 (UTC) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mx1.freebsd.org (Postfix) with ESMTPS id 163801D23; Wed, 15 Jan 2014 15:16: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 s0FFGB2a088449; Wed, 15 Jan 2014 15:16:11 GMT (envelope-from skreuzer@svn.freebsd.org) Received: (from skreuzer@localhost) by svn.freebsd.org (8.14.7/8.14.7/Submit) id s0FFGBkM088448; Wed, 15 Jan 2014 15:16:11 GMT (envelope-from skreuzer@svn.freebsd.org) Message-Id: <201401151516.s0FFGBkM088448@svn.freebsd.org> From: Steven Kreuzer Date: Wed, 15 Jan 2014 15:16:11 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r260689 - head/release/doc/en_US.ISO8859-1/relnotes X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.17 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 15 Jan 2014 15:16:12 -0000 Author: skreuzer (ports committer) Date: Wed Jan 15 15:16:11 2014 New Revision: 260689 URL: http://svnweb.freebsd.org/changeset/base/260689 Log: Remove reference to FreeBSD 6.2-RELEASE from 'Upgrading from previous releases' paragraph since all supported version of FreeBSD now support binary upgrades Remove 'of course,' from foot note reminding to create a backup before attempting a binary update Approved by: hrs (mentor) Modified: head/release/doc/en_US.ISO8859-1/relnotes/article.xml Modified: head/release/doc/en_US.ISO8859-1/relnotes/article.xml ============================================================================== --- head/release/doc/en_US.ISO8859-1/relnotes/article.xml Wed Jan 15 12:35:28 2014 (r260688) +++ head/release/doc/en_US.ISO8859-1/relnotes/article.xml Wed Jan 15 15:16:11 2014 (r260689) @@ -723,14 +723,13 @@ hv_vmbus_load="YES" Al Upgrading from previous releases of &os; - Beginning with &os; 6.2-RELEASE, - binary upgrades between RELEASE versions (and snapshots of the - various security branches) are supported using the - &man.freebsd-update.8; utility. The binary upgrade procedure will - update unmodified userland utilities, as well as unmodified GENERIC or - SMP kernels distributed as a part of an official &os; release. - The &man.freebsd-update.8; utility requires that the host being - upgraded have Internet connectivity. + Binary upgrades between RELEASE versions + (and snapshots of the various security branches) are supported + using the &man.freebsd-update.8; utility. The binary upgrade + procedure will update unmodified userland utilities, as well as + unmodified GENERIC kernels distributed as a part of an official + &os; release. The &man.freebsd-update.8; utility requires that + the host being upgraded have Internet connectivity. Source-based upgrades (those based on recompiling the &os; base system from source code) from previous versions are @@ -738,7 +737,7 @@ hv_vmbus_load="YES" Al /usr/src/UPDATING. - Upgrading &os; should, of course, only be attempted after + Upgrading &os; should only be attempted after backing up all data and configuration files. From owner-svn-src-head@FreeBSD.ORG Wed Jan 15 17:34:22 2014 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [8.8.178.115]) (using TLSv1 with cipher ADH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id 184EE905; Wed, 15 Jan 2014 17:34:22 +0000 (UTC) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mx1.freebsd.org (Postfix) with ESMTPS id EC2EE1F2B; Wed, 15 Jan 2014 17:34:21 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.7/8.14.7) with ESMTP id s0FHYLAY042854; Wed, 15 Jan 2014 17:34:21 GMT (envelope-from hrs@svn.freebsd.org) Received: (from hrs@localhost) by svn.freebsd.org (8.14.7/8.14.7/Submit) id s0FHYL0a042853; Wed, 15 Jan 2014 17:34:21 GMT (envelope-from hrs@svn.freebsd.org) Message-Id: <201401151734.s0FHYL0a042853@svn.freebsd.org> From: Hiroki Sato Date: Wed, 15 Jan 2014 17:34:21 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r260691 - head/release/doc/en_US.ISO8859-1/errata X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.17 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 15 Jan 2014 17:34:22 -0000 Author: hrs Date: Wed Jan 15 17:34:21 2014 New Revision: 260691 URL: http://svnweb.freebsd.org/changeset/base/260691 Log: - Fix indent. - Minor clean up after DB5 migration. Modified: head/release/doc/en_US.ISO8859-1/errata/article.xml Modified: head/release/doc/en_US.ISO8859-1/errata/article.xml ============================================================================== --- head/release/doc/en_US.ISO8859-1/errata/article.xml Wed Jan 15 17:06:10 2014 (r260690) +++ head/release/doc/en_US.ISO8859-1/errata/article.xml Wed Jan 15 17:34:21 2014 (r260691) @@ -1,45 +1,24 @@ + "http://www.FreeBSD.org/XML/share/xml/freebsd50.dtd" [ + %release; ]> - -
- &os; &release; Errata - - - - The &os; Project - + +
+ + &os; &release; Errata + + The &os; Project $FreeBSD$ - 2000 - 2001 - 2002 - 2003 - 2004 - 2005 - 2006 - 2007 - 2008 - 2009 - 2010 - 2011 - 2012 - 2013 + 2014 + The &os; Documentation Project @@ -50,20 +29,20 @@ &tm-attrib.general; - - This document lists errata items for &os; &release;, - containing significant information discovered after the release - or too late in the release cycle to be otherwise included in the - release documentation. - This information includes security advisories, as well as news - relating to the software or documentation that could affect its - operation or usability. An up-to-date version of this document - should always be consulted before installing this version of - &os;. - - This errata document for &os; &release; - will be maintained until the release of &os; &release.next;. - + + This document lists errata items for &os; &release;, + containing significant information discovered after the release + or too late in the release cycle to be otherwise included in the + release documentation. + This information includes security advisories, as well as news + relating to the software or documentation that could affect its + operation or usability. An up-to-date version of this document + should always be consulted before installing this version of + &os;. + + This errata document for &os; &release; + will be maintained until the release of &os; &release.next;. + @@ -80,44 +59,35 @@ out of date by definition, but other copies are kept updated on the Internet and should be consulted as the current errata for this release. These other copies of the - errata are located at http://www.FreeBSD.org/releases/, plus any sites + errata are located at + , + plus any sites which keep up-to-date mirrors of this location. Source and binary snapshots of &os; &release.branch; also contain up-to-date copies of this document (as of the time of the snapshot). - For a list of all &os; CERT security advisories, see http://www.FreeBSD.org/security/ or ftp://ftp.FreeBSD.org/pub/FreeBSD/CERT/. - + For a list of all &os; CERT security advisories, see + + or . Security Advisories - No advisories. - - No advisories. - - No advisories. + No advisory. Open Issues - No open issues. - - No open issues. - - No open issues. + No open issues. Late-Breaking News - No news. - - No news. - - No news. + No news.
From owner-svn-src-head@FreeBSD.ORG Wed Jan 15 19:49:13 2014 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) (using TLSv1 with cipher ADH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id 0CE504E6; Wed, 15 Jan 2014 19:49:13 +0000 (UTC) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mx1.freebsd.org (Postfix) with ESMTPS id ED5DE1F4B; Wed, 15 Jan 2014 19:49: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 s0FJnCmX094220; Wed, 15 Jan 2014 19:49:12 GMT (envelope-from imp@svn.freebsd.org) Received: (from imp@localhost) by svn.freebsd.org (8.14.7/8.14.7/Submit) id s0FJnC6d094219; Wed, 15 Jan 2014 19:49:12 GMT (envelope-from imp@svn.freebsd.org) Message-Id: <201401151949.s0FJnC6d094219@svn.freebsd.org> From: Warner Losh Date: Wed, 15 Jan 2014 19:49:12 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r260695 - head/sys/arm/at91 X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.17 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 15 Jan 2014 19:49:13 -0000 Author: imp Date: Wed Jan 15 19:49:12 2014 New Revision: 260695 URL: http://svnweb.freebsd.org/changeset/base/260695 Log: Provide a simplified way to specify GPIO pins for the Atmel port. Added: head/sys/arm/at91/at91_gpio.h (contents, props changed) Added: head/sys/arm/at91/at91_gpio.h ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ head/sys/arm/at91/at91_gpio.h Wed Jan 15 19:49:12 2014 (r260695) @@ -0,0 +1,296 @@ +/*- + * Copyright (c) 2014 M. Warner Losh. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY 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 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 ARM_AT91_AT91_GPIO_H +#define ARM_AT91_AT91_GPIO_H + +typedef uint32_t at91_pin_t; + +#define AT91_PIN_NONE 0xfffffffful /* No pin / Not GPIO controlled */ + +/* + * Map Atmel PIO pins to a unique number. They are just numbered sequentially. + */ + +#define AT91_PIN_PA0 (at91_pin_t)0 +#define AT91_PIN_PA1 (at91_pin_t)1 +#define AT91_PIN_PA2 (at91_pin_t)2 +#define AT91_PIN_PA3 (at91_pin_t)3 +#define AT91_PIN_PA4 (at91_pin_t)4 +#define AT91_PIN_PA5 (at91_pin_t)5 +#define AT91_PIN_PA6 (at91_pin_t)6 +#define AT91_PIN_PA7 (at91_pin_t)7 +#define AT91_PIN_PA8 (at91_pin_t)8 +#define AT91_PIN_PA9 (at91_pin_t)9 +#define AT91_PIN_PA10 (at91_pin_t)10 +#define AT91_PIN_PA11 (at91_pin_t)11 +#define AT91_PIN_PA12 (at91_pin_t)12 +#define AT91_PIN_PA13 (at91_pin_t)13 +#define AT91_PIN_PA14 (at91_pin_t)14 +#define AT91_PIN_PA15 (at91_pin_t)15 +#define AT91_PIN_PA16 (at91_pin_t)16 +#define AT91_PIN_PA17 (at91_pin_t)17 +#define AT91_PIN_PA18 (at91_pin_t)18 +#define AT91_PIN_PA19 (at91_pin_t)19 +#define AT91_PIN_PA20 (at91_pin_t)20 +#define AT91_PIN_PA21 (at91_pin_t)21 +#define AT91_PIN_PA22 (at91_pin_t)22 +#define AT91_PIN_PA23 (at91_pin_t)23 +#define AT91_PIN_PA24 (at91_pin_t)24 +#define AT91_PIN_PA25 (at91_pin_t)25 +#define AT91_PIN_PA26 (at91_pin_t)26 +#define AT91_PIN_PA27 (at91_pin_t)27 +#define AT91_PIN_PA28 (at91_pin_t)28 +#define AT91_PIN_PA29 (at91_pin_t)29 +#define AT91_PIN_PA30 (at91_pin_t)30 +#define AT91_PIN_PA31 (at91_pin_t)31 +#define AT91_PIN_PB0 (at91_pin_t)32 +#define AT91_PIN_PB1 (at91_pin_t)33 +#define AT91_PIN_PB2 (at91_pin_t)34 +#define AT91_PIN_PB3 (at91_pin_t)35 +#define AT91_PIN_PB4 (at91_pin_t)36 +#define AT91_PIN_PB5 (at91_pin_t)37 +#define AT91_PIN_PB6 (at91_pin_t)38 +#define AT91_PIN_PB7 (at91_pin_t)39 +#define AT91_PIN_PB8 (at91_pin_t)40 +#define AT91_PIN_PB9 (at91_pin_t)41 +#define AT91_PIN_PB10 (at91_pin_t)42 +#define AT91_PIN_PB11 (at91_pin_t)43 +#define AT91_PIN_PB12 (at91_pin_t)44 +#define AT91_PIN_PB13 (at91_pin_t)45 +#define AT91_PIN_PB14 (at91_pin_t)46 +#define AT91_PIN_PB15 (at91_pin_t)47 +#define AT91_PIN_PB16 (at91_pin_t)48 +#define AT91_PIN_PB17 (at91_pin_t)49 +#define AT91_PIN_PB18 (at91_pin_t)50 +#define AT91_PIN_PB19 (at91_pin_t)51 +#define AT91_PIN_PB20 (at91_pin_t)52 +#define AT91_PIN_PB21 (at91_pin_t)53 +#define AT91_PIN_PB22 (at91_pin_t)54 +#define AT91_PIN_PB23 (at91_pin_t)55 +#define AT91_PIN_PB24 (at91_pin_t)56 +#define AT91_PIN_PB25 (at91_pin_t)57 +#define AT91_PIN_PB26 (at91_pin_t)58 +#define AT91_PIN_PB27 (at91_pin_t)59 +#define AT91_PIN_PB28 (at91_pin_t)60 +#define AT91_PIN_PB29 (at91_pin_t)61 +#define AT91_PIN_PB30 (at91_pin_t)62 +#define AT91_PIN_PB31 (at91_pin_t)63 +#define AT91_PIN_PC0 (at91_pin_t)64 +#define AT91_PIN_PC1 (at91_pin_t)65 +#define AT91_PIN_PC2 (at91_pin_t)66 +#define AT91_PIN_PC3 (at91_pin_t)67 +#define AT91_PIN_PC4 (at91_pin_t)68 +#define AT91_PIN_PC5 (at91_pin_t)69 +#define AT91_PIN_PC6 (at91_pin_t)70 +#define AT91_PIN_PC7 (at91_pin_t)71 +#define AT91_PIN_PC8 (at91_pin_t)72 +#define AT91_PIN_PC9 (at91_pin_t)73 +#define AT91_PIN_PC10 (at91_pin_t)74 +#define AT91_PIN_PC11 (at91_pin_t)75 +#define AT91_PIN_PC12 (at91_pin_t)76 +#define AT91_PIN_PC13 (at91_pin_t)77 +#define AT91_PIN_PC14 (at91_pin_t)78 +#define AT91_PIN_PC15 (at91_pin_t)79 +#define AT91_PIN_PC16 (at91_pin_t)80 +#define AT91_PIN_PC17 (at91_pin_t)81 +#define AT91_PIN_PC18 (at91_pin_t)82 +#define AT91_PIN_PC19 (at91_pin_t)83 +#define AT91_PIN_PC20 (at91_pin_t)84 +#define AT91_PIN_PC21 (at91_pin_t)85 +#define AT91_PIN_PC22 (at91_pin_t)86 +#define AT91_PIN_PC23 (at91_pin_t)87 +#define AT91_PIN_PC24 (at91_pin_t)88 +#define AT91_PIN_PC25 (at91_pin_t)89 +#define AT91_PIN_PC26 (at91_pin_t)90 +#define AT91_PIN_PC27 (at91_pin_t)91 +#define AT91_PIN_PC28 (at91_pin_t)92 +#define AT91_PIN_PC29 (at91_pin_t)93 +#define AT91_PIN_PC30 (at91_pin_t)94 +#define AT91_PIN_PC31 (at91_pin_t)95 +#define AT91_PIN_PD0 (at91_pin_t)96 +#define AT91_PIN_PD1 (at91_pin_t)97 +#define AT91_PIN_PD2 (at91_pin_t)98 +#define AT91_PIN_PD3 (at91_pin_t)99 +#define AT91_PIN_PD4 (at91_pin_t)100 +#define AT91_PIN_PD5 (at91_pin_t)101 +#define AT91_PIN_PD6 (at91_pin_t)102 +#define AT91_PIN_PD7 (at91_pin_t)103 +#define AT91_PIN_PD8 (at91_pin_t)104 +#define AT91_PIN_PD9 (at91_pin_t)105 +#define AT91_PIN_PD10 (at91_pin_t)106 +#define AT91_PIN_PD11 (at91_pin_t)107 +#define AT91_PIN_PD12 (at91_pin_t)108 +#define AT91_PIN_PD13 (at91_pin_t)109 +#define AT91_PIN_PD14 (at91_pin_t)110 +#define AT91_PIN_PD15 (at91_pin_t)111 +#define AT91_PIN_PD16 (at91_pin_t)112 +#define AT91_PIN_PD17 (at91_pin_t)113 +#define AT91_PIN_PD18 (at91_pin_t)114 +#define AT91_PIN_PD19 (at91_pin_t)115 +#define AT91_PIN_PD20 (at91_pin_t)116 +#define AT91_PIN_PD21 (at91_pin_t)117 +#define AT91_PIN_PD22 (at91_pin_t)118 +#define AT91_PIN_PD23 (at91_pin_t)119 +#define AT91_PIN_PD24 (at91_pin_t)120 +#define AT91_PIN_PD25 (at91_pin_t)121 +#define AT91_PIN_PD26 (at91_pin_t)122 +#define AT91_PIN_PD27 (at91_pin_t)123 +#define AT91_PIN_PD28 (at91_pin_t)124 +#define AT91_PIN_PD29 (at91_pin_t)125 +#define AT91_PIN_PD30 (at91_pin_t)126 +#define AT91_PIN_PD31 (at91_pin_t)127 +#define AT91_PIN_PE0 (at91_pin_t)128 +#define AT91_PIN_PE1 (at91_pin_t)129 +#define AT91_PIN_PE2 (at91_pin_t)130 +#define AT91_PIN_PE3 (at91_pin_t)131 +#define AT91_PIN_PE4 (at91_pin_t)132 +#define AT91_PIN_PE5 (at91_pin_t)133 +#define AT91_PIN_PE6 (at91_pin_t)134 +#define AT91_PIN_PE7 (at91_pin_t)135 +#define AT91_PIN_PE8 (at91_pin_t)136 +#define AT91_PIN_PE9 (at91_pin_t)137 +#define AT91_PIN_PE10 (at91_pin_t)138 +#define AT91_PIN_PE11 (at91_pin_t)139 +#define AT91_PIN_PE12 (at91_pin_t)140 +#define AT91_PIN_PE13 (at91_pin_t)141 +#define AT91_PIN_PE14 (at91_pin_t)142 +#define AT91_PIN_PE15 (at91_pin_t)143 +#define AT91_PIN_PE16 (at91_pin_t)144 +#define AT91_PIN_PE17 (at91_pin_t)145 +#define AT91_PIN_PE18 (at91_pin_t)146 +#define AT91_PIN_PE19 (at91_pin_t)147 +#define AT91_PIN_PE20 (at91_pin_t)148 +#define AT91_PIN_PE21 (at91_pin_t)149 +#define AT91_PIN_PE22 (at91_pin_t)150 +#define AT91_PIN_PE23 (at91_pin_t)151 +#define AT91_PIN_PE24 (at91_pin_t)152 +#define AT91_PIN_PE25 (at91_pin_t)153 +#define AT91_PIN_PE26 (at91_pin_t)154 +#define AT91_PIN_PE27 (at91_pin_t)155 +#define AT91_PIN_PE28 (at91_pin_t)156 +#define AT91_PIN_PE29 (at91_pin_t)157 +#define AT91_PIN_PE30 (at91_pin_t)158 +#define AT91_PIN_PE31 (at91_pin_t)159 +#define AT91_PIN_PF0 (at91_pin_t)160 +#define AT91_PIN_PF1 (at91_pin_t)161 +#define AT91_PIN_PF2 (at91_pin_t)162 +#define AT91_PIN_PF3 (at91_pin_t)163 +#define AT91_PIN_PF4 (at91_pin_t)164 +#define AT91_PIN_PF5 (at91_pin_t)165 +#define AT91_PIN_PF6 (at91_pin_t)166 +#define AT91_PIN_PF7 (at91_pin_t)167 +#define AT91_PIN_PF8 (at91_pin_t)168 +#define AT91_PIN_PF9 (at91_pin_t)169 +#define AT91_PIN_PF10 (at91_pin_t)170 +#define AT91_PIN_PF11 (at91_pin_t)171 +#define AT91_PIN_PF12 (at91_pin_t)172 +#define AT91_PIN_PF13 (at91_pin_t)173 +#define AT91_PIN_PF14 (at91_pin_t)174 +#define AT91_PIN_PF15 (at91_pin_t)175 +#define AT91_PIN_PF16 (at91_pin_t)176 +#define AT91_PIN_PF17 (at91_pin_t)177 +#define AT91_PIN_PF18 (at91_pin_t)178 +#define AT91_PIN_PF19 (at91_pin_t)179 +#define AT91_PIN_PF20 (at91_pin_t)180 +#define AT91_PIN_PF21 (at91_pin_t)181 +#define AT91_PIN_PF22 (at91_pin_t)182 +#define AT91_PIN_PF23 (at91_pin_t)183 +#define AT91_PIN_PF24 (at91_pin_t)184 +#define AT91_PIN_PF25 (at91_pin_t)185 +#define AT91_PIN_PF26 (at91_pin_t)186 +#define AT91_PIN_PF27 (at91_pin_t)187 +#define AT91_PIN_PF28 (at91_pin_t)188 +#define AT91_PIN_PF29 (at91_pin_t)189 +#define AT91_PIN_PF30 (at91_pin_t)190 +#define AT91_PIN_PF31 (at91_pin_t)191 +#define AT91_PIN_PG0 (at91_pin_t)192 +#define AT91_PIN_PG1 (at91_pin_t)193 +#define AT91_PIN_PG2 (at91_pin_t)194 +#define AT91_PIN_PG3 (at91_pin_t)195 +#define AT91_PIN_PG4 (at91_pin_t)196 +#define AT91_PIN_PG5 (at91_pin_t)197 +#define AT91_PIN_PG6 (at91_pin_t)198 +#define AT91_PIN_PG7 (at91_pin_t)199 +#define AT91_PIN_PG8 (at91_pin_t)200 +#define AT91_PIN_PG9 (at91_pin_t)201 +#define AT91_PIN_PG10 (at91_pin_t)202 +#define AT91_PIN_PG11 (at91_pin_t)203 +#define AT91_PIN_PG12 (at91_pin_t)204 +#define AT91_PIN_PG13 (at91_pin_t)205 +#define AT91_PIN_PG14 (at91_pin_t)206 +#define AT91_PIN_PG15 (at91_pin_t)207 +#define AT91_PIN_PG16 (at91_pin_t)208 +#define AT91_PIN_PG17 (at91_pin_t)209 +#define AT91_PIN_PG18 (at91_pin_t)210 +#define AT91_PIN_PG19 (at91_pin_t)211 +#define AT91_PIN_PG20 (at91_pin_t)212 +#define AT91_PIN_PG21 (at91_pin_t)213 +#define AT91_PIN_PG22 (at91_pin_t)214 +#define AT91_PIN_PG23 (at91_pin_t)215 +#define AT91_PIN_PG24 (at91_pin_t)216 +#define AT91_PIN_PG25 (at91_pin_t)217 +#define AT91_PIN_PG26 (at91_pin_t)218 +#define AT91_PIN_PG27 (at91_pin_t)219 +#define AT91_PIN_PG28 (at91_pin_t)220 +#define AT91_PIN_PG29 (at91_pin_t)221 +#define AT91_PIN_PG30 (at91_pin_t)222 +#define AT91_PIN_PG31 (at91_pin_t)223 +#define AT91_PIN_PH0 (at91_pin_t)224 +#define AT91_PIN_PH1 (at91_pin_t)225 +#define AT91_PIN_PH2 (at91_pin_t)226 +#define AT91_PIN_PH3 (at91_pin_t)227 +#define AT91_PIN_PH4 (at91_pin_t)228 +#define AT91_PIN_PH5 (at91_pin_t)229 +#define AT91_PIN_PH6 (at91_pin_t)230 +#define AT91_PIN_PH7 (at91_pin_t)231 +#define AT91_PIN_PH8 (at91_pin_t)232 +#define AT91_PIN_PH9 (at91_pin_t)233 +#define AT91_PIN_PH10 (at91_pin_t)234 +#define AT91_PIN_PH11 (at91_pin_t)235 +#define AT91_PIN_PH12 (at91_pin_t)236 +#define AT91_PIN_PH13 (at91_pin_t)237 +#define AT91_PIN_PH14 (at91_pin_t)238 +#define AT91_PIN_PH15 (at91_pin_t)239 +#define AT91_PIN_PH16 (at91_pin_t)240 +#define AT91_PIN_PH17 (at91_pin_t)241 +#define AT91_PIN_PH18 (at91_pin_t)242 +#define AT91_PIN_PH19 (at91_pin_t)243 +#define AT91_PIN_PH20 (at91_pin_t)244 +#define AT91_PIN_PH21 (at91_pin_t)245 +#define AT91_PIN_PH22 (at91_pin_t)246 +#define AT91_PIN_PH23 (at91_pin_t)247 +#define AT91_PIN_PH24 (at91_pin_t)248 +#define AT91_PIN_PH25 (at91_pin_t)249 +#define AT91_PIN_PH26 (at91_pin_t)250 +#define AT91_PIN_PH27 (at91_pin_t)251 +#define AT91_PIN_PH28 (at91_pin_t)252 +#define AT91_PIN_PH29 (at91_pin_t)253 +#define AT91_PIN_PH30 (at91_pin_t)254 +#define AT91_PIN_PH31 (at91_pin_t)255 + +#endif /* ARM_AT91_AT91_GPIO_H */ From owner-svn-src-head@FreeBSD.ORG Wed Jan 15 19:53:38 2014 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [8.8.178.115]) (using TLSv1 with cipher ADH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id 052518AC; Wed, 15 Jan 2014 19:53:38 +0000 (UTC) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mx1.freebsd.org (Postfix) with ESMTPS id D96DE1FD7; Wed, 15 Jan 2014 19:53: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 s0FJrbb3097534; Wed, 15 Jan 2014 19:53:37 GMT (envelope-from imp@svn.freebsd.org) Received: (from imp@localhost) by svn.freebsd.org (8.14.7/8.14.7/Submit) id s0FJraal097526; Wed, 15 Jan 2014 19:53:36 GMT (envelope-from imp@svn.freebsd.org) Message-Id: <201401151953.s0FJraal097526@svn.freebsd.org> From: Warner Losh Date: Wed, 15 Jan 2014 19:53:36 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r260696 - head/sys/arm/at91 X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.17 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 15 Jan 2014 19:53:38 -0000 Author: imp Date: Wed Jan 15 19:53:36 2014 New Revision: 260696 URL: http://svnweb.freebsd.org/changeset/base/260696 Log: Add data so we can convert a PIO unit number into a base address. Modified: head/sys/arm/at91/at91rm9200.c head/sys/arm/at91/at91sam9260.c head/sys/arm/at91/at91sam9g20.c head/sys/arm/at91/at91sam9g45.c head/sys/arm/at91/at91sam9x5.c head/sys/arm/at91/at91var.h Modified: head/sys/arm/at91/at91rm9200.c ============================================================================== --- head/sys/arm/at91/at91rm9200.c Wed Jan 15 19:49:12 2014 (r260695) +++ head/sys/arm/at91/at91rm9200.c Wed Jan 15 19:53:36 2014 (r260696) @@ -88,6 +88,13 @@ static const int at91_irq_prio[32] = 0 /* Advanced Interrupt Controller (IRQ6) */ }; +static const uint32_t at91_pio_base[] = { + AT91RM92_PIOA_BASE, + AT91RM92_PIOB_BASE, + AT91RM92_PIOC_BASE, + AT91RM92_PIOD_BASE, +}; + #define DEVICE(_name, _id, _unit) \ { \ _name, _unit, \ @@ -195,6 +202,8 @@ static struct at91_soc_data soc_data = { .soc_clock_init = at91_clock_init, .soc_irq_prio = at91_irq_prio, .soc_children = at91_devs, + .soc_pio_base = at91_pio_base, + .soc_pio_count = nitems(at91_pio_base), }; AT91_SOC(AT91_T_RM9200, &soc_data); Modified: head/sys/arm/at91/at91sam9260.c ============================================================================== --- head/sys/arm/at91/at91sam9260.c Wed Jan 15 19:49:12 2014 (r260695) +++ head/sys/arm/at91/at91sam9260.c Wed Jan 15 19:53:36 2014 (r260696) @@ -87,6 +87,12 @@ static const int at91_irq_prio[32] = 0, /* Advanced Interrupt Controller IRQ2 */ }; +static const uint32_t at91_pio_base[] = { + AT91SAM9260_PIOA_BASE, + AT91SAM9260_PIOB_BASE, + AT91SAM9260_PIOC_BASE, +}; + #define DEVICE(_name, _id, _unit) \ { \ _name, _unit, \ @@ -204,6 +210,8 @@ static struct at91_soc_data soc_data = { .soc_clock_init = at91_clock_init, .soc_irq_prio = at91_irq_prio, .soc_children = at91_devs, + .soc_pio_base = at91_pio_base, + .soc_pio_count = nitems(at91_pio_base), }; AT91_SOC(AT91_T_SAM9260, &soc_data); Modified: head/sys/arm/at91/at91sam9g20.c ============================================================================== --- head/sys/arm/at91/at91sam9g20.c Wed Jan 15 19:49:12 2014 (r260695) +++ head/sys/arm/at91/at91sam9g20.c Wed Jan 15 19:53:36 2014 (r260696) @@ -87,6 +87,12 @@ static const int at91_irq_prio[32] = 0, /* Advanced Interrupt Controller IRQ2 */ }; +static const uint32_t at91_pio_base[] = { + AT91SAM9G20_PIOA_BASE, + AT91SAM9G20_PIOB_BASE, + AT91SAM9G20_PIOC_BASE, +}; + #define DEVICE(_name, _id, _unit) \ { \ _name, _unit, \ @@ -169,6 +175,8 @@ static struct at91_soc_data soc_data = { .soc_clock_init = at91_clock_init, .soc_irq_prio = at91_irq_prio, .soc_children = at91_devs, + .soc_pio_base = at91_pio_base, + .soc_pio_count = nitems(at91_pio_base), }; AT91_SOC(AT91_T_SAM9G20, &soc_data); Modified: head/sys/arm/at91/at91sam9g45.c ============================================================================== --- head/sys/arm/at91/at91sam9g45.c Wed Jan 15 19:49:12 2014 (r260695) +++ head/sys/arm/at91/at91sam9g45.c Wed Jan 15 19:53:36 2014 (r260696) @@ -88,6 +88,14 @@ static const int at91_irq_prio[32] = 0, /* Advanced Interrupt Controller IRQ0 */ }; +static const uint32_t at91_pio_base[] = { + AT91SAM9G45_PIOA_BASE, + AT91SAM9G45_PIOB_BASE, + AT91SAM9G45_PIOC_BASE, + AT91SAM9G45_PIOD_BASE, + AT91SAM9G45_PIOE_BASE, +}; + #define DEVICE(_name, _id, _unit) \ { \ _name, _unit, \ @@ -155,6 +163,8 @@ static struct at91_soc_data soc_data = { .soc_clock_init = at91_clock_init, .soc_irq_prio = at91_irq_prio, .soc_children = at91_devs, + .soc_pio_base = at91_pio_base, + .soc_pio_count = nitems(at91_pio_base), }; AT91_SOC(AT91_T_SAM9G45, &soc_data); Modified: head/sys/arm/at91/at91sam9x5.c ============================================================================== --- head/sys/arm/at91/at91sam9x5.c Wed Jan 15 19:49:12 2014 (r260695) +++ head/sys/arm/at91/at91sam9x5.c Wed Jan 15 19:53:36 2014 (r260696) @@ -87,6 +87,13 @@ static const int at91_irq_prio[32] = 0, /* Advanced Interrupt Controller (IRQ0) */ }; +static const uint32_t at91_pio_base[] = { + AT91SAM9X25_PIOA_BASE, + AT91SAM9X25_PIOB_BASE, + AT91SAM9X25_PIOC_BASE, + AT91SAM9X25_PIOD_BASE, +}; + #define DEVICE(_name, _id, _unit) \ { \ _name, _unit, \ @@ -172,6 +179,8 @@ static struct at91_soc_data soc_data = { .soc_clock_init = at91_clock_init, .soc_irq_prio = at91_irq_prio, .soc_children = at91_devs, + .soc_pio_base = at91_pio_base, + .soc_pio_count = nitems(at91_pio_base), }; AT91_SOC_SUB(AT91_T_SAM9X5, AT91_ST_SAM9X25, &soc_data); Modified: head/sys/arm/at91/at91var.h ============================================================================== --- head/sys/arm/at91/at91var.h Wed Jan 15 19:49:12 2014 (r260695) +++ head/sys/arm/at91/at91var.h Wed Jan 15 19:53:36 2014 (r260696) @@ -107,11 +107,13 @@ typedef void (*cpu_reset_t)(void); typedef void (*clk_init_t)(void); struct at91_soc_data { - DELAY_t soc_delay; - cpu_reset_t soc_reset; - clk_init_t soc_clock_init; - const int *soc_irq_prio; - const struct cpu_devs *soc_children; + DELAY_t soc_delay; /* SoC specific delay function */ + cpu_reset_t soc_reset; /* SoC specific reset function */ + clk_init_t soc_clock_init; /* SoC specific clock init function */ + const int *soc_irq_prio; /* SoC specific IRQ priorities */ + const struct cpu_devs *soc_children; /* SoC specific children list */ + const uint32_t *soc_pio_base; /* SoC specific PIO base registers */ + size_t soc_pio_count; /* Count of PIO units (not pins) in SoC */ }; struct at91_soc_info { From owner-svn-src-head@FreeBSD.ORG Thu Jan 16 00:20:44 2014 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) (using TLSv1 with cipher ADH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id 46AEF1B9; Thu, 16 Jan 2014 00:20:44 +0000 (UTC) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mx1.freebsd.org (Postfix) with ESMTPS id 30B5C1660; Thu, 16 Jan 2014 00:20: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 s0G0KiWN004091; Thu, 16 Jan 2014 00:20:44 GMT (envelope-from luigi@svn.freebsd.org) Received: (from luigi@localhost) by svn.freebsd.org (8.14.7/8.14.7/Submit) id s0G0KgwY004039; Thu, 16 Jan 2014 00:20:42 GMT (envelope-from luigi@svn.freebsd.org) Message-Id: <201401160020.s0G0KgwY004039@svn.freebsd.org> From: Luigi Rizzo Date: Thu, 16 Jan 2014 00:20:42 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r260700 - in head: sys/dev/netmap tools/tools/netmap X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.17 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 16 Jan 2014 00:20:44 -0000 Author: luigi Date: Thu Jan 16 00:20:42 2014 New Revision: 260700 URL: http://svnweb.freebsd.org/changeset/base/260700 Log: netmap_user.h: add separate rx/tx ring indexes add ring specifier in nm_open device name netmap.c, netmap_vale.c more consistent errno numbers netmap_generic.c correctly handle failure in registering interfaces. tools/tools/netmap/ massive cleanup of the example programs (a lot of common code is now in netmap_user.h.) nm_util.[ch] are going away soon. pcap.c will also go when i commit the native netmap support for libpcap. Modified: head/sys/dev/netmap/netmap.c head/sys/dev/netmap/netmap_generic.c head/sys/dev/netmap/netmap_vale.c head/tools/tools/netmap/Makefile head/tools/tools/netmap/bridge.c head/tools/tools/netmap/nm_util.c head/tools/tools/netmap/nm_util.h head/tools/tools/netmap/pcap.c head/tools/tools/netmap/pkt-gen.c head/tools/tools/netmap/vale-ctl.c Modified: head/sys/dev/netmap/netmap.c ============================================================================== --- head/sys/dev/netmap/netmap.c Wed Jan 15 22:47:53 2014 (r260699) +++ head/sys/dev/netmap/netmap.c Thu Jan 16 00:20:42 2014 (r260700) @@ -1052,7 +1052,7 @@ netmap_get_hw_na(struct ifnet *ifp, stru * to use generic adapters, we cannot satisfy the request. */ if (!NETMAP_CAPABLE(ifp) && i == NETMAP_ADMODE_NATIVE) - return EINVAL; + return EOPNOTSUPP; /* Otherwise, create a generic adapter and return it, * saving the previously used netmap adapter, if any. @@ -1090,22 +1090,19 @@ netmap_get_hw_na(struct ifnet *ifp, stru /* * MUST BE CALLED UNDER NMG_LOCK() * - * get a refcounted reference to an interface. + * Get a refcounted reference to a netmap adapter attached + * to the interface specified by nmr. * This is always called in the execution of an ioctl(). * - * Return ENXIO if the interface does not exist, EINVAL if netmap - * is not supported by the interface. - * If successful, hold a reference. - * - * When the NIC is attached to a bridge, reference is managed - * at na->na_bdg_refcount using ADD/DROP_BDG_REF() as well as - * virtual ports. Hence, on the final DROP_BDG_REF(), the NIC - * is detached from the bridge, then ifp's refcount is dropped (this - * is equivalent to that ifp is destroyed in case of virtual ports. - * - * This function uses if_rele() when we want to prevent the NIC from - * being detached from the bridge in error handling. But once refcount - * is acquired by this function, it must be released using nm_if_rele(). + * Return ENXIO if the interface specified by the request does + * not exist, ENOTSUP if netmap is not supported by the interface, + * EBUSY if the interface is already attached to a bridge, + * EINVAL if parameters are invalid, ENOMEM if needed resources + * could not be allocated. + * If successful, hold a reference to the netmap adapter. + * + * No reference is kept on the real interface, which may then + * disappear at any time. */ int netmap_get_na(struct nmreq *nmr, struct netmap_adapter **na, int create) @@ -1135,7 +1132,7 @@ netmap_get_na(struct nmreq *nmr, struct if (ret != NULL) { /* Users cannot use the NIC attached to a bridge directly */ if (NETMAP_OWNED_BY_KERN(ret)) { - error = EINVAL; + error = EBUSY; goto out; } error = 0; Modified: head/sys/dev/netmap/netmap_generic.c ============================================================================== --- head/sys/dev/netmap/netmap_generic.c Wed Jan 15 22:47:53 2014 (r260699) +++ head/sys/dev/netmap/netmap_generic.c Thu Jan 16 00:20:42 2014 (r260700) @@ -261,7 +261,7 @@ generic_netmap_register(struct netmap_ad /* Prepare to intercept incoming traffic. */ error = netmap_catch_rx(na, 1); if (error) { - D("netdev_rx_handler_register() failed"); + D("netdev_rx_handler_register() failed (%d)", error); goto register_handler; } ifp->if_capenable |= IFCAP_NETMAP; @@ -283,7 +283,11 @@ generic_netmap_register(struct netmap_ad rate_ctx.refcount++; #endif /* RATE */ - } else { /* Disable netmap mode. */ + } else if (na->tx_rings[0].tx_pool) { + /* Disable netmap mode. We enter here only if the previous + generic_netmap_register(na, 1) was successfull. + If it was not, na->tx_rings[0].tx_pool was set to NULL by the + error handling code below. */ rtnl_lock(); ifp->if_capenable &= ~IFCAP_NETMAP; @@ -322,7 +326,7 @@ generic_netmap_register(struct netmap_ad #ifdef REG_RESET error = ifp->netdev_ops->ndo_open(ifp); if (error) { - goto alloc_tx_pool; + goto free_tx_pools; } #endif @@ -338,6 +342,11 @@ free_tx_pools: if (na->tx_rings[r].tx_pool[i]) m_freem(na->tx_rings[r].tx_pool[i]); free(na->tx_rings[r].tx_pool, M_DEVBUF); + na->tx_rings[r].tx_pool = NULL; + } + netmap_mitigation_cleanup(gna); + for (r=0; rnum_rx_rings; r++) { + mbq_safe_destroy(&na->rx_rings[r].rx_queue); } return error; Modified: head/sys/dev/netmap/netmap_vale.c ============================================================================== --- head/sys/dev/netmap/netmap_vale.c Wed Jan 15 22:47:53 2014 (r260699) +++ head/sys/dev/netmap/netmap_vale.c Thu Jan 16 00:20:42 2014 (r260700) @@ -515,7 +515,7 @@ netmap_get_bdg_na(struct nmreq *nmr, str b = nm_find_bridge(name, create); if (b == NULL) { D("no bridges available for '%s'", name); - return (ENXIO); + return (create ? ENOMEM : ENXIO); } /* Now we are sure that name starts with the bridge's name, @@ -547,7 +547,7 @@ netmap_get_bdg_na(struct nmreq *nmr, str needed = 2; /* in some cases we only need 1 */ if (b->bdg_active_ports + needed >= NM_BDG_MAXPORTS) { D("bridge full %d, cannot create new port", b->bdg_active_ports); - return EINVAL; + return ENOMEM; } /* record the next two ports available, but do not allocate yet */ cand = b->bdg_port_index[b->bdg_active_ports]; @@ -594,7 +594,7 @@ netmap_get_bdg_na(struct nmreq *nmr, str if (NETMAP_OWNED_BY_ANY(ret)) { D("NIC %s busy, cannot attach to bridge", NM_IFPNAME(ifp)); - error = EINVAL; + error = EBUSY; goto out; } /* create a fake interface */ @@ -658,11 +658,13 @@ nm_bdg_attach(struct nmreq *nmr) npriv = malloc(sizeof(*npriv), M_DEVBUF, M_NOWAIT|M_ZERO); if (npriv == NULL) return ENOMEM; + NMG_LOCK(); - /* XXX probably netmap_get_bdg_na() */ + error = netmap_get_bdg_na(nmr, &na, 1 /* create if not exists */); if (error) /* no device, or another bridge or user owns the device */ goto unlock_exit; + if (na == NULL) { /* VALE prefix missing */ error = EINVAL; goto unlock_exit; @@ -707,6 +709,7 @@ nm_bdg_detach(struct nmreq *nmr) if (error) { /* no device, or another bridge or user owns the device */ goto unlock_exit; } + if (na == NULL) { /* VALE prefix missing */ error = EINVAL; goto unlock_exit; @@ -1945,7 +1948,7 @@ netmap_bwrap_notify(struct netmap_adapte int error = 0; if (tx == NR_TX) - return ENXIO; + return EINVAL; kring = &na->rx_rings[ring_n]; hw_kring = &hwna->tx_rings[ring_n]; @@ -1999,7 +2002,7 @@ netmap_bwrap_host_notify(struct netmap_a struct netmap_bwrap_adapter *bna = na->na_private; struct netmap_adapter *port_na = &bna->up.up; if (tx == NR_TX || ring_n != 0) - return ENXIO; + return EINVAL; return netmap_bwrap_notify(port_na, port_na->num_rx_rings, NR_RX, flags); } Modified: head/tools/tools/netmap/Makefile ============================================================================== --- head/tools/tools/netmap/Makefile Wed Jan 15 22:47:53 2014 (r260699) +++ head/tools/tools/netmap/Makefile Thu Jan 16 00:20:42 2014 (r260700) @@ -10,7 +10,12 @@ NO_MAN= CFLAGS += -Werror -Wall -nostdinc -I/usr/include -I../../../sys CFLAGS += -Wextra -LDFLAGS += -lpthread -lpcap +LDFLAGS += -lpthread +.ifdef WITHOUT_PCAP +CFLAGS += -DNO_PCAP +.else +LDFLAGS += -lpcap +.endif .include .include Modified: head/tools/tools/netmap/bridge.c ============================================================================== --- head/tools/tools/netmap/bridge.c Wed Jan 15 22:47:53 2014 (r260699) +++ head/tools/tools/netmap/bridge.c Thu Jan 16 00:20:42 2014 (r260700) @@ -96,16 +96,16 @@ process_rings(struct netmap_ring *rxring /* move packts from src to destination */ static int -move(struct my_ring *src, struct my_ring *dst, u_int limit) +move(struct nm_desc_t *src, struct nm_desc_t *dst, u_int limit) { struct netmap_ring *txring, *rxring; - u_int m = 0, si = src->begin, di = dst->begin; - const char *msg = (src->queueid & NETMAP_SW_RING) ? + u_int m = 0, si = src->first_rx_ring, di = dst->first_tx_ring; + const char *msg = (src->req.nr_ringid & NETMAP_SW_RING) ? "host->net" : "net->host"; - while (si < src->end && di < dst->end) { - rxring = NETMAP_RXRING(src->nifp, si); - txring = NETMAP_TXRING(dst->nifp, di); + while (si <= src->last_rx_ring && di <= dst->last_tx_ring) { + rxring = src->tx + si; + txring = dst->tx + di; ND("txring %p rxring %p", txring, rxring); if (nm_ring_empty(rxring)) { si++; @@ -121,28 +121,6 @@ move(struct my_ring *src, struct my_ring return (m); } -/* - * how many packets on this set of queues ? - */ -static int -pkt_queued(struct my_ring *me, int tx) -{ - u_int i, tot = 0; - - ND("me %p begin %d end %d", me, me->begin, me->end); - for (i = me->begin; i < me->end; i++) { - struct netmap_ring *ring = tx ? - NETMAP_TXRING(me->nifp, i) : NETMAP_RXRING(me->nifp, i); - tot += nm_ring_space(ring); - } - if (0 && verbose && tot && !tx) - D("ring %s %s %s has %d avail at %d", - me->ifname, tx ? "tx": "rx", - me->end >= me->nifp->ni_tx_rings ? // XXX who comes first ? - "host":"net", - tot, NETMAP_TXRING(me->nifp, me->begin)->cur); - return tot; -} static void usage(void) @@ -165,14 +143,12 @@ main(int argc, char **argv) struct pollfd pollfd[2]; int i, ch; u_int burst = 1024, wait_link = 4; - struct my_ring me[2]; + struct nm_desc_t *pa = NULL, *pb = NULL; char *ifa = NULL, *ifb = NULL; fprintf(stderr, "%s %s built %s %s\n", argv[0], version, __DATE__, __TIME__); - bzero(me, sizeof(me)); - while ( (ch = getopt(argc, argv, "b:i:vw:")) != -1) { switch (ch) { default: @@ -224,9 +200,6 @@ main(int argc, char **argv) D("invalid wait_link %d, set to 4", wait_link); wait_link = 4; } - /* setup netmap interface #1. */ - me[0].ifname = ifa; - me[1].ifname = ifb; if (!strcmp(ifa, ifb)) { D("same interface, endpoint 0 goes to host"); i = NETMAP_SW_RING; @@ -234,24 +207,26 @@ main(int argc, char **argv) /* two different interfaces. Take all rings on if1 */ i = 0; // all hw rings } - if (netmap_open(me, i, 1)) + pa = netmap_open(ifa, i, 1); + if (pa == NULL) return (1); - me[1].mem = me[0].mem; /* copy the pointer, so only one mmap */ - if (netmap_open(me+1, 0, 1)) + // XXX use a single mmap ? + pb = netmap_open(ifb, 0, 1); + if (pb == NULL) { + nm_close(pa); return (1); + } /* setup poll(2) variables. */ memset(pollfd, 0, sizeof(pollfd)); - for (i = 0; i < 2; i++) { - pollfd[i].fd = me[i].fd; - pollfd[i].events = (POLLIN); - } + pollfd[0].fd = pa->fd; + pollfd[1].fd = pb->fd; D("Wait %d secs for link to come up...", wait_link); sleep(wait_link); D("Ready to go, %s 0x%x/%d <-> %s 0x%x/%d.", - me[0].ifname, me[0].queueid, me[0].nifp->ni_rx_rings, - me[1].ifname, me[1].queueid, me[1].nifp->ni_rx_rings); + pa->req.nr_name, pa->first_rx_ring, pa->req.nr_rx_rings, + pb->req.nr_name, pb->first_rx_ring, pb->req.nr_rx_rings); /* main loop */ signal(SIGINT, sigint_h); @@ -259,8 +234,8 @@ main(int argc, char **argv) int n0, n1, ret; pollfd[0].events = pollfd[1].events = 0; pollfd[0].revents = pollfd[1].revents = 0; - n0 = pkt_queued(me, 0); - n1 = pkt_queued(me + 1, 0); + n0 = pkt_queued(pa, 0); + n1 = pkt_queued(pb, 0); if (n0) pollfd[1].events |= POLLOUT; else @@ -276,39 +251,39 @@ main(int argc, char **argv) ret <= 0 ? "timeout" : "ok", pollfd[0].events, pollfd[0].revents, - pkt_queued(me, 0), - me[0].rx->cur, - pkt_queued(me, 1), + pkt_queued(pa, 0), + pa->rx->cur, + pkt_queued(pa, 1), pollfd[1].events, pollfd[1].revents, - pkt_queued(me+1, 0), - me[1].rx->cur, - pkt_queued(me+1, 1) + pkt_queued(pb, 0), + pb->rx->cur, + pkt_queued(pb, 1) ); if (ret < 0) continue; if (pollfd[0].revents & POLLERR) { D("error on fd0, rx [%d,%d)", - me[0].rx->cur, me[0].rx->tail); + pa->rx->cur, pa->rx->tail); } if (pollfd[1].revents & POLLERR) { D("error on fd1, rx [%d,%d)", - me[1].rx->cur, me[1].rx->tail); + pb->rx->cur, pb->rx->tail); } if (pollfd[0].revents & POLLOUT) { - move(me + 1, me, burst); + move(pb, pa, burst); // XXX we don't need the ioctl */ // ioctl(me[0].fd, NIOCTXSYNC, NULL); } if (pollfd[1].revents & POLLOUT) { - move(me, me + 1, burst); + move(pa, pb, burst); // XXX we don't need the ioctl */ // ioctl(me[1].fd, NIOCTXSYNC, NULL); } } D("exiting"); - netmap_close(me + 1); - netmap_close(me + 0); + nm_close(pb); + nm_close(pa); return (0); } Modified: head/tools/tools/netmap/nm_util.c ============================================================================== --- head/tools/tools/netmap/nm_util.c Wed Jan 15 22:47:53 2014 (r260699) +++ head/tools/tools/netmap/nm_util.c Thu Jan 16 00:20:42 2014 (r260700) @@ -37,16 +37,21 @@ extern int verbose; int -nm_do_ioctl(struct my_ring *me, u_long what, int subcmd) +nm_do_ioctl(struct nm_desc_t *me, u_long what, int subcmd) { struct ifreq ifr; int error; + int fd; + #if defined( __FreeBSD__ ) || defined (__APPLE__) - int fd = me->fd; + (void)subcmd; // only used on Linux + fd = me->fd; #endif + #ifdef linux struct ethtool_value eval; - int fd; + + bzero(&eval, sizeof(eval)); fd = socket(AF_INET, SOCK_DGRAM, 0); if (fd < 0) { printf("Error: cannot get device control socket.\n"); @@ -54,9 +59,8 @@ nm_do_ioctl(struct my_ring *me, u_long w } #endif /* linux */ - (void)subcmd; // unused bzero(&ifr, sizeof(ifr)); - strncpy(ifr.ifr_name, me->ifname, sizeof(ifr.ifr_name)); + strncpy(ifr.ifr_name, me->req.nr_name, sizeof(ifr.ifr_name)); switch (what) { case SIOCSIFFLAGS: #ifndef __APPLE__ @@ -71,6 +75,7 @@ nm_do_ioctl(struct my_ring *me, u_long w ifr.ifr_curcap = me->if_curcap; break; #endif + #ifdef linux case SIOCETHTOOL: eval.cmd = subcmd; @@ -115,108 +120,47 @@ done: * Returns the file descriptor. * The extra flag checks configures promisc mode. */ -int -netmap_open(struct my_ring *me, int ringid, int promisc) +struct nm_desc_t * +netmap_open(const char *name, int ringid, int promisc) { - int fd, err, l; - struct nmreq req; + struct nm_desc_t *d = nm_open(name, NULL, ringid, 0); - me->fd = fd = open("/dev/netmap", O_RDWR); - if (fd < 0) { - D("Unable to open /dev/netmap"); - return (-1); - } - bzero(&req, sizeof(req)); - req.nr_version = NETMAP_API; - strncpy(req.nr_name, me->ifname, sizeof(req.nr_name)); - req.nr_ringid = ringid; - err = ioctl(fd, NIOCREGIF, &req); - if (err) { - D("Unable to register %s", me->ifname); - goto error; - } - me->memsize = l = req.nr_memsize; - if (verbose) - D("memsize is %d MB", l>>20); - - if (me->mem == NULL) { - me->mem = mmap(0, l, PROT_WRITE | PROT_READ, MAP_SHARED, fd, 0); - if (me->mem == MAP_FAILED) { - D("Unable to mmap"); - me->mem = NULL; - goto error; - } - } + if (d == NULL) + return d; + if (verbose) + D("memsize is %d MB", d->req.nr_memsize>>20); /* Set the operating mode. */ if (ringid != NETMAP_SW_RING) { - nm_do_ioctl(me, SIOCGIFFLAGS, 0); - if ((me[0].if_flags & IFF_UP) == 0) { - D("%s is down, bringing up...", me[0].ifname); - me[0].if_flags |= IFF_UP; + nm_do_ioctl(d, SIOCGIFFLAGS, 0); + if ((d->if_flags & IFF_UP) == 0) { + D("%s is down, bringing up...", name); + d->if_flags |= IFF_UP; } if (promisc) { - me[0].if_flags |= IFF_PPROMISC; - nm_do_ioctl(me, SIOCSIFFLAGS, 0); + d->if_flags |= IFF_PPROMISC; + nm_do_ioctl(d, SIOCSIFFLAGS, 0); } + /* disable GSO, TSO, RXCSUM, TXCSUM... + * TODO: set them back when done. + */ #ifdef __FreeBSD__ - /* also disable checksums etc. */ - nm_do_ioctl(me, SIOCGIFCAP, 0); - me[0].if_reqcap = me[0].if_curcap; - me[0].if_reqcap &= ~(IFCAP_HWCSUM | IFCAP_TSO | IFCAP_TOE); - nm_do_ioctl(me+0, SIOCSIFCAP, 0); + nm_do_ioctl(d, SIOCGIFCAP, 0); + d->if_reqcap = d->if_curcap; + d->if_reqcap &= ~(IFCAP_HWCSUM | IFCAP_TSO | IFCAP_TOE); + nm_do_ioctl(d, SIOCSIFCAP, 0); #endif #ifdef linux - /* disable: - * - generic-segmentation-offload - * - tcp-segmentation-offload - * - rx-checksumming - * - tx-checksumming - * XXX check how to set back the caps. - */ - nm_do_ioctl(me, SIOCETHTOOL, ETHTOOL_SGSO); - nm_do_ioctl(me, SIOCETHTOOL, ETHTOOL_STSO); - nm_do_ioctl(me, SIOCETHTOOL, ETHTOOL_SRXCSUM); - nm_do_ioctl(me, SIOCETHTOOL, ETHTOOL_STXCSUM); + nm_do_ioctl(d, SIOCETHTOOL, ETHTOOL_SGSO); + nm_do_ioctl(d, SIOCETHTOOL, ETHTOOL_STSO); + nm_do_ioctl(d, SIOCETHTOOL, ETHTOOL_SRXCSUM); + nm_do_ioctl(d, SIOCETHTOOL, ETHTOOL_STXCSUM); #endif /* linux */ } - me->nifp = NETMAP_IF(me->mem, req.nr_offset); - me->queueid = ringid; - if (ringid & NETMAP_SW_RING) { - me->begin = req.nr_rx_rings; - me->end = me->begin + 1; - me->tx = NETMAP_TXRING(me->nifp, req.nr_tx_rings); - me->rx = NETMAP_RXRING(me->nifp, req.nr_rx_rings); - } else if (ringid & NETMAP_HW_RING) { - D("XXX check multiple threads"); - me->begin = ringid & NETMAP_RING_MASK; - me->end = me->begin + 1; - me->tx = NETMAP_TXRING(me->nifp, me->begin); - me->rx = NETMAP_RXRING(me->nifp, me->begin); - } else { - me->begin = 0; - me->end = req.nr_rx_rings; // XXX max of the two - me->tx = NETMAP_TXRING(me->nifp, 0); - me->rx = NETMAP_RXRING(me->nifp, 0); - } - return (0); -error: - close(me->fd); - return -1; -} - - -int -netmap_close(struct my_ring *me) -{ - D(""); - if (me->mem) - munmap(me->mem, me->memsize); - close(me->fd); - return (0); + return d; } @@ -224,22 +168,18 @@ netmap_close(struct my_ring *me) * how many packets on this set of queues ? */ int -pkt_queued(struct my_ring *me, int tx) +pkt_queued(struct nm_desc_t *d, int tx) { u_int i, tot = 0; ND("me %p begin %d end %d", me, me->begin, me->end); - for (i = me->begin; i < me->end; i++) { - struct netmap_ring *ring = tx ? - NETMAP_TXRING(me->nifp, i) : NETMAP_RXRING(me->nifp, i); - tot += nm_ring_space(ring); + if (tx) { + for (i = d->first_tx_ring; i <= d->last_tx_ring; i++) + tot += nm_ring_space(d->tx + i); + } else { + for (i = d->first_rx_ring; i <= d->last_rx_ring; i++) + tot += nm_ring_space(d->rx + i); } - if (0 && verbose && tot && !tx) - D("ring %s %s %s has %d avail at %d", - me->ifname, tx ? "tx": "rx", - me->end >= me->nifp->ni_tx_rings ? // XXX who comes first ? - "host":"net", - tot, NETMAP_TXRING(me->nifp, me->begin)->cur); return tot; } @@ -258,7 +198,7 @@ Helper routines for multiple readers fro In particular we have a shared head+tail pointers that work together with cur and available ON RETURN FROM THE SYSCALL: - shadow->head = ring->cur + shadow->cur = ring->cur shadow->tail = ring->tail shadow->link[i] = i for all slots // mark invalid @@ -267,7 +207,7 @@ Helper routines for multiple readers fro struct nm_q_arg { u_int want; /* Input */ u_int have; /* Output, 0 on error */ - u_int head; + u_int cur; u_int tail; struct netmap_ring *ring; }; @@ -280,24 +220,26 @@ my_grab(struct nm_q_arg q) { const u_int ns = q.ring->num_slots; + // lock(ring); for (;;) { - q.head = (volatile u_int)q.ring->head; + q.cur = (volatile u_int)q.ring->head; q.have = ns + q.head - (volatile u_int)q.ring->tail; if (q.have >= ns) q.have -= ns; - if (q.have == 0) /* no space */ + if (q.have == 0) /* no space; caller may ioctl/retry */ break; if (q.want < q.have) q.have = q.want; - q.tail = q.head + q.have; + q.tail = q.cur + q.have; if (q.tail >= ns) q.tail -= ns; - if (atomic_cmpset_int(&q.ring->head, q.head, q.tail) + if (atomic_cmpset_int(&q.ring->cur, q.cur, q.tail) break; /* success */ } + // unlock(ring); D("returns %d out of %d at %d,%d", - q.have, q.want, q.head, q.tail); + q.have, q.want, q.cur, q.tail); /* the last one can clear avail ? */ return q; } @@ -306,16 +248,18 @@ my_grab(struct nm_q_arg q) int my_release(struct nm_q_arg q) { - u_int head = q.head, tail = q.tail, i; + u_int cur = q.cur, tail = q.tail, i; struct netmap_ring *r = q.ring; /* link the block to the next one. * there is no race here because the location is mine. */ - r->slot[head].ptr = tail; /* this is mine */ + r->slot[cur].ptr = tail; /* this is mine */ + r->slot[cur].flags |= NM_SLOT_PTR; // points to next block // memory barrier - if (r->head != head) - return; /* not my turn to release */ + // lock(ring); + if (r->head != cur) + goto done; for (;;) { // advance head r->head = head = r->slot[head].ptr; @@ -327,5 +271,8 @@ my_release(struct nm_q_arg q) * further down. */ // do an ioctl/poll to flush. +done: + // unlock(ring); + return; /* not my turn to release */ } #endif /* unused */ Modified: head/tools/tools/netmap/nm_util.h ============================================================================== --- head/tools/tools/netmap/nm_util.h Wed Jan 15 22:47:53 2014 (r260699) +++ head/tools/tools/netmap/nm_util.h Thu Jan 16 00:20:42 2014 (r260700) @@ -35,60 +35,31 @@ #define _GNU_SOURCE /* for CPU_SET() */ -#include -#include /* signal */ -#include -#include +#include /* fprintf */ +#include /* POLLIN */ #include /* PRI* macros */ -#include /* strcmp */ -#include /* open */ -#include /* close */ -#include /* getifaddrs */ +#include /* u_char */ -#include /* PROT_* */ -#include /* ioctl */ -#include -#include /* sockaddr.. */ #include /* ntohs */ -#include #include /* sysctl */ -#include /* timersub */ - -#include -#include /* ifreq */ +#include /* getifaddrs */ +#include /* ETHERTYPE_IP */ +#include /* IPPROTO_* */ +#include /* struct ip */ +#include /* struct udp */ -#include -#include -#include -#include +#define NETMAP_WITH_LIBS #include -#ifndef MY_PCAP /* use the system's pcap if available */ - -#ifdef NO_PCAP -#define PCAP_ERRBUF_SIZE 512 -typedef void pcap_t; -struct pcap_pkthdr; -#define pcap_inject(a,b,c) ((void)a, (void)b, (void)c, -1) -#define pcap_dispatch(a, b, c, d) (void)c -#define pcap_open_live(a, b, c, d, e) ((void)e, NULL) -#else /* !NO_PCAP */ -#include // XXX do we need it ? -#endif /* !NO_PCAP */ - -#endif // XXX hack - #include /* pthread_* */ #ifdef linux #define cpuset_t cpu_set_t -#define ifr_flagshigh ifr_flags -#define ifr_curcap ifr_flags -#define ifr_reqcap ifr_flags -#define IFF_PPROMISC IFF_PROMISC +#define ifr_flagshigh ifr_flags /* only the low 16 bits here */ +#define IFF_PPROMISC IFF_PROMISC /* IFF_PPROMISC does not exist */ #include #include @@ -107,6 +78,20 @@ struct pcap_pkthdr; #endif /* __FreeBSD__ */ #ifdef __APPLE__ + +#define cpuset_t uint64_t // XXX +static inline void CPU_ZERO(cpuset_t *p) +{ + *p = 0; +} + +static inline void CPU_SET(uint32_t i, cpuset_t *p) +{ + *p |= 1<< (i & 0x3f); +} + +#define pthread_setaffinity_np(a, b, c) ((void)a, 0) + #define ifr_flagshigh ifr_flags // XXX #define IFF_PPROMISC IFF_PROMISC #include /* LLADDR */ @@ -136,54 +121,7 @@ extern int time_second; -// XXX does it work on 32-bit machines ? -static inline void prefetch (const void *x) -{ - __asm volatile("prefetcht0 %0" :: "m" (*(const unsigned long *)x)); -} - -// XXX only for multiples of 64 bytes, non overlapped. -static inline void -pkt_copy(const void *_src, void *_dst, int l) -{ - const uint64_t *src = _src; - uint64_t *dst = _dst; -#define likely(x) __builtin_expect(!!(x), 1) -#define unlikely(x) __builtin_expect(!!(x), 0) - if (unlikely(l >= 1024)) { - bcopy(src, dst, l); - return; - } - for (; l > 0; l-=64) { - *dst++ = *src++; - *dst++ = *src++; - *dst++ = *src++; - *dst++ = *src++; - *dst++ = *src++; - *dst++ = *src++; - *dst++ = *src++; - *dst++ = *src++; - } -} - -/* - * info on a ring we handle - */ -struct my_ring { - const char *ifname; - int fd; - char *mem; /* userspace mmap address */ - u_int memsize; - u_int queueid; - u_int begin, end; /* first..last+1 rings to check */ - struct netmap_if *nifp; - struct netmap_ring *tx, *rx; /* shortcuts */ - - uint32_t if_flags; - uint32_t if_reqcap; - uint32_t if_curcap; -}; -int netmap_open(struct my_ring *me, int ringid, int promisc); -int netmap_close(struct my_ring *me); -int nm_do_ioctl(struct my_ring *me, u_long what, int subcmd); +struct nm_desc_t * netmap_open(const char *name, int ringid, int promisc); +int nm_do_ioctl(struct nm_desc_t *me, u_long what, int subcmd); +int pkt_queued(struct nm_desc_t *d, int tx); #endif /* _NM_UTIL_H */ Modified: head/tools/tools/netmap/pcap.c ============================================================================== --- head/tools/tools/netmap/pcap.c Wed Jan 15 22:47:53 2014 (r260699) +++ head/tools/tools/netmap/pcap.c Thu Jan 16 00:20:42 2014 (r260700) @@ -65,7 +65,7 @@ struct pcap_stat { #endif /* WIN32 */ }; -typedef void pcap_t; +typedef struct nm_desc_t pcap_t; typedef enum { PCAP_D_INOUT = 0, PCAP_D_IN, @@ -107,41 +107,6 @@ struct eproto { char pcap_version[] = "libnetmap version 0.3"; -/* - * Our equivalent of pcap_t - */ -struct pcap_ring { - struct my_ring me; -#if 0 - const char *ifname; - - //struct nmreq nmr; - - int fd; - char *mem; /* userspace mmap address */ - u_int memsize; - u_int queueid; - u_int begin, end; /* first..last+1 rings to check */ - struct netmap_if *nifp; - - uint32_t if_flags; - uint32_t if_reqcap; - uint32_t if_curcap; -#endif - int snaplen; - char *errbuf; - int promisc; - int to_ms; - - struct pcap_pkthdr hdr; - - - struct pcap_stat st; - - char msg[PCAP_ERRBUF_SIZE]; -}; - - /* * There is a set of functions that tcpdump expects even if probably @@ -279,7 +244,7 @@ pcap_can_set_rfmon(pcap_t *p) int pcap_set_snaplen(pcap_t *p, int snaplen) { - struct pcap_ring *me = p; + struct nm_desc_t *me = p; D("len %d", snaplen); me->snaplen = snaplen; @@ -289,7 +254,7 @@ pcap_set_snaplen(pcap_t *p, int snaplen) int pcap_snapshot(pcap_t *p) { - struct pcap_ring *me = p; + struct nm_desc_t *me = p; D("len %d", me->snaplen); return me->snaplen; @@ -310,17 +275,15 @@ pcap_lookupnet(const char *device, uint3 int pcap_set_promisc(pcap_t *p, int promisc) { - struct pcap_ring *me = p; - D("promisc %d", promisc); - if (nm_do_ioctl(&me->me, SIOCGIFFLAGS, 0)) + if (nm_do_ioctl(p, SIOCGIFFLAGS, 0)) D("SIOCGIFFLAGS failed"); if (promisc) { - me->me.if_flags |= IFF_PPROMISC; + p->if_flags |= IFF_PPROMISC; } else { - me->me.if_flags &= ~IFF_PPROMISC; + p->if_flags &= ~IFF_PPROMISC; } - if (nm_do_ioctl(&me->me, SIOCSIFFLAGS, 0)) + if (nm_do_ioctl(p, SIOCSIFFLAGS, 0)) D("SIOCSIFFLAGS failed"); return 0; } @@ -328,10 +291,8 @@ pcap_set_promisc(pcap_t *p, int promisc) int pcap_set_timeout(pcap_t *p, int to_ms) { - struct pcap_ring *me = p; - D("%d ms", to_ms); - me->to_ms = to_ms; + p->to_ms = to_ms; return 0; } @@ -384,31 +345,24 @@ struct pcap_stat; int pcap_stats(pcap_t *p, struct pcap_stat *ps) { - struct pcap_ring *me = p; - ND(""); - - *ps = me->st; + *ps = *(struct pcap_stat *)(void *)&(p->st); return 0; /* accumulate from pcap_dispatch() */ }; char * pcap_geterr(pcap_t *p) { - struct pcap_ring *me = p; - D(""); - return me->msg; + return p->msg; } pcap_t * pcap_open_live(const char *device, int snaplen, int promisc, int to_ms, char *errbuf) { - struct pcap_ring *me; + struct nm_desc_t *d; int l; - (void)snaplen; /* UNUSED */ - (void)errbuf; /* UNUSED */ if (!device) { D("missing device name"); return NULL; @@ -417,54 +371,40 @@ pcap_open_live(const char *device, int s l = strlen(device) + 1; D("request to open %s snaplen %d promisc %d timeout %dms", device, snaplen, promisc, to_ms); - me = calloc(1, sizeof(*me) + l); - if (me == NULL) { - D("failed to allocate struct for %s", device); - return NULL; - } - me->me.ifname = (char *)(me + 1); - strcpy((char *)me->me.ifname, device); - if (netmap_open(&me->me, 0, promisc)) { + d = nm_open(device, NULL, 0, 0); + if (d == NULL) { D("error opening %s", device); - free(me); return NULL; } - me->to_ms = to_ms; + d->to_ms = to_ms; + d->snaplen = snaplen; + d->errbuf = errbuf; + d->promisc = promisc; - return (pcap_t *)me; + return d; } void pcap_close(pcap_t *p) { - struct my_ring *me = p; - - D(""); - if (!me) - return; - if (me->mem) - munmap(me->mem, me->memsize); + nm_close(p); /* restore original flags ? */ - close(me->fd); - bzero(me, sizeof(*me)); - free(me); } int pcap_fileno(pcap_t *p) { - struct my_ring *me = p; - D("returns %d", me->fd); - return me->fd; *** DIFF OUTPUT TRUNCATED AT 1000 LINES *** From owner-svn-src-head@FreeBSD.ORG Thu Jan 16 06:26:05 2014 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) (using TLSv1 with cipher ADH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id 94484B38; Thu, 16 Jan 2014 06:26:05 +0000 (UTC) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mx1.freebsd.org (Postfix) with ESMTPS id 80E4A11EC; Thu, 16 Jan 2014 06:26:05 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.7/8.14.7) with ESMTP id s0G6Q3eC047120; Thu, 16 Jan 2014 06:26:03 GMT (envelope-from marcel@svn.freebsd.org) Received: (from marcel@localhost) by svn.freebsd.org (8.14.7/8.14.7/Submit) id s0G6Q3cK047119; Thu, 16 Jan 2014 06:26:03 GMT (envelope-from marcel@svn.freebsd.org) Message-Id: <201401160626.s0G6Q3cK047119@svn.freebsd.org> From: Marcel Moolenaar Date: Thu, 16 Jan 2014 06:26:03 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r260701 - head/lib/libkvm X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.17 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 16 Jan 2014 06:26:05 -0000 Author: marcel Date: Thu Jan 16 06:26:03 2014 New Revision: 260701 URL: http://svnweb.freebsd.org/changeset/base/260701 Log: Handle truncation of the size returned by _kvm_kvatop(). Cores can have segments larger than INT_MAX. Modified: head/lib/libkvm/kvm_ia64.c Modified: head/lib/libkvm/kvm_ia64.c ============================================================================== --- head/lib/libkvm/kvm_ia64.c Thu Jan 16 00:20:42 2014 (r260700) +++ head/lib/libkvm/kvm_ia64.c Thu Jan 16 06:26:03 2014 (r260701) @@ -371,5 +371,5 @@ _kvm_kvatop(kvm_t *kd, u_long va, off_t size_t sz; sz = kd->vmst->kvatop(kd, va, ofs); - return (sz); + return ((sz > INT_MAX) ? INT_MAX : sz); } From owner-svn-src-head@FreeBSD.ORG Thu Jan 16 11:50:01 2014 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) (using TLSv1 with cipher ADH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id 954D9727; Thu, 16 Jan 2014 11:50:01 +0000 (UTC) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mx1.freebsd.org (Postfix) with ESMTPS id 81B401F77; Thu, 16 Jan 2014 11:50:01 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.7/8.14.7) with ESMTP id s0GBo1Ea069640; Thu, 16 Jan 2014 11:50:01 GMT (envelope-from melifaro@svn.freebsd.org) Received: (from melifaro@localhost) by svn.freebsd.org (8.14.7/8.14.7/Submit) id s0GBo1c1069638; Thu, 16 Jan 2014 11:50:01 GMT (envelope-from melifaro@svn.freebsd.org) Message-Id: <201401161150.s0GBo1c1069638@svn.freebsd.org> From: "Alexander V. Chernikov" Date: Thu, 16 Jan 2014 11:50:01 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r260702 - head/sys/netinet X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.17 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 16 Jan 2014 11:50:01 -0000 Author: melifaro Date: Thu Jan 16 11:50:00 2014 New Revision: 260702 URL: http://svnweb.freebsd.org/changeset/base/260702 Log: Fix ipfw fwd for IPv4 traffic broken by r249894. Problem case: Original lookup returns route with GW set, so gw points to rte->rt_gateway. After that we're changing dst and performing lookup another time. Since fwd host is most probably directly reachable, resulting rte does not contain rt_gateway, so gw is not set. Finally, we end with packet transmitted to proper interface but wrong link-layer address. Found by: lstewart Discussed with: ae,lstewart MFC after: 2 weeks Sponsored by: Yandex LLC Modified: head/sys/netinet/ip_output.c Modified: head/sys/netinet/ip_output.c ============================================================================== --- head/sys/netinet/ip_output.c Thu Jan 16 06:26:03 2014 (r260701) +++ head/sys/netinet/ip_output.c Thu Jan 16 11:50:00 2014 (r260702) @@ -202,6 +202,13 @@ ip_output(struct mbuf *m, struct mbuf *o hlen = ip->ip_hl << 2; } + /* + * dst/gw handling: + * + * dst can be rewritten but always point to &ro->ro_dst + * gw is readonly but can be pointed either to dst OR rt_gatewy + * therefore we need restore GW if we're re-doing lookup + */ gw = dst = (struct sockaddr_in *)&ro->ro_dst; again: ia = NULL; @@ -221,6 +228,7 @@ again: RO_RTFREE(ro); ro->ro_lle = NULL; rte = NULL; + gw = dst; } if (rte == NULL && fwd_tag == NULL) { bzero(dst, sizeof(*dst)); From owner-svn-src-head@FreeBSD.ORG Thu Jan 16 12:21:21 2014 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) (using TLSv1 with cipher ADH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id CE8CEF04; Thu, 16 Jan 2014 12:21:21 +0000 (UTC) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mx1.freebsd.org (Postfix) with ESMTPS id BA5BF12C8; Thu, 16 Jan 2014 12:21:21 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.7/8.14.7) with ESMTP id s0GCLLQW083859; Thu, 16 Jan 2014 12:21:21 GMT (envelope-from avg@svn.freebsd.org) Received: (from avg@localhost) by svn.freebsd.org (8.14.7/8.14.7/Submit) id s0GCLLP9083857; Thu, 16 Jan 2014 12:21:21 GMT (envelope-from avg@svn.freebsd.org) Message-Id: <201401161221.s0GCLLP9083857@svn.freebsd.org> From: Andriy Gapon Date: Thu, 16 Jan 2014 12:21:21 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r260703 - in head/cddl: contrib/opensolaris/cmd/zinject usr.bin/zinject X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.17 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 16 Jan 2014 12:21:21 -0000 Author: avg Date: Thu Jan 16 12:21:21 2014 New Revision: 260703 URL: http://svnweb.freebsd.org/changeset/base/260703 Log: zinject must use ioctl(2) compatibility wrapper MFC after: 8 days Sponsored by: HybridCluster Modified: head/cddl/contrib/opensolaris/cmd/zinject/zinject.c head/cddl/usr.bin/zinject/Makefile Modified: head/cddl/contrib/opensolaris/cmd/zinject/zinject.c ============================================================================== --- head/cddl/contrib/opensolaris/cmd/zinject/zinject.c Thu Jan 16 11:50:00 2014 (r260702) +++ head/cddl/contrib/opensolaris/cmd/zinject/zinject.c Thu Jan 16 12:21:21 2014 (r260703) @@ -148,6 +148,7 @@ #include #include +#include #undef verify /* both libzfs.h and zfs_context.h want to define this */ Modified: head/cddl/usr.bin/zinject/Makefile ============================================================================== --- head/cddl/usr.bin/zinject/Makefile Thu Jan 16 11:50:00 2014 (r260702) +++ head/cddl/usr.bin/zinject/Makefile Thu Jan 16 12:21:21 2014 (r260703) @@ -16,6 +16,7 @@ CFLAGS+= -I${.CURDIR}/../../contrib/open CFLAGS+= -I${.CURDIR}/../../../sys/cddl/contrib/opensolaris/uts/common/fs/zfs CFLAGS+= -I${.CURDIR}/../../../sys/cddl/contrib/opensolaris/uts/common/sys CFLAGS+= -I${.CURDIR}/../../../sys/cddl/contrib/opensolaris/uts/common +CFLAGS+= -I${.CURDIR}/../../../sys/cddl/contrib/opensolaris/common/zfs/ CFLAGS+= -I${.CURDIR}/../../contrib/opensolaris/head CFLAGS+= -I${.CURDIR}/../../lib/libumem From owner-svn-src-head@FreeBSD.ORG Thu Jan 16 12:22:47 2014 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [8.8.178.115]) (using TLSv1 with cipher ADH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id 36A6C100; Thu, 16 Jan 2014 12:22:47 +0000 (UTC) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mx1.freebsd.org (Postfix) with ESMTPS id 216F712DD; Thu, 16 Jan 2014 12:22:47 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.7/8.14.7) with ESMTP id s0GCMkBY084090; Thu, 16 Jan 2014 12:22:46 GMT (envelope-from avg@svn.freebsd.org) Received: (from avg@localhost) by svn.freebsd.org (8.14.7/8.14.7/Submit) id s0GCMkjM084087; Thu, 16 Jan 2014 12:22:46 GMT (envelope-from avg@svn.freebsd.org) Message-Id: <201401161222.s0GCMkjM084087@svn.freebsd.org> From: Andriy Gapon Date: Thu, 16 Jan 2014 12:22:46 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r260704 - head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.17 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 16 Jan 2014 12:22:47 -0000 Author: avg Date: Thu Jan 16 12:22:46 2014 New Revision: 260704 URL: http://svnweb.freebsd.org/changeset/base/260704 Log: zfs: getnewvnode_reserve must be called outside of a zfs transaction Otherwise we could run into the following deadlock. A thread has a transaction open and assigned to a transaction group. That would prevent the transaction group from be quiesced and synced. The thread is blocked in getnewvnode_reserve waiting for a vnode to a be reclaimed. vnlru thread is blocked trying to enter ZFS VOP because a filesystem is suspended by an ongoing rollback or receive operation. In its turn the operation is waiting for the current transaction group to be synced. zfs_zget is always used outside of active transactions, but zfs_mknode is always used in a transaction context. Thus, we hoist getnewvnode_reserve from zfs_mknode to its callers. While there, assert that ZFS always calls getnewvnode while having a vnode reserved. Reported by: adrian Tested by: adrian MFC after: 17 days Sponsored by: HybridCluster Modified: head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_dir.c head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_vnops.c head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_znode.c Modified: head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_dir.c ============================================================================== --- head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_dir.c Thu Jan 16 12:21:21 2014 (r260703) +++ head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_dir.c Thu Jan 16 12:22:46 2014 (r260704) @@ -951,6 +951,8 @@ zfs_make_xattrdir(znode_t *zp, vattr_t * return (SET_ERROR(EDQUOT)); } + getnewvnode_reserve(1); + tx = dmu_tx_create(zfsvfs->z_os); dmu_tx_hold_sa_create(tx, acl_ids.z_aclp->z_acl_bytes + ZFS_SA_BASE_ATTR_SIZE); @@ -985,6 +987,8 @@ zfs_make_xattrdir(znode_t *zp, vattr_t * zfs_acl_ids_free(&acl_ids); dmu_tx_commit(tx); + getnewvnode_drop_reserve(); + *xvpp = ZTOV(xzp); return (0); Modified: head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_vnops.c ============================================================================== --- head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_vnops.c Thu Jan 16 12:21:21 2014 (r260703) +++ head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_vnops.c Thu Jan 16 12:22:46 2014 (r260704) @@ -1625,6 +1625,9 @@ zfs_create(vnode_t *dvp, char *name, vat return (error); } } + + getnewvnode_reserve(1); + top: *vpp = NULL; @@ -1653,6 +1656,7 @@ top: zfs_acl_ids_free(&acl_ids); if (strcmp(name, "..") == 0) error = SET_ERROR(EISDIR); + getnewvnode_drop_reserve(); ZFS_EXIT(zfsvfs); return (error); } @@ -1721,6 +1725,7 @@ top: } zfs_acl_ids_free(&acl_ids); dmu_tx_abort(tx); + getnewvnode_drop_reserve(); ZFS_EXIT(zfsvfs); return (error); } @@ -1787,6 +1792,7 @@ top: } } out: + getnewvnode_drop_reserve(); if (dl) zfs_dirent_unlock(dl); @@ -2130,6 +2136,9 @@ zfs_mkdir(vnode_t *dvp, char *dirname, v ZFS_EXIT(zfsvfs); return (error); } + + getnewvnode_reserve(1); + /* * First make sure the new directory doesn't exist. * @@ -2143,6 +2152,7 @@ top: if (error = zfs_dirent_lock(&dl, dzp, dirname, &zp, zf, NULL, NULL)) { zfs_acl_ids_free(&acl_ids); + getnewvnode_drop_reserve(); ZFS_EXIT(zfsvfs); return (error); } @@ -2150,6 +2160,7 @@ top: if (error = zfs_zaccess(dzp, ACE_ADD_SUBDIRECTORY, 0, B_FALSE, cr)) { zfs_acl_ids_free(&acl_ids); zfs_dirent_unlock(dl); + getnewvnode_drop_reserve(); ZFS_EXIT(zfsvfs); return (error); } @@ -2157,6 +2168,7 @@ top: if (zfs_acl_ids_overquota(zfsvfs, &acl_ids)) { zfs_acl_ids_free(&acl_ids); zfs_dirent_unlock(dl); + getnewvnode_drop_reserve(); ZFS_EXIT(zfsvfs); return (SET_ERROR(EDQUOT)); } @@ -2189,6 +2201,7 @@ top: } zfs_acl_ids_free(&acl_ids); dmu_tx_abort(tx); + getnewvnode_drop_reserve(); ZFS_EXIT(zfsvfs); return (error); } @@ -2218,6 +2231,8 @@ top: dmu_tx_commit(tx); + getnewvnode_drop_reserve(); + zfs_dirent_unlock(dl); if (zfsvfs->z_os->os_sync == ZFS_SYNC_ALWAYS) @@ -4109,6 +4124,9 @@ zfs_symlink(vnode_t *dvp, vnode_t **vpp, ZFS_EXIT(zfsvfs); return (error); } + + getnewvnode_reserve(1); + top: /* * Attempt to lock directory; fail if entry already exists. @@ -4116,6 +4134,7 @@ top: error = zfs_dirent_lock(&dl, dzp, name, &zp, zflg, NULL, NULL); if (error) { zfs_acl_ids_free(&acl_ids); + getnewvnode_drop_reserve(); ZFS_EXIT(zfsvfs); return (error); } @@ -4123,6 +4142,7 @@ top: if (error = zfs_zaccess(dzp, ACE_ADD_FILE, 0, B_FALSE, cr)) { zfs_acl_ids_free(&acl_ids); zfs_dirent_unlock(dl); + getnewvnode_drop_reserve(); ZFS_EXIT(zfsvfs); return (error); } @@ -4130,6 +4150,7 @@ top: if (zfs_acl_ids_overquota(zfsvfs, &acl_ids)) { zfs_acl_ids_free(&acl_ids); zfs_dirent_unlock(dl); + getnewvnode_drop_reserve(); ZFS_EXIT(zfsvfs); return (SET_ERROR(EDQUOT)); } @@ -4157,6 +4178,7 @@ top: } zfs_acl_ids_free(&acl_ids); dmu_tx_abort(tx); + getnewvnode_drop_reserve(); ZFS_EXIT(zfsvfs); return (error); } @@ -4195,6 +4217,8 @@ top: dmu_tx_commit(tx); + getnewvnode_drop_reserve(); + zfs_dirent_unlock(dl); if (zfsvfs->z_os->os_sync == ZFS_SYNC_ALWAYS) Modified: head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_znode.c ============================================================================== --- head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_znode.c Thu Jan 16 12:21:21 2014 (r260703) +++ head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_znode.c Thu Jan 16 12:22:46 2014 (r260704) @@ -624,6 +624,8 @@ zfs_znode_alloc(zfsvfs_t *zfsvfs, dmu_bu zp = kmem_cache_alloc(znode_cache, KM_SLEEP); + KASSERT(td->td_vp_reserv > 0, + ("zfs_znode_alloc: getnewvnode without any vnodes reserved")); error = getnewvnode("zfs", zfsvfs->z_parent->z_vfs, &zfs_vnodeops, &vp); if (error != 0) { kmem_cache_free(znode_cache, zp); @@ -830,7 +832,6 @@ zfs_mknode(znode_t *dzp, vattr_t *vap, d } } - getnewvnode_reserve(1); ZFS_OBJ_HOLD_ENTER(zfsvfs, obj); VERIFY(0 == sa_buf_hold(zfsvfs->z_os, obj, NULL, &db)); @@ -1016,7 +1017,6 @@ zfs_mknode(znode_t *dzp, vattr_t *vap, d KASSERT(err == 0, ("insmntque() failed: error %d", err)); } ZFS_OBJ_HOLD_EXIT(zfsvfs, obj); - getnewvnode_drop_reserve(); } /* From owner-svn-src-head@FreeBSD.ORG Thu Jan 16 12:26:54 2014 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [8.8.178.115]) (using TLSv1 with cipher ADH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id CA395340; Thu, 16 Jan 2014 12:26:54 +0000 (UTC) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mx1.freebsd.org (Postfix) with ESMTPS id B5EAF1311; Thu, 16 Jan 2014 12:26: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 s0GCQsxi084558; Thu, 16 Jan 2014 12:26:54 GMT (envelope-from avg@svn.freebsd.org) Received: (from avg@localhost) by svn.freebsd.org (8.14.7/8.14.7/Submit) id s0GCQsKO084557; Thu, 16 Jan 2014 12:26:54 GMT (envelope-from avg@svn.freebsd.org) Message-Id: <201401161226.s0GCQsKO084557@svn.freebsd.org> From: Andriy Gapon Date: Thu, 16 Jan 2014 12:26:54 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r260705 - head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.17 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 16 Jan 2014 12:26:54 -0000 Author: avg Date: Thu Jan 16 12:26:54 2014 New Revision: 260705 URL: http://svnweb.freebsd.org/changeset/base/260705 Log: fix a bug in ZFS mirror code for handling multiple DVAa The bug was introduced in r256956 "Improve ZFS N-way mirror read performance". The code in vdev_mirror_dva_select erroneously considers already tried DVAs for the next attempt. Thus, it is possible that a failing DVA would be retried forever. As a secondary effect, if the attempts fail with checksum error, then checksum error reports are accumulated until the original request ultimately fails or succeeds. But because retrying is going on indefinitely the cheksum reports accumulation will effectively be a memory leak. Reviewed by: gibbs MFC after: 13 days Sponsored by: HybridCluster Modified: head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/vdev_mirror.c Modified: head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/vdev_mirror.c ============================================================================== --- head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/vdev_mirror.c Thu Jan 16 12:22:46 2014 (r260704) +++ head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/vdev_mirror.c Thu Jan 16 12:26:54 2014 (r260705) @@ -317,9 +317,13 @@ vdev_mirror_dva_select(zio_t *zio, int p { dva_t *dva = zio->io_bp->blk_dva; mirror_map_t *mm = zio->io_vsd; + mirror_child_t *mc; int c; for (c = preferred - 1; c >= 0; c--) { + mc = &mm->mm_child[c]; + if (mc->mc_tried || mc->mc_skipped) + continue; if (DVA_GET_VDEV(&dva[c]) == DVA_GET_VDEV(&dva[preferred])) preferred = c; } From owner-svn-src-head@FreeBSD.ORG Thu Jan 16 12:31:27 2014 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) (using TLSv1 with cipher ADH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id E56D85B7; Thu, 16 Jan 2014 12:31:27 +0000 (UTC) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mx1.freebsd.org (Postfix) with ESMTPS id D183A1390; Thu, 16 Jan 2014 12:31: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 s0GCVRvk087725; Thu, 16 Jan 2014 12:31:27 GMT (envelope-from avg@svn.freebsd.org) Received: (from avg@localhost) by svn.freebsd.org (8.14.7/8.14.7/Submit) id s0GCVRuO087724; Thu, 16 Jan 2014 12:31:27 GMT (envelope-from avg@svn.freebsd.org) Message-Id: <201401161231.s0GCVRuO087724@svn.freebsd.org> From: Andriy Gapon Date: Thu, 16 Jan 2014 12:31:27 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r260706 - head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.17 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 16 Jan 2014 12:31:28 -0000 Author: avg Date: Thu Jan 16 12:31:27 2014 New Revision: 260706 URL: http://svnweb.freebsd.org/changeset/base/260706 Log: zfs_deleteextattr: name buffer from namei is needed by zfs_rename If we prematurely free the name buffer and it gets quickly recycled, then zfs_rename may see data from another lookup or even unmapped memory via cn_nameptr. MFC after: 6 days Sponsored by: HybridCluster Modified: head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_vnops.c Modified: head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_vnops.c ============================================================================== --- head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_vnops.c Thu Jan 16 12:26:54 2014 (r260705) +++ head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_vnops.c Thu Jan 16 12:31:27 2014 (r260706) @@ -6774,14 +6774,16 @@ vop_deleteextattr { UIO_SYSSPACE, attrname, xvp, td); error = namei(&nd); vp = nd.ni_vp; - NDFREE(&nd, NDF_ONLY_PNBUF); if (error != 0) { ZFS_EXIT(zfsvfs); + NDFREE(&nd, NDF_ONLY_PNBUF); if (error == ENOENT) error = ENOATTR; return (error); } + error = VOP_REMOVE(nd.ni_dvp, vp, &nd.ni_cnd); + NDFREE(&nd, NDF_ONLY_PNBUF); vput(nd.ni_dvp); if (vp == nd.ni_dvp) From owner-svn-src-head@FreeBSD.ORG Thu Jan 16 12:35:19 2014 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) (using TLSv1 with cipher ADH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id 12A3F81A; Thu, 16 Jan 2014 12:35:19 +0000 (UTC) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mx1.freebsd.org (Postfix) with ESMTPS id F326913C8; Thu, 16 Jan 2014 12:35: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 s0GCZI9E088225; Thu, 16 Jan 2014 12:35:18 GMT (envelope-from melifaro@svn.freebsd.org) Received: (from melifaro@localhost) by svn.freebsd.org (8.14.7/8.14.7/Submit) id s0GCZIL8088224; Thu, 16 Jan 2014 12:35:18 GMT (envelope-from melifaro@svn.freebsd.org) Message-Id: <201401161235.s0GCZIL8088224@svn.freebsd.org> From: "Alexander V. Chernikov" Date: Thu, 16 Jan 2014 12:35:18 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r260707 - head/sys/netinet X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.17 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 16 Jan 2014 12:35:19 -0000 Author: melifaro Date: Thu Jan 16 12:35:18 2014 New Revision: 260707 URL: http://svnweb.freebsd.org/changeset/base/260707 Log: Fix refcount leak on netinet ifa. Reviewed by: glebius MFC after: 2 weeks Sponsored by: Yandex LLC Modified: head/sys/netinet/in.c Modified: head/sys/netinet/in.c ============================================================================== --- head/sys/netinet/in.c Thu Jan 16 12:31:27 2014 (r260706) +++ head/sys/netinet/in.c Thu Jan 16 12:35:18 2014 (r260707) @@ -408,7 +408,7 @@ in_aifaddr_ioctl(u_long cmd, caddr_t dat if (ifp->if_flags & IFF_LOOPBACK) ia->ia_dstaddr = ia->ia_addr; - ifa_ref(ifa); /* if_addrhead */ + /* if_addrhead is already referenced by ifa_alloc() */ IF_ADDR_WLOCK(ifp); TAILQ_INSERT_TAIL(&ifp->if_addrhead, ifa, ifa_link); IF_ADDR_WUNLOCK(ifp); @@ -495,13 +495,13 @@ fail1: IF_ADDR_WLOCK(ifp); TAILQ_REMOVE(&ifp->if_addrhead, &ia->ia_ifa, ifa_link); IF_ADDR_WUNLOCK(ifp); - ifa_free(&ia->ia_ifa); + ifa_free(&ia->ia_ifa); /* if_addrhead */ IN_IFADDR_WLOCK(); TAILQ_REMOVE(&V_in_ifaddrhead, ia, ia_link); LIST_REMOVE(ia, ia_hash); IN_IFADDR_WUNLOCK(); - ifa_free(&ia->ia_ifa); + ifa_free(&ia->ia_ifa); /* in_ifaddrhead */ return (error); } @@ -565,7 +565,6 @@ in_difaddr_ioctl(caddr_t data, struct if TAILQ_REMOVE(&V_in_ifaddrhead, ia, ia_link); LIST_REMOVE(ia, ia_hash); IN_IFADDR_WUNLOCK(); - ifa_free(&ia->ia_ifa); /* in_ifaddrhead */ /* * in_scrubprefix() kills the interface route. @@ -601,6 +600,7 @@ in_difaddr_ioctl(caddr_t data, struct if } EVENTHANDLER_INVOKE(ifaddr_event, ifp); + ifa_free(&ia->ia_ifa); /* in_ifaddrhead */ return (0); } From owner-svn-src-head@FreeBSD.ORG Thu Jan 16 12:58:04 2014 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [8.8.178.115]) (using TLSv1 with cipher ADH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id 7ADCB128; Thu, 16 Jan 2014 12:58:04 +0000 (UTC) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mx1.freebsd.org (Postfix) with ESMTPS id 5AF9615E5; Thu, 16 Jan 2014 12:58: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 s0GCw4Tu096288; Thu, 16 Jan 2014 12:58:04 GMT (envelope-from glebius@svn.freebsd.org) Received: (from glebius@localhost) by svn.freebsd.org (8.14.7/8.14.7/Submit) id s0GCw4eM096287; Thu, 16 Jan 2014 12:58:04 GMT (envelope-from glebius@svn.freebsd.org) Message-Id: <201401161258.s0GCw4eM096287@svn.freebsd.org> From: Gleb Smirnoff Date: Thu, 16 Jan 2014 12:58:04 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r260709 - head/sys/netinet X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.17 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 16 Jan 2014 12:58:04 -0000 Author: glebius Date: Thu Jan 16 12:58:03 2014 New Revision: 260709 URL: http://svnweb.freebsd.org/changeset/base/260709 Log: Cleanup comments and whitespace. No functional changes. Modified: head/sys/netinet/ip_output.c Modified: head/sys/netinet/ip_output.c ============================================================================== --- head/sys/netinet/ip_output.c Thu Jan 16 12:53:01 2014 (r260708) +++ head/sys/netinet/ip_output.c Thu Jan 16 12:58:03 2014 (r260709) @@ -123,9 +123,6 @@ ip_output(struct mbuf *m, struct mbuf *o struct mbuf *m0; int hlen = sizeof (struct ip); int mtu; -#if 0 - int n; /* scratchpad */ -#endif int error = 0; struct sockaddr_in *dst; const struct sockaddr_in *gw; @@ -158,7 +155,7 @@ ip_output(struct mbuf *m, struct mbuf *o #ifdef FLOWTABLE if (ro->ro_rt == NULL) { struct flentry *fle; - + /* * The flow table returns route entries valid for up to 30 * seconds; we rely on the remainder of ip_output() taking no @@ -205,19 +202,18 @@ ip_output(struct mbuf *m, struct mbuf *o /* * dst/gw handling: * - * dst can be rewritten but always point to &ro->ro_dst - * gw is readonly but can be pointed either to dst OR rt_gatewy - * therefore we need restore GW if we're re-doing lookup + * dst can be rewritten but always points to &ro->ro_dst. + * gw is readonly but can point either to dst OR rt_gateway, + * therefore we need restore gw if we're redoing lookup. */ gw = dst = (struct sockaddr_in *)&ro->ro_dst; again: ia = NULL; /* - * If there is a cached route, - * check that it is to the same destination - * and is still up. If not, free it and try again. - * The address family should also be checked in case of sharing the - * cache with IPv6. + * If there is a cached route, check that it is to the same + * destination and is still up. If not, free it and try again. + * The address family should also be checked in case of sharing + * the cache with IPv6. */ rte = ro->ro_rt; if (rte && ((rte->rt_flags & RTF_UP) == 0 || @@ -770,10 +766,10 @@ ip_fragment(struct ip *ip, struct mbuf * } #endif if (len > PAGE_SIZE) { - /* - * Fragment large datagrams such that each segment - * contains a multiple of PAGE_SIZE amount of data, - * plus headers. This enables a receiver to perform + /* + * Fragment large datagrams such that each segment + * contains a multiple of PAGE_SIZE amount of data, + * plus headers. This enables a receiver to perform * page-flipping zero-copy optimizations. * * XXX When does this help given that sender and receiver @@ -787,7 +783,7 @@ ip_fragment(struct ip *ip, struct mbuf * off += m->m_len; /* - * firstlen (off - hlen) must be aligned on an + * firstlen (off - hlen) must be aligned on an * 8-byte boundary */ if (off < hlen) @@ -1172,7 +1168,7 @@ ip_ctloutput(struct socket *so, struct s case IP_OPTIONS: case IP_RETOPTS: if (inp->inp_options) - error = sooptcopyout(sopt, + error = sooptcopyout(sopt, mtod(inp->inp_options, char *), inp->inp_options->m_len); From owner-svn-src-head@FreeBSD.ORG Thu Jan 16 13:20:21 2014 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [8.8.178.115]) (using TLSv1 with cipher ADH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id 6D4F7FD4; Thu, 16 Jan 2014 13:20:21 +0000 (UTC) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mx1.freebsd.org (Postfix) with ESMTPS id 59D0F1ABE; Thu, 16 Jan 2014 13:20:21 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.7/8.14.7) with ESMTP id s0GDKLAi007255; Thu, 16 Jan 2014 13:20:21 GMT (envelope-from avg@svn.freebsd.org) Received: (from avg@localhost) by svn.freebsd.org (8.14.7/8.14.7/Submit) id s0GDKLKZ007254; Thu, 16 Jan 2014 13:20:21 GMT (envelope-from avg@svn.freebsd.org) Message-Id: <201401161320.s0GDKLKZ007254@svn.freebsd.org> From: Andriy Gapon Date: Thu, 16 Jan 2014 13:20:21 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r260711 - head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.17 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 16 Jan 2014 13:20:21 -0000 Author: avg Date: Thu Jan 16 13:20:20 2014 New Revision: 260711 URL: http://svnweb.freebsd.org/changeset/base/260711 Log: Revert r260705: wrong patch committed by accident An earlier, less efficient version was committed by accident. Modified: head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/vdev_mirror.c Modified: head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/vdev_mirror.c ============================================================================== --- head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/vdev_mirror.c Thu Jan 16 13:12:06 2014 (r260710) +++ head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/vdev_mirror.c Thu Jan 16 13:20:20 2014 (r260711) @@ -317,13 +317,9 @@ vdev_mirror_dva_select(zio_t *zio, int p { dva_t *dva = zio->io_bp->blk_dva; mirror_map_t *mm = zio->io_vsd; - mirror_child_t *mc; int c; for (c = preferred - 1; c >= 0; c--) { - mc = &mm->mm_child[c]; - if (mc->mc_tried || mc->mc_skipped) - continue; if (DVA_GET_VDEV(&dva[c]) == DVA_GET_VDEV(&dva[preferred])) preferred = c; } From owner-svn-src-head@FreeBSD.ORG Thu Jan 16 13:24:10 2014 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [8.8.178.115]) (using TLSv1 with cipher ADH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id E03B935F; Thu, 16 Jan 2014 13:24:10 +0000 (UTC) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mx1.freebsd.org (Postfix) with ESMTPS id B374E1B34; Thu, 16 Jan 2014 13:24: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 s0GDOA1w008513; Thu, 16 Jan 2014 13:24:10 GMT (envelope-from avg@svn.freebsd.org) Received: (from avg@localhost) by svn.freebsd.org (8.14.7/8.14.7/Submit) id s0GDOADB008512; Thu, 16 Jan 2014 13:24:10 GMT (envelope-from avg@svn.freebsd.org) Message-Id: <201401161324.s0GDOADB008512@svn.freebsd.org> From: Andriy Gapon Date: Thu, 16 Jan 2014 13:24:10 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r260713 - head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.17 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 16 Jan 2014 13:24:11 -0000 Author: avg Date: Thu Jan 16 13:24:10 2014 New Revision: 260713 URL: http://svnweb.freebsd.org/changeset/base/260713 Log: fix a bug in ZFS mirror code for handling multiple DVAa The bug was introduced in r256956 "Improve ZFS N-way mirror read performance". The code in vdev_mirror_dva_select erroneously considers already tried DVAs for the next attempt. Thus, it is possible that a failing DVA would be retried forever. As a secondary effect, if the attempts fail with checksum error, then checksum error reports are accumulated until the original request ultimately fails or succeeds. But because retrying is going on indefinitely the cheksum reports accumulation will effectively be a memory leak. Reviewed by: gibbs MFC after: 13 days Sponsored by: HybridCluster Modified: head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/vdev_mirror.c Modified: head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/vdev_mirror.c ============================================================================== --- head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/vdev_mirror.c Thu Jan 16 13:21:32 2014 (r260712) +++ head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/vdev_mirror.c Thu Jan 16 13:24:10 2014 (r260713) @@ -313,13 +313,16 @@ vdev_mirror_scrub_done(zio_t *zio) * single-copy data. */ static int -vdev_mirror_dva_select(zio_t *zio, int preferred) +vdev_mirror_dva_select(zio_t *zio, int p) { dva_t *dva = zio->io_bp->blk_dva; mirror_map_t *mm = zio->io_vsd; + int preferred; int c; - for (c = preferred - 1; c >= 0; c--) { + preferred = mm->mm_preferred[p]; + for (p-- ; p >= 0; p--) { + c = mm->mm_preferred[p]; if (DVA_GET_VDEV(&dva[c]) == DVA_GET_VDEV(&dva[preferred])) preferred = c; } @@ -334,7 +337,7 @@ vdev_mirror_preferred_child_randomize(zi if (mm->mm_root) { p = spa_get_random(mm->mm_preferred_cnt); - return (vdev_mirror_dva_select(zio, mm->mm_preferred[p])); + return (vdev_mirror_dva_select(zio, p)); } /* From owner-svn-src-head@FreeBSD.ORG Thu Jan 16 13:42:15 2014 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) (using TLSv1 with cipher ADH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id 12585BD0; Thu, 16 Jan 2014 13:42:15 +0000 (UTC) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mx1.freebsd.org (Postfix) with ESMTPS id E73D31E01; Thu, 16 Jan 2014 13:42: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 s0GDgENw015936; Thu, 16 Jan 2014 13:42:14 GMT (envelope-from glebius@svn.freebsd.org) Received: (from glebius@localhost) by svn.freebsd.org (8.14.7/8.14.7/Submit) id s0GDgEiJ015934; Thu, 16 Jan 2014 13:42:14 GMT (envelope-from glebius@svn.freebsd.org) Message-Id: <201401161342.s0GDgEiJ015934@svn.freebsd.org> From: Gleb Smirnoff Date: Thu, 16 Jan 2014 13:42:14 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r260715 - head/sys/contrib/ipfilter/netinet X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.17 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 16 Jan 2014 13:42:15 -0000 Author: glebius Date: Thu Jan 16 13:42:14 2014 New Revision: 260715 URL: http://svnweb.freebsd.org/changeset/base/260715 Log: Substitute flags from historical mbuf(9) allocator with modern ones. Sponsored by: Nginx, Inc. Modified: head/sys/contrib/ipfilter/netinet/ip_compat.h head/sys/contrib/ipfilter/netinet/ip_fil_freebsd.c Modified: head/sys/contrib/ipfilter/netinet/ip_compat.h ============================================================================== --- head/sys/contrib/ipfilter/netinet/ip_compat.h Thu Jan 16 13:24:58 2014 (r260714) +++ head/sys/contrib/ipfilter/netinet/ip_compat.h Thu Jan 16 13:42:14 2014 (r260715) @@ -543,7 +543,7 @@ MALLOC_DECLARE(M_IPFILTER); # ifndef ALLOC_MB_T # ifdef MGETHDR # define ALLOC_MB_T(m,l) do { \ - MGETHDR((m), M_DONTWAIT, MT_HEADER); \ + MGETHDR((m), M_NOWAIT, MT_HEADER); \ if ((m) != NULL) { \ (m)->m_len = (l); \ (m)->m_pkthdr.len = (l); \ @@ -551,7 +551,7 @@ MALLOC_DECLARE(M_IPFILTER); } while (0) # else # define ALLOC_MB_T(m,l) do { \ - MGET((m), M_DONTWAIT, MT_HEADER); \ + MGET((m), M_NOWAIT, MT_HEADER); \ if ((m) != NULL) { \ (m)->m_len = (l); \ (m)->m_pkthdr.len = (l); \ Modified: head/sys/contrib/ipfilter/netinet/ip_fil_freebsd.c ============================================================================== --- head/sys/contrib/ipfilter/netinet/ip_fil_freebsd.c Thu Jan 16 13:24:58 2014 (r260714) +++ head/sys/contrib/ipfilter/netinet/ip_fil_freebsd.c Thu Jan 16 13:42:14 2014 (r260715) @@ -368,14 +368,14 @@ ipf_send_reset(fin) hlen = sizeof(ip_t); #endif #ifdef MGETHDR - MGETHDR(m, M_DONTWAIT, MT_HEADER); + MGETHDR(m, M_NOWAIT, MT_HEADER); #else - MGET(m, M_DONTWAIT, MT_HEADER); + MGET(m, M_NOWAIT, MT_HEADER); #endif if (m == NULL) return -1; if (sizeof(*tcp2) + hlen > MLEN) { - MCLGET(m, M_DONTWAIT); + MCLGET(m, M_NOWAIT); if ((m->m_flags & M_EXT) == 0) { FREE_MB_T(m); return -1; @@ -543,9 +543,9 @@ ipf_send_icmp_err(type, fin, dst) if (ipf_checkl4sum(fin) == -1) return -1; #ifdef MGETHDR - MGETHDR(m, M_DONTWAIT, MT_HEADER); + MGETHDR(m, M_NOWAIT, MT_HEADER); #else - MGET(m, M_DONTWAIT, MT_HEADER); + MGET(m, M_NOWAIT, MT_HEADER); #endif if (m == NULL) return -1; @@ -599,7 +599,7 @@ ipf_send_icmp_err(type, fin, dst) code = icmptoicmp6unreach[code]; if (iclen + max_linkhdr + fin->fin_plen > avail) { - MCLGET(m, M_DONTWAIT); + MCLGET(m, M_NOWAIT); if ((m->m_flags & M_EXT) == 0) { FREE_MB_T(m); return -1; @@ -730,7 +730,7 @@ ipf_fastroute(m0, mpp, fin, fdp) * problem. */ if (M_WRITABLE(m) == 0) { - m0 = m_dup(m, M_DONTWAIT); + m0 = m_dup(m, M_NOWAIT); if (m0 != 0) { FREE_MB_T(m); m = m0; @@ -878,9 +878,9 @@ ipf_fastroute(m0, mpp, fin, fdp) mhlen = sizeof (struct ip); for (off = hlen + len; off < ntohs(ip->ip_len); off += len) { #ifdef MGETHDR - MGETHDR(m, M_DONTWAIT, MT_HEADER); + MGETHDR(m, M_NOWAIT, MT_HEADER); #else - MGET(m, M_DONTWAIT, MT_HEADER); + MGET(m, M_NOWAIT, MT_HEADER); #endif if (m == 0) { m = m0; From owner-svn-src-head@FreeBSD.ORG Thu Jan 16 13:42:50 2014 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) (using TLSv1 with cipher ADH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id B844ED2A; Thu, 16 Jan 2014 13:42:50 +0000 (UTC) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mx1.freebsd.org (Postfix) with ESMTPS id A4C951E0F; Thu, 16 Jan 2014 13:42:50 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.7/8.14.7) with ESMTP id s0GDgoUs016023; Thu, 16 Jan 2014 13:42:50 GMT (envelope-from glebius@svn.freebsd.org) Received: (from glebius@localhost) by svn.freebsd.org (8.14.7/8.14.7/Submit) id s0GDgonV016022; Thu, 16 Jan 2014 13:42:50 GMT (envelope-from glebius@svn.freebsd.org) Message-Id: <201401161342.s0GDgonV016022@svn.freebsd.org> From: Gleb Smirnoff Date: Thu, 16 Jan 2014 13:42:50 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r260716 - head/sys/kern X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.17 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 16 Jan 2014 13:42:50 -0000 Author: glebius Date: Thu Jan 16 13:42:50 2014 New Revision: 260716 URL: http://svnweb.freebsd.org/changeset/base/260716 Log: Remove historical macro. Sponsored by: Nginx, Inc. Modified: head/sys/kern/uipc_mbuf.c Modified: head/sys/kern/uipc_mbuf.c ============================================================================== --- head/sys/kern/uipc_mbuf.c Thu Jan 16 13:42:14 2014 (r260715) +++ head/sys/kern/uipc_mbuf.c Thu Jan 16 13:42:50 2014 (r260716) @@ -554,7 +554,7 @@ m_dup_pkthdr(struct mbuf *to, struct mbu to->m_data = to->m_pktdat; to->m_pkthdr = from->m_pkthdr; SLIST_INIT(&to->m_pkthdr.tags); - return (m_tag_copy_chain(to, from, MBTOM(how))); + return (m_tag_copy_chain(to, from, how)); } /* From owner-svn-src-head@FreeBSD.ORG Thu Jan 16 13:44:38 2014 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) (using TLSv1 with cipher ADH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id 7E060E99; Thu, 16 Jan 2014 13:44:38 +0000 (UTC) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mx1.freebsd.org (Postfix) with ESMTPS id 6A0F71E22; Thu, 16 Jan 2014 13:44:38 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.7/8.14.7) with ESMTP id s0GDicb2016308; Thu, 16 Jan 2014 13:44:38 GMT (envelope-from avg@svn.freebsd.org) Received: (from avg@localhost) by svn.freebsd.org (8.14.7/8.14.7/Submit) id s0GDic0j016307; Thu, 16 Jan 2014 13:44:38 GMT (envelope-from avg@svn.freebsd.org) Message-Id: <201401161344.s0GDic0j016307@svn.freebsd.org> From: Andriy Gapon Date: Thu, 16 Jan 2014 13:44:38 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r260717 - head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.17 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 16 Jan 2014 13:44:38 -0000 Author: avg Date: Thu Jan 16 13:44:37 2014 New Revision: 260717 URL: http://svnweb.freebsd.org/changeset/base/260717 Log: fix a build problem with INVARIANTS enabled introduced in r260704 Reported by: glebius MFC after: 5 days X-MFC with: r260704 Modified: head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_znode.c Modified: head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_znode.c ============================================================================== --- head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_znode.c Thu Jan 16 13:42:50 2014 (r260716) +++ head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_znode.c Thu Jan 16 13:44:37 2014 (r260717) @@ -624,7 +624,7 @@ zfs_znode_alloc(zfsvfs_t *zfsvfs, dmu_bu zp = kmem_cache_alloc(znode_cache, KM_SLEEP); - KASSERT(td->td_vp_reserv > 0, + KASSERT(curthread->td_vp_reserv > 0, ("zfs_znode_alloc: getnewvnode without any vnodes reserved")); error = getnewvnode("zfs", zfsvfs->z_parent->z_vfs, &zfs_vnodeops, &vp); if (error != 0) { From owner-svn-src-head@FreeBSD.ORG Thu Jan 16 13:44:48 2014 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) (using TLSv1 with cipher ADH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id A7C8BFD4; Thu, 16 Jan 2014 13:44:48 +0000 (UTC) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mx1.freebsd.org (Postfix) with ESMTPS id 88D271E24; Thu, 16 Jan 2014 13:44: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 s0GDimg7016364; Thu, 16 Jan 2014 13:44:48 GMT (envelope-from glebius@svn.freebsd.org) Received: (from glebius@localhost) by svn.freebsd.org (8.14.7/8.14.7/Submit) id s0GDilSa016356; Thu, 16 Jan 2014 13:44:47 GMT (envelope-from glebius@svn.freebsd.org) Message-Id: <201401161344.s0GDilSa016356@svn.freebsd.org> From: Gleb Smirnoff Date: Thu, 16 Jan 2014 13:44:47 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r260718 - in head/sys: dev/altera/atse dev/bxe dev/hyperv/netvsc dev/qlxge net80211 X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.17 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 16 Jan 2014 13:44:48 -0000 Author: glebius Date: Thu Jan 16 13:44:47 2014 New Revision: 260718 URL: http://svnweb.freebsd.org/changeset/base/260718 Log: Another round of removing historical mbuf(9) allocator flags. They are breeding! New ones arouse since last round. Sponsored by: Nginx, Inc. Modified: head/sys/dev/altera/atse/if_atse.c head/sys/dev/bxe/bxe.c head/sys/dev/hyperv/netvsc/hv_netvsc_drv_freebsd.c head/sys/dev/qlxge/qls_os.c head/sys/net80211/ieee80211_mesh.c Modified: head/sys/dev/altera/atse/if_atse.c ============================================================================== --- head/sys/dev/altera/atse/if_atse.c Thu Jan 16 13:44:37 2014 (r260717) +++ head/sys/dev/altera/atse/if_atse.c Thu Jan 16 13:44:47 2014 (r260718) @@ -1174,7 +1174,7 @@ outer: sc->atse_rx_cycles--; if (sc->atse_rx_m == NULL) { - m = m_getcl(M_DONTWAIT, MT_DATA, M_PKTHDR); + m = m_getcl(M_NOWAIT, MT_DATA, M_PKTHDR); if (m == NULL) return (rx_npkts); m->m_len = m->m_pkthdr.len = MCLBYTES; Modified: head/sys/dev/bxe/bxe.c ============================================================================== --- head/sys/dev/bxe/bxe.c Thu Jan 16 13:44:37 2014 (r260717) +++ head/sys/dev/bxe/bxe.c Thu Jan 16 13:44:47 2014 (r260718) @@ -5443,7 +5443,7 @@ bxe_tx_encap(struct bxe_fastpath *fp, st } else if (error == EFBIG) { /* possibly recoverable with defragmentation */ fp->eth_q_stats.mbuf_defrag_attempts++; - m0 = m_defrag(*m_head, M_DONTWAIT); + m0 = m_defrag(*m_head, M_NOWAIT); if (m0 == NULL) { fp->eth_q_stats.mbuf_defrag_failures++; rc = ENOBUFS; @@ -5504,7 +5504,7 @@ bxe_tx_encap(struct bxe_fastpath *fp, st /* lets try to defragment this mbuf */ fp->eth_q_stats.mbuf_defrag_attempts++; - m0 = m_defrag(*m_head, M_DONTWAIT); + m0 = m_defrag(*m_head, M_NOWAIT); if (m0 == NULL) { fp->eth_q_stats.mbuf_defrag_failures++; /* Ugh, just drop the frame... :( */ @@ -6564,7 +6564,7 @@ bxe_alloc_rx_bd_mbuf(struct bxe_fastpath rc = 0; /* allocate the new RX BD mbuf */ - m = m_getjcl(M_DONTWAIT, MT_DATA, M_PKTHDR, fp->mbuf_alloc_size); + m = m_getjcl(M_NOWAIT, MT_DATA, M_PKTHDR, fp->mbuf_alloc_size); if (__predict_false(m == NULL)) { fp->eth_q_stats.mbuf_rx_bd_alloc_failed++; return (ENOBUFS); @@ -6645,7 +6645,7 @@ bxe_alloc_rx_tpa_mbuf(struct bxe_fastpat int rc = 0; /* allocate the new TPA mbuf */ - m = m_getjcl(M_DONTWAIT, MT_DATA, M_PKTHDR, fp->mbuf_alloc_size); + m = m_getjcl(M_NOWAIT, MT_DATA, M_PKTHDR, fp->mbuf_alloc_size); if (__predict_false(m == NULL)) { fp->eth_q_stats.mbuf_rx_tpa_alloc_failed++; return (ENOBUFS); @@ -6707,7 +6707,7 @@ bxe_alloc_rx_sge_mbuf(struct bxe_fastpat int rc = 0; /* allocate a new SGE mbuf */ - m = m_getjcl(M_DONTWAIT, MT_DATA, M_PKTHDR, SGE_PAGE_SIZE); + m = m_getjcl(M_NOWAIT, MT_DATA, M_PKTHDR, SGE_PAGE_SIZE); if (__predict_false(m == NULL)) { fp->eth_q_stats.mbuf_rx_sge_alloc_failed++; return (ENOMEM); @@ -6769,7 +6769,7 @@ bxe_alloc_fp_buffers(struct bxe_softc *s #if __FreeBSD_version >= 800000 fp->tx_br = buf_ring_alloc(BXE_BR_SIZE, M_DEVBUF, - M_DONTWAIT, &fp->tx_mtx); + M_NOWAIT, &fp->tx_mtx); if (fp->tx_br == NULL) { BLOGE(sc, "buf_ring alloc fail for fp[%02d]\n", i); goto bxe_alloc_fp_buffers_error; Modified: head/sys/dev/hyperv/netvsc/hv_netvsc_drv_freebsd.c ============================================================================== --- head/sys/dev/hyperv/netvsc/hv_netvsc_drv_freebsd.c Thu Jan 16 13:44:37 2014 (r260717) +++ head/sys/dev/hyperv/netvsc/hv_netvsc_drv_freebsd.c Thu Jan 16 13:44:47 2014 (r260718) @@ -485,7 +485,7 @@ hn_start_locked(struct ifnet *ifp) * bpf_mtap code has a chance to run. */ if (ifp->if_bpf) { - mc_head = m_copypacket(m_head, M_DONTWAIT); + mc_head = m_copypacket(m_head, M_NOWAIT); } retry_send: /* Set the completion routine */ @@ -594,7 +594,7 @@ hv_m_append(struct mbuf *m0, int len, c_ * Allocate a new mbuf; could check space * and allocate a cluster instead. */ - n = m_getjcl(M_DONTWAIT, m->m_type, 0, MJUMPAGESIZE); + n = m_getjcl(M_NOWAIT, m->m_type, 0, MJUMPAGESIZE); if (n == NULL) break; n->m_len = min(MJUMPAGESIZE, remainder); @@ -658,7 +658,7 @@ netvsc_recv(struct hv_device *device_ctx size = MJUMPAGESIZE; } - m_new = m_getjcl(M_DONTWAIT, MT_DATA, M_PKTHDR, size); + m_new = m_getjcl(M_NOWAIT, MT_DATA, M_PKTHDR, size); if (m_new == NULL) return (0); Modified: head/sys/dev/qlxge/qls_os.c ============================================================================== --- head/sys/dev/qlxge/qls_os.c Thu Jan 16 13:44:37 2014 (r260717) +++ head/sys/dev/qlxge/qls_os.c Thu Jan 16 13:44:47 2014 (r260718) @@ -1158,7 +1158,7 @@ qls_send(qla_host_t *ha, struct mbuf **m QL_DPRINT8((ha->pci_dev, "%s: EFBIG [%d]\n", __func__, m_head->m_pkthdr.len)); - m = m_defrag(m_head, M_DONTWAIT); + m = m_defrag(m_head, M_NOWAIT); if (m == NULL) { ha->err_tx_defrag++; m_freem(m_head); @@ -1413,7 +1413,7 @@ qls_get_mbuf(qla_host_t *ha, qla_rx_buf_ if (mp == NULL) { - mp = m_getjcl(M_DONTWAIT, MT_DATA, M_PKTHDR, ha->msize); + mp = m_getjcl(M_NOWAIT, MT_DATA, M_PKTHDR, ha->msize); if (mp == NULL) { Modified: head/sys/net80211/ieee80211_mesh.c ============================================================================== --- head/sys/net80211/ieee80211_mesh.c Thu Jan 16 13:44:37 2014 (r260717) +++ head/sys/net80211/ieee80211_mesh.c Thu Jan 16 13:44:47 2014 (r260718) @@ -2693,7 +2693,7 @@ mesh_send_action(struct ieee80211_node * return EIO; /* XXX */ } - M_PREPEND(m, sizeof(struct ieee80211_frame), M_DONTWAIT); + M_PREPEND(m, sizeof(struct ieee80211_frame), M_NOWAIT); if (m == NULL) { ieee80211_free_node(ni); return ENOMEM; From owner-svn-src-head@FreeBSD.ORG Thu Jan 16 13:45:42 2014 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [8.8.178.115]) (using TLSv1 with cipher ADH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id C35C71C1; Thu, 16 Jan 2014 13:45:42 +0000 (UTC) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mx1.freebsd.org (Postfix) with ESMTPS id 956251E39; Thu, 16 Jan 2014 13:45: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 s0GDjgY9016548; Thu, 16 Jan 2014 13:45:42 GMT (envelope-from glebius@svn.freebsd.org) Received: (from glebius@localhost) by svn.freebsd.org (8.14.7/8.14.7/Submit) id s0GDjgqM016546; Thu, 16 Jan 2014 13:45:42 GMT (envelope-from glebius@svn.freebsd.org) Message-Id: <201401161345.s0GDjgqM016546@svn.freebsd.org> From: Gleb Smirnoff Date: Thu, 16 Jan 2014 13:45:42 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r260719 - in head/sys: kern sys X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.17 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 16 Jan 2014 13:45:42 -0000 Author: glebius Date: Thu Jan 16 13:45:41 2014 New Revision: 260719 URL: http://svnweb.freebsd.org/changeset/base/260719 Log: Simplify wait/nowait code, eventually killing last remnant of historical mbuf(9) allocator flag. Sponsored by: Nginx, Inc. Modified: head/sys/kern/uipc_socket.c head/sys/sys/mbuf.h Modified: head/sys/kern/uipc_socket.c ============================================================================== --- head/sys/kern/uipc_socket.c Thu Jan 16 13:44:47 2014 (r260718) +++ head/sys/kern/uipc_socket.c Thu Jan 16 13:45:41 2014 (r260719) @@ -1723,28 +1723,27 @@ dontblock: moff += len; else { if (mp != NULL) { - int copy_flag; - - if (flags & MSG_DONTWAIT) - copy_flag = M_NOWAIT; - else - copy_flag = M_WAIT; - if (copy_flag == M_WAITOK) + if (flags & MSG_DONTWAIT) { + *mp = m_copym(m, 0, len, + M_NOWAIT); + if (*mp == NULL) { + /* + * m_copym() couldn't + * allocate an mbuf. + * Adjust uio_resid back + * (it was adjusted + * down by len bytes, + * which we didn't end + * up "copying" over). + */ + uio->uio_resid += len; + break; + } + } else { SOCKBUF_UNLOCK(&so->so_rcv); - *mp = m_copym(m, 0, len, copy_flag); - if (copy_flag == M_WAITOK) + *mp = m_copym(m, 0, len, + M_WAITOK); SOCKBUF_LOCK(&so->so_rcv); - if (*mp == NULL) { - /* - * m_copym() couldn't - * allocate an mbuf. Adjust - * uio_resid back (it was - * adjusted down by len - * bytes, which we didn't end - * up "copying" over). - */ - uio->uio_resid += len; - break; } } m->m_data += len; Modified: head/sys/sys/mbuf.h ============================================================================== --- head/sys/sys/mbuf.h Thu Jan 16 13:44:47 2014 (r260718) +++ head/sys/sys/mbuf.h Thu Jan 16 13:45:41 2014 (r260719) @@ -466,14 +466,6 @@ struct mbuf { a non-initialized mbuf */ /* - * Compatibility with historic mbuf allocator. - */ -#define MBTOM(how) (how) -#define M_DONTWAIT M_NOWAIT -#define M_TRYWAIT M_WAITOK -#define M_WAIT M_WAITOK - -/* * String names of mbuf-related UMA(9) and malloc(9) types. Exposed to * !_KERNEL so that monitoring tools can look up the zones with * libmemstat(3). From owner-svn-src-head@FreeBSD.ORG Thu Jan 16 13:47:36 2014 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [8.8.178.115]) (using TLSv1 with cipher ADH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id BF33333E; Thu, 16 Jan 2014 13:47:36 +0000 (UTC) Received: from cell.glebius.int.ru (glebius.int.ru [81.19.69.10]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mx1.freebsd.org (Postfix) with ESMTPS id 464391E51; Thu, 16 Jan 2014 13:47:35 +0000 (UTC) Received: from cell.glebius.int.ru (localhost [127.0.0.1]) by cell.glebius.int.ru (8.14.7/8.14.7) with ESMTP id s0GDlXWb038838 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=NO); Thu, 16 Jan 2014 17:47:33 +0400 (MSK) (envelope-from glebius@FreeBSD.org) Received: (from glebius@localhost) by cell.glebius.int.ru (8.14.7/8.14.7/Submit) id s0GDlXmw038837; Thu, 16 Jan 2014 17:47:33 +0400 (MSK) (envelope-from glebius@FreeBSD.org) X-Authentication-Warning: cell.glebius.int.ru: glebius set sender to glebius@FreeBSD.org using -f Date: Thu, 16 Jan 2014 17:47:33 +0400 From: Gleb Smirnoff To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: Re: svn commit: r260719 - in head/sys: kern sys Message-ID: <20140116134733.GB32734@FreeBSD.org> References: <201401161345.s0GDjgqM016546@svn.freebsd.org> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <201401161345.s0GDjgqM016546@svn.freebsd.org> User-Agent: Mutt/1.5.22 (2013-10-16) X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.17 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 16 Jan 2014 13:47:36 -0000 On Thu, Jan 16, 2014 at 01:45:42PM +0000, Gleb Smirnoff wrote: T> Author: glebius T> Date: Thu Jan 16 13:45:41 2014 T> New Revision: 260719 T> URL: http://svnweb.freebsd.org/changeset/base/260719 T> T> Log: T> Simplify wait/nowait code, eventually killing last remnant of T> historical mbuf(9) allocator flag. T> T> Sponsored by: Nginx, Inc. T> T> Modified: T> head/sys/kern/uipc_socket.c T> head/sys/sys/mbuf.h The mbuf.h should have been committed separately: T> Modified: head/sys/sys/mbuf.h T> ============================================================================== T> --- head/sys/sys/mbuf.h Thu Jan 16 13:44:47 2014 (r260718) T> +++ head/sys/sys/mbuf.h Thu Jan 16 13:45:41 2014 (r260719) T> @@ -466,14 +466,6 @@ struct mbuf { T> a non-initialized mbuf */ T> T> /* T> - * Compatibility with historic mbuf allocator. T> - */ T> -#define MBTOM(how) (how) T> -#define M_DONTWAIT M_NOWAIT T> -#define M_TRYWAIT M_WAITOK T> -#define M_WAIT M_WAITOK T> - T> -/* T> * String names of mbuf-related UMA(9) and malloc(9) types. Exposed to T> * !_KERNEL so that monitoring tools can look up the zones with T> * libmemstat(3). ... with a comment: Put an end to uncontrollable breeding of historical flags. -- Totus tuus, Glebius. From owner-svn-src-head@FreeBSD.ORG Thu Jan 16 13:58:56 2014 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) (using TLSv1 with cipher ADH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id 3436C876; Thu, 16 Jan 2014 13:58:56 +0000 (UTC) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mx1.freebsd.org (Postfix) with ESMTPS id 208241F26; Thu, 16 Jan 2014 13:58: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 s0GDwtVB020751; Thu, 16 Jan 2014 13:58:55 GMT (envelope-from glebius@svn.freebsd.org) Received: (from glebius@localhost) by svn.freebsd.org (8.14.7/8.14.7/Submit) id s0GDwtIH020749; Thu, 16 Jan 2014 13:58:55 GMT (envelope-from glebius@svn.freebsd.org) Message-Id: <201401161358.s0GDwtIH020749@svn.freebsd.org> From: Gleb Smirnoff Date: Thu, 16 Jan 2014 13:58:55 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r260720 - head/share/man/man9 X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.17 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 16 Jan 2014 13:58:56 -0000 Author: glebius Date: Thu Jan 16 13:58:55 2014 New Revision: 260720 URL: http://svnweb.freebsd.org/changeset/base/260720 Log: Remove notes about historical mbuf(9) allocator flags from documentation. Sponsored by: Nginx, Inc. Modified: head/share/man/man9/malloc.9 head/share/man/man9/mbuf.9 Modified: head/share/man/man9/malloc.9 ============================================================================== --- head/share/man/man9/malloc.9 Thu Jan 16 13:45:41 2014 (r260719) +++ head/share/man/man9/malloc.9 Thu Jan 16 13:58:55 2014 (r260720) @@ -29,7 +29,7 @@ .\" $NetBSD: malloc.9,v 1.3 1996/11/11 00:05:11 lukem Exp $ .\" $FreeBSD$ .\" -.Dd November 15, 2012 +.Dd January 16, 2014 .Dt MALLOC 9 .Os .Sh NAME @@ -214,17 +214,6 @@ of two for requests up to the size of a For larger requests, one or more pages is allocated. While it should not be relied upon, this information may be useful for optimizing the efficiency of memory use. -.Pp -Programmers should be careful not to confuse the malloc flags -.Dv M_NOWAIT -and -.Dv M_WAITOK -with the -.Xr mbuf 9 -flags -.Dv M_DONTWAIT -and -.Dv M_WAIT . .Sh CONTEXT .Fn malloc , .Fn realloc Modified: head/share/man/man9/mbuf.9 ============================================================================== --- head/share/man/man9/mbuf.9 Thu Jan 16 13:45:41 2014 (r260719) +++ head/share/man/man9/mbuf.9 Thu Jan 16 13:58:55 2014 (r260720) @@ -24,7 +24,7 @@ .\" .\" $FreeBSD$ .\" -.Dd December 20, 2013 +.Dd January 16, 2014 .Dt MBUF 9 .Os .\" @@ -381,17 +381,6 @@ A number of other functions and macros r have the same argument because they may at some point need to allocate new .Vt mbufs . -.Pp -Historical -.Vt mbuf -allocator (See -.Sx HISTORY -section) used allocation flags -.Dv M_WAIT -and -.Dv M_DONTWAIT . -These constants are kept for compatibility -and their use in new code is discouraged. .It Fn MGETHDR mbuf how type Allocate an .Vt mbuf From owner-svn-src-head@FreeBSD.ORG Thu Jan 16 14:48:23 2014 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) (using TLSv1 with cipher ADH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id E1981BBA; Thu, 16 Jan 2014 14:48:23 +0000 (UTC) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mx1.freebsd.org (Postfix) with ESMTPS id CE3C113A0; Thu, 16 Jan 2014 14:48: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 s0GEmNKc041262; Thu, 16 Jan 2014 14:48:23 GMT (envelope-from ray@svn.freebsd.org) Received: (from ray@localhost) by svn.freebsd.org (8.14.7/8.14.7/Submit) id s0GEmNYH041261; Thu, 16 Jan 2014 14:48:23 GMT (envelope-from ray@svn.freebsd.org) Message-Id: <201401161448.s0GEmNYH041261@svn.freebsd.org> From: Aleksandr Rybalko Date: Thu, 16 Jan 2014 14:48:23 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r260752 - head/sys/arm/freescale/imx X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.17 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 16 Jan 2014 14:48:24 -0000 Author: ray Date: Thu Jan 16 14:48:23 2014 New Revision: 260752 URL: http://svnweb.freebsd.org/changeset/base/260752 Log: Fix build after FDT changes. Sponsored by: The FreeBSD Foundation Modified: head/sys/arm/freescale/imx/imx51_ipuv3_fbd.c Modified: head/sys/arm/freescale/imx/imx51_ipuv3_fbd.c ============================================================================== --- head/sys/arm/freescale/imx/imx51_ipuv3_fbd.c Thu Jan 16 14:48:05 2014 (r260751) +++ head/sys/arm/freescale/imx/imx51_ipuv3_fbd.c Thu Jan 16 14:48:23 2014 (r260752) @@ -57,6 +57,7 @@ __FBSDID("$FreeBSD$"); #include #include #include +#include #include #include #include From owner-svn-src-head@FreeBSD.ORG Thu Jan 16 16:12:10 2014 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [8.8.178.115]) (using TLSv1 with cipher ADH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id 0D8351BE; Thu, 16 Jan 2014 16:12:10 +0000 (UTC) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mx1.freebsd.org (Postfix) with ESMTPS id ECC151AD3; Thu, 16 Jan 2014 16:12: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 s0GGC921077797; Thu, 16 Jan 2014 16:12:09 GMT (envelope-from gjb@svn.freebsd.org) Received: (from gjb@localhost) by svn.freebsd.org (8.14.7/8.14.7/Submit) id s0GGC9Pv077791; Thu, 16 Jan 2014 16:12:09 GMT (envelope-from gjb@svn.freebsd.org) Message-Id: <201401161612.s0GGC9Pv077791@svn.freebsd.org> From: Glen Barber Date: Thu, 16 Jan 2014 16:12:09 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r260772 - in head/release: . amd64 i386 pkg_repos scripts X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.17 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 16 Jan 2014 16:12:10 -0000 Author: gjb Date: Thu Jan 16 16:12:09 2014 New Revision: 260772 URL: http://svnweb.freebsd.org/changeset/base/260772 Log: Update the pkg-stage target to be more compatible with pkg-1.2: - Add a release-dvd.conf pkg(8) configuration file to override the default FreeBSD.conf configuration. - Remove architecture-specific pkg-stage.conf files, consolidate, and move their contents to scripts/pkg-stage.sh. - Use 'pkg -vv' to determine the ABI, which is used as the cache directory. Prior to these changes, it would be possible for pkg-stage to fetch conflicting binary packages from multiple repositories. Tested against: head@r260522, stable/10@r260522 MFC after: 3 days X-Insta-MFC: possibly Sponsored by: The FreeBSD Foundation Added: head/release/pkg_repos/ head/release/pkg_repos/release-dvd.conf (contents, props changed) Deleted: head/release/amd64/pkg-stage.conf head/release/i386/pkg-stage.conf Modified: head/release/Makefile head/release/scripts/pkg-stage.sh Modified: head/release/Makefile ============================================================================== --- head/release/Makefile Thu Jan 16 16:08:26 2014 (r260771) +++ head/release/Makefile Thu Jan 16 16:12:09 2014 (r260772) @@ -224,9 +224,9 @@ packagesystem: base.txz kernel.txz ${EXT touch ${.TARGET} pkg-stage: -.if !defined(NOPKG) && exists(${.CURDIR}/${TARGET}/pkg-stage.conf) - sh ${.CURDIR}/scripts/pkg-stage.sh ${.CURDIR}/${TARGET}/pkg-stage.conf \ - ${REVISION} +.if !defined(NOPKG) + env REPOS_DIR=${.CURDIR}/pkg_repos/ \ + sh ${.CURDIR}/scripts/pkg-stage.sh mkdir -p ${.OBJDIR}/dvd/packages/repos/ cp ${.CURDIR}/scripts/FreeBSD_install_cdrom.conf \ ${.OBJDIR}/dvd/packages/repos/ Added: head/release/pkg_repos/release-dvd.conf ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ head/release/pkg_repos/release-dvd.conf Thu Jan 16 16:12:09 2014 (r260772) @@ -0,0 +1,8 @@ +# $FreeBSD$ +release: { + url: "pkg+http://pkg.FreeBSD.org/${ABI}/latest", + mirror_type: "srv", + signature_type: "fingerprints", + fingerprints: "/usr/share/keys/pkg", + enabled: yes +} Modified: head/release/scripts/pkg-stage.sh ============================================================================== --- head/release/scripts/pkg-stage.sh Thu Jan 16 16:08:26 2014 (r260771) +++ head/release/scripts/pkg-stage.sh Thu Jan 16 16:12:09 2014 (r260772) @@ -5,24 +5,31 @@ set -e -usage() { - echo "$(basename ${0}) /path/to/pkg-stage.conf revision" - exit 1 -} - -if [ ! -e "${1}" ]; then - echo "Configuration file not specified." - echo - usage -fi - -if [ "$#" -lt 2 ]; then - usage -fi - -# Source config file for this architecture. -REVISION="${2}" -. "${1}" || exit 1 +export ASSUME_ALWAYS_YES=1 +export PKG_DBDIR="/tmp/pkg" +export PERMISSIVE="YES" +export REPO_AUTOUPDATE="NO" +export PKGCMD="/usr/sbin/pkg -d" + +DVD_PACKAGES="archivers/unzip +devel/subversion +devel/subversion-static +emulators/linux_base-f10 +misc/freebsd-doc-all +net/mpd5 +net/rsync +ports-mgmt/pkg +ports-mgmt/portmaster +shells/bash +shells/zsh +security/sudo +sysutils/screen +www/firefox +www/links +x11-drivers/xf86-video-vmware +x11/gnome2 +x11/kde4 +x11/xorg" # If NOPORTS is set for the release, do not attempt to build pkg(8). if [ ! -f /usr/ports/Makefile ]; then @@ -33,8 +40,13 @@ if [ ! -x /usr/local/sbin/pkg ]; then /usr/bin/make -C /usr/ports/ports-mgmt/pkg install clean fi +export PKG_ABI=$(pkg -vv | grep ^ABI | awk '{print $3}') +export PKG_CACHEDIR="dvd/packages/${PKG_ABI}" + /bin/mkdir -p ${PKG_CACHEDIR} +# Print pkg(8) information to make debugging easier. +${PKGCMD} -vv ${PKGCMD} update -f ${PKGCMD} fetch -d ${DVD_PACKAGES} From owner-svn-src-head@FreeBSD.ORG Thu Jan 16 17:06:02 2014 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) (using TLSv1 with cipher ADH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id A4309685; Thu, 16 Jan 2014 17:06:02 +0000 (UTC) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mx1.freebsd.org (Postfix) with ESMTPS id 9068D1103; Thu, 16 Jan 2014 17:06: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 s0GH62HG099572; Thu, 16 Jan 2014 17:06:02 GMT (envelope-from wblock@svn.freebsd.org) Received: (from wblock@localhost) by svn.freebsd.org (8.14.7/8.14.7/Submit) id s0GH62T4099571; Thu, 16 Jan 2014 17:06:02 GMT (envelope-from wblock@svn.freebsd.org) Message-Id: <201401161706.s0GH62T4099571@svn.freebsd.org> From: Warren Block Date: Thu, 16 Jan 2014 17:06:02 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r260782 - head/bin/df X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.17 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 16 Jan 2014 17:06:02 -0000 Author: wblock (doc committer) Date: Thu Jan 16 17:06:02 2014 New Revision: 260782 URL: http://svnweb.freebsd.org/changeset/base/260782 Log: -h and -H options backwards in manual page. PR: bin/183681 docs/183681 Submitted by: Robin Hahling MFC after: 3 days Modified: head/bin/df/df.1 Modified: head/bin/df/df.1 ============================================================================== --- head/bin/df/df.1 Thu Jan 16 16:44:23 2014 (r260781) +++ head/bin/df/df.1 Thu Jan 16 17:06:02 2014 (r260782) @@ -29,7 +29,7 @@ .\" @(#)df.1 8.3 (Berkeley) 5/8/95 .\" $FreeBSD$ .\" -.Dd January 24, 2013 +.Dd January 16, 2014 .Dt DF 1 .Os .Sh NAME @@ -83,13 +83,13 @@ Use 1073741824 byte (1 Gibibyte) blocks This overrides any .Ev BLOCKSIZE specification from the environment. -.It Fl H +.It Fl h .Dq Human-readable output. Use unit suffixes: Byte, Kibibyte, Mebibyte, Gibibyte, Tebibyte and Pebibyte (based on powers of 1024) in order to reduce the number of digits to four or fewer. -.It Fl h +.It Fl H .Dq Human-readable output. Use unit suffixes: Byte, Kilobyte, Megabyte, From owner-svn-src-head@FreeBSD.ORG Thu Jan 16 18:04:44 2014 Return-Path: Delivered-To: svn-src-head@FreeBSD.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) (using TLSv1 with cipher ADH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id DA1BF478; Thu, 16 Jan 2014 18:04:44 +0000 (UTC) Received: from h2.funkthat.com (gate2.funkthat.com [208.87.223.18]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.freebsd.org (Postfix) with ESMTPS id AFBFA16B9; Thu, 16 Jan 2014 18:04:44 +0000 (UTC) Received: from h2.funkthat.com (localhost [127.0.0.1]) by h2.funkthat.com (8.14.3/8.14.3) with ESMTP id s0GI4hSC088725 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=NO); Thu, 16 Jan 2014 10:04:44 -0800 (PST) (envelope-from jmg@h2.funkthat.com) Received: (from jmg@localhost) by h2.funkthat.com (8.14.3/8.14.3/Submit) id s0GI4hg1088724; Thu, 16 Jan 2014 10:04:43 -0800 (PST) (envelope-from jmg) Date: Thu, 16 Jan 2014 10:04:43 -0800 From: John-Mark Gurney To: "Alexander V. Chernikov" Subject: Re: svn commit: r260702 - head/sys/netinet Message-ID: <20140116180443.GD75135@funkthat.com> References: <201401161150.s0GBo1c1069638@svn.freebsd.org> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <201401161150.s0GBo1c1069638@svn.freebsd.org> User-Agent: Mutt/1.4.2.3i X-Operating-System: FreeBSD 7.2-RELEASE i386 X-PGP-Fingerprint: 54BA 873B 6515 3F10 9E88 9322 9CB1 8F74 6D3F A396 X-Files: The truth is out there X-URL: http://resnet.uoregon.edu/~gurney_j/ X-Resume: http://resnet.uoregon.edu/~gurney_j/resume.html X-to-the-FBI-CIA-and-NSA: HI! HOW YA DOIN? can i haz chizburger? X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.2.2 (h2.funkthat.com [127.0.0.1]); Thu, 16 Jan 2014 10:04:44 -0800 (PST) Cc: svn-src-head@FreeBSD.org, svn-src-all@FreeBSD.org, src-committers@FreeBSD.org X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.17 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 16 Jan 2014 18:04:44 -0000 Alexander V. Chernikov wrote this message on Thu, Jan 16, 2014 at 11:50 +0000: > Author: melifaro > Date: Thu Jan 16 11:50:00 2014 > New Revision: 260702 > URL: http://svnweb.freebsd.org/changeset/base/260702 > > Log: > Fix ipfw fwd for IPv4 traffic broken by r249894. > > Problem case: > Original lookup returns route with GW set, so gw points to > rte->rt_gateway. > After that we're changing dst and performing lookup another time. > Since fwd host is most probably directly reachable, resulting > rte does not contain rt_gateway, so gw is not set. Finally, we > end with packet transmitted to proper interface but wrong > link-layer address. > > Found by: lstewart > Discussed with: ae,lstewart > MFC after: 2 weeks > Sponsored by: Yandex LLC This may be needed for 10.0 as this sounds suspiciously familar to the recent multicast code that was fixed too... It sounds like someone needs to audit this code to verify that there are no other code paths that can break because of this. -- John-Mark Gurney Voice: +1 415 225 5579 "All that I will do, has been done, All that I have, has not." From owner-svn-src-head@FreeBSD.ORG Thu Jan 16 20:26:56 2014 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) (using TLSv1 with cipher ADH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id 555466F0 for ; Thu, 16 Jan 2014 20:26:56 +0000 (UTC) Received: from mail-ve0-x242.google.com (mail-ve0-x242.google.com [IPv6:2607:f8b0:400c:c01::242]) (using TLSv1 with cipher ECDHE-RSA-RC4-SHA (128/128 bits)) (No client certificate requested) by mx1.freebsd.org (Postfix) with ESMTPS id 14D3F159E for ; Thu, 16 Jan 2014 20:26:56 +0000 (UTC) Received: by mail-ve0-f194.google.com with SMTP id jw12so235148veb.9 for ; Thu, 16 Jan 2014 12:26:55 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:date:message-id:subject:from:to:content-type; bh=nNJ1Fs6Sy9GCmb1z7yEffnj7mZ+0TH9NV5qjgyndvMs=; b=nYxxp3JzCOClcyH8LZTWJwL0ds5UUaSGJgUnBbiv2cNGyqOJ6Yi0y37JwFgeecpHM8 9t8/Y0Xm5+OXu4GZU68wT5/It7Kv8ks4T1oIrFxAwE9vYnkjZMwcupA45s1hUlvEQkvd dyvChxixJRGHX68bzPZHTt44rAZ20JeBIQkRea1D3CINDdjDBl8Q0wF+ScTcagGIBRIJ 9zY1XrQjv2IP3VFgMG7ySPvzOlxYTFdjnw+rFmmxespDVdBQbLLnPviaGn4pcoQfhhAr eAB5BctSR8tLoj1BPYnTNZfOEK/+4Flwlg3F1V3RZlr+juzYDgdDMQJjKtAL5FjhuSFu 7nEA== MIME-Version: 1.0 X-Received: by 10.58.44.8 with SMTP id a8mr7972604vem.11.1389904015191; Thu, 16 Jan 2014 12:26:55 -0800 (PST) Received: by 10.58.95.132 with HTTP; Thu, 16 Jan 2014 12:26:55 -0800 (PST) Received: by 10.58.95.132 with HTTP; Thu, 16 Jan 2014 12:26:55 -0800 (PST) Date: Thu, 16 Jan 2014 12:26:55 -0800 Message-ID: Subject: From: Ricky Graham To: svn-src-head@freebsd.org Content-Type: text/plain; charset=ISO-8859-1 X-Content-Filtered-By: Mailman/MimeDel 2.1.17 X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.17 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 16 Jan 2014 20:26:56 -0000 How do I remove the could RPC:S-3) so I can down lod apps From owner-svn-src-head@FreeBSD.ORG Thu Jan 16 20:40:02 2014 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) (using TLSv1 with cipher ADH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id E1A25DE7; Thu, 16 Jan 2014 20:40:02 +0000 (UTC) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mx1.freebsd.org (Postfix) with ESMTPS id CE3461688; Thu, 16 Jan 2014 20:40: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 s0GKe2uv088133; Thu, 16 Jan 2014 20:40:02 GMT (envelope-from imp@svn.freebsd.org) Received: (from imp@localhost) by svn.freebsd.org (8.14.7/8.14.7/Submit) id s0GKe2Gm088131; Thu, 16 Jan 2014 20:40:02 GMT (envelope-from imp@svn.freebsd.org) Message-Id: <201401162040.s0GKe2Gm088131@svn.freebsd.org> From: Warner Losh Date: Thu, 16 Jan 2014 20:40:02 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r260790 - head/sys/mips/cavium X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.17 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 16 Jan 2014 20:40:03 -0000 Author: imp Date: Thu Jan 16 20:40:02 2014 New Revision: 260790 URL: http://svnweb.freebsd.org/changeset/base/260790 Log: Remove two redundantly repetitive assignments. Modified: head/sys/mips/cavium/ciu.c Modified: head/sys/mips/cavium/ciu.c ============================================================================== --- head/sys/mips/cavium/ciu.c Thu Jan 16 18:43:50 2014 (r260789) +++ head/sys/mips/cavium/ciu.c Thu Jan 16 20:40:02 2014 (r260790) @@ -433,7 +433,6 @@ ciu_intr(void *arg) if (en0_sum == 0 && en1_sum == 0) return (FILTER_STRAY); - irq_index = 0; for (irq_index = 0; en0_sum != 0; irq_index++, en0_sum >>= 1) { if ((en0_sum & 1) == 0) continue; @@ -445,7 +444,6 @@ ciu_intr(void *arg) printf("%s: stray en0 irq%d\n", __func__, irq_index); } - irq_index = 0; for (irq_index = 0; en1_sum != 0; irq_index++, en1_sum >>= 1) { if ((en1_sum & 1) == 0) continue; From owner-svn-src-head@FreeBSD.ORG Thu Jan 16 20:46:14 2014 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) (using TLSv1 with cipher ADH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id 0430E81C; Thu, 16 Jan 2014 20:46:14 +0000 (UTC) Received: from mail-ea0-x22d.google.com (mail-ea0-x22d.google.com [IPv6:2a00:1450:4013:c01::22d]) (using TLSv1 with cipher ECDHE-RSA-RC4-SHA (128/128 bits)) (No client certificate requested) by mx1.freebsd.org (Postfix) with ESMTPS id 138081754; Thu, 16 Jan 2014 20:46:12 +0000 (UTC) Received: by mail-ea0-f173.google.com with SMTP id o10so1383749eaj.4 for ; Thu, 16 Jan 2014 12:46:10 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:sender:in-reply-to:references:date:message-id:subject :from:to:cc:content-type; bh=DMH58uIPInWsE7ei8lNZ8YoIVzqv7PV1zWc/PdnE+UY=; b=EFM+8TW5/+dn1FUUUcKLJqHFBlZvhq8rdoNDWbzufH+YL6R520Mmd7p1uqFkcVX65t kFCMFh0xUDqKWUYDxhPyCo1SyihUIVH6U/yaB+KWsPamu8v+DosOj+NWqKXzMN4zwK9U qSM8wPGxx6ukFfaVHuXAGOHnbA0L/cD2FzOdTH8+ZsmmpTkDJhWL0V53VlMSg4zJIPGU Er+c3mKgf5TeMgXol2xOmDZchPA3MUNEDhKLppUduMw5YiImfQRdqdeR75EoCByuCH1M oClPQuvX/SV1kPATAgRbS22o1TuKB2gkqksiQIqHdbeqPdPgLRPRaYu0TB5YhblyKRt4 D3Cg== MIME-Version: 1.0 X-Received: by 10.15.95.72 with SMTP id bc48mr14780471eeb.49.1389905170890; Thu, 16 Jan 2014 12:46:10 -0800 (PST) Sender: hiren.panchasara@gmail.com Received: by 10.14.2.66 with HTTP; Thu, 16 Jan 2014 12:46:10 -0800 (PST) In-Reply-To: <201401160020.s0G0KgwY004039@svn.freebsd.org> References: <201401160020.s0G0KgwY004039@svn.freebsd.org> Date: Thu, 16 Jan 2014 12:46:10 -0800 X-Google-Sender-Auth: hp7DjWMVAv2cQNNC5yt-vM5yAQw Message-ID: Subject: Re: svn commit: r260700 - in head: sys/dev/netmap tools/tools/netmap From: hiren panchasara To: Luigi Rizzo Content-Type: text/plain; charset=UTF-8 Cc: svn-src-head , svn-src-all , src-committers X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.17 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 16 Jan 2014 20:46:14 -0000 On Wed, Jan 15, 2014 at 4:20 PM, Luigi Rizzo wrote: > Author: luigi > Date: Thu Jan 16 00:20:42 2014 > New Revision: 260700 > URL: http://svnweb.freebsd.org/changeset/base/260700 > > Log: > netmap_user.h: > add separate rx/tx ring indexes > add ring specifier in nm_open device name > > netmap.c, netmap_vale.c > more consistent errno numbers > > netmap_generic.c > correctly handle failure in registering interfaces. > > tools/tools/netmap/ > massive cleanup of the example programs > (a lot of common code is now in netmap_user.h.) > > nm_util.[ch] are going away soon. > pcap.c will also go when i commit the native netmap support for libpcap. > > Modified: > head/sys/dev/netmap/netmap.c > head/sys/dev/netmap/netmap_generic.c > head/sys/dev/netmap/netmap_vale.c > head/tools/tools/netmap/Makefile > head/tools/tools/netmap/bridge.c > head/tools/tools/netmap/nm_util.c > head/tools/tools/netmap/nm_util.h > head/tools/tools/netmap/pcap.c > head/tools/tools/netmap/pkt-gen.c > head/tools/tools/netmap/vale-ctl.c > Hi Luigi, Doing make in tools/tools/netmap gives me a bunch of errors because "struct nm_desc_t" doesn't have members like if_flags, if_reqcap and if_curcap. It seems those members were coming from struct my_ring which is no more there. FreeBSD 11.0-CURRENT #0 r260789 cheers, Hiren From owner-svn-src-head@FreeBSD.ORG Thu Jan 16 21:46:44 2014 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [8.8.178.115]) (using TLSv1 with cipher ADH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id 2106ACC5; Thu, 16 Jan 2014 21:46:44 +0000 (UTC) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mx1.freebsd.org (Postfix) with ESMTPS id E64241D0F; Thu, 16 Jan 2014 21: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 s0GLkh3R015911; Thu, 16 Jan 2014 21:46:43 GMT (envelope-from gnn@svn.freebsd.org) Received: (from gnn@localhost) by svn.freebsd.org (8.14.7/8.14.7/Submit) id s0GLkhdB015910; Thu, 16 Jan 2014 21:46:43 GMT (envelope-from gnn@svn.freebsd.org) Message-Id: <201401162146.s0GLkhdB015910@svn.freebsd.org> From: "George V. Neville-Neil" Date: Thu, 16 Jan 2014 21:46:43 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r260791 - head/tools/tools/mcgrab X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.17 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 16 Jan 2014 21:46:44 -0000 Author: gnn Date: Thu Jan 16 21:46:43 2014 New Revision: 260791 URL: http://svnweb.freebsd.org/changeset/base/260791 Log: Add a command line argument to turn off blocking waiting for the user to press Ctrl-C (-b). This allows tests with tight loops of mcgrabs that can stress the multicast tables. MFC after: 2 weeks Modified: head/tools/tools/mcgrab/mcgrab.cc Modified: head/tools/tools/mcgrab/mcgrab.cc ============================================================================== --- head/tools/tools/mcgrab/mcgrab.cc Thu Jan 16 20:40:02 2014 (r260790) +++ head/tools/tools/mcgrab/mcgrab.cc Thu Jan 16 21:46:43 2014 (r260791) @@ -88,7 +88,7 @@ void usage(string message) // // @return 0 for 0K, -1 for error, sets errno // -void grab(char *interface, struct in_addr *group, int number) { +void grab(char *interface, struct in_addr *group, int number, int block) { int sock; @@ -138,8 +138,10 @@ void grab(char *interface, struct in_add group->s_addr = htonl(ntohl(group->s_addr) + 1); } - printf("Press Control-C to exit.\n"); - sleep(INT_MAX); + if (block > 0) { + printf("Press Control-C to exit.\n"); + sleep(INT_MAX); + } } @@ -160,11 +162,12 @@ int main(int argc, char**argv) char* interface = 0; ///< Name of the interface struct in_addr *group = NULL; ///< the multicast group address int number = 0; ///< Number of addresses to grab + int block = 1; ///< Do we block or just return? - if (argc != 7) + if ((argc < 7) || (argc > 8)) usage(); - while ((ch = getopt(argc, argv, "g:i:n:h")) != -1) { + while ((ch = getopt(argc, argv, "g:i:n:bh")) != -1) { switch (ch) { case 'g': group = new (struct in_addr ); @@ -178,12 +181,15 @@ int main(int argc, char**argv) case 'n': number = atoi(optarg); break; + case 'b': + block = 0; + break; case 'h': usage(string("Help\n")); break; } } - grab(interface, group, number); + grab(interface, group, number, block); } From owner-svn-src-head@FreeBSD.ORG Thu Jan 16 22:14:55 2014 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) (using TLSv1 with cipher ADH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id 8597063B; Thu, 16 Jan 2014 22:14:55 +0000 (UTC) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mx1.freebsd.org (Postfix) with ESMTPS id 657AD1F06; Thu, 16 Jan 2014 22:14: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 s0GMEtdw027527; Thu, 16 Jan 2014 22:14:55 GMT (envelope-from gnn@svn.freebsd.org) Received: (from gnn@localhost) by svn.freebsd.org (8.14.7/8.14.7/Submit) id s0GMEtd3027526; Thu, 16 Jan 2014 22:14:55 GMT (envelope-from gnn@svn.freebsd.org) Message-Id: <201401162214.s0GMEtd3027526@svn.freebsd.org> From: "George V. Neville-Neil" Date: Thu, 16 Jan 2014 22:14:55 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r260796 - head/sys/netinet X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.17 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 16 Jan 2014 22:14:55 -0000 Author: gnn Date: Thu Jan 16 22:14:54 2014 New Revision: 260796 URL: http://svnweb.freebsd.org/changeset/base/260796 Log: Fix various places where we don't properly release a lock PR: 185043 Submitted by: Michael Bentkofsky MFC after: 2 weeks Modified: head/sys/netinet/in_mcast.c Modified: head/sys/netinet/in_mcast.c ============================================================================== --- head/sys/netinet/in_mcast.c Thu Jan 16 21:56:05 2014 (r260795) +++ head/sys/netinet/in_mcast.c Thu Jan 16 22:14:54 2014 (r260796) @@ -1496,7 +1496,7 @@ inp_block_unblock_source(struct inpcb *i error = inm_merge(inm, imf); if (error) { CTR1(KTR_IGMPV3, "%s: failed to merge inm state", __func__); - goto out_imf_rollback; + goto out_in_multi_locked; } CTR1(KTR_IGMPV3, "%s: doing igmp downcall", __func__); @@ -1504,6 +1504,8 @@ inp_block_unblock_source(struct inpcb *i if (error) CTR1(KTR_IGMPV3, "%s: failed igmp downcall", __func__); +out_in_multi_locked: + IN_MULTI_UNLOCK(); out_imf_rollback: @@ -2172,8 +2174,12 @@ inp_join_group(struct inpcb *inp, struct if (is_new) { error = in_joingroup_locked(ifp, &gsa->sin.sin_addr, imf, &inm); - if (error) + if (error) { + CTR1(KTR_IGMPV3, "%s: in_joingroup_locked failed", + __func__); + IN_MULTI_UNLOCK(); goto out_imo_free; + } imo->imo_membership[idx] = inm; } else { CTR1(KTR_IGMPV3, "%s: merge inm state", __func__); @@ -2181,20 +2187,21 @@ inp_join_group(struct inpcb *inp, struct if (error) { CTR1(KTR_IGMPV3, "%s: failed to merge inm state", __func__); - goto out_imf_rollback; + goto out_in_multi_locked; } CTR1(KTR_IGMPV3, "%s: doing igmp downcall", __func__); error = igmp_change_state(inm); if (error) { CTR1(KTR_IGMPV3, "%s: failed igmp downcall", __func__); - goto out_imf_rollback; + goto out_in_multi_locked; } } +out_in_multi_locked: + IN_MULTI_UNLOCK(); -out_imf_rollback: INP_WLOCK_ASSERT(inp); if (error) { imf_rollback(imf); @@ -2398,7 +2405,7 @@ inp_leave_group(struct inpcb *inp, struc if (error) { CTR1(KTR_IGMPV3, "%s: failed to merge inm state", __func__); - goto out_imf_rollback; + goto out_in_multi_locked; } CTR1(KTR_IGMPV3, "%s: doing igmp downcall", __func__); @@ -2409,9 +2416,10 @@ inp_leave_group(struct inpcb *inp, struc } } +out_in_multi_locked: + IN_MULTI_UNLOCK(); -out_imf_rollback: if (error) imf_rollback(imf); else @@ -2645,7 +2653,7 @@ inp_set_source_filters(struct inpcb *inp error = inm_merge(inm, imf); if (error) { CTR1(KTR_IGMPV3, "%s: failed to merge inm state", __func__); - goto out_imf_rollback; + goto out_in_multi_locked; } CTR1(KTR_IGMPV3, "%s: doing igmp downcall", __func__); @@ -2653,6 +2661,8 @@ inp_set_source_filters(struct inpcb *inp if (error) CTR1(KTR_IGMPV3, "%s: failed igmp downcall", __func__); +out_in_multi_locked: + IN_MULTI_UNLOCK(); out_imf_rollback: From owner-svn-src-head@FreeBSD.ORG Fri Jan 17 03:30:25 2014 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) (using TLSv1 with cipher ADH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id 536A6F81; Fri, 17 Jan 2014 03:30:25 +0000 (UTC) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mx1.freebsd.org (Postfix) with ESMTPS id 401E71720; Fri, 17 Jan 2014 03:30: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 s0H3UPRM052872; Fri, 17 Jan 2014 03:30:25 GMT (envelope-from csjp@svn.freebsd.org) Received: (from csjp@localhost) by svn.freebsd.org (8.14.7/8.14.7/Submit) id s0H3UP5t052870; Fri, 17 Jan 2014 03:30:25 GMT (envelope-from csjp@svn.freebsd.org) Message-Id: <201401170330.s0H3UP5t052870@svn.freebsd.org> From: "Christian S.J. Peron" Date: Fri, 17 Jan 2014 03:30:25 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r260800 - head/usr.bin/killall X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.17 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 17 Jan 2014 03:30:25 -0000 Author: csjp Date: Fri Jan 17 03:30:24 2014 New Revision: 260800 URL: http://svnweb.freebsd.org/changeset/base/260800 Log: fix a regression introduced in r237618 that would result in killall confusing killall -INT with killall -I (interactive confirmation) which resulted in the wrong signal (TERM) being delivered to the process(s). Discussed with: delphij MFC after: 2 weeks Modified: head/usr.bin/killall/killall.c Modified: head/usr.bin/killall/killall.c ============================================================================== --- head/usr.bin/killall/killall.c Fri Jan 17 01:23:31 2014 (r260799) +++ head/usr.bin/killall/killall.c Fri Jan 17 03:30:24 2014 (r260800) @@ -144,9 +144,6 @@ main(int ac, char **av) if (**av == '-') { ++*av; switch (**av) { - case 'I': - Iflag = 1; - break; case 'j': ++*av; if (**av == '\0') { @@ -213,6 +210,15 @@ main(int ac, char **av) case 'z': zflag++; break; + case 'I': + /* + * NB: do not confuse -INT with -I + */ + if (strncmp(*av, "INT", 3) != 0) { + Iflag = 1; + break; + } + /* FALLTHROUGH */ default: if (isalpha((unsigned char)**av)) { if (strncasecmp(*av, "SIG", 3) == 0) From owner-svn-src-head@FreeBSD.ORG Fri Jan 17 04:16:39 2014 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [8.8.178.115]) (using TLSv1 with cipher ADH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id CBAE2B1C; Fri, 17 Jan 2014 04:16:39 +0000 (UTC) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mx1.freebsd.org (Postfix) with ESMTPS id B838E1A3D; Fri, 17 Jan 2014 04:16: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 s0H4Gdwc070001; Fri, 17 Jan 2014 04:16:39 GMT (envelope-from csjp@svn.freebsd.org) Received: (from csjp@localhost) by svn.freebsd.org (8.14.7/8.14.7/Submit) id s0H4GdUI070000; Fri, 17 Jan 2014 04:16:39 GMT (envelope-from csjp@svn.freebsd.org) Message-Id: <201401170416.s0H4GdUI070000@svn.freebsd.org> From: "Christian S.J. Peron" Date: Fri, 17 Jan 2014 04:16:39 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r260801 - head/usr.bin/killall X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.17 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 17 Jan 2014 04:16:39 -0000 Author: csjp Date: Fri Jan 17 04:16:39 2014 New Revision: 260801 URL: http://svnweb.freebsd.org/changeset/base/260801 Log: Re-work r260800 to include other signals which start with 'I' such as ILL, INFO etc.. Submitted by: delphij MFC after: 2 weeks Modified: head/usr.bin/killall/killall.c Modified: head/usr.bin/killall/killall.c ============================================================================== --- head/usr.bin/killall/killall.c Fri Jan 17 03:30:24 2014 (r260800) +++ head/usr.bin/killall/killall.c Fri Jan 17 04:16:39 2014 (r260801) @@ -90,6 +90,7 @@ nosig(char *name) int main(int ac, char **av) { + char **saved_av; struct kinfo_proc *procs, *newprocs; struct stat sb; struct passwd *pw; @@ -210,16 +211,8 @@ main(int ac, char **av) case 'z': zflag++; break; - case 'I': - /* - * NB: do not confuse -INT with -I - */ - if (strncmp(*av, "INT", 3) != 0) { - Iflag = 1; - break; - } - /* FALLTHROUGH */ default: + saved_av = av; if (isalpha((unsigned char)**av)) { if (strncasecmp(*av, "SIG", 3) == 0) *av += 3; @@ -229,8 +222,14 @@ main(int ac, char **av) sig = p - sys_signame; break; } - if (!sig) - nosig(*av); + if (!sig) { + if (**saved_av == 'I') { + av = saved_av; + Iflag = 1; + break; + } else + nosig(*av); + } } else if (isdigit((unsigned char)**av)) { sig = strtol(*av, &ep, 10); if (!*av || *ep) From owner-svn-src-head@FreeBSD.ORG Fri Jan 17 04:21:39 2014 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [8.8.178.115]) (using TLSv1 with cipher ADH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id E99BCD7F; Fri, 17 Jan 2014 04:21:39 +0000 (UTC) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mx1.freebsd.org (Postfix) with ESMTPS id D63F91AB9; Fri, 17 Jan 2014 04:21: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 s0H4Lde5073369; Fri, 17 Jan 2014 04:21:39 GMT (envelope-from neel@svn.freebsd.org) Received: (from neel@localhost) by svn.freebsd.org (8.14.7/8.14.7/Submit) id s0H4LdLE073366; Fri, 17 Jan 2014 04:21:39 GMT (envelope-from neel@svn.freebsd.org) Message-Id: <201401170421.s0H4LdLE073366@svn.freebsd.org> From: Neel Natu Date: Fri, 17 Jan 2014 04:21:39 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r260802 - head/sys/amd64/vmm/intel X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.17 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 17 Jan 2014 04:21:40 -0000 Author: neel Date: Fri Jan 17 04:21:39 2014 New Revision: 260802 URL: http://svnweb.freebsd.org/changeset/base/260802 Log: If a VM-exit happens during an NMI injection then clear the "NMI Blocking" bit in the Guest Interruptibility-state VMCS field. If we fail to do this then a subsequent VM-entry will fail because it is an error to inject an NMI into the guest while "NMI Blocking" is turned on. This is described in "Checks on Guest Non-Register State" in the Intel SDM. Submitted by: David Reed (david.reed@tidalscale.com) Modified: head/sys/amd64/vmm/intel/vmcs.h head/sys/amd64/vmm/intel/vmx.c Modified: head/sys/amd64/vmm/intel/vmcs.h ============================================================================== --- head/sys/amd64/vmm/intel/vmcs.h Fri Jan 17 04:16:39 2014 (r260801) +++ head/sys/amd64/vmm/intel/vmcs.h Fri Jan 17 04:21:39 2014 (r260802) @@ -333,10 +333,10 @@ vmcs_write(uint32_t encoding, uint64_t v /* * VMCS interrupt information fields */ -#define VMCS_INTR_INFO_VALID (1U << 31) -#define VMCS_INTR_INFO_TYPE(info) (((info) >> 8) & 0x7) -#define VMCS_INTR_INFO_HW_INTR (0 << 8) -#define VMCS_INTR_INFO_NMI (2 << 8) +#define VMCS_INTR_VALID (1U << 31) +#define VMCS_INTR_T_MASK 0x700 /* Interruption-info type */ +#define VMCS_INTR_T_HWINTR (0 << 8) +#define VMCS_INTR_T_NMI (2 << 8) /* * VMCS IDT-Vectoring information fields Modified: head/sys/amd64/vmm/intel/vmx.c ============================================================================== --- head/sys/amd64/vmm/intel/vmx.c Fri Jan 17 04:16:39 2014 (r260801) +++ head/sys/amd64/vmm/intel/vmx.c Fri Jan 17 04:21:39 2014 (r260802) @@ -1065,7 +1065,7 @@ vmx_inject_nmi(struct vmx *vmx, int vcpu * Inject the virtual NMI. The vector must be the NMI IDT entry * or the VMCS entry check will fail. */ - info = VMCS_INTR_INFO_NMI | VMCS_INTR_INFO_VALID; + info = VMCS_INTR_T_NMI | VMCS_INTR_VALID; info |= IDT_NMI; vmcs_write(VMCS_ENTRY_INTR_INFO, info); @@ -1103,7 +1103,7 @@ vmx_inject_interrupts(struct vmx *vmx, i * because of a pending AST. */ info = vmcs_read(VMCS_ENTRY_INTR_INFO); - if (info & VMCS_INTR_INFO_VALID) + if (info & VMCS_INTR_VALID) return; /* @@ -1134,7 +1134,7 @@ vmx_inject_interrupts(struct vmx *vmx, i goto cantinject; /* Inject the interrupt */ - info = VMCS_INTR_INFO_HW_INTR | VMCS_INTR_INFO_VALID; + info = VMCS_INTR_T_HWINTR | VMCS_INTR_VALID; info |= vector; vmcs_write(VMCS_ENTRY_INTR_INFO, info); @@ -1444,10 +1444,12 @@ vmx_exit_process(struct vmx *vmx, int vc int error, handled; struct vmxctx *vmxctx; struct vlapic *vlapic; - uint32_t eax, ecx, edx, idtvec_info, idtvec_err, intr_info, reason; + uint32_t eax, ecx, edx, gi, idtvec_info, idtvec_err, intr_info, reason; uint64_t qual, gpa; bool retu; + CTASSERT((PINBASED_CTLS_ONE_SETTING & PINBASED_VIRTUAL_NMI) != 0); + handled = 0; vmxctx = &vmx->ctx[vcpu]; @@ -1480,6 +1482,18 @@ vmx_exit_process(struct vmx *vmx, int vc vmcs_write(VMCS_ENTRY_EXCEPTION_ERROR, idtvec_err); } + /* + * If 'virtual NMIs' are being used and the VM-exit + * happened while injecting an NMI during the previous + * VM-entry, then clear "blocking by NMI" in the Guest + * Interruptibility-state. + */ + if ((idtvec_info & VMCS_INTR_T_MASK) == + VMCS_INTR_T_NMI) { + gi = vmcs_read(VMCS_GUEST_INTERRUPTIBILITY); + gi &= ~VMCS_INTERRUPTIBILITY_NMI_BLOCKING; + vmcs_write(VMCS_GUEST_INTERRUPTIBILITY, gi); + } vmcs_write(VMCS_ENTRY_INST_LENGTH, vmexit->inst_length); } default: @@ -1556,8 +1570,8 @@ vmx_exit_process(struct vmx *vmx, int vc * this virtual interrupt during the subsequent VM enter. */ intr_info = vmcs_read(VMCS_EXIT_INTR_INFO); - KASSERT((intr_info & VMCS_INTR_INFO_VALID) != 0 && - VMCS_INTR_INFO_TYPE(intr_info) == 0, + KASSERT((intr_info & VMCS_INTR_VALID) != 0 && + (intr_info & VMCS_INTR_T_MASK) == VMCS_INTR_T_HWINTR, ("VM exit interruption info invalid: %#x", intr_info)); vmx_trigger_hostintr(intr_info & 0xff); @@ -2039,11 +2053,11 @@ vmx_inject(void *arg, int vcpu, int type if (error) return (error); - if (info & VMCS_INTR_INFO_VALID) + if (info & VMCS_INTR_VALID) return (EAGAIN); info = vector | (type_map[type] << 8) | (code_valid ? 1 << 11 : 0); - info |= VMCS_INTR_INFO_VALID; + info |= VMCS_INTR_VALID; error = vmcs_setreg(vmcs, 0, VMCS_IDENT(VMCS_ENTRY_INTR_INFO), info); if (error != 0) return (error); From owner-svn-src-head@FreeBSD.ORG Fri Jan 17 04:38:59 2014 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) (using TLSv1 with cipher ADH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id 560E51F0; Fri, 17 Jan 2014 04:38:59 +0000 (UTC) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mx1.freebsd.org (Postfix) with ESMTPS id 364871C8D; Fri, 17 Jan 2014 04:38:59 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.7/8.14.7) with ESMTP id s0H4cxfR077967; Fri, 17 Jan 2014 04:38:59 GMT (envelope-from luigi@svn.freebsd.org) Received: (from luigi@localhost) by svn.freebsd.org (8.14.7/8.14.7/Submit) id s0H4cxRf077966; Fri, 17 Jan 2014 04:38:59 GMT (envelope-from luigi@svn.freebsd.org) Message-Id: <201401170438.s0H4cxRf077966@svn.freebsd.org> From: Luigi Rizzo Date: Fri, 17 Jan 2014 04:38:59 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r260803 - head/sys/net X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.17 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 17 Jan 2014 04:38:59 -0000 Author: luigi Date: Fri Jan 17 04:38:58 2014 New Revision: 260803 URL: http://svnweb.freebsd.org/changeset/base/260803 Log: forgot to update this file in 2607000 Modified: head/sys/net/netmap_user.h Modified: head/sys/net/netmap_user.h ============================================================================== --- head/sys/net/netmap_user.h Fri Jan 17 04:21:39 2014 (r260802) +++ head/sys/net/netmap_user.h Fri Jan 17 04:38:58 2014 (r260803) @@ -139,11 +139,8 @@ nm_ring_space(struct netmap_ring *ring) #include /* EINVAL */ #include /* O_RDWR */ #include /* close() */ -#ifdef __FreeBSD__ +#include #include -#else -#include /* on FreeBSD it is stdlib.h */ -#endif struct nm_hdr_t { /* same as pcap_pkthdr */ struct timeval ts; @@ -151,15 +148,43 @@ struct nm_hdr_t { /* same as pcap_pkthdr uint32_t len; }; +struct nm_stat_t { // pcap_stat + u_int ps_recv; + u_int ps_drop; + u_int ps_ifdrop; +#ifdef WIN32 + u_int bs_capt; +#endif /* WIN32 */ +}; + +#define NM_ERRBUF_SIZE 512 + struct nm_desc_t { struct nm_desc_t *self; int fd; void *mem; int memsize; struct netmap_if *nifp; - uint16_t first_ring, last_ring, cur_ring; - struct nmreq req; + uint16_t first_tx_ring, last_tx_ring, cur_tx_ring; + uint16_t first_rx_ring, last_rx_ring, cur_rx_ring; + struct nmreq req; /* also contains the nr_name = ifname */ struct nm_hdr_t hdr; + + struct netmap_ring *tx, *rx; /* shortcuts to base hw/sw rings */ + + /* parameters from pcap_open_live */ + int snaplen; + int promisc; + int to_ms; + char *errbuf; + + /* save flags so we can restore them on close */ + uint32_t if_flags; + uint32_t if_reqcap; + uint32_t if_curcap; + + struct nm_stat_t st; + char msg[NM_ERRBUF_SIZE]; }; /* @@ -248,7 +273,8 @@ static struct nm_desc_t * nm_open(const char *ifname, const char *ring_name, int flags, int ring_flags) { struct nm_desc_t *d; - u_int n; + u_int n, namelen; + char *port = NULL; if (strncmp(ifname, "netmap:", 7) && strncmp(ifname, "vale", 4)) { errno = 0; /* name not recognised */ @@ -256,6 +282,20 @@ nm_open(const char *ifname, const char * } if (ifname[0] == 'n') ifname += 7; + port = strchr(ifname, '-'); + if (!port) { + namelen = strlen(ifname); + } else { + namelen = port - ifname; + flags &= ~(NETMAP_SW_RING | NETMAP_HW_RING | NETMAP_RING_MASK); + if (port[1] == 's') + flags |= NETMAP_SW_RING; + else + ring_name = port; + } + if (namelen >= sizeof(d->req.nr_name)) + namelen = sizeof(d->req.nr_name) - 1; + d = (struct nm_desc_t *)calloc(1, sizeof(*d)); if (d == NULL) { errno = ENOMEM; @@ -279,9 +319,11 @@ nm_open(const char *ifname, const char * } d->req.nr_ringid |= (flags & ~NETMAP_RING_MASK); d->req.nr_version = NETMAP_API; - strncpy(d->req.nr_name, ifname, sizeof(d->req.nr_name)); - if (ioctl(d->fd, NIOCREGIF, &d->req)) + memcpy(d->req.nr_name, ifname, namelen); + d->req.nr_name[namelen] = '\0'; + if (ioctl(d->fd, NIOCREGIF, &d->req)) { goto fail; + } d->memsize = d->req.nr_memsize; d->mem = mmap(0, d->memsize, PROT_WRITE | PROT_READ, MAP_SHARED, @@ -290,18 +332,27 @@ nm_open(const char *ifname, const char * goto fail; d->nifp = NETMAP_IF(d->mem, d->req.nr_offset); if (d->req.nr_ringid & NETMAP_SW_RING) { - d->first_ring = d->last_ring = d->req.nr_rx_rings; + d->first_tx_ring = d->last_tx_ring = d->req.nr_tx_rings; + d->first_rx_ring = d->last_rx_ring = d->req.nr_rx_rings; } else if (d->req.nr_ringid & NETMAP_HW_RING) { - d->first_ring = d->last_ring = + /* XXX check validity */ + d->first_tx_ring = d->last_tx_ring = + d->first_rx_ring = d->last_rx_ring = d->req.nr_ringid & NETMAP_RING_MASK; } else { - d->first_ring = 0; - d->last_ring = d->req.nr_rx_rings - 1; + d->first_tx_ring = d->last_rx_ring = 0; + d->last_tx_ring = d->req.nr_tx_rings - 1; + d->last_rx_ring = d->req.nr_rx_rings - 1; } - d->cur_ring = d->first_ring; - for (n = d->first_ring; n <= d->last_ring; n++) { - struct netmap_ring *ring = NETMAP_RXRING(d->nifp, n); - ring->flags |= ring_flags; + d->tx = NETMAP_TXRING(d->nifp, 0); + d->rx = NETMAP_RXRING(d->nifp, 0); + d->cur_tx_ring = d->first_tx_ring; + d->cur_rx_ring = d->first_rx_ring; + for (n = d->first_tx_ring; n <= d->last_tx_ring; n++) { + d->tx[n].flags |= ring_flags; + } + for (n = d->first_rx_ring; n <= d->last_rx_ring; n++) { + d->rx[n].flags |= ring_flags; } return d; @@ -340,30 +391,25 @@ nm_close(struct nm_desc_t *d) static int nm_inject(struct nm_desc_t *d, const void *buf, size_t size) { - u_int c, n = d->last_ring - d->first_ring + 1; + u_int c, n = d->last_tx_ring - d->first_tx_ring + 1; - if (0) fprintf(stderr, "%s rings %d %d %d\n", __FUNCTION__, - d->first_ring, d->cur_ring, d->last_ring); for (c = 0; c < n ; c++) { /* compute current ring to use */ struct netmap_ring *ring; uint32_t i, idx; - uint32_t ri = d->cur_ring + c; + uint32_t ri = d->cur_tx_ring + c; - if (ri > d->last_ring) - ri = d->first_ring; + if (ri > d->last_tx_ring) + ri = d->first_tx_ring; ring = NETMAP_TXRING(d->nifp, ri); if (nm_ring_empty(ring)) { - if (0) fprintf(stderr, "%s ring %d cur %d tail %d\n", - __FUNCTION__, - ri, ring->cur, ring->tail); continue; } i = ring->cur; idx = ring->slot[i].buf_idx; ring->slot[i].len = size; pkt_copy(buf, NETMAP_BUF(ring, idx), size); - d->cur_ring = ri; + d->cur_tx_ring = ri; ring->head = ring->cur = nm_ring_next(ring, i); return size; } @@ -377,8 +423,8 @@ nm_inject(struct nm_desc_t *d, const voi static int nm_dispatch(struct nm_desc_t *d, int cnt, nm_cb_t cb, u_char *arg) { - int n = d->last_ring - d->first_ring + 1; - int c, got = 0, ri = d->cur_ring; + int n = d->last_rx_ring - d->first_rx_ring + 1; + int c, got = 0, ri = d->cur_rx_ring; if (cnt == 0) cnt = -1; @@ -390,30 +436,30 @@ nm_dispatch(struct nm_desc_t *d, int cnt /* compute current ring to use */ struct netmap_ring *ring; - ri = d->cur_ring + c; - if (ri > d->last_ring) - ri = d->first_ring; + ri = d->cur_rx_ring + c; + if (ri > d->last_rx_ring) + ri = d->first_rx_ring; ring = NETMAP_RXRING(d->nifp, ri); for ( ; !nm_ring_empty(ring) && cnt != got; got++) { u_int i = ring->cur; u_int idx = ring->slot[i].buf_idx; u_char *buf = (u_char *)NETMAP_BUF(ring, idx); - // XXX should check valid buf - // prefetch(buf); + + // __builtin_prefetch(buf); d->hdr.len = d->hdr.caplen = ring->slot[i].len; d->hdr.ts = ring->ts; cb(arg, &d->hdr, buf); ring->head = ring->cur = nm_ring_next(ring, i); } } - d->cur_ring = ri; + d->cur_rx_ring = ri; return got; } static u_char * nm_nextpkt(struct nm_desc_t *d, struct nm_hdr_t *hdr) { - int ri = d->cur_ring; + int ri = d->cur_rx_ring; do { /* compute current ring to use */ @@ -422,8 +468,8 @@ nm_nextpkt(struct nm_desc_t *d, struct n u_int i = ring->cur; u_int idx = ring->slot[i].buf_idx; u_char *buf = (u_char *)NETMAP_BUF(ring, idx); - // XXX should check valid buf - // prefetch(buf); + + // __builtin_prefetch(buf); hdr->ts = ring->ts; hdr->len = hdr->caplen = ring->slot[i].len; ring->cur = nm_ring_next(ring, i); @@ -432,13 +478,13 @@ nm_nextpkt(struct nm_desc_t *d, struct n * the future. */ ring->head = ring->cur; - d->cur_ring = ri; + d->cur_rx_ring = ri; return buf; } ri++; - if (ri > d->last_ring) - ri = d->first_ring; - } while (ri != d->cur_ring); + if (ri > d->last_rx_ring) + ri = d->first_rx_ring; + } while (ri != d->cur_rx_ring); return NULL; /* nothing found */ } From owner-svn-src-head@FreeBSD.ORG Fri Jan 17 04:40:30 2014 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) (using TLSv1 with cipher ADH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id 865DC354; Fri, 17 Jan 2014 04:40:30 +0000 (UTC) Received: from onelab2.iet.unipi.it (onelab2.iet.unipi.it [131.114.59.238]) by mx1.freebsd.org (Postfix) with ESMTP id 425DB1C9B; Fri, 17 Jan 2014 04:40:30 +0000 (UTC) Received: by onelab2.iet.unipi.it (Postfix, from userid 275) id 7A2C97300A; Fri, 17 Jan 2014 05:42:54 +0100 (CET) Date: Fri, 17 Jan 2014 05:42:54 +0100 From: Luigi Rizzo To: hiren panchasara Subject: Re: svn commit: r260700 - in head: sys/dev/netmap tools/tools/netmap Message-ID: <20140117044254.GB56239@onelab2.iet.unipi.it> References: <201401160020.s0G0KgwY004039@svn.freebsd.org> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: User-Agent: Mutt/1.5.20 (2009-06-14) Cc: svn-src-head , Luigi Rizzo , src-committers , svn-src-all X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.17 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 17 Jan 2014 04:40:30 -0000 On Thu, Jan 16, 2014 at 12:46:10PM -0800, hiren panchasara wrote: > On Wed, Jan 15, 2014 at 4:20 PM, Luigi Rizzo wrote: > > Author: luigi > > Date: Thu Jan 16 00:20:42 2014 > > New Revision: 260700 > > URL: http://svnweb.freebsd.org/changeset/base/260700 > > > > Log: > > netmap_user.h: > > add separate rx/tx ring indexes > > add ring specifier in nm_open device name > > > > netmap.c, netmap_vale.c > > more consistent errno numbers > > > > netmap_generic.c > > correctly handle failure in registering interfaces. > > > > tools/tools/netmap/ > > massive cleanup of the example programs > > (a lot of common code is now in netmap_user.h.) > > > > nm_util.[ch] are going away soon. > > pcap.c will also go when i commit the native netmap support for libpcap. > > > > Modified: > > head/sys/dev/netmap/netmap.c > > head/sys/dev/netmap/netmap_generic.c > > head/sys/dev/netmap/netmap_vale.c > > head/tools/tools/netmap/Makefile > > head/tools/tools/netmap/bridge.c > > head/tools/tools/netmap/nm_util.c > > head/tools/tools/netmap/nm_util.h > > head/tools/tools/netmap/pcap.c > > head/tools/tools/netmap/pkt-gen.c > > head/tools/tools/netmap/vale-ctl.c > > > > Hi Luigi, > > Doing make in tools/tools/netmap gives me a bunch of errors because > "struct nm_desc_t" doesn't have members like if_flags, if_reqcap and > if_curcap. It seems those members were coming from struct my_ring > which is no more there. sorry my bad, i forgot to include sys/net/netmap_user.h in the commit. Fixed in rev 260803 cheers luigi From owner-svn-src-head@FreeBSD.ORG Fri Jan 17 05:13:09 2014 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [8.8.178.115]) (using TLSv1 with cipher ADH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id 088BC79E; Fri, 17 Jan 2014 05:13:09 +0000 (UTC) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mx1.freebsd.org (Postfix) with ESMTPS id E971F1E9D; Fri, 17 Jan 2014 05:13: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 s0H5D8U8092968; Fri, 17 Jan 2014 05:13:08 GMT (envelope-from adrian@svn.freebsd.org) Received: (from adrian@localhost) by svn.freebsd.org (8.14.7/8.14.7/Submit) id s0H5D8RH092967; Fri, 17 Jan 2014 05:13:08 GMT (envelope-from adrian@svn.freebsd.org) Message-Id: <201401170513.s0H5D8RH092967@svn.freebsd.org> From: Adrian Chadd Date: Fri, 17 Jan 2014 05:13:08 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r260804 - head/sys/sys X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.17 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 17 Jan 2014 05:13:09 -0000 Author: adrian Date: Fri Jan 17 05:13:08 2014 New Revision: 260804 URL: http://svnweb.freebsd.org/changeset/base/260804 Log: Implement the extension api for sendfile to allow for kqueue notifications. This is still under a bit of flux, as the final API hasn't been nailed down. It's also unclear whether we should define the two new types in the header or not - it may allow bad code to compile that shouldn't (ie, since uintX's are defined, the developer may not include sys/types.h.) Reviewed by: peter, imp, bde Sponsored by: Netflix, Inc. Modified: head/sys/sys/socket.h Modified: head/sys/sys/socket.h ============================================================================== --- head/sys/sys/socket.h Fri Jan 17 04:38:58 2014 (r260803) +++ head/sys/sys/socket.h Fri Jan 17 05:13:08 2014 (r260804) @@ -84,6 +84,16 @@ typedef __uid_t uid_t; #endif #endif +#ifndef _UINT32_T_DECLARED +typedef __uint32_t uint32_t; +#define _UINT32_T_DECLARED +#endif + +#ifndef _UINTPTR_T_DECLARED +typedef __uintptr_t uintptr_t; +#define _UINTPTR_T_DECLARED +#endif + /* * Types */ @@ -577,11 +587,27 @@ struct sf_hdtr { }; /* + * sendfile(2) kqueue information + */ +struct sf_hdtr_kq { + uintptr_t kq_ident; /* ident (from userland?) */ + void *kq_udata; /* user data pointer */ + uint32_t kq_flags; /* extra flags to pass in */ + int kq_fd; /* kq fd to post completion events on */ +}; + +struct sf_hdtr_all { + struct sf_hdtr hdtr; + struct sf_hdtr_kq kq; +}; + +/* * Sendfile-specific flag(s) */ #define SF_NODISKIO 0x00000001 #define SF_MNOWAIT 0x00000002 #define SF_SYNC 0x00000004 +#define SF_KQUEUE 0x00000008 #ifdef _KERNEL #define SFK_COMPAT 0x00000001 From owner-svn-src-head@FreeBSD.ORG Fri Jan 17 05:15:45 2014 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [8.8.178.115]) (using TLSv1 with cipher ADH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id 1A62C8E9; Fri, 17 Jan 2014 05:15:45 +0000 (UTC) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mx1.freebsd.org (Postfix) with ESMTPS id 07A911EA8; Fri, 17 Jan 2014 05:15: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 s0H5FiVf093418; Fri, 17 Jan 2014 05:15:44 GMT (envelope-from adrian@svn.freebsd.org) Received: (from adrian@localhost) by svn.freebsd.org (8.14.7/8.14.7/Submit) id s0H5Fimg093417; Fri, 17 Jan 2014 05:15:44 GMT (envelope-from adrian@svn.freebsd.org) Message-Id: <201401170515.s0H5Fimg093417@svn.freebsd.org> From: Adrian Chadd Date: Fri, 17 Jan 2014 05:15:44 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r260805 - head/sys/kern X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.17 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 17 Jan 2014 05:15:45 -0000 Author: adrian Date: Fri Jan 17 05:15:44 2014 New Revision: 260805 URL: http://svnweb.freebsd.org/changeset/base/260805 Log: Add in a default initialiser for the EVOPS_SENDFILE kqueue filterops. Sponsored by: Netflix, Inc. Modified: head/sys/kern/kern_event.c Modified: head/sys/kern/kern_event.c ============================================================================== --- head/sys/kern/kern_event.c Fri Jan 17 05:13:08 2014 (r260804) +++ head/sys/kern/kern_event.c Fri Jan 17 05:15:44 2014 (r260805) @@ -294,6 +294,7 @@ static struct { { &fs_filtops }, /* EVFILT_FS */ { &null_filtops }, /* EVFILT_LIO */ { &user_filtops }, /* EVFILT_USER */ + { &null_filtops }, /* EVFILT_SENDFILE */ }; /* From owner-svn-src-head@FreeBSD.ORG Fri Jan 17 05:26:56 2014 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [8.8.178.115]) (using TLSv1 with cipher ADH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id A94D5A90; Fri, 17 Jan 2014 05:26:56 +0000 (UTC) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mx1.freebsd.org (Postfix) with ESMTPS id 9523F1F36; Fri, 17 Jan 2014 05:26: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 s0H5QuCS097444; Fri, 17 Jan 2014 05:26:56 GMT (envelope-from adrian@svn.freebsd.org) Received: (from adrian@localhost) by svn.freebsd.org (8.14.7/8.14.7/Submit) id s0H5QtFI097439; Fri, 17 Jan 2014 05:26:55 GMT (envelope-from adrian@svn.freebsd.org) Message-Id: <201401170526.s0H5QtFI097439@svn.freebsd.org> From: Adrian Chadd Date: Fri, 17 Jan 2014 05:26:55 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r260806 - in head/sys: compat/freebsd32 kern sys X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.17 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 17 Jan 2014 05:26:56 -0000 Author: adrian Date: Fri Jan 17 05:26:55 2014 New Revision: 260806 URL: http://svnweb.freebsd.org/changeset/base/260806 Log: Implement a kqueue notification path for sendfile. This fires off a kqueue note (of type sendfile) to the configured kqfd when the sendfile transaction has completed and the relevant memory backing the transaction is no longer in use by this transaction. This is analogous to SF_SYNC waiting for the mbufs to complete - except now you don't have to wait. Both SF_SYNC and SF_KQUEUE should work together, even if it doesn't necessarily make any practical sense. This is designed for use by applications which use backing cache/store files (eg Varnish) or POSIX shared memory (not sure anything is using it yet!) to know when a region of memory is free for re-use. Note it doesn't mark the region as free overall - only free from this transaction. The application developer still needs to track which ranges are in the process of being recycled and wait until all pending transactions are completed. TODO: * documentation, as always Sponsored by: Netflix, Inc. Modified: head/sys/compat/freebsd32/freebsd32_misc.c head/sys/kern/uipc_syscalls.c head/sys/sys/sf_base.h head/sys/sys/sf_sync.h Modified: head/sys/compat/freebsd32/freebsd32_misc.c ============================================================================== --- head/sys/compat/freebsd32/freebsd32_misc.c Fri Jan 17 05:15:44 2014 (r260805) +++ head/sys/compat/freebsd32/freebsd32_misc.c Fri Jan 17 05:26:55 2014 (r260806) @@ -1644,18 +1644,28 @@ struct sf_hdtr32 { int trl_cnt; }; +struct sf_hdtr_kq32 { + int kq_fd; + uint32_t kq_flags; + uint32_t kq_udata; /* 32-bit void ptr */ + uint32_t kq_ident; /* 32-bit uintptr_t */ +}; + static int freebsd32_do_sendfile(struct thread *td, struct freebsd32_sendfile_args *uap, int compat) { struct sf_hdtr32 hdtr32; struct sf_hdtr hdtr; + struct sf_hdtr_kq32 hdtr_kq32; + struct sf_hdtr_kq hdtr_kq; struct uio *hdr_uio, *trl_uio; struct iovec32 *iov32; off_t offset; int error; off_t sbytes; struct sendfile_sync *sfs; + int do_kqueue = 0; offset = PAIR32TO64(off_t, uap->offset); if (offset < 0) @@ -1687,10 +1697,32 @@ freebsd32_do_sendfile(struct thread *td, if (error) goto out; } + + /* + * If SF_KQUEUE is set, then we need to also copy in + * the kqueue data after the normal hdtr set and set do_kqueue=1. + */ + if (uap->flags & SF_KQUEUE) { + error = copyin(((char *) uap->hdtr) + sizeof(hdtr32), + &hdtr_kq32, + sizeof(hdtr_kq32)); + if (error != 0) + goto out; + + /* 32->64 bit fields */ + CP(hdtr_kq32, hdtr_kq, kq_fd); + CP(hdtr_kq32, hdtr_kq, kq_flags); + PTRIN_CP(hdtr_kq32, hdtr_kq, kq_udata); + CP(hdtr_kq32, hdtr_kq, kq_ident); + do_kqueue = 1; + } } + + /* Call sendfile */ + /* XXX stack depth! */ error = _do_sendfile(td, uap->fd, uap->s, uap->flags, compat, - offset, uap->nbytes, &sbytes, hdr_uio, trl_uio); + offset, uap->nbytes, &sbytes, hdr_uio, trl_uio, &hdtr_kq); if (uap->sbytes != NULL) copyout(&sbytes, uap->sbytes, sizeof(off_t)); Modified: head/sys/kern/uipc_syscalls.c ============================================================================== --- head/sys/kern/uipc_syscalls.c Fri Jan 17 05:15:44 2014 (r260805) +++ head/sys/kern/uipc_syscalls.c Fri Jan 17 05:26:55 2014 (r260806) @@ -123,6 +123,10 @@ static int getpeername1(struct thread *t counter_u64_t sfstat[sizeof(struct sfstat) / sizeof(uint64_t)]; +static int filt_sfsync_attach(struct knote *kn); +static void filt_sfsync_detach(struct knote *kn); +static int filt_sfsync(struct knote *kn, long hint); + /* * sendfile(2)-related variables and associated sysctls */ @@ -132,8 +136,28 @@ static int sfreadahead = 1; SYSCTL_INT(_kern_ipc_sendfile, OID_AUTO, readahead, CTLFLAG_RW, &sfreadahead, 0, "Number of sendfile(2) read-ahead MAXBSIZE blocks"); +#ifdef SFSYNC_DEBUG +static int sf_sync_debug = 0; +SYSCTL_INT(_debug, OID_AUTO, sf_sync_debug, CTLFLAG_RW, + &sf_sync_debug, 0, "Output debugging during sf_sync lifecycle"); +#define SFSYNC_DPRINTF(s, ...) \ + do { \ + if (sf_sync_debug) \ + printf((s), ##__VA_ARGS__); \ + } while (0) +#else +#define SFSYNC_DPRINTF(c, ...) +#endif + static uma_zone_t zone_sfsync; +static struct filterops sendfile_filtops = { + .f_isfd = 0, + .f_attach = filt_sfsync_attach, + .f_detach = filt_sfsync_detach, + .f_event = filt_sfsync, +}; + static void sfstat_init(const void *unused) { @@ -152,6 +176,7 @@ sf_sync_init(const void *unused) NULL, NULL, UMA_ALIGN_CACHE, 0); + kqueue_add_filteropts(EVFILT_SENDFILE, &sendfile_filtops); } SYSINIT(sf_sync, SI_SUB_MBUF, SI_ORDER_FIRST, sf_sync_init, NULL); @@ -1860,6 +1885,118 @@ getsockaddr(namp, uaddr, len) return (error); } +static int +filt_sfsync_attach(struct knote *kn) +{ + struct sendfile_sync *sfs = (struct sendfile_sync *) kn->kn_sdata; + struct knlist *knl = &sfs->klist; + + SFSYNC_DPRINTF("%s: kn=%p, sfs=%p\n", __func__, kn, sfs); + + /* + * Validate that we actually received this via the kernel API. + */ + if ((kn->kn_flags & EV_FLAG1) == 0) + return (EPERM); + + kn->kn_ptr.p_v = sfs; + kn->kn_flags &= ~EV_FLAG1; + + knl->kl_lock(knl->kl_lockarg); + /* + * If we're in the "freeing" state, + * don't allow the add. That way we don't + * end up racing with some other thread that + * is trying to finish some setup. + */ + if (sfs->state == SF_STATE_FREEING) { + knl->kl_unlock(knl->kl_lockarg); + return (EINVAL); + } + knlist_add(&sfs->klist, kn, 1); + knl->kl_unlock(knl->kl_lockarg); + + return (0); +} + +/* + * Called when a knote is being detached. + */ +static void +filt_sfsync_detach(struct knote *kn) +{ + struct knlist *knl; + struct sendfile_sync *sfs; + int do_free = 0; + + sfs = kn->kn_ptr.p_v; + knl = &sfs->klist; + + SFSYNC_DPRINTF("%s: kn=%p, sfs=%p\n", __func__, kn, sfs); + + knl->kl_lock(knl->kl_lockarg); + if (!knlist_empty(knl)) + knlist_remove(knl, kn, 1); + + /* + * If the list is empty _AND_ the refcount is 0 + * _AND_ we've finished the setup phase and now + * we're in the running phase, we can free the + * underlying sendfile_sync. + * + * But we shouldn't do it before finishing the + * underlying divorce from the knote. + * + * So, we have the sfsync lock held; transition + * it to "freeing", then unlock, then free + * normally. + */ + if (knlist_empty(knl)) { + if (sfs->state == SF_STATE_COMPLETED && sfs->count == 0) { + SFSYNC_DPRINTF("%s: (%llu) sfs=%p; completed, " + "count==0, empty list: time to free!\n", + __func__, + (unsigned long long) curthread->td_tid, + sfs); + sf_sync_set_state(sfs, SF_STATE_FREEING, 1); + do_free = 1; + } + } + knl->kl_unlock(knl->kl_lockarg); + + /* + * Only call free if we're the one who has transitioned things + * to free. Otherwise we could race with another thread that + * is currently tearing things down. + */ + if (do_free == 1) { + SFSYNC_DPRINTF("%s: (%llu) sfs=%p, %s:%d\n", + __func__, + (unsigned long long) curthread->td_tid, + sfs, + __FILE__, + __LINE__); + sf_sync_free(sfs); + } +} + +static int +filt_sfsync(struct knote *kn, long hint) +{ + struct sendfile_sync *sfs = (struct sendfile_sync *) kn->kn_ptr.p_v; + int ret; + + SFSYNC_DPRINTF("%s: kn=%p, sfs=%p\n", __func__, kn, sfs); + + /* + * XXX add a lock assertion here! + */ + ret = (sfs->count == 0 && sfs->state == SF_STATE_COMPLETED); + + return (ret); +} + + /* * Detach mapped page and release resources back to the system. */ @@ -1885,21 +2022,97 @@ sf_buf_mext(struct mbuf *mb, void *addr, sfs = addr; sf_sync_deref(sfs); } + /* + * sfs may be invalid at this point, don't use it! + */ return (EXT_FREE_OK); } +/* + * Called to remove a reference to a sf_sync object. + * + * This is generally done during the mbuf free path to signify + * that one of the mbufs in the transaction has been completed. + * + * If we're doing SF_SYNC and the refcount is zero then we'll wake + * up any waiters. + * + * IF we're doing SF_KQUEUE and the refcount is zero then we'll + * fire off the knote. + */ void sf_sync_deref(struct sendfile_sync *sfs) { + int do_free = 0; if (sfs == NULL) return; mtx_lock(&sfs->mtx); KASSERT(sfs->count> 0, ("Sendfile sync botchup count == 0")); - if (--sfs->count == 0) - cv_signal(&sfs->cv); + sfs->count --; + + /* + * Only fire off the wakeup / kqueue notification if + * we are in the running state. + */ + if (sfs->count == 0 && sfs->state == SF_STATE_COMPLETED) { + if (sfs->flags & SF_SYNC) + cv_signal(&sfs->cv); + + if (sfs->flags & SF_KQUEUE) { + SFSYNC_DPRINTF("%s: (%llu) sfs=%p: knote!\n", + __func__, + (unsigned long long) curthread->td_tid, + sfs); + KNOTE_LOCKED(&sfs->klist, 1); + } + + /* + * If we're not waiting around for a sync, + * check if the knote list is empty. + * If it is, we transition to free. + * + * XXX I think it's about time I added some state + * or flag that says whether we're supposed to be + * waiting around until we've done a signal. + * + * XXX Ie, the reason that I don't free it here + * is because the caller will free the last reference, + * not us. That should be codified in some flag + * that indicates "self-free" rather than checking + * for SF_SYNC all the time. + */ + if ((sfs->flags & SF_SYNC) == 0 && knlist_empty(&sfs->klist)) { + SFSYNC_DPRINTF("%s: (%llu) sfs=%p; completed, " + "count==0, empty list: time to free!\n", + __func__, + (unsigned long long) curthread->td_tid, + sfs); + sf_sync_set_state(sfs, SF_STATE_FREEING, 1); + do_free = 1; + } + + } mtx_unlock(&sfs->mtx); + + /* + * Attempt to do a free here. + * + * We do this outside of the lock because it may destroy the + * lock in question as it frees things. We can optimise this + * later. + * + * XXX yes, we should make it a requirement to hold the + * lock across sf_sync_free(). + */ + if (do_free == 1) { + SFSYNC_DPRINTF("%s: (%llu) sfs=%p\n", + __func__, + (unsigned long long) curthread->td_tid, + sfs); + sf_sync_free(sfs); + } } /* @@ -1917,6 +2130,10 @@ sf_sync_alloc(uint32_t flags) mtx_init(&sfs->mtx, "sendfile", NULL, MTX_DEF); cv_init(&sfs->cv, "sendfile"); sfs->flags = flags; + sfs->state = SF_STATE_SETUP; + knlist_init_mtx(&sfs->klist, &sfs->mtx); + + SFSYNC_DPRINTF("%s: sfs=%p, flags=0x%08x\n", __func__, sfs, sfs->flags); return (sfs); } @@ -1946,13 +2163,49 @@ sf_sync_syscall_wait(struct sendfile_syn if (sfs == NULL) return; - mtx_lock(&sfs->mtx); + KASSERT(mtx_owned(&sfs->mtx), ("%s: sfs=%p: not locked but should be!", + __func__, + sfs)); + + /* + * If we're not requested to wait during the syscall, + * don't bother waiting. + */ + if ((sfs->flags & SF_SYNC) == 0) + goto out; + + /* + * This is a bit suboptimal and confusing, so bear with me. + * + * Ideally sf_sync_syscall_wait() will wait until + * all pending mbuf transmit operations are done. + * This means that when sendfile becomes async, it'll + * run in the background and will transition from + * RUNNING to COMPLETED when it's finished acquiring + * new things to send. Then, when the mbufs finish + * sending, COMPLETED + sfs->count == 0 is enough to + * know that no further work is being done. + * + * So, we will sleep on both RUNNING and COMPLETED. + * It's up to the (in progress) async sendfile loop + * to transition the sf_sync from RUNNING to + * COMPLETED so the wakeup above will actually + * do the cv_signal() call. + */ + if (sfs->state != SF_STATE_COMPLETED && sfs->state != SF_STATE_RUNNING) + goto out; + if (sfs->count != 0) cv_wait(&sfs->cv, &sfs->mtx); KASSERT(sfs->count == 0, ("sendfile sync still busy")); - mtx_unlock(&sfs->mtx); + +out: + return; } +/* + * Free an sf_sync if it's appropriate to. + */ void sf_sync_free(struct sendfile_sync *sfs) { @@ -1960,18 +2213,158 @@ sf_sync_free(struct sendfile_sync *sfs) if (sfs == NULL) return; + SFSYNC_DPRINTF("%s: (%lld) sfs=%p; called; state=%d, flags=0x%08x " + "count=%d\n", + __func__, + (long long) curthread->td_tid, + sfs, + sfs->state, + sfs->flags, + sfs->count); + + mtx_lock(&sfs->mtx); + /* - * XXX we should ensure that nothing else has this - * locked before freeing. + * We keep the sf_sync around if the state is active, + * we are doing kqueue notification and we have active + * knotes. + * + * If the caller wants to free us right this second it + * should transition this to the freeing state. + * + * So, complain loudly if they break this rule. */ - mtx_lock(&sfs->mtx); + if (sfs->state != SF_STATE_FREEING) { + printf("%s: (%llu) sfs=%p; not freeing; let's wait!\n", + __func__, + (unsigned long long) curthread->td_tid, + sfs); + mtx_unlock(&sfs->mtx); + return; + } + KASSERT(sfs->count == 0, ("sendfile sync still busy")); cv_destroy(&sfs->cv); + /* + * This doesn't call knlist_detach() on each knote; it just frees + * the entire list. + */ + knlist_delete(&sfs->klist, curthread, 1); mtx_destroy(&sfs->mtx); + SFSYNC_DPRINTF("%s: (%llu) sfs=%p; freeing\n", + __func__, + (unsigned long long) curthread->td_tid, + sfs); uma_zfree(zone_sfsync, sfs); } /* + * Setup a sf_sync to post a kqueue notification when things are complete. + */ +int +sf_sync_kqueue_setup(struct sendfile_sync *sfs, struct sf_hdtr_kq *sfkq) +{ + struct kevent kev; + int error; + + sfs->flags |= SF_KQUEUE; + + /* Check the flags are valid */ + if ((sfkq->kq_flags & ~(EV_CLEAR | EV_DISPATCH | EV_ONESHOT)) != 0) + return (EINVAL); + + SFSYNC_DPRINTF("%s: sfs=%p: kqfd=%d, flags=0x%08x, ident=%p, udata=%p\n", + __func__, + sfs, + sfkq->kq_fd, + sfkq->kq_flags, + (void *) sfkq->kq_ident, + (void *) sfkq->kq_udata); + + /* Setup and register a knote on the given kqfd. */ + kev.ident = (uintptr_t) sfkq->kq_ident; + kev.filter = EVFILT_SENDFILE; + kev.flags = EV_ADD | EV_ENABLE | EV_FLAG1 | sfkq->kq_flags; + kev.data = (intptr_t) sfs; + kev.udata = sfkq->kq_udata; + + error = kqfd_register(sfkq->kq_fd, &kev, curthread, 1); + if (error != 0) { + SFSYNC_DPRINTF("%s: returned %d\n", __func__, error); + } + return (error); +} + +void +sf_sync_set_state(struct sendfile_sync *sfs, sendfile_sync_state_t state, + int islocked) +{ + sendfile_sync_state_t old_state; + + if (! islocked) + mtx_lock(&sfs->mtx); + + /* + * Update our current state. + */ + old_state = sfs->state; + sfs->state = state; + SFSYNC_DPRINTF("%s: (%llu) sfs=%p; going from %d to %d\n", + __func__, + (unsigned long long) curthread->td_tid, + sfs, + old_state, + state); + + /* + * If we're transitioning from RUNNING to COMPLETED and the count is + * zero, then post the knote. The caller may have completed the + * send before we updated the state to COMPLETED and we need to make + * sure this is communicated. + */ + if (old_state == SF_STATE_RUNNING + && state == SF_STATE_COMPLETED + && sfs->count == 0 + && sfs->flags & SF_KQUEUE) { + SFSYNC_DPRINTF("%s: (%llu) sfs=%p: triggering knote!\n", + __func__, + (unsigned long long) curthread->td_tid, + sfs); + KNOTE_LOCKED(&sfs->klist, 1); + } + + if (! islocked) + mtx_unlock(&sfs->mtx); +} + +/* + * Set the retval/errno for the given transaction. + * + * This will eventually/ideally be used when the KNOTE is fired off + * to signify the completion of this transaction. + * + * The sfsync lock should be held before entering this function. + */ +void +sf_sync_set_retval(struct sendfile_sync *sfs, off_t retval, int xerrno) +{ + + KASSERT(mtx_owned(&sfs->mtx), ("%s: sfs=%p: not locked but should be!", + __func__, + sfs)); + + SFSYNC_DPRINTF("%s: (%llu) sfs=%p: errno=%d, retval=%jd\n", + __func__, + (unsigned long long) curthread->td_tid, + sfs, + xerrno, + (intmax_t) retval); + + sfs->retval = retval; + sfs->xerrno = xerrno; +} + +/* * sendfile(2) * * int sendfile(int fd, int s, off_t offset, size_t nbytes, @@ -1992,15 +2385,21 @@ sys_sendfile(struct thread *td, struct s int _do_sendfile(struct thread *td, int src_fd, int sock_fd, int flags, int compat, off_t offset, size_t nbytes, off_t *sbytes, - struct uio *hdr_uio, struct uio *trl_uio) + struct uio *hdr_uio, + struct uio *trl_uio, struct sf_hdtr_kq *hdtr_kq) { cap_rights_t rights; struct sendfile_sync *sfs = NULL; struct file *fp; int error; + int do_kqueue = 0; + int do_free = 0; AUDIT_ARG_FD(src_fd); + if (hdtr_kq != NULL) + do_kqueue = 1; + /* * sendfile(2) can start at any offset within a file so we require * CAP_READ+CAP_SEEK = CAP_PREAD. @@ -2011,20 +2410,121 @@ _do_sendfile(struct thread *td, int src_ } /* + * IF SF_KQUEUE is set but we haven't copied in anything for + * kqueue data, error out. + */ + if (flags & SF_KQUEUE && do_kqueue == 0) { + SFSYNC_DPRINTF("%s: SF_KQUEUE but no KQUEUE data!\n", __func__); + goto out; + } + + /* * If we need to wait for completion, initialise the sfsync * state here. */ - if (flags & SF_SYNC) - sfs = sf_sync_alloc(flags & SF_SYNC); + if (flags & (SF_SYNC | SF_KQUEUE)) + sfs = sf_sync_alloc(flags & (SF_SYNC | SF_KQUEUE)); + + if (flags & SF_KQUEUE) { + error = sf_sync_kqueue_setup(sfs, hdtr_kq); + if (error) { + SFSYNC_DPRINTF("%s: (%llu) error; sfs=%p\n", + __func__, + (unsigned long long) curthread->td_tid, + sfs); + sf_sync_set_state(sfs, SF_STATE_FREEING, 0); + sf_sync_free(sfs); + goto out; + } + } + /* + * Do the sendfile call. + * + * If this fails, it'll free the mbuf chain which will free up the + * sendfile_sync references. + */ error = fo_sendfile(fp, sock_fd, hdr_uio, trl_uio, offset, nbytes, sbytes, flags, compat ? SFK_COMPAT : 0, sfs, td); /* - * If appropriate, do the wait and free here. + * If the sendfile call succeeded, transition the sf_sync state + * to RUNNING, then COMPLETED. + * + * If the sendfile call failed, then the sendfile call may have + * actually sent some data first - so we check to see whether + * any data was sent. If some data was queued (ie, count > 0) + * then we can't call free; we have to wait until the partial + * transaction completes before we continue along. + * + * This has the side effect of firing off the knote + * if the refcount has hit zero by the time we get here. */ if (sfs != NULL) { + mtx_lock(&sfs->mtx); + if (error == 0 || sfs->count > 0) { + /* + * When it's time to do async sendfile, the transition + * to RUNNING signifies that we're actually actively + * adding and completing mbufs. When the last disk + * buffer is read (ie, when we're not doing any + * further read IO and all subsequent stuff is mbuf + * transmissions) we'll transition to COMPLETED + * and when the final mbuf is freed, the completion + * will be signaled. + */ + sf_sync_set_state(sfs, SF_STATE_RUNNING, 1); + + /* + * Set the retval before we signal completed. + * If we do it the other way around then transitioning to + * COMPLETED may post the knote before you set the return + * status! + * + * XXX for now, errno is always 0, as we don't post + * knotes if sendfile failed. Maybe that'll change later. + */ + sf_sync_set_retval(sfs, *sbytes, error); + + /* + * And now transition to completed, which will kick off + * the knote if required. + */ + sf_sync_set_state(sfs, SF_STATE_COMPLETED, 1); + } else { + /* + * Error isn't zero, sfs_count is zero, so we + * won't have some other thing to wake things up. + * Thus free. + */ + sf_sync_set_state(sfs, SF_STATE_FREEING, 1); + do_free = 1; + } + + /* + * Next - wait if appropriate. + */ sf_sync_syscall_wait(sfs); + + /* + * If we're not doing kqueue notifications, we can + * transition this immediately to the freeing state. + */ + if ((sfs->flags & SF_KQUEUE) == 0) { + sf_sync_set_state(sfs, SF_STATE_FREEING, 1); + do_free = 1; + } + + mtx_unlock(&sfs->mtx); + } + + /* + * If do_free is set, free here. + * + * If we're doing no-kqueue notification and it's just sleep notification, + * we also do free; it's the only chance we have. + */ + if (sfs != NULL && do_free == 1) { sf_sync_free(sfs); } @@ -2036,16 +2536,20 @@ _do_sendfile(struct thread *td, int src_ fdrop(fp, td); out: + /* Return error */ return (error); } + static int do_sendfile(struct thread *td, struct sendfile_args *uap, int compat) { struct sf_hdtr hdtr; + struct sf_hdtr_kq hdtr_kq; struct uio *hdr_uio, *trl_uio; int error; off_t sbytes; + int do_kqueue = 0; /* * File offset must be positive. If it goes beyond EOF @@ -2070,10 +2574,25 @@ do_sendfile(struct thread *td, struct se if (error != 0) goto out; } + + /* + * If SF_KQUEUE is set, then we need to also copy in + * the kqueue data after the normal hdtr set and set + * do_kqueue=1. + */ + if (uap->flags & SF_KQUEUE) { + error = copyin(((char *) uap->hdtr) + sizeof(hdtr), + &hdtr_kq, + sizeof(hdtr_kq)); + if (error != 0) + goto out; + do_kqueue = 1; + } } + /* Call sendfile */ error = _do_sendfile(td, uap->fd, uap->s, uap->flags, compat, - uap->offset, uap->nbytes, &sbytes, hdr_uio, trl_uio); + uap->offset, uap->nbytes, &sbytes, hdr_uio, trl_uio, &hdtr_kq); if (uap->sbytes != NULL) { copyout(&sbytes, uap->sbytes, sizeof(off_t)); Modified: head/sys/sys/sf_base.h ============================================================================== --- head/sys/sys/sf_base.h Fri Jan 17 05:15:44 2014 (r260805) +++ head/sys/sys/sf_base.h Fri Jan 17 05:26:55 2014 (r260806) @@ -31,6 +31,7 @@ extern int _do_sendfile(struct thread *, int src_fd, int sock_fd, int flags, int compat, off_t offset, size_t nbytes, off_t *sbytes, - struct uio *hdr_uio, struct uio *trl_uio); + struct uio *hdr_uio, struct uio *trl_uio, + struct sf_hdtr_kq *hdtr_kq); #endif /* _SYS_SF_BASE_H_ */ Modified: head/sys/sys/sf_sync.h ============================================================================== --- head/sys/sys/sf_sync.h Fri Jan 17 05:15:44 2014 (r260805) +++ head/sys/sys/sf_sync.h Fri Jan 17 05:26:55 2014 (r260806) @@ -29,17 +29,36 @@ #ifndef _SYS_SF_SYNC_H_ #define _SYS_SF_SYNC_H_ +typedef enum { + SF_STATE_NONE, + SF_STATE_SETUP, + SF_STATE_RUNNING, + SF_STATE_COMPLETED, + SF_STATE_FREEING +} sendfile_sync_state_t; + struct sendfile_sync { - uint32_t flags; struct mtx mtx; struct cv cv; - unsigned count; + struct knlist klist; + uint32_t flags; + uint32_t count; + int32_t xerrno; /* Completion errno, if retval < 0 */ + off_t retval; /* Completion retval (eg written bytes) */ + sendfile_sync_state_t state; }; +/* XXX pollution */ +struct sf_hdtr_kq; + extern struct sendfile_sync * sf_sync_alloc(uint32_t flags); extern void sf_sync_syscall_wait(struct sendfile_sync *); extern void sf_sync_free(struct sendfile_sync *); +extern void sf_sync_try_free(struct sendfile_sync *); extern void sf_sync_ref(struct sendfile_sync *); extern void sf_sync_deref(struct sendfile_sync *); +extern int sf_sync_kqueue_setup(struct sendfile_sync *, struct sf_hdtr_kq *); +extern void sf_sync_set_state(struct sendfile_sync *, sendfile_sync_state_t, int); +extern void sf_sync_set_retval(struct sendfile_sync *, off_t, int); #endif /* !_SYS_SF_BUF_H_ */ From owner-svn-src-head@FreeBSD.ORG Fri Jan 17 06:33:24 2014 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [8.8.178.115]) (using TLSv1 with cipher ADH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id 26D3B336; Fri, 17 Jan 2014 06:33:24 +0000 (UTC) Received: from mail-ea0-x22f.google.com (mail-ea0-x22f.google.com [IPv6:2a00:1450:4013:c01::22f]) (using TLSv1 with cipher ECDHE-RSA-RC4-SHA (128/128 bits)) (No client certificate requested) by mx1.freebsd.org (Postfix) with ESMTPS id 3AC0E1331; Fri, 17 Jan 2014 06:33:23 +0000 (UTC) Received: by mail-ea0-f175.google.com with SMTP id z10so1517498ead.6 for ; Thu, 16 Jan 2014 22:33:21 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:sender:in-reply-to:references:date:message-id:subject :from:to:cc:content-type; bh=MeP6NWHF8d5MAc8bAfV7GJB1uyDf352YSmsQIaWiAv8=; b=evHfPPNHMvV3eJW6IFy07iwm14/ocNMhdettz2iJD2+m7F/7mvznLZKIizWYSWXbCm gf/hraoGM0MCUYVfh+QNM1ml9nQVFJiCd1dTns//JY/oC009MDsM2mtD8iHpr/KgwZwJ vAuNp+xAuXhSgd5AQHraYYvj+I868k1skD8LnUSAAETqHQbB6+V5Ww6SQ0Iw1SFWR7/i OB7CoFO8ZEJXAY7d1y15lI2059pC9waUC2e2tSIKAa9rEsbAQNsJOfDfbODLchkIUZyx pO09G2edgC3Dlu+aEUALqRXlRD5cGlv7ACgXwetR3KLrYsCyjmzwPnqI88cyJlYx/Iqn O4bw== MIME-Version: 1.0 X-Received: by 10.14.6.5 with SMTP id 5mr170605eem.51.1389940401294; Thu, 16 Jan 2014 22:33:21 -0800 (PST) Sender: hiren.panchasara@gmail.com Received: by 10.14.2.66 with HTTP; Thu, 16 Jan 2014 22:33:21 -0800 (PST) In-Reply-To: <20140117044254.GB56239@onelab2.iet.unipi.it> References: <201401160020.s0G0KgwY004039@svn.freebsd.org> <20140117044254.GB56239@onelab2.iet.unipi.it> Date: Thu, 16 Jan 2014 22:33:21 -0800 X-Google-Sender-Auth: -yOH-gBWh43N9qfhnAn6QICLW0I Message-ID: Subject: Re: svn commit: r260700 - in head: sys/dev/netmap tools/tools/netmap From: hiren panchasara To: Luigi Rizzo Content-Type: text/plain; charset=UTF-8 Cc: svn-src-head , Luigi Rizzo , src-committers , svn-src-all X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.17 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 17 Jan 2014 06:33:24 -0000 On Thu, Jan 16, 2014 at 8:42 PM, Luigi Rizzo wrote: > On Thu, Jan 16, 2014 at 12:46:10PM -0800, hiren panchasara wrote: >> On Wed, Jan 15, 2014 at 4:20 PM, Luigi Rizzo wrote: >> > Author: luigi >> > Date: Thu Jan 16 00:20:42 2014 >> > New Revision: 260700 >> > URL: http://svnweb.freebsd.org/changeset/base/260700 >> > >> > Log: >> > netmap_user.h: >> > add separate rx/tx ring indexes >> > add ring specifier in nm_open device name >> > >> > netmap.c, netmap_vale.c >> > more consistent errno numbers >> > >> > netmap_generic.c >> > correctly handle failure in registering interfaces. >> > >> > tools/tools/netmap/ >> > massive cleanup of the example programs >> > (a lot of common code is now in netmap_user.h.) >> > >> > nm_util.[ch] are going away soon. >> > pcap.c will also go when i commit the native netmap support for libpcap. >> > >> > Modified: >> > head/sys/dev/netmap/netmap.c >> > head/sys/dev/netmap/netmap_generic.c >> > head/sys/dev/netmap/netmap_vale.c >> > head/tools/tools/netmap/Makefile >> > head/tools/tools/netmap/bridge.c >> > head/tools/tools/netmap/nm_util.c >> > head/tools/tools/netmap/nm_util.h >> > head/tools/tools/netmap/pcap.c >> > head/tools/tools/netmap/pkt-gen.c >> > head/tools/tools/netmap/vale-ctl.c >> > >> >> Hi Luigi, >> >> Doing make in tools/tools/netmap gives me a bunch of errors because >> "struct nm_desc_t" doesn't have members like if_flags, if_reqcap and >> if_curcap. It seems those members were coming from struct my_ring >> which is no more there. > > sorry my bad, i forgot to include sys/net/netmap_user.h in the commit. > Fixed in rev 260803 Thank you, Hiren From owner-svn-src-head@FreeBSD.ORG Fri Jan 17 08:21:10 2014 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [8.8.178.115]) (using TLSv1 with cipher ADH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id 8B76C568; Fri, 17 Jan 2014 08:21:10 +0000 (UTC) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mx1.freebsd.org (Postfix) with ESMTPS id 785F41ADC; Fri, 17 Jan 2014 08:21: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 s0H8LAYK067700; Fri, 17 Jan 2014 08:21:10 GMT (envelope-from hselasky@svn.freebsd.org) Received: (from hselasky@localhost) by svn.freebsd.org (8.14.7/8.14.7/Submit) id s0H8LA1C067699; Fri, 17 Jan 2014 08:21:10 GMT (envelope-from hselasky@svn.freebsd.org) Message-Id: <201401170821.s0H8LA1C067699@svn.freebsd.org> From: Hans Petter Selasky Date: Fri, 17 Jan 2014 08:21:10 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r260808 - head/sys/dev/usb X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.17 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 17 Jan 2014 08:21:10 -0000 Author: hselasky Date: Fri Jan 17 08:21:09 2014 New Revision: 260808 URL: http://svnweb.freebsd.org/changeset/base/260808 Log: Close a minor deadlock. MFC after: 1 week Modified: head/sys/dev/usb/usb_dev.c Modified: head/sys/dev/usb/usb_dev.c ============================================================================== --- head/sys/dev/usb/usb_dev.c Fri Jan 17 06:43:35 2014 (r260807) +++ head/sys/dev/usb/usb_dev.c Fri Jan 17 08:21:09 2014 (r260808) @@ -597,6 +597,13 @@ usb_fifo_free(struct usb_fifo *f) mtx_unlock(f->priv_mtx); mtx_lock(&usb_ref_lock); + /* + * Check if the "f->refcount" variable reached zero + * during the unlocked time before entering wait: + */ + if (f->refcount == 0) + break; + /* wait for sync */ cv_wait(&f->cv_drain, &usb_ref_lock); } From owner-svn-src-head@FreeBSD.ORG Fri Jan 17 09:11:45 2014 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [8.8.178.115]) (using TLSv1 with cipher ADH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id 78D44D4D; Fri, 17 Jan 2014 09:11:45 +0000 (UTC) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mx1.freebsd.org (Postfix) with ESMTPS id 6529B1EEF; Fri, 17 Jan 2014 09:11: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 s0H9BjJi087937; Fri, 17 Jan 2014 09:11:45 GMT (envelope-from glebius@svn.freebsd.org) Received: (from glebius@localhost) by svn.freebsd.org (8.14.7/8.14.7/Submit) id s0H9BjUP087936; Fri, 17 Jan 2014 09:11:45 GMT (envelope-from glebius@svn.freebsd.org) Message-Id: <201401170911.s0H9BjUP087936@svn.freebsd.org> From: Gleb Smirnoff Date: Fri, 17 Jan 2014 09:11:45 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r260810 - head/usr.bin/ktrdump X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.17 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 17 Jan 2014 09:11:45 -0000 Author: glebius Date: Fri Jan 17 09:11:44 2014 New Revision: 260810 URL: http://svnweb.freebsd.org/changeset/base/260810 Log: Print the ktr(4) format line that caused a failure. Sponsored by: Nginx, Inc. Modified: head/usr.bin/ktrdump/ktrdump.c Modified: head/usr.bin/ktrdump/ktrdump.c ============================================================================== --- head/usr.bin/ktrdump/ktrdump.c Fri Jan 17 08:44:12 2014 (r260809) +++ head/usr.bin/ktrdump/ktrdump.c Fri Jan 17 09:11:44 2014 (r260810) @@ -236,7 +236,7 @@ main(int ac, char **av) next: if ((c = *p++) == '\0') break; if (parm == KTR_PARMS) - errx(1, "too many parameters"); + errx(1, "too many parameters in \"%s\"", desc); switch (c) { case '0': case '1': case '2': case '3': case '4': case '5': case '6': case '7': case '8': case '9': From owner-svn-src-head@FreeBSD.ORG Fri Jan 17 10:18:46 2014 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) (using TLSv1 with cipher ADH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id 745FFD86; Fri, 17 Jan 2014 10:18:46 +0000 (UTC) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mx1.freebsd.org (Postfix) with ESMTPS id 5EB301364; Fri, 17 Jan 2014 10:18: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 s0HAIkLh013523; Fri, 17 Jan 2014 10:18:46 GMT (envelope-from avg@svn.freebsd.org) Received: (from avg@localhost) by svn.freebsd.org (8.14.7/8.14.7/Submit) id s0HAIknP013522; Fri, 17 Jan 2014 10:18:46 GMT (envelope-from avg@svn.freebsd.org) Message-Id: <201401171018.s0HAIknP013522@svn.freebsd.org> From: Andriy Gapon Date: Fri, 17 Jan 2014 10:18:46 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r260811 - head/cddl/contrib/opensolaris/cmd/zdb X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.17 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 17 Jan 2014 10:18:46 -0000 Author: avg Date: Fri Jan 17 10:18:45 2014 New Revision: 260811 URL: http://svnweb.freebsd.org/changeset/base/260811 Log: zdb -R: do not treat numeric parameters to a flag as more flags Reviewed by: Matthew Ahrens MFC after: 1 week Modified: head/cddl/contrib/opensolaris/cmd/zdb/zdb.c Modified: head/cddl/contrib/opensolaris/cmd/zdb/zdb.c ============================================================================== --- head/cddl/contrib/opensolaris/cmd/zdb/zdb.c Fri Jan 17 09:11:44 2014 (r260810) +++ head/cddl/contrib/opensolaris/cmd/zdb/zdb.c Fri Jan 17 10:18:45 2014 (r260811) @@ -3012,6 +3012,7 @@ zdb_read_block(char *thing, spa_t *spa) free(dup); return; } + i += p - &flagstr[i + 1]; /* skip over the number */ } } From owner-svn-src-head@FreeBSD.ORG Fri Jan 17 10:23:47 2014 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) (using TLSv1 with cipher ADH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id 1B1F5FE9; Fri, 17 Jan 2014 10:23:47 +0000 (UTC) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mx1.freebsd.org (Postfix) with ESMTPS id DD16013E3; Fri, 17 Jan 2014 10:23: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 s0HANkwa016914; Fri, 17 Jan 2014 10:23:46 GMT (envelope-from avg@svn.freebsd.org) Received: (from avg@localhost) by svn.freebsd.org (8.14.7/8.14.7/Submit) id s0HANkNC016913; Fri, 17 Jan 2014 10:23:46 GMT (envelope-from avg@svn.freebsd.org) Message-Id: <201401171023.s0HANkNC016913@svn.freebsd.org> From: Andriy Gapon Date: Fri, 17 Jan 2014 10:23:46 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r260812 - head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.17 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 17 Jan 2014 10:23:47 -0000 Author: avg Date: Fri Jan 17 10:23:46 2014 New Revision: 260812 URL: http://svnweb.freebsd.org/changeset/base/260812 Log: traverse_visitbp: visit DMU_GROUPUSED_OBJECT before DMU_USERUSED_OBJECT This is done to ensure that visited object IDs are always increasing. Also, pass correct object ID to prefetch_dnode_metadata for os_groupused_dnode. Without this change we would hit an assert if traversal was paused on a GROUPUSED object, which is unlikely but possible. Apparently the same change was independently developed by Deplhix. Reviewed by: Matthew Ahrens MFC after: 10 days Sponsored by: HybridCluster Modified: head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/dmu_traverse.c Modified: head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/dmu_traverse.c ============================================================================== --- head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/dmu_traverse.c Fri Jan 17 10:18:45 2014 (r260811) +++ head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/dmu_traverse.c Fri Jan 17 10:23:46 2014 (r260812) @@ -351,9 +351,9 @@ traverse_visitbp(traverse_data_t *td, co prefetch_dnode_metadata(td, dnp, zb->zb_objset, DMU_META_DNODE_OBJECT); if (arc_buf_size(buf) >= sizeof (objset_phys_t)) { - prefetch_dnode_metadata(td, &osp->os_userused_dnode, - zb->zb_objset, DMU_USERUSED_OBJECT); prefetch_dnode_metadata(td, &osp->os_groupused_dnode, + zb->zb_objset, DMU_GROUPUSED_OBJECT); + prefetch_dnode_metadata(td, &osp->os_userused_dnode, zb->zb_objset, DMU_USERUSED_OBJECT); } @@ -364,18 +364,18 @@ traverse_visitbp(traverse_data_t *td, co err = 0; } if (err == 0 && arc_buf_size(buf) >= sizeof (objset_phys_t)) { - dnp = &osp->os_userused_dnode; + dnp = &osp->os_groupused_dnode; err = traverse_dnode(td, dnp, zb->zb_objset, - DMU_USERUSED_OBJECT); + DMU_GROUPUSED_OBJECT); } if (err && hard) { lasterr = err; err = 0; } if (err == 0 && arc_buf_size(buf) >= sizeof (objset_phys_t)) { - dnp = &osp->os_groupused_dnode; + dnp = &osp->os_userused_dnode; err = traverse_dnode(td, dnp, zb->zb_objset, - DMU_GROUPUSED_OBJECT); + DMU_USERUSED_OBJECT); } } From owner-svn-src-head@FreeBSD.ORG Fri Jan 17 10:35:19 2014 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) (using TLSv1 with cipher ADH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id 724505B4; Fri, 17 Jan 2014 10:35:19 +0000 (UTC) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mx1.freebsd.org (Postfix) with ESMTPS id 5E5FD14FB; Fri, 17 Jan 2014 10:35: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 s0HAZJaJ021309; Fri, 17 Jan 2014 10:35:19 GMT (envelope-from hselasky@svn.freebsd.org) Received: (from hselasky@localhost) by svn.freebsd.org (8.14.7/8.14.7/Submit) id s0HAZJ3X021307; Fri, 17 Jan 2014 10:35:19 GMT (envelope-from hselasky@svn.freebsd.org) Message-Id: <201401171035.s0HAZJ3X021307@svn.freebsd.org> From: Hans Petter Selasky Date: Fri, 17 Jan 2014 10:35:19 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r260814 - head/sys/dev/usb X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.17 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 17 Jan 2014 10:35:19 -0000 Author: hselasky Date: Fri Jan 17 10:35:18 2014 New Revision: 260814 URL: http://svnweb.freebsd.org/changeset/base/260814 Log: Fix a possible memory use after free and leak situation associated with USB device detach when using character device handles. This also includes LibUSB. It turns out that "usb_close()" cannot always get a reference to clean up its USB transfers and such, if called during the kernel USB device detach. Analysis by: hselasky @ Reported by: Juergen Lock MFC after: 1 week Modified: head/sys/dev/usb/usb_dev.c head/sys/dev/usb/usb_device.c Modified: head/sys/dev/usb/usb_dev.c ============================================================================== --- head/sys/dev/usb/usb_dev.c Fri Jan 17 10:34:01 2014 (r260813) +++ head/sys/dev/usb/usb_dev.c Fri Jan 17 10:35:18 2014 (r260814) @@ -207,6 +207,11 @@ usb_ref_device(struct usb_cdev_privdata DPRINTFN(2, "no device at %u\n", cpd->dev_index); goto error; } + if (cpd->udev->state == USB_STATE_DETACHED && + (need_uref != 2)) { + DPRINTFN(2, "device is detached\n"); + goto error; + } if (cpd->udev->refcount == USB_DEV_REF_MAX) { DPRINTFN(2, "no dev ref\n"); goto error; @@ -922,23 +927,12 @@ usb_close(void *arg) DPRINTFN(2, "cpd=%p\n", cpd); - err = usb_ref_device(cpd, &refs, 0); - if (err) + err = usb_ref_device(cpd, &refs, + 2 /* uref and allow detached state */); + if (err) { + DPRINTFN(0, "Cannot grab USB reference when " + "closing USB file handle\n"); goto done; - - /* - * If this function is not called directly from the root HUB - * thread, there is usually a need to lock the enumeration - * lock. Check this. - */ - if (!usbd_enum_is_locked(cpd->udev)) { - - DPRINTFN(2, "Locking enumeration\n"); - - /* reference device */ - err = usb_usb_ref_device(cpd, &refs); - if (err) - goto done; } if (cpd->fflags & FREAD) { usb_fifo_close(refs.rxfifo, cpd->fflags); Modified: head/sys/dev/usb/usb_device.c ============================================================================== --- head/sys/dev/usb/usb_device.c Fri Jan 17 10:34:01 2014 (r260813) +++ head/sys/dev/usb/usb_device.c Fri Jan 17 10:35:18 2014 (r260814) @@ -2070,6 +2070,8 @@ usb_free_device(struct usb_device *udev, DPRINTFN(4, "udev=%p port=%d\n", udev, udev->port_no); bus = udev->bus; + + /* set DETACHED state to prevent any further references */ usb_set_device_state(udev, USB_STATE_DETACHED); #if USB_HAVE_DEVCTL @@ -2085,16 +2087,7 @@ usb_free_device(struct usb_device *udev, usb_free_symlink(udev->ugen_symlink); udev->ugen_symlink = NULL; } -#endif - /* - * Unregister our device first which will prevent any further - * references: - */ - usb_bus_port_set_device(bus, udev->parent_hub ? - udev->parent_hub->hub->ports + udev->port_index : NULL, - NULL, USB_ROOT_HUB_ADDR); -#if USB_HAVE_UGEN /* wait for all pending references to go away: */ mtx_lock(&usb_ref_lock); udev->refcount--; @@ -2114,6 +2107,11 @@ usb_free_device(struct usb_device *udev, /* the following will get the device unconfigured in software */ usb_unconfigure(udev, USB_UNCFG_FLAG_FREE_EP0); + /* final device unregister after all character devices are closed */ + usb_bus_port_set_device(bus, udev->parent_hub ? + udev->parent_hub->hub->ports + udev->port_index : NULL, + NULL, USB_ROOT_HUB_ADDR); + /* unsetup any leftover default USB transfers */ usbd_transfer_unsetup(udev->ctrl_xfer, USB_CTRL_XFER_MAX); @@ -2647,8 +2645,14 @@ usb_set_device_state(struct usb_device * DPRINTF("udev %p state %s -> %s\n", udev, usb_statestr(udev->state), usb_statestr(state)); - udev->state = state; +#if USB_HAVE_UGEN + mtx_lock(&usb_ref_lock); +#endif + udev->state = state; +#if USB_HAVE_UGEN + mtx_unlock(&usb_ref_lock); +#endif if (udev->bus->methods->device_state_change != NULL) (udev->bus->methods->device_state_change) (udev); } From owner-svn-src-head@FreeBSD.ORG Fri Jan 17 11:09:05 2014 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) (using TLSv1 with cipher ADH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id EAA6219F; Fri, 17 Jan 2014 11:09:05 +0000 (UTC) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mx1.freebsd.org (Postfix) with ESMTPS id D7953171E; Fri, 17 Jan 2014 11:09:05 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.7/8.14.7) with ESMTP id s0HB95IY034310; Fri, 17 Jan 2014 11:09:05 GMT (envelope-from glebius@svn.freebsd.org) Received: (from glebius@localhost) by svn.freebsd.org (8.14.7/8.14.7/Submit) id s0HB95Ln034309; Fri, 17 Jan 2014 11:09:05 GMT (envelope-from glebius@svn.freebsd.org) Message-Id: <201401171109.s0HB95Ln034309@svn.freebsd.org> From: Gleb Smirnoff Date: Fri, 17 Jan 2014 11:09:05 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r260819 - head/sys/kern X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.17 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 17 Jan 2014 11:09:06 -0000 Author: glebius Date: Fri Jan 17 11:09:05 2014 New Revision: 260819 URL: http://svnweb.freebsd.org/changeset/base/260819 Log: Fix comment. Modified: head/sys/kern/uipc_sockbuf.c Modified: head/sys/kern/uipc_sockbuf.c ============================================================================== --- head/sys/kern/uipc_sockbuf.c Fri Jan 17 11:04:59 2014 (r260818) +++ head/sys/kern/uipc_sockbuf.c Fri Jan 17 11:09:05 2014 (r260819) @@ -813,7 +813,7 @@ sbflush_internal(struct sockbuf *sb) while (sb->sb_mbcnt) { /* - * Don't call sbdrop(sb, 0) if the leading mbuf is non-empty: + * Don't call sbcut(sb, 0) if the leading mbuf is non-empty: * we would loop forever. Panic instead. */ if (!sb->sb_cc && (sb->sb_mb == NULL || sb->sb_mb->m_len)) From owner-svn-src-head@FreeBSD.ORG Fri Jan 17 12:38:46 2014 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [8.8.178.115]) (using TLSv1 with cipher ADH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id 585FE507 for ; Fri, 17 Jan 2014 12:38:46 +0000 (UTC) Received: from mail-pd0-x243.google.com (mail-pd0-x243.google.com [IPv6:2607:f8b0:400e:c02::243]) (using TLSv1 with cipher ECDHE-RSA-RC4-SHA (128/128 bits)) (No client certificate requested) by mx1.freebsd.org (Postfix) with ESMTPS id 2AB9D1E60 for ; Fri, 17 Jan 2014 12:38:46 +0000 (UTC) Received: by mail-pd0-f195.google.com with SMTP id x10so1921222pdj.6 for ; Fri, 17 Jan 2014 04:38:45 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=from:to:subject:date:message-id:mime-version:content-type :thread-index:content-language; bh=RuCeC1igY98SGyyZKNzacJ5YO8/7TFfPRRucFEa8KI0=; b=jugv2OfUm5P/RciQaQVeBGvRokEz3Vmbu0x+7ra715ge7GHVlhpl2QMi1wfvcywspH MDlf3kRXalke2Wn80qKBVUhFnZanTO+8G021agiZjjOoFndHUVZIIr2ans+LbFTW1D8+ cKpuvcqw8QOsYNkJwIEqkrXJL2GGlT8rNxX9Jio8o72qFugqk72IQWT2qLtbzNmNAHX1 axoPSx+hompX5sB/lpgBdJC+jMkSyTPfLRmYbxulivX3G7KYz0Gp3mdCDZ1KANXUkfoP NqWItKd5q/efiguLvRPjWy0Ho+mUpqU/If/eGqqSTLk++332woLMAxU4eCVsU/GprahC 1yrg== X-Received: by 10.66.119.136 with SMTP id ku8mr1743954pab.121.1389962325842; Fri, 17 Jan 2014 04:38:45 -0800 (PST) Received: from spidersPC ([122.177.110.18]) by mx.google.com with ESMTPSA id vn10sm22551821pbc.21.2014.01.17.04.38.43 for (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Fri, 17 Jan 2014 04:38:44 -0800 (PST) From: "Tania" To: Subject: Online Presence Date: Fri, 17 Jan 2014 18:08:30 +0530 Message-ID: <52d92454.eaee440a.24a6.1b8e@mx.google.com> MIME-Version: 1.0 X-Mailer: Microsoft Office Outlook 12.0 Thread-Index: Ac8TgQFJhK3UjwJFQXm90MFBcKS8PA== Content-Language: en-us X-Antivirus: avast! (VPS 140117-0, 01/17/2014), Outbound message X-Antivirus-Status: Clean Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: quoted-printable X-Content-Filtered-By: Mailman/MimeDel 2.1.17 X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.17 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 17 Jan 2014 12:38:46 -0000 Hi, Greetings for the day! I was surfing through your site and can see that you are offering Online services to your clients. We will be happy to execute SEO & Web Design and Development projects at a much lower cost than what you have in house - No compromise on quality! We are at present partnering with over 30 firms from UK, US, Australia and parts of Europe. We specialize in SEO, SMO, SEM, PPC, and Website Design & Development. To brief you about our company: =FC We are a group of 75+ professionals. =FC We are in business from last 5 years. =FC We have served 10000+ clients. =FC We are an offshore execution partner for leading Digital Agencies in U= S, UK & Australia and across the Globe. I shall look forward to hear from you soon. Once have the consent from your end would have the next step to accomplish your queries at an immediate effect. Feel free to discuss any other queries. Truly yours, Tania --- This email is free from viruses and malware because avast! Antivirus protec= tion is active. http://www.avast.com From owner-svn-src-head@FreeBSD.ORG Fri Jan 17 14:36:26 2014 Return-Path: Delivered-To: svn-src-head@FreeBSD.org Received: from mx1.freebsd.org (mx1.freebsd.org [8.8.178.115]) (using TLSv1 with cipher ADH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id 5E44D624; Fri, 17 Jan 2014 14:36:26 +0000 (UTC) Received: from citadel.icyb.net.ua (citadel.icyb.net.ua [212.40.38.140]) by mx1.freebsd.org (Postfix) with ESMTP id 26E4B18B0; Fri, 17 Jan 2014 14:36:24 +0000 (UTC) Received: from porto.starpoint.kiev.ua (porto-e.starpoint.kiev.ua [212.40.38.100]) by citadel.icyb.net.ua (8.8.8p3/ICyb-2.3exp) with ESMTP id QAA28801; Fri, 17 Jan 2014 16:36:19 +0200 (EET) (envelope-from avg@FreeBSD.org) Received: from localhost ([127.0.0.1]) by porto.starpoint.kiev.ua with esmtp (Exim 4.34 (FreeBSD)) id 1W4AWx-000OcI-1r; Fri, 17 Jan 2014 16:36:19 +0200 Message-ID: <52D93F91.502@FreeBSD.org> Date: Fri, 17 Jan 2014 16:34:57 +0200 From: Andriy Gapon User-Agent: Mozilla/5.0 (X11; FreeBSD amd64; rv:24.0) Gecko/20100101 Thunderbird/24.2.0 MIME-Version: 1.0 To: "Justin T. Gibbs" Subject: Re: svn commit: r258713 - in head/sys: kern sys References: <201311281856.rASIuZu8059699@svn.freebsd.org> <3784C560-3648-4E03-93DA-9A60E3AC401D@scsiguy.com> In-Reply-To: <3784C560-3648-4E03-93DA-9A60E3AC401D@scsiguy.com> X-Enigmail-Version: 1.6 Content-Type: text/plain; charset=windows-1252 Content-Transfer-Encoding: 7bit Cc: svn-src-head@FreeBSD.org, svn-src-all@FreeBSD.org, src-committers@FreeBSD.org X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.17 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 17 Jan 2014 14:36:26 -0000 on 30/11/2013 08:46 Justin T. Gibbs said the following: > Man page update? I came up with the following update that - adds taskqueue_drain_all documentation - extends taskqueue_drain description - adds description for previously undocumented taskqueue_block / taskqueue_unblock, including a warning on taskqueue_block + taskqueue_drain combination All reviews and suggestions are welcome. Both for content and language. diff --git a/share/man/man9/taskqueue.9 b/share/man/man9/taskqueue.9 index 5f6131a..4db3d7a 100644 --- a/share/man/man9/taskqueue.9 +++ b/share/man/man9/taskqueue.9 @@ -86,6 +86,12 @@ struct timeout_task; .Fn taskqueue_drain "struct taskqueue *queue" "struct task *task" .Ft void .Fn taskqueue_drain_timeout "struct taskqueue *queue" "struct timeout_task *timeout_task" +.Ft void +.Fn taskqueue_drain_all "struct taskqueue *queue" +.Ft void +.Fn taskqueue_block "struct taskqueue *queue" +.Ft void +.Fn taskqueue_unblock "struct taskqueue *queue" .Ft int .Fn taskqueue_member "struct taskqueue *queue" "struct thread *td" .Ft void @@ -255,6 +261,74 @@ function is used to wait for the scheduled task to finish. There is no guarantee that the task will not be enqueued after call to .Fn taskqueue_drain . +Because the caller typically would use +.Fn taskqueue_drain +to put the task into a known state, then the caller should use +out-of-band means to ensure, before calling +.Fn taskqueue_drain , +that the task would not be enqueued. +For example, if the task is enqueued by an interrupt filter, then +the interrupt could be disabled. +.Pp +The +.Fn taskqueue_drain_all +function is used to wait for all the pending and running tasks that +are enqueued on the taskqueue to finish. +The caller must arrange that the tasks are not re-enqueued. +Note that +.Fn taskqueue_drain_all +currently does not handle tasks with delayed enqueueing. +.Pp +The +.Fn taskqueue_block +function blocks the taskqueue. +It prevents any enqueued but not running tasks from being executed. +Future calls to +.Fn taskqueue_enqueue +will enqueue tasks, but the tasks will not be run until +.Fn taskqueue_unblock +is called. +Please note that +.Fn taskqueue_block +does not wait for any currently running tasks to finish. +Thus, the +.Fn taskqueue_block +does not provide a guarantee that +.Fn taskqueue_run +is not running after +.Fn taskqueue_block +returns, but it does provide a guarantee that +.Fn taskqueue_run +will not be called again +until +.Fn taskqueue_unblock +is called. +If the caller requires a guarantee that +.Fn taskqueue_run +is not running, then this must be arranged by the caller. +Note that if +.Fn taskqueue_drain +is called on a task that is enqueued on a taskqueue that is blocked by +.Fn taskqueue_block , +then +.Fn taskqueue_drain +can not return until the taskqueue is unblocked. +This can result in a deadlock if the thread blocked in +.Fn taskqueue_drain +is a thread that is supposed to call +.Fn taskqueue_unblock . +Thus, use of +.Fn taskqueue_drain +after +.Fn taskqueue_block +is discouraged, because a state of the task can not be known in advance. +The same applies to +.Fn taskqueue_drain_all . +.Pp +The +.Fn taskqueue_unblock +function unblocks the previously blocked taskqueue. +All enqueued tasks can be run after this call. .Pp The .Fn taskqueue_member -- Andriy Gapon From owner-svn-src-head@FreeBSD.ORG Fri Jan 17 17:16:50 2014 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) (using TLSv1 with cipher ADH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id 460A4F31; Fri, 17 Jan 2014 17:16:50 +0000 (UTC) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mx1.freebsd.org (Postfix) with ESMTPS id 3269E178B; Fri, 17 Jan 2014 17:16:50 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.7/8.14.7) with ESMTP id s0HHGo0r086551; Fri, 17 Jan 2014 17:16:50 GMT (envelope-from mav@svn.freebsd.org) Received: (from mav@localhost) by svn.freebsd.org (8.14.7/8.14.7/Submit) id s0HHGolr086550; Fri, 17 Jan 2014 17:16:50 GMT (envelope-from mav@svn.freebsd.org) Message-Id: <201401171716.s0HHGolr086550@svn.freebsd.org> From: Alexander Motin Date: Fri, 17 Jan 2014 17:16:50 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r260830 - head/sys/dev/ahci X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.17 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 17 Jan 2014 17:16:50 -0000 Author: mav Date: Fri Jan 17 17:16:49 2014 New Revision: 260830 URL: http://svnweb.freebsd.org/changeset/base/260830 Log: Add ID for one more ASMedia AHCI-compatible controller. Reported by: ignace.peeters@gmail.com MFC after: 2 weeks Modified: head/sys/dev/ahci/ahci.c Modified: head/sys/dev/ahci/ahci.c ============================================================================== --- head/sys/dev/ahci/ahci.c Fri Jan 17 16:29:57 2014 (r260829) +++ head/sys/dev/ahci/ahci.c Fri Jan 17 17:16:49 2014 (r260830) @@ -146,6 +146,7 @@ static struct { {0x78021022, 0x00, "AMD Hudson-2", 0}, {0x78031022, 0x00, "AMD Hudson-2", 0}, {0x78041022, 0x00, "AMD Hudson-2", 0}, + {0x06111b21, 0x00, "ASMedia ASM2106", 0}, {0x06121b21, 0x00, "ASMedia ASM1061", 0}, {0x26528086, 0x00, "Intel ICH6", AHCI_Q_NOFORCE}, {0x26538086, 0x00, "Intel ICH6M", AHCI_Q_NOFORCE}, From owner-svn-src-head@FreeBSD.ORG Fri Jan 17 18:39:20 2014 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) (using TLSv1 with cipher ADH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id 1951F508 for ; Fri, 17 Jan 2014 18:39:20 +0000 (UTC) Received: from mail-pb0-x242.google.com (mail-pb0-x242.google.com [IPv6:2607:f8b0:400e:c01::242]) (using TLSv1 with cipher ECDHE-RSA-RC4-SHA (128/128 bits)) (No client certificate requested) by mx1.freebsd.org (Postfix) with ESMTPS id E67461E91 for ; Fri, 17 Jan 2014 18:39:19 +0000 (UTC) Received: by mail-pb0-f66.google.com with SMTP id ma3so3110457pbc.1 for ; Fri, 17 Jan 2014 10:39:19 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=message-id:from:to:reply-to:subject:date; bh=Iyk2K6fvYNLbDPkOF2p5SQgAED667GVP56ua58RI4bE=; b=I4jdwYuB3Q16w8Z2Z8E3IFlcy5Skc7JsBNTnsYW+YXA0HUDTGothxGnw5TX8sKEJN1 8vqgSwV23+OATuu/K27Dh1VzOsVzaQCFPikw2BnybUoTTqkCmxwpyUPAAobz9YPQIGN0 R08DGryZREclH28V1q5Nw4l6r6orqQF5ia8x9CYoGPkWaxVHDsjXHkB7lKJwuXNqassv tymg/3lzcEqP1gvKBmK0vXaMkFxUZClT9N39gOhR2FGVlb5KQ52tw5tECXvUyMk7CWH8 wqnkc3+2RU967tWwhGHY8pMhMXnScOQK2oP3STVwpLStoZMlCz7OcLQHPlrrGULnUHOr fazQ== X-Received: by 10.66.179.143 with SMTP id dg15mr3894215pac.52.1389983959533; Fri, 17 Jan 2014 10:39:19 -0800 (PST) Received: from localhost.localdomain ([124.253.47.249]) by mx.google.com with ESMTPSA id iq10sm24558335pbc.14.2014.01.17.10.39.17 for (version=TLSv1 cipher=RC4-SHA bits=128/128); Fri, 17 Jan 2014 10:39:18 -0800 (PST) Message-ID: <52d978d6.0ac5440a.7499.53b6@mx.google.com> From: barks83216@gmail.com To: svn-src-head@freebsd.org Subject: RE: LOCAL MAP OPTIMIZATION FOR : mail-archive.com (Less Than $99/Month) Date: Sat, 18 Jan 2014 00:09:25 +0530 X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.17 Precedence: list Reply-To: JUDY18088@gmail.com List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 17 Jan 2014 18:39:20 -0000 Good Morning Sir / Mam Is your business ranking in local maps shown on PAGE 1 of google ? With new google policies they have specifically asked local business owners to optimize their website for local maps rather than JUST organics. Do you know the reason why you are not ranked well on google MAPs or why there is drop in your website rankings? Prime reason for bad rankings for a busniess is lack of local presence and local citations ie getting your business listed on directories like YELP, MANTA & Many more. These websites not just give your business a push but also help you Maintain a good Online Reputation. Why you need to optimize your website for local MAP Listings ? - MAP listings get 10 times more clicks than organic listings - Increased conversions because of real reviews posted on your Google Plus Page - Every year there is 30% increase in searches for local keywords - Increases legitimacy of a Business We will help you get your website ranked well on google for the related keywords in your niche. We specialize in LOCAL SEARCH ENGINE OPTIMIZATION increasing visibility for small businesses by ranking them for geographically-related keywords. Say for eg-: you want to search a plumber in your city, You will be typing in keywords like Plumbers + City Or Plumbers + IN + City. We make sure your website comes in google MAP listings shown on page 1 for each such keyword. Now Google believes in - BE ORIGINAL, HAVE ORIGINAL AND GIVE ORIGINAL which means that google wants to end up that frustrating experience of users who are searching for Service Or Product and seeing the results that are not even close to what they are looking for. Google only wants to give their user original and relevant results. This makes it even more important that we showcase our business in the best possible way and make sure our website in valued high by google. We at TheLOCALIST will make google feel the importance of your business by following their guidelines thus ranking your website higher in serach results. We are presently offering LOCAL OPTIMIZATION to more than 400 websites and they all rank page 1 for all possible keywords !!! Each month your website is submitted to more than 50 citations and social presence is controlled by posting videos and blogs all over the web. Email us back with your website & phone number so we can discuss this further with you. Our Packages start from as low as 99$/month. Thanks For Taking Time To Read Our Email Polly Martin Local SEO Manager ( THE Localist ) Address : 24 ST Suite 32 Downtown Provo Utah ------------------- NOT INTERESTED ? REPLY WITH NOT INTERESTED IN THE SUBJECT LINE From owner-svn-src-head@FreeBSD.ORG Fri Jan 17 19:57:51 2014 Return-Path: Delivered-To: svn-src-head@FreeBSD.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) (using TLSv1 with cipher ADH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id 4193CA06; Fri, 17 Jan 2014 19:57:51 +0000 (UTC) Received: from mail.ipfw.ru (mail.ipfw.ru [IPv6:2a01:4f8:120:6141::2]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.freebsd.org (Postfix) with ESMTPS id F1E6714FC; Fri, 17 Jan 2014 19:57:50 +0000 (UTC) Received: from secured.by.ipfw.ru ([95.143.220.47] helo=ws.su29.net) by mail.ipfw.ru with esmtpsa (TLSv1:CAMELLIA256-SHA:256) (Exim 4.76 (FreeBSD)) (envelope-from ) id 1W4BiF-000LYE-Sa; Fri, 17 Jan 2014 19:52:03 +0400 Message-ID: <52D98B15.3030409@FreeBSD.org> Date: Fri, 17 Jan 2014 23:57:09 +0400 From: "Alexander V. Chernikov" User-Agent: Mozilla/5.0 (X11; FreeBSD amd64; rv:17.0) Gecko/20130728 Thunderbird/17.0.7 MIME-Version: 1.0 To: John-Mark Gurney Subject: Re: svn commit: r260702 - head/sys/netinet References: <201401161150.s0GBo1c1069638@svn.freebsd.org> <20140116180443.GD75135@funkthat.com> In-Reply-To: <20140116180443.GD75135@funkthat.com> X-Enigmail-Version: 1.5.1 Content-Type: multipart/signed; micalg=pgp-sha1; protocol="application/pgp-signature"; boundary="----enig2BCQLUDFFUCDBJQMJOSUN" Cc: svn-src-head@FreeBSD.org, svn-src-all@FreeBSD.org, src-committers@FreeBSD.org X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.17 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 17 Jan 2014 19:57:51 -0000 This is an OpenPGP/MIME signed message (RFC 4880 and 3156) ------enig2BCQLUDFFUCDBJQMJOSUN Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: quoted-printable On 16.01.2014 22:04, John-Mark Gurney wrote: > Alexander V. Chernikov wrote this message on Thu, Jan 16, 2014 at 11:50= +0000: >> Author: melifaro >> Date: Thu Jan 16 11:50:00 2014 >> New Revision: 260702 >> URL: http://svnweb.freebsd.org/changeset/base/260702 >> >> Log: >> Fix ipfw fwd for IPv4 traffic broken by r249894. >> =20 >> Problem case: >> Original lookup returns route with GW set, so gw points to >> rte->rt_gateway. >> After that we're changing dst and performing lookup another time. >> Since fwd host is most probably directly reachable, resulting >> rte does not contain rt_gateway, so gw is not set. Finally, we >> end with packet transmitted to proper interface but wrong >> link-layer address. >> =20 >> Found by: lstewart >> Discussed with: ae,lstewart >> MFC after: 2 weeks >> Sponsored by: Yandex LLC >=20 > This may be needed for 10.0 as this sounds suspiciously familar to > the recent multicast code that was fixed too... I'll be happy if this can happen, but that's too late :( >=20 > It sounds like someone needs to audit this code to verify that there > are no other code paths that can break because of this. glebius@ did some kind of, but that didn't bring us forward :) >=20 ------enig2BCQLUDFFUCDBJQMJOSUN Content-Type: application/pgp-signature; name="signature.asc" Content-Description: OpenPGP digital signature Content-Disposition: attachment; filename="signature.asc" -----BEGIN PGP SIGNATURE----- Version: GnuPG v2.0.20 (FreeBSD) Comment: Using GnuPG with Thunderbird - http://www.enigmail.net/ iEYEARECAAYFAlLZixoACgkQwcJ4iSZ1q2nauACfZnNQ5AyF7WKnLTmYmDD2STKC TvMAn33BhM1fSDqUp3qYv19bJ6JsPSw9 =v4IC -----END PGP SIGNATURE----- ------enig2BCQLUDFFUCDBJQMJOSUN-- From owner-svn-src-head@FreeBSD.ORG Fri Jan 17 21:21:29 2014 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) (using TLSv1 with cipher ADH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id 0D6288F1; Fri, 17 Jan 2014 21:21:29 +0000 (UTC) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mx1.freebsd.org (Postfix) with ESMTPS id E1FC51CDE; Fri, 17 Jan 2014 21:21:28 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.7/8.14.7) with ESMTP id s0HLLSp8088269; Fri, 17 Jan 2014 21:21:28 GMT (envelope-from pfg@svn.freebsd.org) Received: (from pfg@localhost) by svn.freebsd.org (8.14.7/8.14.7/Submit) id s0HLLSAe088267; Fri, 17 Jan 2014 21:21:28 GMT (envelope-from pfg@svn.freebsd.org) Message-Id: <201401172121.s0HLLSAe088267@svn.freebsd.org> From: "Pedro F. Giffuni" Date: Fri, 17 Jan 2014 21:21:28 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r260831 - head/contrib/gcc/cp X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.17 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 17 Jan 2014 21:21:29 -0000 Author: pfg Date: Fri Jan 17 21:21:28 2014 New Revision: 260831 URL: http://svnweb.freebsd.org/changeset/base/260831 Log: gcc: Drop useless objc change from r260311. Among some of the objc changes from Apple that crept into r260311, Radar 5355344 is incomplete and is not used since we don't carry ObjC in the base system. The dead code seems to have caused issues in some Tinderboxes so get rid of it altogether. Reported by: luigi MFC after: 9 days Modified: head/contrib/gcc/cp/ChangeLog.apple head/contrib/gcc/cp/parser.c Modified: head/contrib/gcc/cp/ChangeLog.apple ============================================================================== --- head/contrib/gcc/cp/ChangeLog.apple Fri Jan 17 17:16:49 2014 (r260830) +++ head/contrib/gcc/cp/ChangeLog.apple Fri Jan 17 21:21:28 2014 (r260831) @@ -302,15 +302,6 @@ (cp_parser_objc_declaration): Parses attribute list and passes it down to cp_parser_objc_class_interface/cp_parser_objc_protocol_declaration. -2007-07-24 Fariborz Jahanian - - Radar 5355344 - * cp-tree.h (cp_objc_protocol_id_list): New declaration - * cp-lang.c (cp_objc_protocol_id_list): New stub - * parser.c (cp_parser_type_name): Added code to disambiguate - conditional from a protocol type. - (cp_parser_objc_tentative_protocol_refs_opt): New - 2007-07-13 Fariborz Jahanian Radar 5277239 Modified: head/contrib/gcc/cp/parser.c ============================================================================== --- head/contrib/gcc/cp/parser.c Fri Jan 17 17:16:49 2014 (r260830) +++ head/contrib/gcc/cp/parser.c Fri Jan 17 21:21:28 2014 (r260831) @@ -1827,10 +1827,6 @@ static tree cp_parser_objc_identifier_li /* APPLE LOCAL end radar 3803157 - objc attribute */ static tree cp_parser_objc_protocol_refs_opt (cp_parser *); -/* APPLE LOCAL begin radar 5355344 */ -static bool cp_parser_objc_tentative_protocol_refs_opt - (cp_parser *, tree *); -/* APPLE LOCAL end radar 5355344 */ static void cp_parser_objc_declaration (cp_parser *); static tree cp_parser_objc_statement @@ -17873,32 +17869,6 @@ cp_parser_objc_protocol_refs_opt (cp_par return protorefs; } -/* APPLE LOCAL begin radar 5355344 */ -/* This routine also parses a list of Objective-C protocol references; except that - if list is not valid, it returns FALSE and back-tracks parsing. */ - -static bool -cp_parser_objc_tentative_protocol_refs_opt (cp_parser* parser, tree *protorefs) -{ - *protorefs = NULL_TREE; - if(cp_lexer_next_token_is (parser->lexer, CPP_LESS)) - { - cp_parser_parse_tentatively (parser); - cp_lexer_consume_token (parser->lexer); /* Eat '<'. */ - *protorefs = cp_parser_objc_identifier_list (parser); - if (!cp_objc_protocol_id_list (*protorefs)) - { - cp_parser_abort_tentative_parse (parser); - return false; - } - if (cp_parser_parse_definitely (parser)) - cp_parser_require (parser, CPP_GREATER, "`>'"); - } - - return true; -} -/* APPLE LOCAL end radar 5355344 */ - /* Parse a Objective-C visibility specification. */ static void From owner-svn-src-head@FreeBSD.ORG Fri Jan 17 21:45:25 2014 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [8.8.178.115]) (using TLSv1 with cipher ADH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id 94FAFB56; Fri, 17 Jan 2014 21:45:25 +0000 (UTC) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mx1.freebsd.org (Postfix) with ESMTPS id 8100B1E85; Fri, 17 Jan 2014 21:45: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 s0HLjPSS097406; Fri, 17 Jan 2014 21:45:25 GMT (envelope-from trociny@svn.freebsd.org) Received: (from trociny@localhost) by svn.freebsd.org (8.14.7/8.14.7/Submit) id s0HLjP3i097405; Fri, 17 Jan 2014 21:45:25 GMT (envelope-from trociny@svn.freebsd.org) Message-Id: <201401172145.s0HLjP3i097405@svn.freebsd.org> From: Mikolaj Golub Date: Fri, 17 Jan 2014 21:45:25 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r260833 - head/usr.bin/script X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.17 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 17 Jan 2014 21:45:25 -0000 Author: trociny Date: Fri Jan 17 21:45:25 2014 New Revision: 260833 URL: http://svnweb.freebsd.org/changeset/base/260833 Log: Bring back r226403, the fix for bin/161526, which was (accidentally?) reverted in r238896. PR: bin/161526 Reported by: Karli.Sjoberg slu.se MFC after: 3 days Modified: head/usr.bin/script/script.c Modified: head/usr.bin/script/script.c ============================================================================== --- head/usr.bin/script/script.c Fri Jan 17 21:37:55 2014 (r260832) +++ head/usr.bin/script/script.c Fri Jan 17 21:45:25 2014 (r260833) @@ -238,12 +238,15 @@ main(int argc, char *argv[]) FD_SET(master, &rfd); if (readstdin) FD_SET(STDIN_FILENO, &rfd); - if ((!readstdin && ttyflg) || flushtime > 0) { - tv.tv_sec = !readstdin && ttyflg ? 1 : - flushtime - (tvec - start); + if (!readstdin && ttyflg) { + tv.tv_sec = 1; tv.tv_usec = 0; tvp = &tv; readstdin = 1; + } else if (flushtime > 0) { + tv.tv_sec = flushtime - (tvec - start); + tv.tv_usec = 0; + tvp = &tv; } else { tvp = NULL; } From owner-svn-src-head@FreeBSD.ORG Sat Jan 18 01:45:39 2014 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) (using TLSv1 with cipher ADH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id C7B86D98; Sat, 18 Jan 2014 01:45:39 +0000 (UTC) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mx1.freebsd.org (Postfix) with ESMTPS id B33611EE7; Sat, 18 Jan 2014 01:45: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 s0I1jdo2096725; Sat, 18 Jan 2014 01:45:39 GMT (envelope-from delphij@svn.freebsd.org) Received: (from delphij@localhost) by svn.freebsd.org (8.14.7/8.14.7/Submit) id s0I1jdZj096724; Sat, 18 Jan 2014 01:45:39 GMT (envelope-from delphij@svn.freebsd.org) Message-Id: <201401180145.s0I1jdZj096724@svn.freebsd.org> From: Xin LI Date: Sat, 18 Jan 2014 01:45:39 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r260835 - head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.17 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 18 Jan 2014 01:45:39 -0000 Author: delphij Date: Sat Jan 18 01:45:39 2014 New Revision: 260835 URL: http://svnweb.freebsd.org/changeset/base/260835 Log: MFV r260834: Fix memory leak of compressed buffers in l2arc_write_done (Illumos #3995). Modified: head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/arc.c Directory Properties: head/sys/cddl/contrib/opensolaris/ (props changed) Modified: head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/arc.c ============================================================================== --- head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/arc.c Sat Jan 18 01:40:36 2014 (r260834) +++ head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/arc.c Sat Jan 18 01:45:39 2014 (r260835) @@ -21,7 +21,7 @@ /* * Copyright (c) 2005, 2010, Oracle and/or its affiliates. All rights reserved. * Copyright (c) 2013 by Delphix. All rights reserved. - * Copyright (c) 2013 by Saso Kiselkov. All rights reserved. + * Copyright (c) 2014 by Saso Kiselkov. All rights reserved. * Copyright 2013 Nexenta Systems, Inc. All rights reserved. */ @@ -4597,6 +4597,13 @@ l2arc_write_done(zio_t *zio) */ for (ab = list_prev(buflist, head); ab; ab = ab_prev) { ab_prev = list_prev(buflist, ab); + abl2 = ab->b_l2hdr; + + /* + * Release the temporary compressed buffer as soon as possible. + */ + if (abl2->b_compress != ZIO_COMPRESS_OFF) + l2arc_release_cdata_buf(ab); hash_lock = HDR_LOCK(ab); if (!mutex_tryenter(hash_lock)) { @@ -4609,14 +4616,6 @@ l2arc_write_done(zio_t *zio) continue; } - abl2 = ab->b_l2hdr; - - /* - * Release the temporary compressed buffer as soon as possible. - */ - if (abl2->b_compress != ZIO_COMPRESS_OFF) - l2arc_release_cdata_buf(ab); - if (zio->io_error != 0) { /* * Error - drop L2ARC entry. From owner-svn-src-head@FreeBSD.ORG Sat Jan 18 02:20:11 2014 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) (using TLSv1 with cipher ADH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id 43A814B0; Sat, 18 Jan 2014 02:20:11 +0000 (UTC) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mx1.freebsd.org (Postfix) with ESMTPS id 249071133; Sat, 18 Jan 2014 02:20:11 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.7/8.14.7) with ESMTP id s0I2KBUI010474; Sat, 18 Jan 2014 02:20:11 GMT (envelope-from neel@svn.freebsd.org) Received: (from neel@localhost) by svn.freebsd.org (8.14.7/8.14.7/Submit) id s0I2KA41010472; Sat, 18 Jan 2014 02:20:10 GMT (envelope-from neel@svn.freebsd.org) Message-Id: <201401180220.s0I2KA41010472@svn.freebsd.org> From: Neel Natu Date: Sat, 18 Jan 2014 02:20:10 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r260836 - head/sys/amd64/vmm/intel X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.17 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 18 Jan 2014 02:20:11 -0000 Author: neel Date: Sat Jan 18 02:20:10 2014 New Revision: 260836 URL: http://svnweb.freebsd.org/changeset/base/260836 Log: If the guest exits due to a fault while it is executing IRET then restore the state of "Virtual NMI blocking" in the guest's interruptibility-state field before resuming the guest. Modified: head/sys/amd64/vmm/intel/vmcs.h head/sys/amd64/vmm/intel/vmx.c Modified: head/sys/amd64/vmm/intel/vmcs.h ============================================================================== --- head/sys/amd64/vmm/intel/vmcs.h Sat Jan 18 01:45:39 2014 (r260835) +++ head/sys/amd64/vmm/intel/vmcs.h Sat Jan 18 02:20:10 2014 (r260836) @@ -331,6 +331,12 @@ vmcs_write(uint32_t encoding, uint64_t v #define EXIT_REASON_APIC_WRITE 56 /* + * NMI unblocking due to IRET. + * + * Applies to VM-exits due to hardware exception or EPT fault. + */ +#define EXIT_QUAL_NMIUDTI (1 << 12) +/* * VMCS interrupt information fields */ #define VMCS_INTR_VALID (1U << 31) Modified: head/sys/amd64/vmm/intel/vmx.c ============================================================================== --- head/sys/amd64/vmm/intel/vmx.c Sat Jan 18 01:45:39 2014 (r260835) +++ head/sys/amd64/vmm/intel/vmx.c Sat Jan 18 02:20:10 2014 (r260836) @@ -1155,6 +1155,37 @@ cantinject: VCPU_CTR0(vmx->vm, vcpu, "Enabling interrupt window exiting"); } +/* + * If the Virtual NMIs execution control is '1' then the logical processor + * tracks virtual-NMI blocking in the Guest Interruptibility-state field of + * the VMCS. An IRET instruction in VMX non-root operation will remove any + * virtual-NMI blocking. + * + * This unblocking occurs even if the IRET causes a fault. In this case the + * hypervisor needs to restore virtual-NMI blocking before resuming the guest. + */ +static void +vmx_restore_nmi_blocking(struct vmx *vmx, int vcpuid) +{ + uint32_t gi; + + VCPU_CTR0(vmx->vm, vcpuid, "Restore Virtual-NMI blocking"); + gi = vmcs_read(VMCS_GUEST_INTERRUPTIBILITY); + gi |= VMCS_INTERRUPTIBILITY_NMI_BLOCKING; + vmcs_write(VMCS_GUEST_INTERRUPTIBILITY, gi); +} + +static void +vmx_clear_nmi_blocking(struct vmx *vmx, int vcpuid) +{ + uint32_t gi; + + VCPU_CTR0(vmx->vm, vcpuid, "Clear Virtual-NMI blocking"); + gi = vmcs_read(VMCS_GUEST_INTERRUPTIBILITY); + gi &= ~VMCS_INTERRUPTIBILITY_NMI_BLOCKING; + vmcs_write(VMCS_GUEST_INTERRUPTIBILITY, gi); +} + static int vmx_emulate_cr_access(struct vmx *vmx, int vcpu, uint64_t exitqual) { @@ -1444,7 +1475,7 @@ vmx_exit_process(struct vmx *vmx, int vc int error, handled; struct vmxctx *vmxctx; struct vlapic *vlapic; - uint32_t eax, ecx, edx, gi, idtvec_info, idtvec_err, intr_info, reason; + uint32_t eax, ecx, edx, idtvec_info, idtvec_err, intr_info, reason; uint64_t qual, gpa; bool retu; @@ -1490,13 +1521,12 @@ vmx_exit_process(struct vmx *vmx, int vc */ if ((idtvec_info & VMCS_INTR_T_MASK) == VMCS_INTR_T_NMI) { - gi = vmcs_read(VMCS_GUEST_INTERRUPTIBILITY); - gi &= ~VMCS_INTERRUPTIBILITY_NMI_BLOCKING; - vmcs_write(VMCS_GUEST_INTERRUPTIBILITY, gi); + vmx_clear_nmi_blocking(vmx, vcpu); } vmcs_write(VMCS_ENTRY_INST_LENGTH, vmexit->inst_length); } default: + idtvec_info = 0; break; } @@ -1601,6 +1631,23 @@ vmx_exit_process(struct vmx *vmx, int vc vmm_stat_incr(vmx->vm, vcpu, VMEXIT_CPUID, 1); handled = vmx_handle_cpuid(vmx->vm, vcpu, vmxctx); break; + case EXIT_REASON_EXCEPTION: + intr_info = vmcs_read(VMCS_EXIT_INTR_INFO); + KASSERT((intr_info & VMCS_INTR_VALID) != 0, + ("VM exit interruption info invalid: %#x", intr_info)); + /* + * If Virtual NMIs control is 1 and the VM-exit is due to a + * fault encountered during the execution of IRET then we must + * restore the state of "virtual-NMI blocking" before resuming + * the guest. + * + * See "Resuming Guest Software after Handling an Exception". + */ + if ((idtvec_info & VMCS_IDT_VEC_VALID) == 0 && + (intr_info & 0xff) != IDT_DF && + (intr_info & EXIT_QUAL_NMIUDTI) != 0) + vmx_restore_nmi_blocking(vmx, vcpu); + break; case EXIT_REASON_EPT_FAULT: vmm_stat_incr(vmx->vm, vcpu, VMEXIT_EPT_FAULT, 1); /* @@ -1619,6 +1666,17 @@ vmx_exit_process(struct vmx *vmx, int vc vmexit->u.inst_emul.gla = vmcs_gla(); vmexit->u.inst_emul.cr3 = vmcs_guest_cr3(); } + /* + * If Virtual NMIs control is 1 and the VM-exit is due to an + * EPT fault during the execution of IRET then we must restore + * the state of "virtual-NMI blocking" before resuming. + * + * See description of "NMI unblocking due to IRET" in + * "Exit Qualification for EPT Violations". + */ + if ((idtvec_info & VMCS_IDT_VEC_VALID) == 0 && + (qual & EXIT_QUAL_NMIUDTI) != 0) + vmx_restore_nmi_blocking(vmx, vcpu); break; case EXIT_REASON_APIC_ACCESS: handled = vmx_handle_apic_access(vmx, vcpu, vmexit); From owner-svn-src-head@FreeBSD.ORG Sat Jan 18 04:09:40 2014 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) (using TLSv1 with cipher ADH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id 7BD38929; Sat, 18 Jan 2014 04:09:40 +0000 (UTC) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mx1.freebsd.org (Postfix) with ESMTPS id 67A72192B; Sat, 18 Jan 2014 04:09: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 s0I49eRV054409; Sat, 18 Jan 2014 04:09:40 GMT (envelope-from marcel@svn.freebsd.org) Received: (from marcel@localhost) by svn.freebsd.org (8.14.7/8.14.7/Submit) id s0I49eHu054407; Sat, 18 Jan 2014 04:09:40 GMT (envelope-from marcel@svn.freebsd.org) Message-Id: <201401180409.s0I49eHu054407@svn.freebsd.org> From: Marcel Moolenaar Date: Sat, 18 Jan 2014 04:09:40 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r260844 - head/gnu/lib/libgcc X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.17 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 18 Jan 2014 04:09:40 -0000 Author: marcel Date: Sat Jan 18 04:09:39 2014 New Revision: 260844 URL: http://svnweb.freebsd.org/changeset/base/260844 Log: For ia64, add _bswapsi2 & _bswapdi2. The audio/flac port uses the bswap32 builtin and the compiler emits a call to the libgcc function rather than generating inline code. Modified: head/gnu/lib/libgcc/Makefile Modified: head/gnu/lib/libgcc/Makefile ============================================================================== --- head/gnu/lib/libgcc/Makefile Sat Jan 18 04:06:00 2014 (r260843) +++ head/gnu/lib/libgcc/Makefile Sat Jan 18 04:09:39 2014 (r260844) @@ -145,6 +145,7 @@ LIB1ASMFUNCS = __divxf3 __divdf3 __divsf __divsi3 __modsi3 __udivsi3 __umodsi3 __save_stack_nonlocal \ __nonlocal_goto __restore_stack_nonlocal __trampoline \ _fixtfdi _fixunstfdi _floatditf +LIB2FUNCS += _bswapsi2 _bswapdi2 LIB2ADDEH = unwind-ia64.c unwind-sjlj.c unwind-c.c .endif From owner-svn-src-head@FreeBSD.ORG Sat Jan 18 05:36:34 2014 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) (using TLSv1 with cipher ADH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id 202EE813 for ; Sat, 18 Jan 2014 05:36:34 +0000 (UTC) Received: from nm36-vm6.bullet.mail.bf1.yahoo.com (nm36-vm6.bullet.mail.bf1.yahoo.com [72.30.238.142]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.freebsd.org (Postfix) with ESMTPS id A8C4A1175 for ; Sat, 18 Jan 2014 05:36:33 +0000 (UTC) Received: from [66.196.81.170] by nm36.bullet.mail.bf1.yahoo.com with NNFMP; 18 Jan 2014 05:30:14 -0000 Received: from [98.139.211.196] by tm16.bullet.mail.bf1.yahoo.com with NNFMP; 18 Jan 2014 05:30:14 -0000 Received: from [127.0.0.1] by smtp205.mail.bf1.yahoo.com with NNFMP; 18 Jan 2014 05:30:14 -0000 X-Yahoo-Newman-Id: 241364.75222.bm@smtp205.mail.bf1.yahoo.com X-Yahoo-Newman-Property: ymail-3 X-YMail-OSG: Id4yehMVM1kLGBnPntUaVnHMFAiAEMgt.tRzZXBolHKy4cf LWj3q5yzqg2XsrSUuucjWTpOE3G6Wu6MMh3nZBaddplJvVja_VlxH91AG1dU nRvAX8tPcruguXuu44a6nf5NalviBBi4ouMPIx5OFLF1wAq2M2TKIHBxB1MS UBs6QmYzAA.smPGH5P1e5VDpg8D2k5sq_jtJhQZUAq.QE.P8UDSFM6jt4WxT OdHW5PcIU__20z4Z5jNZBwmIk68Nqf2CTrRPnFYxsKJVMDiMp_A_o3_iv6Vg nTeeDVv86ertGcGH3g1RJLFse_sSscJJL.usKtyTbV8XyexPM6zrev6HY63t FYgL03Jtopl4ZKOmWzupv6KpKsJ6RIXKPAUr685yDtuDxGWryCN7oMI3VTku 6dAg4Wf9LNeUh_hAf.gVnYED_LIgfuJq7zEZ6M0Dvfopb.nH1ma37Fl4YzPs LDUSzqNcUPpK5B4ogDGLTwrtR5Yq._.3m4MGmKDrqxs_zGwk2tr2uYZqwkp5 mxWrr_IBodIxvqJj8B92Tr4I2zbpmwBUXVqrgSG9PnrsRWm3pNcjx9A-- X-Yahoo-SMTP: xcjD0guswBAZaPPIbxpWwLcp9Unf X-Rocket-Received: from [192.168.0.101] (pfg@190.157.126.109 with plain [98.138.105.21]) by smtp205.mail.bf1.yahoo.com with SMTP; 17 Jan 2014 21:30:14 -0800 PST Content-Type: text/plain; charset=us-ascii Mime-Version: 1.0 (Mac OS X Mail 7.1 \(1827\)) Subject: Re: svn commit: r260844 - head/gnu/lib/libgcc From: Pedro Giffuni In-Reply-To: <201401180409.s0I49eHu054407@svn.freebsd.org> Date: Sat, 18 Jan 2014 00:30:10 -0500 Content-Transfer-Encoding: quoted-printable Message-Id: References: <201401180409.s0I49eHu054407@svn.freebsd.org> To: Marcel Moolenaar X-Mailer: Apple Mail (2.1827) Cc: svn-src-head@freebsd.org, svn-src-all@freebsd.org, src-committers@freebsd.org X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.17 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 18 Jan 2014 05:36:34 -0000 Hi Marcel, Nice find ... Il giorno 17/gen/2014, alle ore 23:09, Marcel Moolenaar = ha scritto: > Author: marcel > Date: Sat Jan 18 04:09:39 2014 > New Revision: 260844 > URL: http://svnweb.freebsd.org/changeset/base/260844 >=20 > Log: > For ia64, add _bswapsi2 & _bswapdi2. The audio/flac port uses the > bswap32 builtin and the compiler emits a call to the libgcc function > rather than generating inline code. >=20 > Modified: > head/gnu/lib/libgcc/Makefile >=20 > Modified: head/gnu/lib/libgcc/Makefile > = =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D > --- head/gnu/lib/libgcc/Makefile Sat Jan 18 04:06:00 2014 = (r260843) > +++ head/gnu/lib/libgcc/Makefile Sat Jan 18 04:09:39 2014 = (r260844) > @@ -145,6 +145,7 @@ LIB1ASMFUNCS =3D __divxf3 __divdf3 __divsf > __divsi3 __modsi3 __udivsi3 __umodsi3 __save_stack_nonlocal \ > __nonlocal_goto __restore_stack_nonlocal __trampoline \ > _fixtfdi _fixunstfdi _floatditf > +LIB2FUNCS +=3D _bswapsi2 _bswapdi2 > LIB2ADDEH =3D unwind-ia64.c unwind-sjlj.c unwind-c.c > .endif >=20 I think this was an overlook on my part. This change: = http://svnweb.freebsd.org/base/head/contrib/gcc/mklibgcc.in?r1=3D169690&r2= =3D258428 would suggest the change is not only for ia64, and It should apply for = stable-10 but not for -9. where I detected the issue and was looking for a solution before merging = it further. Thank you for finding it and feel free to do it general and MFC if you = like ;-). Pedro. From owner-svn-src-head@FreeBSD.ORG Sat Jan 18 06:14:41 2014 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [8.8.178.115]) (using TLSv1 with cipher ADH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id AB40B3E7; Sat, 18 Jan 2014 06:14:41 +0000 (UTC) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mx1.freebsd.org (Postfix) with ESMTPS id 7B49E1454; Sat, 18 Jan 2014 06:14:41 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.7/8.14.7) with ESMTP id s0I6EfFv003499; Sat, 18 Jan 2014 06:14:41 GMT (envelope-from bryanv@svn.freebsd.org) Received: (from bryanv@localhost) by svn.freebsd.org (8.14.7/8.14.7/Submit) id s0I6Ed7q003487; Sat, 18 Jan 2014 06:14:39 GMT (envelope-from bryanv@svn.freebsd.org) Message-Id: <201401180614.s0I6Ed7q003487@svn.freebsd.org> From: Bryan Venteicher Date: Sat, 18 Jan 2014 06:14:39 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r260847 - in head: share/man/man4 sys/amd64/conf sys/conf sys/dev/virtio/random sys/i386/conf sys/modules/virtio sys/modules/virtio/random sys/sys X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.17 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 18 Jan 2014 06:14:41 -0000 Author: bryanv Date: Sat Jan 18 06:14:38 2014 New Revision: 260847 URL: http://svnweb.freebsd.org/changeset/base/260847 Log: Add very simple virtio_random(4) driver to harvest entropy from host Reviewed by: markm (random bits only) Added: head/share/man/man4/virtio_random.4 (contents, props changed) head/sys/dev/virtio/random/ head/sys/dev/virtio/random/virtio_random.c (contents, props changed) head/sys/modules/virtio/random/ head/sys/modules/virtio/random/Makefile (contents, props changed) Modified: head/share/man/man4/Makefile head/sys/amd64/conf/NOTES head/sys/conf/files.amd64 head/sys/conf/files.i386 head/sys/i386/conf/NOTES head/sys/modules/virtio/Makefile head/sys/sys/random.h Modified: head/share/man/man4/Makefile ============================================================================== --- head/share/man/man4/Makefile Sat Jan 18 04:27:13 2014 (r260846) +++ head/share/man/man4/Makefile Sat Jan 18 06:14:38 2014 (r260847) @@ -543,6 +543,7 @@ MAN= aac.4 \ ${_virtio.4} \ ${_virtio_balloon.4} \ ${_virtio_blk.4} \ + ${_virtio_random.4} \ ${_virtio_scsi.4} \ vkbd.4 \ vlan.4 \ @@ -787,6 +788,7 @@ _nxge.4= nxge.4 _virtio.4= virtio.4 _virtio_balloon.4=virtio_balloon.4 _virtio_blk.4= virtio_blk.4 +_virtio_random.4= virtio_random.4 _virtio_scsi.4= virtio_scsi.4 _vmx.4= vmx.4 _vtnet.4= vtnet.4 Added: head/share/man/man4/virtio_random.4 ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ head/share/man/man4/virtio_random.4 Sat Jan 18 06:14:38 2014 (r260847) @@ -0,0 +1,61 @@ +.\" Copyright (c) 2013 Bryan Venteicher +.\" All rights reserved. +.\" +.\" Redistribution and use in source and binary forms, with or without +.\" modification, are permitted provided that the following conditions +.\" are met: +.\" 1. Redistributions of source code must retain the above copyright +.\" notice, this list of conditions and the following disclaimer. +.\" 2. Redistributions in binary form must reproduce the above copyright +.\" notice, this list of conditions and the following disclaimer in the +.\" documentation and/or other materials provided with the distribution. +.\" +.\" THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND +.\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE +.\" ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE +.\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL +.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS +.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) +.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT +.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY +.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF +.\" SUCH DAMAGE. +.\" +.\" $FreeBSD$ +.\" +.Dd December 28, 2013 +.Dt VIRTIO_RANDOM 4 +.Os +.Sh NAME +.Nm virtio_random +.Nd VirtIO Entropy driver +.Sh SYNOPSIS +To compile this driver into the kernel, +place the following lines in your +kernel configuration file: +.Bd -ragged -offset indent +.Cd "device virtio_random" +.Ed +.Pp +Alternatively, to load the driver as a +module at boot time, place the following line in +.Xr loader.conf 5 : +.Bd -literal -offset indent +virtio_random_load="YES" +.Ed +.Sh DESCRIPTION +The +.Nm +device driver provides support for VirtIO entropy devices. +.Pp +The entropy device supplies high-quality randomness from the +hypervisor to the guest. +.Sh SEE ALSO +.Xr random 4 +.Xr virtio 4 +.Sh HISTORY +The +.Nm +driver was written by +.An Bryan Venteicher Aq bryanv@FreeBSD.org . Modified: head/sys/amd64/conf/NOTES ============================================================================== --- head/sys/amd64/conf/NOTES Sat Jan 18 04:27:13 2014 (r260846) +++ head/sys/amd64/conf/NOTES Sat Jan 18 06:14:38 2014 (r260847) @@ -472,6 +472,7 @@ device vtnet # VirtIO Ethernet device device virtio_blk # VirtIO Block device device virtio_scsi # VirtIO SCSI device device virtio_balloon # VirtIO Memory Balloon device +device virtio_random # VirtIO Entropy device device hyperv # HyperV drivers Modified: head/sys/conf/files.amd64 ============================================================================== --- head/sys/conf/files.amd64 Sat Jan 18 04:27:13 2014 (r260846) +++ head/sys/conf/files.amd64 Sat Jan 18 06:14:38 2014 (r260847) @@ -448,6 +448,7 @@ dev/virtio/network/if_vtnet.c optional dev/virtio/block/virtio_blk.c optional virtio_blk dev/virtio/balloon/virtio_balloon.c optional virtio_balloon dev/virtio/scsi/virtio_scsi.c optional virtio_scsi +dev/virtio/random/virtio_random.c optional virtio_random isa/syscons_isa.c optional sc isa/vga_isa.c optional vga kern/kern_clocksource.c standard Modified: head/sys/conf/files.i386 ============================================================================== --- head/sys/conf/files.i386 Sat Jan 18 04:27:13 2014 (r260846) +++ head/sys/conf/files.i386 Sat Jan 18 06:14:38 2014 (r260847) @@ -414,6 +414,7 @@ dev/virtio/network/if_vtnet.c optional dev/virtio/block/virtio_blk.c optional virtio_blk dev/virtio/balloon/virtio_balloon.c optional virtio_balloon dev/virtio/scsi/virtio_scsi.c optional virtio_scsi +dev/virtio/random/virtio_random.c optional virtio_random i386/acpica/acpi_machdep.c optional acpi acpi_wakecode.o optional acpi \ dependency "$S/i386/acpica/acpi_wakecode.S assym.s" \ Added: head/sys/dev/virtio/random/virtio_random.c ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ head/sys/dev/virtio/random/virtio_random.c Sat Jan 18 06:14:38 2014 (r260847) @@ -0,0 +1,231 @@ +/*- + * Copyright (c) 2013, Bryan Venteicher + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice unmodified, this list of conditions, and the following + * disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR + * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES + * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. + * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, + * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT + * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, + * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY + * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF + * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ + +/* Driver for VirtIO entropy device. */ + +#include +__FBSDID("$FreeBSD$"); + +#include +#include +#include +#include +#include +#include + +#include +#include +#include + +#include +#include + +struct vtrnd_softc { + device_t vtrnd_dev; + uint64_t vtrnd_features; + struct callout vtrnd_callout; + struct virtqueue *vtrnd_vq; +}; + +static int vtrnd_modevent(module_t, int, void *); + +static int vtrnd_probe(device_t); +static int vtrnd_attach(device_t); +static int vtrnd_detach(device_t); + +static void vtrnd_negotiate_features(struct vtrnd_softc *); +static int vtrnd_alloc_virtqueue(struct vtrnd_softc *); +static void vtrnd_harvest(struct vtrnd_softc *); +static void vtrnd_timer(void *); + +#define VTRND_FEATURES 0 + +static struct virtio_feature_desc vtrnd_feature_desc[] = { + { 0, NULL } +}; + +static device_method_t vtrnd_methods[] = { + /* Device methods. */ + DEVMETHOD(device_probe, vtrnd_probe), + DEVMETHOD(device_attach, vtrnd_attach), + DEVMETHOD(device_detach, vtrnd_detach), + + DEVMETHOD_END +}; + +static driver_t vtrnd_driver = { + "vtrnd", + vtrnd_methods, + sizeof(struct vtrnd_softc) +}; +static devclass_t vtrnd_devclass; + +DRIVER_MODULE(virtio_random, virtio_pci, vtrnd_driver, vtrnd_devclass, + vtrnd_modevent, 0); +MODULE_VERSION(virtio_random, 1); +MODULE_DEPEND(virtio_random, virtio, 1, 1, 1); + +static int +vtrnd_modevent(module_t mod, int type, void *unused) +{ + int error; + + switch (type) { + case MOD_LOAD: + case MOD_QUIESCE: + case MOD_UNLOAD: + case MOD_SHUTDOWN: + error = 0; + break; + default: + error = EOPNOTSUPP; + break; + } + + return (error); +} + +static int +vtrnd_probe(device_t dev) +{ + + if (virtio_get_device_type(dev) != VIRTIO_ID_ENTROPY) + return (ENXIO); + + device_set_desc(dev, "VirtIO Entropy Adapter"); + + return (BUS_PROBE_DEFAULT); +} + +static int +vtrnd_attach(device_t dev) +{ + struct vtrnd_softc *sc; + int error; + + sc = device_get_softc(dev); + sc->vtrnd_dev = dev; + + callout_init(&sc->vtrnd_callout, CALLOUT_MPSAFE); + + virtio_set_feature_desc(dev, vtrnd_feature_desc); + vtrnd_negotiate_features(sc); + + error = vtrnd_alloc_virtqueue(sc); + if (error) { + device_printf(dev, "cannot allocate virtqueue\n"); + goto fail; + } + + callout_reset(&sc->vtrnd_callout, 5 * hz, vtrnd_timer, sc); + +fail: + if (error) + vtrnd_detach(dev); + + return (error); +} + +static int +vtrnd_detach(device_t dev) +{ + struct vtrnd_softc *sc; + + sc = device_get_softc(dev); + + callout_stop(&sc->vtrnd_callout); + + return (0); +} + +static void +vtrnd_negotiate_features(struct vtrnd_softc *sc) +{ + device_t dev; + uint64_t features; + + dev = sc->vtrnd_dev; + features = VTRND_FEATURES; + + sc->vtrnd_features = virtio_negotiate_features(dev, features); +} + +static int +vtrnd_alloc_virtqueue(struct vtrnd_softc *sc) +{ + device_t dev; + struct vq_alloc_info vq_info; + + dev = sc->vtrnd_dev; + + VQ_ALLOC_INFO_INIT(&vq_info, 0, NULL, sc, &sc->vtrnd_vq, + "%s request", device_get_nameunit(dev)); + + return (virtio_alloc_virtqueues(dev, 0, 1, &vq_info)); +} + +static void +vtrnd_harvest(struct vtrnd_softc *sc) +{ + struct sglist_seg segs[1]; + struct sglist sg; + struct virtqueue *vq; + uint32_t value; + int error; + + vq = sc->vtrnd_vq; + + sglist_init(&sg, 1, segs); + error = sglist_append(&sg, &value, sizeof(value)); + KASSERT(error == 0 && sg.sg_nseg == 1, + ("%s: error %d adding buffer to sglist", __func__, error)); + + if (!virtqueue_empty(vq)) + return; + if (virtqueue_enqueue(vq, &value, &sg, 0, 1) != 0) + return; + + /* + * Poll for the response, but the command is likely already + * done when we return from the notify. + */ + virtqueue_notify(vq); + virtqueue_poll(vq, NULL); + + random_harvest(&value, sizeof(value), sizeof(value) * NBBY / 2, + RANDOM_PURE_VIRTIO); +} + +static void +vtrnd_timer(void *xsc) +{ + struct vtrnd_softc *sc; + + sc = xsc; + + vtrnd_harvest(sc); + callout_schedule(&sc->vtrnd_callout, 5 * hz); +} Modified: head/sys/i386/conf/NOTES ============================================================================== --- head/sys/i386/conf/NOTES Sat Jan 18 04:27:13 2014 (r260846) +++ head/sys/i386/conf/NOTES Sat Jan 18 06:14:38 2014 (r260847) @@ -800,6 +800,7 @@ device vtnet # VirtIO Ethernet device device virtio_blk # VirtIO Block device device virtio_scsi # VirtIO SCSI device device virtio_balloon # VirtIO Memory Balloon device +device virtio_random # VirtIO Entropy device device hyperv # HyperV drivers Modified: head/sys/modules/virtio/Makefile ============================================================================== --- head/sys/modules/virtio/Makefile Sat Jan 18 04:27:13 2014 (r260846) +++ head/sys/modules/virtio/Makefile Sat Jan 18 06:14:38 2014 (r260847) @@ -23,6 +23,6 @@ # SUCH DAMAGE. # -SUBDIR= virtio pci network block balloon scsi +SUBDIR= virtio pci network block balloon scsi random .include Added: head/sys/modules/virtio/random/Makefile ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ head/sys/modules/virtio/random/Makefile Sat Jan 18 06:14:38 2014 (r260847) @@ -0,0 +1,36 @@ +# +# $FreeBSD$ +# +# 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. +# + +.PATH: ${.CURDIR}/../../../dev/virtio/random + +KMOD= virtio_random +SRCS= virtio_random.c +SRCS+= virtio_bus_if.h virtio_if.h +SRCS+= bus_if.h device_if.h + +MFILES= kern/bus_if.m kern/device_if.m \ + dev/virtio/virtio_bus_if.m dev/virtio/virtio_if.m + +.include Modified: head/sys/sys/random.h ============================================================================== --- head/sys/sys/random.h Sat Jan 18 04:27:13 2014 (r260846) +++ head/sys/sys/random.h Sat Jan 18 06:14:38 2014 (r260847) @@ -56,6 +56,7 @@ enum esource { RANDOM_PURE_RDRAND, RANDOM_PURE_NEHEMIAH, RANDOM_PURE_RNDTEST, + RANDOM_PURE_VIRTIO, ENTROPYSOURCE }; void random_harvest(const void *, u_int, u_int, enum esource); From owner-svn-src-head@FreeBSD.ORG Sat Jan 18 14:22:58 2014 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) (using TLSv1 with cipher ADH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id E45CC775; Sat, 18 Jan 2014 14:22:57 +0000 (UTC) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mx1.freebsd.org (Postfix) with ESMTPS id CFFB9150F; Sat, 18 Jan 2014 14:22: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 s0IEMvYH087584; Sat, 18 Jan 2014 14:22:57 GMT (envelope-from ed@svn.freebsd.org) Received: (from ed@localhost) by svn.freebsd.org (8.14.7/8.14.7/Submit) id s0IEMvDP087579; Sat, 18 Jan 2014 14:22:57 GMT (envelope-from ed@svn.freebsd.org) Message-Id: <201401181422.s0IEMvDP087579@svn.freebsd.org> From: Ed Schouten Date: Sat, 18 Jan 2014 14:22:57 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r260849 - in head: gnu/lib/libgcc lib/libc libexec/rtld-elf share/mk X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.17 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 18 Jan 2014 14:22:58 -0000 Author: ed Date: Sat Jan 18 14:22:56 2014 New Revision: 260849 URL: http://svnweb.freebsd.org/changeset/base/260849 Log: Replace LIBGCC by LIBCOMPILER_RT. We now use libcompiler_rt on all platforms now. Instead of referring directly to -lgcc and LIBGCC, use -lcompiler_rt and LIBCOMPILER_RT. Modified: head/gnu/lib/libgcc/Makefile head/lib/libc/Makefile head/libexec/rtld-elf/Makefile head/share/mk/bsd.libnames.mk Modified: head/gnu/lib/libgcc/Makefile ============================================================================== --- head/gnu/lib/libgcc/Makefile Sat Jan 18 10:13:04 2014 (r260848) +++ head/gnu/lib/libgcc/Makefile Sat Jan 18 14:22:56 2014 (r260849) @@ -119,8 +119,8 @@ LIB1ASMFUNCS = _dvmd_tls _bb_init_func .if ${MK_ARM_EABI} != "no" LIB2ADDEH = unwind-arm.c libunwind.S pr-support.c unwind-c.c # Some compilers generate __aeabi_ functions libgcc_s is missing -DPADD+= ${LIBGCC} -LDADD+= -lgcc +DPADD+= ${LIBCOMPILER_RT} +LDADD+= -lcompiler_rt .else LIB2FUNCS_EXTRA = floatunsidf.c floatunsisf.c .endif Modified: head/lib/libc/Makefile ============================================================================== --- head/lib/libc/Makefile Sat Jan 18 10:13:04 2014 (r260848) +++ head/lib/libc/Makefile Sat Jan 18 14:22:56 2014 (r260849) @@ -40,11 +40,11 @@ CFLAGS+=${CANCELPOINTS_CFLAGS} .endif # -# Only link with static libgcc.a (no libgcc_eh.a). +# Link with static libcompiler_rt.a. # -DPADD+= ${LIBGCC} +DPADD+= ${LIBCOMPILER_RT} LDFLAGS+= -nodefaultlibs -LDADD+= -lgcc +LDADD+= -lcompiler_rt .if ${MK_SSP} != "no" LDADD+= -lssp_nonshared Modified: head/libexec/rtld-elf/Makefile ============================================================================== --- head/libexec/rtld-elf/Makefile Sat Jan 18 10:13:04 2014 (r260848) +++ head/libexec/rtld-elf/Makefile Sat Jan 18 14:22:56 2014 (r260849) @@ -43,11 +43,12 @@ DPADD= ${LIBC_PIC} LDADD= -lc_pic .if ${MACHINE_CPUARCH} == "arm" && ${MK_ARM_EABI} != "no" -# Some of the required math functions (div & mod) are implemented in libgcc -# on ARM. The library also needs to be placed first to be correctly linked. -# As some of the functions are used before we have shared libraries. -DPADD+= ${LIBGCC} -LDADD+= -lgcc +# Some of the required math functions (div & mod) are implemented in +# libcompiler_rt on ARM. The library also needs to be placed first to be +# correctly linked. As some of the functions are used before we have +# shared libraries. +DPADD+= ${LIBCOMPILER_RT} +LDADD+= -lcompiler_rt .endif Modified: head/share/mk/bsd.libnames.mk ============================================================================== --- head/share/mk/bsd.libnames.mk Sat Jan 18 10:13:04 2014 (r260848) +++ head/share/mk/bsd.libnames.mk Sat Jan 18 14:22:56 2014 (r260849) @@ -36,6 +36,7 @@ LIBCAPSICUM?= ${DESTDIR}${LIBDIR}/libcap LIBCASPER?= ${DESTDIR}${LIBDIR}/libcasper.a LIBCOM_ERR?= ${DESTDIR}${LIBDIR}/libcom_err.a LIBCOMPAT?= ${DESTDIR}${LIBDIR}/libcompat.a +LIBCOMPILER_RT?=${DESTDIR}${LIBDIR}/libgcc.a LIBCRYPT?= ${DESTDIR}${LIBDIR}/libcrypt.a LIBCRYPTO?= ${DESTDIR}${LIBDIR}/libcrypto.a LIBCTF?= ${DESTDIR}${LIBDIR}/libctf.a @@ -53,8 +54,6 @@ LIBFETCH?= ${DESTDIR}${LIBDIR}/libfetch. LIBFL?= "don't use LIBFL, use LIBL" LIBFORM?= ${DESTDIR}${LIBDIR}/libform.a LIBG2C?= ${DESTDIR}${LIBDIR}/libg2c.a -LIBGCC?= ${DESTDIR}${LIBDIR}/libgcc.a -LIBGCC_PIC?= ${DESTDIR}${LIBDIR}/libgcc_pic.a LIBGEOM?= ${DESTDIR}${LIBDIR}/libgeom.a LIBGNUREGEX?= ${DESTDIR}${LIBDIR}/libgnuregex.a LIBGSSAPI?= ${DESTDIR}${LIBDIR}/libgssapi.a From owner-svn-src-head@FreeBSD.ORG Sat Jan 18 14:32:56 2014 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) (using TLSv1 with cipher ADH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id 57FB5A20 for ; Sat, 18 Jan 2014 14:32:56 +0000 (UTC) Received: from mout.web.de (mout.web.de [212.227.17.11]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-SHA (128/128 bits)) (No client certificate requested) by mx1.freebsd.org (Postfix) with ESMTPS id E6C3915D5 for ; Sat, 18 Jan 2014 14:32:55 +0000 (UTC) Received: from nil ([180.149.96.169]) by smtp.web.de (mrweb102) with ESMTPA (Nemesis) id 0MSJGB-1VtN5s3CcV-00TSfH for ; Sat, 18 Jan 2014 15:32:47 +0100 From: Luca Bayer To: Ed Schouten Subject: Re: svn commit: r260849 - in head: gnu/lib/libgcc lib/libc libexec/rtld-elf share/mk In-Reply-To: <201401181422.s0IEMvDP087579@svn.freebsd.org> (Ed Schouten's message of "Sat, 18 Jan 2014 14:22:57 +0000 (UTC)") Date: Sat, 18 Jan 2014 15:31:51 +0100 Message-ID: <20140118.8638klico8@web.de> References: <201401181422.s0IEMvDP087579@svn.freebsd.org> MIME-Version: 1.0 Content-Type: text/plain X-Provags-ID: V03:K0:L0Q51kM7HvK79ABkOaPh8C+k8vTmMxwX7ktoAV8/lN5CDUs6EzZ lq8I08Zd/re8tYwhJ19KhI+UZjFxPgEpWTKBLRQOcMVpjD1tG8RhDLUjcdNXpkYR3VL7Fgt JSFxaCFlSKP+bS9gpwKitBhqkg07zKcJul5/PY2ieN097D5UpV13po3UDAjHb9/E1t7xg+s ilj93dkvoi17GEfRJrHLQ== Cc: svn-src-head@freebsd.org, svn-src-all@freebsd.org, src-committers@freebsd.org X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.17 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 18 Jan 2014 14:32:56 -0000 Ed Schouten writes: > Log: > Replace LIBGCC by LIBCOMPILER_RT. > > We now use libcompiler_rt on all platforms now. Instead of referring > directly to -lgcc and LIBGCC, use -lcompiler_rt and LIBCOMPILER_RT. > [...] > Modified: head/share/mk/bsd.libnames.mk > ============================================================================== > --- head/share/mk/bsd.libnames.mk Sat Jan 18 10:13:04 2014 (r260848) > +++ head/share/mk/bsd.libnames.mk Sat Jan 18 14:22:56 2014 (r260849) > @@ -36,6 +36,7 @@ LIBCAPSICUM?= ${DESTDIR}${LIBDIR}/libcap > LIBCASPER?= ${DESTDIR}${LIBDIR}/libcasper.a > LIBCOM_ERR?= ${DESTDIR}${LIBDIR}/libcom_err.a > LIBCOMPAT?= ${DESTDIR}${LIBDIR}/libcompat.a > +LIBCOMPILER_RT?=${DESTDIR}${LIBDIR}/libgcc.a > LIBCRYPT?= ${DESTDIR}${LIBDIR}/libcrypt.a > LIBCRYPTO?= ${DESTDIR}${LIBDIR}/libcrypto.a > LIBCTF?= ${DESTDIR}${LIBDIR}/libctf.a Shouldn't it be the following? +LIBCOMPILER_RT?=${DESTDIR}${LIBDIR}/libcompiler_rt.a From owner-svn-src-head@FreeBSD.ORG Sat Jan 18 14:47:35 2014 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [8.8.178.115]) (using TLSv1 with cipher ADH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id 0EA32CE7; Sat, 18 Jan 2014 14:47:35 +0000 (UTC) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mx1.freebsd.org (Postfix) with ESMTPS id EF7E2168F; Sat, 18 Jan 2014 14:47: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 s0IElYa6095359; Sat, 18 Jan 2014 14:47:34 GMT (envelope-from ed@svn.freebsd.org) Received: (from ed@localhost) by svn.freebsd.org (8.14.7/8.14.7/Submit) id s0IElY0N095358; Sat, 18 Jan 2014 14:47:34 GMT (envelope-from ed@svn.freebsd.org) Message-Id: <201401181447.s0IElY0N095358@svn.freebsd.org> From: Ed Schouten Date: Sat, 18 Jan 2014 14:47:34 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r260850 - head/share/mk X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.17 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 18 Jan 2014 14:47:35 -0000 Author: ed Date: Sat Jan 18 14:47:34 2014 New Revision: 260850 URL: http://svnweb.freebsd.org/changeset/base/260850 Log: Correct value of LIBCOMPILER_RT. Caught by: Luca Bayer Modified: head/share/mk/bsd.libnames.mk Modified: head/share/mk/bsd.libnames.mk ============================================================================== --- head/share/mk/bsd.libnames.mk Sat Jan 18 14:22:56 2014 (r260849) +++ head/share/mk/bsd.libnames.mk Sat Jan 18 14:47:34 2014 (r260850) @@ -36,7 +36,7 @@ LIBCAPSICUM?= ${DESTDIR}${LIBDIR}/libcap LIBCASPER?= ${DESTDIR}${LIBDIR}/libcasper.a LIBCOM_ERR?= ${DESTDIR}${LIBDIR}/libcom_err.a LIBCOMPAT?= ${DESTDIR}${LIBDIR}/libcompat.a -LIBCOMPILER_RT?=${DESTDIR}${LIBDIR}/libgcc.a +LIBCOMPILER_RT?=${DESTDIR}${LIBDIR}/libcompiler_rt.a LIBCRYPT?= ${DESTDIR}${LIBDIR}/libcrypt.a LIBCRYPTO?= ${DESTDIR}${LIBDIR}/libcrypto.a LIBCTF?= ${DESTDIR}${LIBDIR}/libctf.a From owner-svn-src-head@FreeBSD.ORG Sat Jan 18 14:49:15 2014 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) (using TLSv1 with cipher ADH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id 029B1E3B; Sat, 18 Jan 2014 14:49:15 +0000 (UTC) Received: from mail-ve0-x233.google.com (mail-ve0-x233.google.com [IPv6:2607:f8b0:400c:c01::233]) (using TLSv1 with cipher ECDHE-RSA-RC4-SHA (128/128 bits)) (No client certificate requested) by mx1.freebsd.org (Postfix) with ESMTPS id 8ECCA169F; Sat, 18 Jan 2014 14:49:14 +0000 (UTC) Received: by mail-ve0-f179.google.com with SMTP id jw12so2141284veb.10 for ; Sat, 18 Jan 2014 06:49:13 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:sender:in-reply-to:references:date:message-id:subject :from:to:cc:content-type; bh=jhKBD2KVGcDE13d3a8UnXg+1LvkiEL9pZ6oYif8JxS0=; b=OraHRauKmWcj/wx2pi1gnpMlbvNR1fOzdJAegZ/bZZLNhsPY60HpoZVqeC8w8ATLhr 5Iqt36NY/IVoAJ4/1dK7JJWHlWvjnDL8lzHKn1O301s1gg/2M7h/IH6C7v9ytT4wwweu +20PDfqUWH2DUcacVAO66NUawWqfaRDmsT8q7DuwxLTn67d3feDhe/Fi89TSQhmrJxtN 4AY22CSaZxupeFEEEjhb1xg34dZJ8AeI5IqnOa7evZikTgWPB/hjMfuMM6695ytWGAZf s76r4oMj2mMv/dLn5hCz2LwIjxL05Ke3bJGHh0jiHDSLQjabvE7RXBTORV0meqcXDI6U HpQg== MIME-Version: 1.0 X-Received: by 10.52.230.35 with SMTP id sv3mr235995vdc.27.1390056553756; Sat, 18 Jan 2014 06:49:13 -0800 (PST) Sender: edschouten@gmail.com Received: by 10.220.105.140 with HTTP; Sat, 18 Jan 2014 06:49:13 -0800 (PST) In-Reply-To: <20140118.8638klico8@web.de> References: <201401181422.s0IEMvDP087579@svn.freebsd.org> <20140118.8638klico8@web.de> Date: Sat, 18 Jan 2014 15:49:13 +0100 X-Google-Sender-Auth: fv072CIdva0q9I6-CWGfwQzkXLk Message-ID: Subject: Re: svn commit: r260849 - in head: gnu/lib/libgcc lib/libc libexec/rtld-elf share/mk From: Ed Schouten To: Luca Bayer Content-Type: text/plain; charset=UTF-8 Cc: svn-src-head@freebsd.org, svn-src-all@freebsd.org, src-committers@freebsd.org X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.17 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 18 Jan 2014 14:49:15 -0000 Hi Luca, On 18 January 2014 15:31, Luca Bayer wrote: > Shouldn't it be the following? > > +LIBCOMPILER_RT?=${DESTDIR}${LIBDIR}/libcompiler_rt.a Yes, indeed. Fixed in r260850. The tricky thing with the dependency lines is that they silently ignore any errors in them, which is why I didn't catch this. -- Ed Schouten From owner-svn-src-head@FreeBSD.ORG Sat Jan 18 15:52:53 2014 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) (using TLSv1 with cipher ADH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id 7C20059F; Sat, 18 Jan 2014 15:52:53 +0000 (UTC) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mx1.freebsd.org (Postfix) with ESMTPS id 6642F1C9D; Sat, 18 Jan 2014 15:52: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 s0IFqrcb021465; Sat, 18 Jan 2014 15:52:53 GMT (envelope-from melifaro@svn.freebsd.org) Received: (from melifaro@localhost) by svn.freebsd.org (8.14.7/8.14.7/Submit) id s0IFqr3k021464; Sat, 18 Jan 2014 15:52:53 GMT (envelope-from melifaro@svn.freebsd.org) Message-Id: <201401181552.s0IFqr3k021464@svn.freebsd.org> From: "Alexander V. Chernikov" Date: Sat, 18 Jan 2014 15:52:53 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r260851 - head/sys/netinet6 X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.17 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 18 Jan 2014 15:52:53 -0000 Author: melifaro Date: Sat Jan 18 15:52:52 2014 New Revision: 260851 URL: http://svnweb.freebsd.org/changeset/base/260851 Log: Split in6_update_ifa() into smaller pieces leaving functionality intact. Discussed with: ae MFC after: 2 weeks Modified: head/sys/netinet6/in6.c Modified: head/sys/netinet6/in6.c ============================================================================== --- head/sys/netinet6/in6.c Sat Jan 18 14:47:34 2014 (r260850) +++ head/sys/netinet6/in6.c Sat Jan 18 15:52:52 2014 (r260851) @@ -139,6 +139,15 @@ static void in6_unlink_ifa(struct in6_if int (*faithprefix_p)(struct in6_addr *); +static int in6_validate_ifra(struct ifnet *, struct in6_aliasreq *, + struct in6_ifaddr *, int); +static struct in6_ifaddr *in6_alloc_ifa(struct ifnet *, + struct in6_aliasreq *, int flags); +static int in6_update_ifa_internal(struct ifnet *, struct in6_aliasreq *, + struct in6_ifaddr *, int, int); +static int in6_setup_ifa(struct ifnet *, struct in6_aliasreq *, + struct in6_ifaddr *, int); + #define ifa2ia6(ifa) ((struct in6_ifaddr *)(ifa)) #define ia62ifa(ia6) (&((ia6)->ia_ifa)) @@ -1001,11 +1010,39 @@ int in6_update_ifa(struct ifnet *ifp, struct in6_aliasreq *ifra, struct in6_ifaddr *ia, int flags) { - int error = 0, hostIsNew = 0, plen = -1; + int error, hostIsNew = 0; + + if ((error = in6_validate_ifra(ifp, ifra, ia, flags)) != 0) + return (error); + + if (ia == NULL) { + hostIsNew = 1; + if ((ia = in6_alloc_ifa(ifp, ifra, flags)) == NULL) + return (ENOBUFS); + } + + error = in6_update_ifa_internal(ifp, ifra, ia, hostIsNew, flags); + if (error != 0) { + if (hostIsNew != 0) { + in6_unlink_ifa(ia, ifp); + ifa_free(&ia->ia_ifa); + } + return (error); + } + + if (hostIsNew) + error = in6_setup_ifa(ifp, ifra, ia, flags); + + return (error); +} + +static int +in6_validate_ifra(struct ifnet *ifp, struct in6_aliasreq *ifra, + struct in6_ifaddr *ia, int flags) +{ + int plen = -1; struct sockaddr_in6 dst6; struct in6_addrlifetime *lt; - struct in6_multi *in6m_sol; - int delay; char ip6buf[INET6_ADDRSTRLEN]; /* Validate parameters */ @@ -1072,6 +1109,9 @@ in6_update_ifa(struct ifnet *ifp, struct if (sa6_embedscope(&dst6, 0)) return (EINVAL); /* XXX: should be impossible */ } + /* Modify original ifra_dstaddr to reflect changes */ + ifra->ifra_dstaddr = dst6; + /* * The destination address can be specified only for a p2p or a * loopback interface. If specified, the corresponding prefix length @@ -1107,12 +1147,36 @@ in6_update_ifa(struct ifnet *ifp, struct return (0); /* there's nothing to do */ } + /* Check prefix mask */ + if (ia != NULL && ifra->ifra_prefixmask.sin6_len != 0) { + /* + * We prohibit changing the prefix length of an existing + * address, because + * + such an operation should be rare in IPv6, and + * + the operation would confuse prefix management. + */ + if (ia->ia_prefixmask.sin6_len != 0 && + in6_mask2len(&ia->ia_prefixmask.sin6_addr, NULL) != plen) { + nd6log((LOG_INFO, "in6_validate_ifa: the prefix length " + "of an existing %s address should not be changed\n", + ip6_sprintf(ip6buf, &ia->ia_addr.sin6_addr))); + + return (EINVAL); + } + } + + return (0); +} + /* * If this is a new address, allocate a new ifaddr and link it * into chains. */ - if (ia == NULL) { - hostIsNew = 1; +static struct in6_ifaddr * +in6_alloc_ifa(struct ifnet *ifp, struct in6_aliasreq *ifra, int flags) +{ + struct in6_ifaddr *ia; + /* * When in6_update_ifa() is called in a process of a received * RA, it is called under an interrupt context. So, we should @@ -1120,7 +1184,7 @@ in6_update_ifa(struct ifnet *ifp, struct */ ia = (struct in6_ifaddr *)ifa_alloc(sizeof(*ia), M_NOWAIT); if (ia == NULL) - return (ENOBUFS); + return (NULL); LIST_INIT(&ia->ia6_memberships); /* Initialize the address and masks, and put time stamp */ ia->ia_ifa.ifa_addr = (struct sockaddr *)&ia->ia_addr; @@ -1150,52 +1214,28 @@ in6_update_ifa(struct ifnet *ifp, struct LIST_INSERT_HEAD(IN6ADDR_HASH(&ifra->ifra_addr.sin6_addr), ia, ia6_hash); IN6_IFADDR_WUNLOCK(); - } + + return (ia); +} + +static int +in6_update_ifa_internal(struct ifnet *ifp, struct in6_aliasreq *ifra, + struct in6_ifaddr *ia, int hostIsNew, int flags) +{ + struct sockaddr_in6 *pdst; + int error; + char ip6buf[INET6_ADDRSTRLEN]; /* update timestamp */ ia->ia6_updatetime = time_uptime; /* set prefix mask */ - if (ifra->ifra_prefixmask.sin6_len) { - /* - * We prohibit changing the prefix length of an existing - * address, because - * + such an operation should be rare in IPv6, and - * + the operation would confuse prefix management. - */ - if (ia->ia_prefixmask.sin6_len && - in6_mask2len(&ia->ia_prefixmask.sin6_addr, NULL) != plen) { - nd6log((LOG_INFO, "in6_update_ifa: the prefix length of an" - " existing (%s) address should not be changed\n", - ip6_sprintf(ip6buf, &ia->ia_addr.sin6_addr))); - error = EINVAL; - goto unlink; - } + if (ifra->ifra_prefixmask.sin6_len != 0) { ia->ia_prefixmask = ifra->ifra_prefixmask; ia->ia_prefixmask.sin6_family = AF_INET6; } /* - * If a new destination address is specified, scrub the old one and - * install the new destination. Note that the interface must be - * p2p or loopback (see the check above.) - */ - if (dst6.sin6_family == AF_INET6 && - !IN6_ARE_ADDR_EQUAL(&dst6.sin6_addr, &ia->ia_dstaddr.sin6_addr)) { - int e; - - if ((ia->ia_flags & IFA_ROUTE) != 0 && - (e = rtinit(&(ia->ia_ifa), (int)RTM_DELETE, RTF_HOST)) != 0) { - nd6log((LOG_ERR, "in6_update_ifa: failed to remove " - "a route to the old destination: %s\n", - ip6_sprintf(ip6buf, &ia->ia_addr.sin6_addr))); - /* proceed anyway... */ - } else - ia->ia_flags &= ~IFA_ROUTE; - ia->ia_dstaddr = dst6; - } - - /* * Set lifetimes. We do not refer to ia6t_expire and ia6t_preferred * to see if the address is deprecated or invalidated, but initialize * these members for applications. @@ -1212,14 +1252,6 @@ in6_update_ifa(struct ifnet *ifp, struct } else ia->ia6_lifetime.ia6t_preferred = 0; - /* reset the interface and routing table appropriately. */ - if ((error = in6_ifinit(ifp, ia, &ifra->ifra_addr, hostIsNew)) != 0) - goto unlink; - - /* - * configure address flags. - */ - ia->ia6_flags = ifra->ifra_flags; /* * backward compatibility - if IN6_IFF_DEPRECATED is set from the * userland, make it deprecated. @@ -1228,6 +1260,12 @@ in6_update_ifa(struct ifnet *ifp, struct ia->ia6_lifetime.ia6t_pltime = 0; ia->ia6_lifetime.ia6t_preferred = time_uptime; } + + /* + * configure address flags. + */ + ia->ia6_flags = ifra->ifra_flags; + /* * Make the address tentative before joining multicast addresses, * so that corresponding MLD responses would not have a tentative @@ -1242,10 +1280,44 @@ in6_update_ifa(struct ifnet *ifp, struct ia->ia6_flags |= IN6_IFF_TENTATIVE; /* - * We are done if we have simply modified an existing address. + * If a new destination address is specified, scrub the old one and + * install the new destination. Note that the interface must be + * p2p or loopback (see the check above.) */ - if (!hostIsNew) - return (error); + pdst = &ifra->ifra_dstaddr; + if (pdst->sin6_family == AF_INET6 && + !IN6_ARE_ADDR_EQUAL(&pdst->sin6_addr, &ia->ia_dstaddr.sin6_addr)) { + if ((ia->ia_flags & IFA_ROUTE) != 0 && + (rtinit(&(ia->ia_ifa), (int)RTM_DELETE, RTF_HOST) != 0)) { + nd6log((LOG_ERR, "in6_update_ifa_internal: failed to " + "remove a route to the old destination: %s\n", + ip6_sprintf(ip6buf, &ia->ia_addr.sin6_addr))); + /* proceed anyway... */ + } else + ia->ia_flags &= ~IFA_ROUTE; + ia->ia_dstaddr = *pdst; + } + + /* reset the interface and routing table appropriately. */ + if ((error = in6_ifinit(ifp, ia, &ifra->ifra_addr, hostIsNew)) != 0) { + /* + * XXX: if a change of an existing address failed, keep the entry + * anyway. + */ + } + + return (error); +} + +static int +in6_setup_ifa(struct ifnet *ifp, struct in6_aliasreq *ifra, + struct in6_ifaddr *ia, int flags) +{ + struct in6_multi *in6m_sol; + int error = 0; + + /* Add local address to lltable, if necessary (ex. on p2p link). */ + in6_ifaddloop(&(ia->ia_ifa)); /* * Beyond this point, we should call in6_purgeaddr upon an error, @@ -1256,8 +1328,11 @@ in6_update_ifa(struct ifnet *ifp, struct in6m_sol = NULL; if ((ifp->if_flags & IFF_MULTICAST) != 0) { error = in6_update_ifa_join_mc(ifp, ifra, ia, flags, &in6m_sol); - if (error) - goto cleanup; + if (error != 0) { + ifa_free(&ia->ia_ifa); + in6_purgeaddr(&ia->ia_ifa); + return (error); + } } /* @@ -1267,7 +1342,7 @@ in6_update_ifa(struct ifnet *ifp, struct if (in6if_do_dad(ifp) && ((ifra->ifra_flags & IN6_IFF_NODAD) == 0) && (ia->ia6_flags & IN6_IFF_TENTATIVE)) { - int mindelay, maxdelay; + int delay, mindelay, maxdelay; delay = 0; if ((flags & IN6_IFAUPDATE_DADDELAY)) { @@ -1298,26 +1373,8 @@ in6_update_ifa(struct ifnet *ifp, struct nd6_dad_start((struct ifaddr *)ia, delay); } - KASSERT(hostIsNew, ("in6_update_ifa: !hostIsNew")); ifa_free(&ia->ia_ifa); return (error); - - unlink: - /* - * XXX: if a change of an existing address failed, keep the entry - * anyway. - */ - if (hostIsNew) { - in6_unlink_ifa(ia, ifp); - ifa_free(&ia->ia_ifa); - } - return (error); - - cleanup: - KASSERT(hostIsNew, ("in6_update_ifa: cleanup: !hostIsNew")); - ifa_free(&ia->ia_ifa); - in6_purgeaddr(&ia->ia_ifa); - return error; } /* @@ -1644,10 +1701,6 @@ in6_ifinit(struct ifnet *ifp, struct in6 ia->ia_flags |= IFA_RTSELF; } - /* Add local address to lltable, if necessary (ex. on p2p link). */ - if (newhost) - in6_ifaddloop(&(ia->ia_ifa)); - return (error); } From owner-svn-src-head@FreeBSD.ORG Sat Jan 18 15:57:44 2014 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) (using TLSv1 with cipher ADH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id 4701E7DD; Sat, 18 Jan 2014 15:57:44 +0000 (UTC) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mx1.freebsd.org (Postfix) with ESMTPS id 3269A1CBB; Sat, 18 Jan 2014 15:57: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 s0IFviIb022095; Sat, 18 Jan 2014 15:57:44 GMT (envelope-from melifaro@svn.freebsd.org) Received: (from melifaro@localhost) by svn.freebsd.org (8.14.7/8.14.7/Submit) id s0IFvieR022094; Sat, 18 Jan 2014 15:57:44 GMT (envelope-from melifaro@svn.freebsd.org) Message-Id: <201401181557.s0IFvieR022094@svn.freebsd.org> From: "Alexander V. Chernikov" Date: Sat, 18 Jan 2014 15:57:44 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r260852 - head/sys/netinet6 X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.17 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 18 Jan 2014 15:57:44 -0000 Author: melifaro Date: Sat Jan 18 15:57:43 2014 New Revision: 260852 URL: http://svnweb.freebsd.org/changeset/base/260852 Log: Do some style(9) not done in r260851 to improve readability. MFC after: 2 weeks Modified: head/sys/netinet6/in6.c Modified: head/sys/netinet6/in6.c ============================================================================== --- head/sys/netinet6/in6.c Sat Jan 18 15:52:52 2014 (r260851) +++ head/sys/netinet6/in6.c Sat Jan 18 15:57:43 2014 (r260852) @@ -1168,53 +1168,53 @@ in6_validate_ifra(struct ifnet *ifp, str return (0); } - /* - * If this is a new address, allocate a new ifaddr and link it - * into chains. - */ + +/* + * Allocate a new ifaddr and link it into chains. + */ static struct in6_ifaddr * in6_alloc_ifa(struct ifnet *ifp, struct in6_aliasreq *ifra, int flags) { struct in6_ifaddr *ia; + /* + * When in6_alloc_ifa() is called in a process of a received + * RA, it is called under an interrupt context. So, we should + * call malloc with M_NOWAIT. + */ + ia = (struct in6_ifaddr *)ifa_alloc(sizeof(*ia), M_NOWAIT); + if (ia == NULL) + return (NULL); + LIST_INIT(&ia->ia6_memberships); + /* Initialize the address and masks, and put time stamp */ + ia->ia_ifa.ifa_addr = (struct sockaddr *)&ia->ia_addr; + ia->ia_addr.sin6_family = AF_INET6; + ia->ia_addr.sin6_len = sizeof(ia->ia_addr); + ia->ia6_createtime = time_uptime; + if ((ifp->if_flags & (IFF_POINTOPOINT | IFF_LOOPBACK)) != 0) { /* - * When in6_update_ifa() is called in a process of a received - * RA, it is called under an interrupt context. So, we should - * call malloc with M_NOWAIT. + * XXX: some functions expect that ifa_dstaddr is not + * NULL for p2p interfaces. */ - ia = (struct in6_ifaddr *)ifa_alloc(sizeof(*ia), M_NOWAIT); - if (ia == NULL) - return (NULL); - LIST_INIT(&ia->ia6_memberships); - /* Initialize the address and masks, and put time stamp */ - ia->ia_ifa.ifa_addr = (struct sockaddr *)&ia->ia_addr; - ia->ia_addr.sin6_family = AF_INET6; - ia->ia_addr.sin6_len = sizeof(ia->ia_addr); - ia->ia6_createtime = time_uptime; - if ((ifp->if_flags & (IFF_POINTOPOINT | IFF_LOOPBACK)) != 0) { - /* - * XXX: some functions expect that ifa_dstaddr is not - * NULL for p2p interfaces. - */ - ia->ia_ifa.ifa_dstaddr = - (struct sockaddr *)&ia->ia_dstaddr; - } else { - ia->ia_ifa.ifa_dstaddr = NULL; - } - ia->ia_ifa.ifa_netmask = (struct sockaddr *)&ia->ia_prefixmask; - ia->ia_ifp = ifp; - ifa_ref(&ia->ia_ifa); /* if_addrhead */ - IF_ADDR_WLOCK(ifp); - TAILQ_INSERT_TAIL(&ifp->if_addrhead, &ia->ia_ifa, ifa_link); - IF_ADDR_WUNLOCK(ifp); - - ifa_ref(&ia->ia_ifa); /* in6_ifaddrhead */ - IN6_IFADDR_WLOCK(); - TAILQ_INSERT_TAIL(&V_in6_ifaddrhead, ia, ia_link); - LIST_INSERT_HEAD(IN6ADDR_HASH(&ifra->ifra_addr.sin6_addr), - ia, ia6_hash); - IN6_IFADDR_WUNLOCK(); - + ia->ia_ifa.ifa_dstaddr = + (struct sockaddr *)&ia->ia_dstaddr; + } else { + ia->ia_ifa.ifa_dstaddr = NULL; + } + ia->ia_ifa.ifa_netmask = (struct sockaddr *)&ia->ia_prefixmask; + ia->ia_ifp = ifp; + ifa_ref(&ia->ia_ifa); /* if_addrhead */ + IF_ADDR_WLOCK(ifp); + TAILQ_INSERT_TAIL(&ifp->if_addrhead, &ia->ia_ifa, ifa_link); + IF_ADDR_WUNLOCK(ifp); + + ifa_ref(&ia->ia_ifa); /* in6_ifaddrhead */ + IN6_IFADDR_WLOCK(); + TAILQ_INSERT_TAIL(&V_in6_ifaddrhead, ia, ia_link); + LIST_INSERT_HEAD(IN6ADDR_HASH(&ifra->ifra_addr.sin6_addr), + ia, ia6_hash); + IN6_IFADDR_WUNLOCK(); + return (ia); } @@ -1319,11 +1319,6 @@ in6_setup_ifa(struct ifnet *ifp, struct /* Add local address to lltable, if necessary (ex. on p2p link). */ in6_ifaddloop(&(ia->ia_ifa)); - /* - * Beyond this point, we should call in6_purgeaddr upon an error, - * not just go to unlink. - */ - /* Join necessary multicast groups. */ in6m_sol = NULL; if ((ifp->if_flags & IFF_MULTICAST) != 0) { From owner-svn-src-head@FreeBSD.ORG Sat Jan 18 16:25:28 2014 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) (using TLSv1 with cipher ADH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id 33E5CC50; Sat, 18 Jan 2014 16:25:28 +0000 (UTC) Received: from mail.xcllnt.net (mail.xcllnt.net [50.0.150.214]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mx1.freebsd.org (Postfix) with ESMTPS id DB23C1E67; Sat, 18 Jan 2014 16:25:27 +0000 (UTC) Received: from macbook-air.wifi.xcllnt.net (atc.xcllnt.net [50.0.150.213]) (authenticated bits=0) by mail.xcllnt.net (8.14.7/8.14.7) with ESMTP id s0IGPK9f017919 (version=TLSv1/SSLv3 cipher=AES128-SHA bits=128 verify=NO); Sat, 18 Jan 2014 08:25:21 -0800 (PST) (envelope-from marcel@xcllnt.net) Content-Type: multipart/signed; boundary="Apple-Mail=_8380AE09-634B-4398-8E09-49B262D3F3F0"; protocol="application/pgp-signature"; micalg=pgp-sha1 Mime-Version: 1.0 (Mac OS X Mail 7.1 \(1827\)) Subject: Re: svn commit: r260844 - head/gnu/lib/libgcc From: Marcel Moolenaar In-Reply-To: Date: Sat, 18 Jan 2014 08:25:20 -0800 Message-Id: <2C043C39-B2E9-4CD1-943C-006947452D4C@xcllnt.net> References: <201401180409.s0I49eHu054407@svn.freebsd.org> To: Pedro Giffuni X-Mailer: Apple Mail (2.1827) Cc: svn-src-head@freebsd.org, svn-src-all@freebsd.org, Marcel Moolenaar , src-committers@freebsd.org X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.17 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 18 Jan 2014 16:25:28 -0000 --Apple-Mail=_8380AE09-634B-4398-8E09-49B262D3F3F0 Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset=us-ascii On Jan 17, 2014, at 9:30 PM, Pedro Giffuni wrote: >> Modified: head/gnu/lib/libgcc/Makefile >> = =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D >> --- head/gnu/lib/libgcc/Makefile Sat Jan 18 04:06:00 2014 = (r260843) >> +++ head/gnu/lib/libgcc/Makefile Sat Jan 18 04:09:39 2014 = (r260844) >> @@ -145,6 +145,7 @@ LIB1ASMFUNCS =3D __divxf3 __divdf3 __divsf >> __divsi3 __modsi3 __udivsi3 __umodsi3 __save_stack_nonlocal \ >> __nonlocal_goto __restore_stack_nonlocal __trampoline \ >> _fixtfdi _fixunstfdi _floatditf >> +LIB2FUNCS +=3D _bswapsi2 _bswapdi2 >> LIB2ADDEH =3D unwind-ia64.c unwind-sjlj.c unwind-c.c >> .endif >>=20 >=20 > I think this was an overlook on my part. This change: >=20 > = http://svnweb.freebsd.org/base/head/contrib/gcc/mklibgcc.in?r1=3D169690&r2= =3D258428 >=20 > would suggest the change is not only for ia64, and It should apply for = stable-10 but not for -9. Ah... I wondered how we could have lived without them in libgcc. I'll update the change and make it generic... Thanks for pointing me at r258428, --=20 Marcel Moolenaar marcel@xcllnt.net --Apple-Mail=_8380AE09-634B-4398-8E09-49B262D3F3F0 Content-Transfer-Encoding: 7bit Content-Disposition: attachment; filename=signature.asc Content-Type: application/pgp-signature; name=signature.asc Content-Description: Message signed with OpenPGP using GPGMail -----BEGIN PGP SIGNATURE----- Comment: GPGTools - http://gpgtools.org iEYEARECAAYFAlLaqvAACgkQpgWlLWHuifYVOwCbBKJ5MT5QFtU4+vkBMlUUyOB+ aWQAni+Vmr5C81oouoUONTr2mbc2e7YC =21pS -----END PGP SIGNATURE----- --Apple-Mail=_8380AE09-634B-4398-8E09-49B262D3F3F0-- From owner-svn-src-head@FreeBSD.ORG Sat Jan 18 20:02:59 2014 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) (using TLSv1 with cipher ADH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id C8349CF4; Sat, 18 Jan 2014 20:02:59 +0000 (UTC) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mx1.freebsd.org (Postfix) with ESMTPS id 9A1601CC7; Sat, 18 Jan 2014 20:02:59 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.7/8.14.7) with ESMTP id s0IK2xBI017339; Sat, 18 Jan 2014 20:02:59 GMT (envelope-from alc@svn.freebsd.org) Received: (from alc@localhost) by svn.freebsd.org (8.14.7/8.14.7/Submit) id s0IK2xTP017338; Sat, 18 Jan 2014 20:02:59 GMT (envelope-from alc@svn.freebsd.org) Message-Id: <201401182002.s0IK2xTP017338@svn.freebsd.org> From: Alan Cox Date: Sat, 18 Jan 2014 20:02:59 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r260859 - head/sys/vm X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.17 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 18 Jan 2014 20:02:59 -0000 Author: alc Date: Sat Jan 18 20:02:59 2014 New Revision: 260859 URL: http://svnweb.freebsd.org/changeset/base/260859 Log: Style changes in vm_pageout_scan(): 1. Be consistent in the style of "act_delta" manipulations between the inactive and active queue scans. 2. Explicitly compare to zero. 3. The deactivation of a page is based is based on its recent history and not just the current call to vm_pageout_scan(). The variable "act_delta" represents the current state of the page, and not its history. Avoid possible confusion by not (ab)using "act_delta" for the making the deactivation decision. Submitted by: kib [1] Reviewed by: kib [2,3] Modified: head/sys/vm/vm_pageout.c Modified: head/sys/vm/vm_pageout.c ============================================================================== --- head/sys/vm/vm_pageout.c Sat Jan 18 18:41:24 2014 (r260858) +++ head/sys/vm/vm_pageout.c Sat Jan 18 20:02:59 2014 (r260859) @@ -1047,11 +1047,11 @@ vm_pageout_scan(struct vm_domain *vmd, i * level VM system not knowing anything about existing * references. */ - act_delta = 0; if ((m->aflags & PGA_REFERENCED) != 0) { vm_page_aflag_clear(m, PGA_REFERENCED); act_delta = 1; - } + } else + act_delta = 0; if (object->ref_count != 0) { act_delta += pmap_ts_referenced(m); } else { @@ -1064,7 +1064,7 @@ vm_pageout_scan(struct vm_domain *vmd, i * references, we reactivate the page or requeue it. */ if (act_delta != 0) { - if (object->ref_count) { + if (object->ref_count != 0) { vm_page_activate(m); m->act_count += act_delta + ACT_ADVANCE; } else { @@ -1361,11 +1361,12 @@ relock_queues: /* * Check to see "how much" the page has been used. */ - act_delta = 0; - if (m->aflags & PGA_REFERENCED) { + if ((m->aflags & PGA_REFERENCED) != 0) { vm_page_aflag_clear(m, PGA_REFERENCED); - act_delta += 1; - } + act_delta = 1; + } else + act_delta = 0; + /* * Unlocked object ref count check. Two races are possible. * 1) The ref was transitioning to zero and we saw non-zero, @@ -1380,20 +1381,18 @@ relock_queues: /* * Advance or decay the act_count based on recent usage. */ - if (act_delta) { + if (act_delta != 0) { m->act_count += ACT_ADVANCE + act_delta; if (m->act_count > ACT_MAX) m->act_count = ACT_MAX; - } else { + } else m->act_count -= min(m->act_count, ACT_DECLINE); - act_delta = m->act_count; - } /* * Move this page to the tail of the active or inactive * queue depending on usage. */ - if (act_delta == 0) { + if (m->act_count == 0) { /* Dequeue to avoid later lock recursion. */ vm_page_dequeue_locked(m); vm_page_deactivate(m); From owner-svn-src-head@FreeBSD.ORG Sat Jan 18 20:33:00 2014 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) (using TLSv1 with cipher ADH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id 674952CE; Sat, 18 Jan 2014 20:33:00 +0000 (UTC) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mx1.freebsd.org (Postfix) with ESMTPS id 520BD1E9E; Sat, 18 Jan 2014 20:33: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 s0IKX0Fm029082; Sat, 18 Jan 2014 20:33:00 GMT (envelope-from melifaro@svn.freebsd.org) Received: (from melifaro@localhost) by svn.freebsd.org (8.14.7/8.14.7/Submit) id s0IKWxXH029028; Sat, 18 Jan 2014 20:32:59 GMT (envelope-from melifaro@svn.freebsd.org) Message-Id: <201401182032.s0IKWxXH029028@svn.freebsd.org> From: "Alexander V. Chernikov" Date: Sat, 18 Jan 2014 20:32:59 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r260860 - head/sys/netinet6 X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.17 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 18 Jan 2014 20:33:00 -0000 Author: melifaro Date: Sat Jan 18 20:32:59 2014 New Revision: 260860 URL: http://svnweb.freebsd.org/changeset/base/260860 Log: Add in6_prepare_ifra() function to ease preparing in-kernel IPv6 address requests. MFC after: 2 weeks Modified: head/sys/netinet6/in6.c head/sys/netinet6/in6_ifattach.c head/sys/netinet6/in6_var.h head/sys/netinet6/nd6_rtr.c Modified: head/sys/netinet6/in6.c ============================================================================== --- head/sys/netinet6/in6.c Sat Jan 18 20:02:59 2014 (r260859) +++ head/sys/netinet6/in6.c Sat Jan 18 20:32:59 2014 (r260860) @@ -1036,6 +1036,27 @@ in6_update_ifa(struct ifnet *ifp, struct return (error); } +/* + * Fill in basic IPv6 address request info + */ +void +in6_prepare_ifra(struct in6_aliasreq *ifra, const struct in6_addr *addr, + const struct in6_addr *mask) +{ + + memset(ifra, 0, sizeof(struct in6_aliasreq)); + + ifra->ifra_addr.sin6_family = AF_INET6; + ifra->ifra_addr.sin6_len = sizeof(struct sockaddr_in6); + if (addr != NULL) + ifra->ifra_addr.sin6_addr = *addr; + + ifra->ifra_prefixmask.sin6_family = AF_INET6; + ifra->ifra_prefixmask.sin6_len = sizeof(struct sockaddr_in6); + if (mask != NULL) + ifra->ifra_prefixmask.sin6_addr = *mask; +} + static int in6_validate_ifra(struct ifnet *ifp, struct in6_aliasreq *ifra, struct in6_ifaddr *ia, int flags) Modified: head/sys/netinet6/in6_ifattach.c ============================================================================== --- head/sys/netinet6/in6_ifattach.c Sat Jan 18 20:02:59 2014 (r260859) +++ head/sys/netinet6/in6_ifattach.c Sat Jan 18 20:32:59 2014 (r260860) @@ -460,16 +460,8 @@ in6_ifattach_linklocal(struct ifnet *ifp /* * configure link-local address. */ - bzero(&ifra, sizeof(ifra)); + in6_prepare_ifra(&ifra, NULL, &in6mask64); - /* - * in6_update_ifa() does not use ifra_name, but we accurately set it - * for safety. - */ - strncpy(ifra.ifra_name, if_name(ifp), sizeof(ifra.ifra_name)); - - ifra.ifra_addr.sin6_family = AF_INET6; - ifra.ifra_addr.sin6_len = sizeof(struct sockaddr_in6); ifra.ifra_addr.sin6_addr.s6_addr32[0] = htonl(0xfe800000); ifra.ifra_addr.sin6_addr.s6_addr32[1] = 0; if ((ifp->if_flags & IFF_LOOPBACK) != 0) { @@ -485,9 +477,6 @@ in6_ifattach_linklocal(struct ifnet *ifp if (in6_setscope(&ifra.ifra_addr.sin6_addr, ifp, NULL)) return (-1); - ifra.ifra_prefixmask.sin6_len = sizeof(struct sockaddr_in6); - ifra.ifra_prefixmask.sin6_family = AF_INET6; - ifra.ifra_prefixmask.sin6_addr = in6mask64; /* link-local addresses should NEVER expire. */ ifra.ifra_lifetime.ia6t_vltime = ND6_INFINITE_LIFETIME; ifra.ifra_lifetime.ia6t_pltime = ND6_INFINITE_LIFETIME; @@ -565,17 +554,7 @@ in6_ifattach_loopback(struct ifnet *ifp) struct in6_aliasreq ifra; int error; - bzero(&ifra, sizeof(ifra)); - - /* - * in6_update_ifa() does not use ifra_name, but we accurately set it - * for safety. - */ - strncpy(ifra.ifra_name, if_name(ifp), sizeof(ifra.ifra_name)); - - ifra.ifra_prefixmask.sin6_len = sizeof(struct sockaddr_in6); - ifra.ifra_prefixmask.sin6_family = AF_INET6; - ifra.ifra_prefixmask.sin6_addr = in6mask128; + in6_prepare_ifra(&ifra, &in6addr_loopback, &in6mask128); /* * Always initialize ia_dstaddr (= broadcast address) to loopback @@ -585,10 +564,6 @@ in6_ifattach_loopback(struct ifnet *ifp) ifra.ifra_dstaddr.sin6_family = AF_INET6; ifra.ifra_dstaddr.sin6_addr = in6addr_loopback; - ifra.ifra_addr.sin6_len = sizeof(struct sockaddr_in6); - ifra.ifra_addr.sin6_family = AF_INET6; - ifra.ifra_addr.sin6_addr = in6addr_loopback; - /* the loopback address should NEVER expire. */ ifra.ifra_lifetime.ia6t_vltime = ND6_INFINITE_LIFETIME; ifra.ifra_lifetime.ia6t_pltime = ND6_INFINITE_LIFETIME; Modified: head/sys/netinet6/in6_var.h ============================================================================== --- head/sys/netinet6/in6_var.h Sat Jan 18 20:02:59 2014 (r260859) +++ head/sys/netinet6/in6_var.h Sat Jan 18 20:32:59 2014 (r260860) @@ -799,6 +799,8 @@ int in6_control(struct socket *, u_long, struct thread *); int in6_update_ifa(struct ifnet *, struct in6_aliasreq *, struct in6_ifaddr *, int); +void in6_prepare_ifra(struct in6_aliasreq *, const struct in6_addr *, + const struct in6_addr *); void in6_purgeaddr(struct ifaddr *); int in6if_do_dad(struct ifnet *); void in6_purgeif(struct ifnet *); Modified: head/sys/netinet6/nd6_rtr.c ============================================================================== --- head/sys/netinet6/nd6_rtr.c Sat Jan 18 20:02:59 2014 (r260859) +++ head/sys/netinet6/nd6_rtr.c Sat Jan 18 20:32:59 2014 (r260860) @@ -1829,19 +1829,9 @@ in6_ifadd(struct nd_prefixctl *pr, int m } /* make ifaddr */ + in6_prepare_ifra(&ifra, &pr->ndpr_prefix.sin6_addr, &mask); - bzero(&ifra, sizeof(ifra)); - /* - * in6_update_ifa() does not use ifra_name, but we accurately set it - * for safety. - */ - strncpy(ifra.ifra_name, if_name(ifp), sizeof(ifra.ifra_name)); - ifra.ifra_addr.sin6_family = AF_INET6; - ifra.ifra_addr.sin6_len = sizeof(struct sockaddr_in6); - /* prefix */ - ifra.ifra_addr.sin6_addr = pr->ndpr_prefix.sin6_addr; IN6_MASK_ADDR(&ifra.ifra_addr.sin6_addr, &mask); - /* interface ID */ ifra.ifra_addr.sin6_addr.s6_addr32[0] |= (ib->ia_addr.sin6_addr.s6_addr32[0] & ~mask.s6_addr32[0]); @@ -1853,12 +1843,6 @@ in6_ifadd(struct nd_prefixctl *pr, int m (ib->ia_addr.sin6_addr.s6_addr32[3] & ~mask.s6_addr32[3]); ifa_free(ifa); - /* new prefix mask. */ - ifra.ifra_prefixmask.sin6_len = sizeof(struct sockaddr_in6); - ifra.ifra_prefixmask.sin6_family = AF_INET6; - bcopy(&mask, &ifra.ifra_prefixmask.sin6_addr, - sizeof(ifra.ifra_prefixmask.sin6_addr)); - /* lifetimes. */ ifra.ifra_lifetime.ia6t_vltime = pr->ndpr_vltime; ifra.ifra_lifetime.ia6t_pltime = pr->ndpr_pltime; @@ -1923,11 +1907,10 @@ in6_tmpifadd(const struct in6_ifaddr *ia u_int32_t randid[2]; time_t vltime0, pltime0; - bzero(&ifra, sizeof(ifra)); - strncpy(ifra.ifra_name, if_name(ifp), sizeof(ifra.ifra_name)); - ifra.ifra_addr = ia0->ia_addr; - /* copy prefix mask */ - ifra.ifra_prefixmask = ia0->ia_prefixmask; + in6_prepare_ifra(&ifra, &ia0->ia_addr.sin6_addr, + &ia0->ia_prefixmask.sin6_addr); + + ifra.ifra_addr = ia0->ia_addr; /* XXX: do we need this ? */ /* clear the old IFID */ IN6_MASK_ADDR(&ifra.ifra_addr.sin6_addr, &ifra.ifra_prefixmask.sin6_addr); From owner-svn-src-head@FreeBSD.ORG Sat Jan 18 20:54:56 2014 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [8.8.178.115]) (using TLSv1 with cipher ADH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id 29BABD22; Sat, 18 Jan 2014 20:54:56 +0000 (UTC) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mx1.freebsd.org (Postfix) with ESMTPS id 14A21105D; Sat, 18 Jan 2014 20:54: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 s0IKstMi036610; Sat, 18 Jan 2014 20:54:55 GMT (envelope-from melifaro@svn.freebsd.org) Received: (from melifaro@localhost) by svn.freebsd.org (8.14.7/8.14.7/Submit) id s0IKstRR036609; Sat, 18 Jan 2014 20:54:55 GMT (envelope-from melifaro@svn.freebsd.org) Message-Id: <201401182054.s0IKstRR036609@svn.freebsd.org> From: "Alexander V. Chernikov" Date: Sat, 18 Jan 2014 20:54:55 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r260861 - head/sys/netinet6 X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.17 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 18 Jan 2014 20:54:56 -0000 Author: melifaro Date: Sat Jan 18 20:54:55 2014 New Revision: 260861 URL: http://svnweb.freebsd.org/changeset/base/260861 Log: Use in6_localip() instead of hand-rolled cycle. MFC after: 2 weeks Modified: head/sys/netinet6/nd6_rtr.c Modified: head/sys/netinet6/nd6_rtr.c ============================================================================== --- head/sys/netinet6/nd6_rtr.c Sat Jan 18 20:32:59 2014 (r260860) +++ head/sys/netinet6/nd6_rtr.c Sat Jan 18 20:54:55 2014 (r260861) @@ -1899,7 +1899,7 @@ int in6_tmpifadd(const struct in6_ifaddr *ia0, int forcegen, int delay) { struct ifnet *ifp = ia0->ia_ifa.ifa_ifp; - struct in6_ifaddr *newia, *ia; + struct in6_ifaddr *newia; struct in6_aliasreq ifra; int error; int trylimit = 3; /* XXX: adhoc value */ @@ -1933,26 +1933,18 @@ in6_tmpifadd(const struct in6_ifaddr *ia * there may be a time lag between generation of the ID and generation * of the address. So, we'll do one more sanity check. */ - IN6_IFADDR_RLOCK(); - TAILQ_FOREACH(ia, &V_in6_ifaddrhead, ia_link) { - if (IN6_ARE_ADDR_EQUAL(&ia->ia_addr.sin6_addr, - &ifra.ifra_addr.sin6_addr)) { - if (trylimit-- == 0) { - IN6_IFADDR_RUNLOCK(); - /* - * Give up. Something strange should have - * happened. - */ - nd6log((LOG_NOTICE, "in6_tmpifadd: failed to " - "find a unique random IFID\n")); - return (EEXIST); - } - IN6_IFADDR_RUNLOCK(); + + if (in6_localip(&ifra.ifra_addr.sin6_addr) != 0) { + if (trylimit-- > 0) { forcegen = 1; goto again; } + + /* Give up. Something strange should have happened. */ + nd6log((LOG_NOTICE, "in6_tmpifadd: failed to " + "find a unique random IFID\n")); + return (EEXIST); } - IN6_IFADDR_RUNLOCK(); /* * The Valid Lifetime is the lower of the Valid Lifetime of the From owner-svn-src-head@FreeBSD.ORG Sat Jan 18 21:47:13 2014 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) (using TLSv1 with cipher ADH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id 821ADC06; Sat, 18 Jan 2014 21:47:13 +0000 (UTC) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mx1.freebsd.org (Postfix) with ESMTPS id 6C5481392; Sat, 18 Jan 2014 21:47:13 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.7/8.14.7) with ESMTP id s0ILlDqK056149; Sat, 18 Jan 2014 21:47:13 GMT (envelope-from neel@svn.freebsd.org) Received: (from neel@localhost) by svn.freebsd.org (8.14.7/8.14.7/Submit) id s0ILlDNx056148; Sat, 18 Jan 2014 21:47:13 GMT (envelope-from neel@svn.freebsd.org) Message-Id: <201401182147.s0ILlDNx056148@svn.freebsd.org> From: Neel Natu Date: Sat, 18 Jan 2014 21:47:13 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r260863 - head/sys/amd64/vmm/intel X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.17 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 18 Jan 2014 21:47:13 -0000 Author: neel Date: Sat Jan 18 21:47:12 2014 New Revision: 260863 URL: http://svnweb.freebsd.org/changeset/base/260863 Log: Some processor's don't allow NMI injection if the STI_BLOCKING bit is set in the Guest Interruptibility-state field. However, there isn't any way to figure out which processors have this requirement. So, inject a pending NMI only if NMI_BLOCKING, MOVSS_BLOCKING, STI_BLOCKING are all clear. If any of these bits are set then enable "NMI window exiting" and inject the NMI in the VM-exit handler. Modified: head/sys/amd64/vmm/intel/vmx.c Modified: head/sys/amd64/vmm/intel/vmx.c ============================================================================== --- head/sys/amd64/vmm/intel/vmx.c Sat Jan 18 21:21:44 2014 (r260862) +++ head/sys/amd64/vmm/intel/vmx.c Sat Jan 18 21:47:12 2014 (r260863) @@ -147,21 +147,6 @@ SYSCTL_INT(_hw_vmm_vmx, OID_AUTO, initia &vmx_initialized, 0, "Intel VMX initialized"); /* - * Virtual NMI blocking conditions. - * - * Some processor implementations also require NMI to be blocked if - * the STI_BLOCKING bit is set. It is possible to detect this at runtime - * based on the (exit_reason,exit_qual) tuple being set to - * (EXIT_REASON_INVAL_VMCS, EXIT_QUAL_NMI_WHILE_STI_BLOCKING). - * - * We take the easy way out and also include STI_BLOCKING as one of the - * gating items for vNMI injection. - */ -static uint64_t nmi_blocking_bits = VMCS_INTERRUPTIBILITY_MOVSS_BLOCKING | - VMCS_INTERRUPTIBILITY_NMI_BLOCKING | - VMCS_INTERRUPTIBILITY_STI_BLOCKING; - -/* * Optional capabilities */ static int cap_halt_exit; @@ -1020,117 +1005,145 @@ static void __inline vmx_set_int_window_exiting(struct vmx *vmx, int vcpu) { - vmx->cap[vcpu].proc_ctls |= PROCBASED_INT_WINDOW_EXITING; - vmcs_write(VMCS_PRI_PROC_BASED_CTLS, vmx->cap[vcpu].proc_ctls); + if ((vmx->cap[vcpu].proc_ctls & PROCBASED_INT_WINDOW_EXITING) == 0) { + vmx->cap[vcpu].proc_ctls |= PROCBASED_INT_WINDOW_EXITING; + vmcs_write(VMCS_PRI_PROC_BASED_CTLS, vmx->cap[vcpu].proc_ctls); + VCPU_CTR0(vmx->vm, vcpu, "Enabling interrupt window exiting"); + } } static void __inline vmx_clear_int_window_exiting(struct vmx *vmx, int vcpu) { + KASSERT((vmx->cap[vcpu].proc_ctls & PROCBASED_INT_WINDOW_EXITING) != 0, + ("intr_window_exiting not set: %#x", vmx->cap[vcpu].proc_ctls)); vmx->cap[vcpu].proc_ctls &= ~PROCBASED_INT_WINDOW_EXITING; vmcs_write(VMCS_PRI_PROC_BASED_CTLS, vmx->cap[vcpu].proc_ctls); + VCPU_CTR0(vmx->vm, vcpu, "Disabling interrupt window exiting"); } static void __inline vmx_set_nmi_window_exiting(struct vmx *vmx, int vcpu) { - vmx->cap[vcpu].proc_ctls |= PROCBASED_NMI_WINDOW_EXITING; - vmcs_write(VMCS_PRI_PROC_BASED_CTLS, vmx->cap[vcpu].proc_ctls); + if ((vmx->cap[vcpu].proc_ctls & PROCBASED_NMI_WINDOW_EXITING) == 0) { + vmx->cap[vcpu].proc_ctls |= PROCBASED_NMI_WINDOW_EXITING; + vmcs_write(VMCS_PRI_PROC_BASED_CTLS, vmx->cap[vcpu].proc_ctls); + VCPU_CTR0(vmx->vm, vcpu, "Enabling NMI window exiting"); + } } static void __inline vmx_clear_nmi_window_exiting(struct vmx *vmx, int vcpu) { + KASSERT((vmx->cap[vcpu].proc_ctls & PROCBASED_NMI_WINDOW_EXITING) != 0, + ("nmi_window_exiting not set %#x", vmx->cap[vcpu].proc_ctls)); vmx->cap[vcpu].proc_ctls &= ~PROCBASED_NMI_WINDOW_EXITING; vmcs_write(VMCS_PRI_PROC_BASED_CTLS, vmx->cap[vcpu].proc_ctls); + VCPU_CTR0(vmx->vm, vcpu, "Disabling NMI window exiting"); } -static int +#define NMI_BLOCKING (VMCS_INTERRUPTIBILITY_NMI_BLOCKING | \ + VMCS_INTERRUPTIBILITY_MOVSS_BLOCKING) +#define HWINTR_BLOCKING (VMCS_INTERRUPTIBILITY_STI_BLOCKING | \ + VMCS_INTERRUPTIBILITY_MOVSS_BLOCKING) + +static void vmx_inject_nmi(struct vmx *vmx, int vcpu) { - uint64_t info, interruptibility; + uint32_t gi, info; - /* Bail out if no NMI requested */ - if (!vm_nmi_pending(vmx->vm, vcpu)) - return (0); + gi = vmcs_read(VMCS_GUEST_INTERRUPTIBILITY); + KASSERT((gi & NMI_BLOCKING) == 0, ("vmx_inject_nmi: invalid guest " + "interruptibility-state %#x", gi)); - interruptibility = vmcs_read(VMCS_GUEST_INTERRUPTIBILITY); - if (interruptibility & nmi_blocking_bits) - goto nmiblocked; + info = vmcs_read(VMCS_ENTRY_INTR_INFO); + KASSERT((info & VMCS_INTR_VALID) == 0, ("vmx_inject_nmi: invalid " + "VM-entry interruption information %#x", info)); /* * Inject the virtual NMI. The vector must be the NMI IDT entry * or the VMCS entry check will fail. */ - info = VMCS_INTR_T_NMI | VMCS_INTR_VALID; - info |= IDT_NMI; + info = IDT_NMI | VMCS_INTR_T_NMI | VMCS_INTR_VALID; vmcs_write(VMCS_ENTRY_INTR_INFO, info); VCPU_CTR0(vmx->vm, vcpu, "Injecting vNMI"); /* Clear the request */ vm_nmi_clear(vmx->vm, vcpu); - return (1); - -nmiblocked: - /* - * Set the NMI Window Exiting execution control so we can inject - * the virtual NMI as soon as blocking condition goes away. - */ - vmx_set_nmi_window_exiting(vmx, vcpu); - - VCPU_CTR0(vmx->vm, vcpu, "Enabling NMI window exiting"); - return (1); } static void vmx_inject_interrupts(struct vmx *vmx, int vcpu, struct vlapic *vlapic) { - int vector; - uint64_t info, rflags, interruptibility; - - const int HWINTR_BLOCKED = VMCS_INTERRUPTIBILITY_STI_BLOCKING | - VMCS_INTERRUPTIBILITY_MOVSS_BLOCKING; + int vector, need_nmi_exiting; + uint64_t rflags; + uint32_t gi, info; - /* - * If there is already an interrupt pending then just return. - * - * This could happen if an interrupt was injected on a prior - * VM entry but the actual entry into guest mode was aborted - * because of a pending AST. - */ - info = vmcs_read(VMCS_ENTRY_INTR_INFO); - if (info & VMCS_INTR_VALID) - return; + if (vm_nmi_pending(vmx->vm, vcpu)) { + /* + * If there are no conditions blocking NMI injection then + * inject it directly here otherwise enable "NMI window + * exiting" to inject it as soon as we can. + * + * We also check for STI_BLOCKING because some implementations + * don't allow NMI injection in this case. If we are running + * on a processor that doesn't have this restriction it will + * immediately exit and the NMI will be injected in the + * "NMI window exiting" handler. + */ + need_nmi_exiting = 1; + gi = vmcs_read(VMCS_GUEST_INTERRUPTIBILITY); + if ((gi & (HWINTR_BLOCKING | NMI_BLOCKING)) == 0) { + info = vmcs_read(VMCS_ENTRY_INTR_INFO); + if ((info & VMCS_INTR_VALID) == 0) { + vmx_inject_nmi(vmx, vcpu); + need_nmi_exiting = 0; + } else { + VCPU_CTR1(vmx->vm, vcpu, "Cannot inject NMI " + "due to VM-entry intr info %#x", info); + } + } else { + VCPU_CTR1(vmx->vm, vcpu, "Cannot inject NMI due to " + "Guest Interruptibility-state %#x", gi); + } - /* - * NMI injection has priority so deal with those first - */ - if (vmx_inject_nmi(vmx, vcpu)) - return; + if (need_nmi_exiting) + vmx_set_nmi_window_exiting(vmx, vcpu); + } if (virtual_interrupt_delivery) { vmx_inject_pir(vlapic); return; } + /* + * If there is already an interrupt pending then just return. This + * could happen for multiple reasons: + * - A vectoring VM-entry was aborted due to astpending or rendezvous. + * - A VM-exit happened during event injection. + * - A NMI was injected above or after "NMI window exiting" VM-exit. + */ + info = vmcs_read(VMCS_ENTRY_INTR_INFO); + if (info & VMCS_INTR_VALID) + return; + /* Ask the local apic for a vector to inject */ if (!vlapic_pending_intr(vlapic, &vector)) return; - if (vector < 32 || vector > 255) - panic("vmx_inject_interrupts: invalid vector %d\n", vector); + KASSERT(vector >= 32 && vector <= 255, ("invalid vector %d", vector)); /* Check RFLAGS.IF and the interruptibility state of the guest */ rflags = vmcs_read(VMCS_GUEST_RFLAGS); if ((rflags & PSL_I) == 0) goto cantinject; - interruptibility = vmcs_read(VMCS_GUEST_INTERRUPTIBILITY); - if (interruptibility & HWINTR_BLOCKED) + gi = vmcs_read(VMCS_GUEST_INTERRUPTIBILITY); + if (gi & HWINTR_BLOCKING) goto cantinject; /* Inject the interrupt */ @@ -1151,8 +1164,6 @@ cantinject: * the interrupt as soon as blocking condition goes away. */ vmx_set_int_window_exiting(vmx, vcpu); - - VCPU_CTR0(vmx->vm, vcpu, "Enabling interrupt window exiting"); } /* @@ -1587,7 +1598,6 @@ vmx_exit_process(struct vmx *vmx, int vc case EXIT_REASON_INTR_WINDOW: vmm_stat_incr(vmx->vm, vcpu, VMEXIT_INTR_WINDOW, 1); vmx_clear_int_window_exiting(vmx, vcpu); - VCPU_CTR0(vmx->vm, vcpu, "Disabling interrupt window exiting"); return (1); case EXIT_REASON_EXT_INTR: /* @@ -1613,9 +1623,10 @@ vmx_exit_process(struct vmx *vmx, int vc return (1); case EXIT_REASON_NMI_WINDOW: /* Exit to allow the pending virtual NMI to be injected */ - vmm_stat_incr(vmx->vm, vcpu, VMEXIT_NMI_WINDOW, 1); + if (vm_nmi_pending(vmx->vm, vcpu)) + vmx_inject_nmi(vmx, vcpu); vmx_clear_nmi_window_exiting(vmx, vcpu); - VCPU_CTR0(vmx->vm, vcpu, "Disabling NMI window exiting"); + vmm_stat_incr(vmx->vm, vcpu, VMEXIT_NMI_WINDOW, 1); return (1); case EXIT_REASON_INOUT: vmm_stat_incr(vmx->vm, vcpu, VMEXIT_INOUT, 1); From owner-svn-src-head@FreeBSD.ORG Sat Jan 18 22:33:49 2014 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [8.8.178.115]) (using TLSv1 with cipher ADH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id B94D7C3E; Sat, 18 Jan 2014 22:33:49 +0000 (UTC) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mx1.freebsd.org (Postfix) with ESMTPS id A541D16D7; Sat, 18 Jan 2014 22:33:49 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.7/8.14.7) with ESMTP id s0IMXnQ1075063; Sat, 18 Jan 2014 22:33:49 GMT (envelope-from dteske@svn.freebsd.org) Received: (from dteske@localhost) by svn.freebsd.org (8.14.7/8.14.7/Submit) id s0IMXn1h075062; Sat, 18 Jan 2014 22:33:49 GMT (envelope-from dteske@svn.freebsd.org) Message-Id: <201401182233.s0IMXn1h075062@svn.freebsd.org> From: Devin Teske Date: Sat, 18 Jan 2014 22:33:49 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r260866 - head/usr.sbin/bsdinstall/scripts X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.17 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 18 Jan 2014 22:33:49 -0000 Author: dteske Date: Sat Jan 18 22:33:49 2014 New Revision: 260866 URL: http://svnweb.freebsd.org/changeset/base/260866 Log: Fix a bad comparison operator (s/==/=/), and address a use-case issue where- in the one-line comment associated with the dumpdev setting was not present for the case where the user deselects the dumpdev service (restoring pre- r256348 behaviour. MFC After: 3 days Modified: head/usr.sbin/bsdinstall/scripts/services Modified: head/usr.sbin/bsdinstall/scripts/services ============================================================================== --- head/usr.sbin/bsdinstall/scripts/services Sat Jan 18 22:32:48 2014 (r260865) +++ head/usr.sbin/bsdinstall/scripts/services Sat Jan 18 22:33:49 2014 (r260866) @@ -52,16 +52,14 @@ exec 3>&- havedump= for daemon in $DAEMONS; do - if [ "$daemon" == "dumpdev" ]; then - havedump=1 - echo '# Set dumpdev to "AUTO" to enable crash dumps, "NO"' \ - 'to disable' >> $BSDINSTALL_TMPETC/rc.conf.services - echo dumpdev=\"AUTO\" >> $BSDINSTALL_TMPETC/rc.conf.services - continue - fi + [ "$daemon" = "dumpdev" ] && havedump=1 continue echo ${daemon}_enable=\"YES\" >> $BSDINSTALL_TMPETC/rc.conf.services done -if [ ! "$havedump" ]; then +echo '# Set dumpdev to "AUTO" to enable crash dumps, "NO"' \ + 'to disable' >> $BSDINSTALL_TMPETC/rc.conf.services +if [ "$havedump" ]; then + echo dumpdev=\"AUTO\" >> $BSDINSTALL_TMPETC/rc.conf.services +else echo dumpdev=\"NO\" >> $BSDINSTALL_TMPETC/rc.conf.services fi From owner-svn-src-head@FreeBSD.ORG Sat Jan 18 23:24:53 2014 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [8.8.178.115]) (using TLSv1 with cipher ADH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id 71389CEA; Sat, 18 Jan 2014 23:24:53 +0000 (UTC) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mx1.freebsd.org (Postfix) with ESMTPS id 5BF0F19A7; Sat, 18 Jan 2014 23:24: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 s0INOrhG094671; Sat, 18 Jan 2014 23:24:53 GMT (envelope-from melifaro@svn.freebsd.org) Received: (from melifaro@localhost) by svn.freebsd.org (8.14.7/8.14.7/Submit) id s0INOpcY094658; Sat, 18 Jan 2014 23:24:51 GMT (envelope-from melifaro@svn.freebsd.org) Message-Id: <201401182324.s0INOpcY094658@svn.freebsd.org> From: "Alexander V. Chernikov" Date: Sat, 18 Jan 2014 23:24:51 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r260870 - in head/sys: net ofed/drivers/infiniband/ulp/ipoib X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.17 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 18 Jan 2014 23:24:53 -0000 Author: melifaro Date: Sat Jan 18 23:24:51 2014 New Revision: 260870 URL: http://svnweb.freebsd.org/changeset/base/260870 Log: Simplify filling sockaddr_dl structure for if_resolvemulti() callback providers. link_init_sdl() function can be used to fill most of the parameters. Use caller stack instead of allocation / freing memory for each request. Do not drop support for extra-long (probably non-existing) link-layer protocols by introducing link_alloc_sdl() (used by if_resolvemulti() callback) and link_free_sdl() (used by caller). Since this change breaks KBI, MFC requires slightly different approach (link_init_sdl() auto-allocating buffer if necessary to handle cases with unmodified if_resolvemulti() callers). MFC after: 2 weeks Modified: head/sys/net/ieee8023ad_lacp.c head/sys/net/if.c head/sys/net/if_arcsubr.c head/sys/net/if_dl.h head/sys/net/if_ethersubr.c head/sys/net/if_fddisubr.c head/sys/net/if_iso88025subr.c head/sys/net/if_lagg.c head/sys/ofed/drivers/infiniband/ulp/ipoib/ipoib_main.c Modified: head/sys/net/ieee8023ad_lacp.c ============================================================================== --- head/sys/net/ieee8023ad_lacp.c Sat Jan 18 22:59:10 2014 (r260869) +++ head/sys/net/ieee8023ad_lacp.c Sat Jan 18 23:24:51 2014 (r260870) @@ -522,11 +522,7 @@ lacp_port_create(struct lagg_port *lgp) boolean_t active = TRUE; /* XXX should be configurable */ boolean_t fast = FALSE; /* XXX should be configurable */ - bzero((char *)&sdl, sizeof(sdl)); - sdl.sdl_len = sizeof(sdl); - sdl.sdl_family = AF_LINK; - sdl.sdl_index = ifp->if_index; - sdl.sdl_type = IFT_ETHER; + link_init_sdl(ifp, (struct sockaddr *)&sdl, IFT_ETHER); sdl.sdl_alen = ETHER_ADDR_LEN; bcopy(ðermulticastaddr_slowprotocols, Modified: head/sys/net/if.c ============================================================================== --- head/sys/net/if.c Sat Jan 18 22:59:10 2014 (r260869) +++ head/sys/net/if.c Sat Jan 18 23:24:51 2014 (r260870) @@ -1888,6 +1888,38 @@ link_rtrequest(int cmd, struct rtentry * } } +struct sockaddr_dl * +link_alloc_sdl(size_t size, int flags) +{ + + return (malloc(size, M_TEMP, flags)); +} + +void +link_free_sdl(struct sockaddr *sa) +{ + free(sa, M_TEMP); +} + +/* + * Fills in given sdl with interface basic info. + * Returns pointer to filled sdl. + */ +struct sockaddr_dl * +link_init_sdl(struct ifnet *ifp, struct sockaddr *paddr, u_char iftype) +{ + struct sockaddr_dl *sdl; + + sdl = (struct sockaddr_dl *)paddr; + memset(sdl, 0, sizeof(struct sockaddr_dl)); + sdl->sdl_len = sizeof(struct sockaddr_dl); + sdl->sdl_family = AF_LINK; + sdl->sdl_index = ifp->if_index; + sdl->sdl_type = iftype; + + return (sdl); +} + /* * Mark an interface down and notify protocols of * the transition. @@ -2938,6 +2970,7 @@ if_addmulti(struct ifnet *ifp, struct so { struct ifmultiaddr *ifma, *ll_ifma; struct sockaddr *llsa; + struct sockaddr_dl sdl; int error; /* @@ -2957,12 +2990,18 @@ if_addmulti(struct ifnet *ifp, struct so /* * The address isn't already present; resolve the protocol address * into a link layer address, and then look that up, bump its - * refcount or allocate an ifma for that also. If 'llsa' was - * returned, we will need to free it later. + * refcount or allocate an ifma for that also. + * Most link layer resolving functions returns address data which + * fits inside default sockaddr_dl structure. However callback + * can allocate another sockaddr structure, in that case we need to + * free it later. */ llsa = NULL; ll_ifma = NULL; if (ifp->if_resolvemulti != NULL) { + /* Provide called function with buffer size information */ + sdl.sdl_len = sizeof(sdl); + llsa = (struct sockaddr *)&sdl; error = ifp->if_resolvemulti(ifp, &llsa, sa); if (error) goto unlock_out; @@ -3026,14 +3065,14 @@ if_addmulti(struct ifnet *ifp, struct so (void) (*ifp->if_ioctl)(ifp, SIOCADDMULTI, 0); } - if (llsa != NULL) - free(llsa, M_IFMADDR); + if ((llsa != NULL) && (llsa != (struct sockaddr *)&sdl)) + link_free_sdl(llsa); return (0); free_llsa_out: - if (llsa != NULL) - free(llsa, M_IFMADDR); + if ((llsa != NULL) && (llsa != (struct sockaddr *)&sdl)) + link_free_sdl(llsa); unlock_out: IF_ADDR_WUNLOCK(ifp); Modified: head/sys/net/if_arcsubr.c ============================================================================== --- head/sys/net/if_arcsubr.c Sat Jan 18 22:59:10 2014 (r260869) +++ head/sys/net/if_arcsubr.c Sat Jan 18 23:24:51 2014 (r260870) @@ -786,14 +786,7 @@ arc_resolvemulti(struct ifnet *ifp, stru sin = (struct sockaddr_in *)sa; if (!IN_MULTICAST(ntohl(sin->sin_addr.s_addr))) return EADDRNOTAVAIL; - sdl = malloc(sizeof *sdl, M_IFMADDR, - M_NOWAIT | M_ZERO); - if (sdl == NULL) - return ENOMEM; - sdl->sdl_len = sizeof *sdl; - sdl->sdl_family = AF_LINK; - sdl->sdl_index = ifp->if_index; - sdl->sdl_type = IFT_ARCNET; + sdl = link_init_sdl(ifp, *llsa, IFT_ETHER); sdl->sdl_alen = ARC_ADDR_LEN; *LLADDR(sdl) = 0; *llsa = (struct sockaddr *)sdl; @@ -814,14 +807,7 @@ arc_resolvemulti(struct ifnet *ifp, stru } if (!IN6_IS_ADDR_MULTICAST(&sin6->sin6_addr)) return EADDRNOTAVAIL; - sdl = malloc(sizeof *sdl, M_IFMADDR, - M_NOWAIT | M_ZERO); - if (sdl == NULL) - return ENOMEM; - sdl->sdl_len = sizeof *sdl; - sdl->sdl_family = AF_LINK; - sdl->sdl_index = ifp->if_index; - sdl->sdl_type = IFT_ARCNET; + sdl = link_init_sdl(ifp, *llsa, IFT_ETHER); sdl->sdl_alen = ARC_ADDR_LEN; *LLADDR(sdl) = 0; *llsa = (struct sockaddr *)sdl; Modified: head/sys/net/if_dl.h ============================================================================== --- head/sys/net/if_dl.h Sat Jan 18 22:59:10 2014 (r260869) +++ head/sys/net/if_dl.h Sat Jan 18 23:24:51 2014 (r260870) @@ -69,6 +69,12 @@ struct sockaddr_dl { #define LLADDR(s) ((caddr_t)((s)->sdl_data + (s)->sdl_nlen)) #define LLINDEX(s) ((s)->sdl_index) + +struct ifnet; +struct sockaddr_dl *link_alloc_sdl(size_t, int); +void link_free_sdl(struct sockaddr *sa); +struct sockaddr_dl *link_init_sdl(struct ifnet *, struct sockaddr *, u_char); + #ifndef _KERNEL #include Modified: head/sys/net/if_ethersubr.c ============================================================================== --- head/sys/net/if_ethersubr.c Sat Jan 18 22:59:10 2014 (r260869) +++ head/sys/net/if_ethersubr.c Sat Jan 18 23:24:51 2014 (r260870) @@ -1168,14 +1168,7 @@ ether_resolvemulti(struct ifnet *ifp, st sin = (struct sockaddr_in *)sa; if (!IN_MULTICAST(ntohl(sin->sin_addr.s_addr))) return EADDRNOTAVAIL; - sdl = malloc(sizeof *sdl, M_IFMADDR, - M_NOWAIT|M_ZERO); - if (sdl == NULL) - return ENOMEM; - sdl->sdl_len = sizeof *sdl; - sdl->sdl_family = AF_LINK; - sdl->sdl_index = ifp->if_index; - sdl->sdl_type = IFT_ETHER; + sdl = link_init_sdl(ifp, *llsa, IFT_ETHER); sdl->sdl_alen = ETHER_ADDR_LEN; e_addr = LLADDR(sdl); ETHER_MAP_IP_MULTICAST(&sin->sin_addr, e_addr); @@ -1197,14 +1190,7 @@ ether_resolvemulti(struct ifnet *ifp, st } if (!IN6_IS_ADDR_MULTICAST(&sin6->sin6_addr)) return EADDRNOTAVAIL; - sdl = malloc(sizeof *sdl, M_IFMADDR, - M_NOWAIT|M_ZERO); - if (sdl == NULL) - return (ENOMEM); - sdl->sdl_len = sizeof *sdl; - sdl->sdl_family = AF_LINK; - sdl->sdl_index = ifp->if_index; - sdl->sdl_type = IFT_ETHER; + sdl = link_init_sdl(ifp, *llsa, IFT_ETHER); sdl->sdl_alen = ETHER_ADDR_LEN; e_addr = LLADDR(sdl); ETHER_MAP_IPV6_MULTICAST(&sin6->sin6_addr, e_addr); Modified: head/sys/net/if_fddisubr.c ============================================================================== --- head/sys/net/if_fddisubr.c Sat Jan 18 22:59:10 2014 (r260869) +++ head/sys/net/if_fddisubr.c Sat Jan 18 23:24:51 2014 (r260870) @@ -729,14 +729,7 @@ fddi_resolvemulti(ifp, llsa, sa) sin = (struct sockaddr_in *)sa; if (!IN_MULTICAST(ntohl(sin->sin_addr.s_addr))) return (EADDRNOTAVAIL); - sdl = malloc(sizeof *sdl, M_IFMADDR, - M_NOWAIT | M_ZERO); - if (sdl == NULL) - return (ENOMEM); - sdl->sdl_len = sizeof *sdl; - sdl->sdl_family = AF_LINK; - sdl->sdl_index = ifp->if_index; - sdl->sdl_type = IFT_FDDI; + sdl = link_init_sdl(ifp, *llsa, IFT_FDDI); sdl->sdl_nlen = 0; sdl->sdl_alen = FDDI_ADDR_LEN; sdl->sdl_slen = 0; @@ -760,14 +753,7 @@ fddi_resolvemulti(ifp, llsa, sa) } if (!IN6_IS_ADDR_MULTICAST(&sin6->sin6_addr)) return (EADDRNOTAVAIL); - sdl = malloc(sizeof *sdl, M_IFMADDR, - M_NOWAIT | M_ZERO); - if (sdl == NULL) - return (ENOMEM); - sdl->sdl_len = sizeof *sdl; - sdl->sdl_family = AF_LINK; - sdl->sdl_index = ifp->if_index; - sdl->sdl_type = IFT_FDDI; + sdl = link_init_sdl(ifp, *llsa, IFT_FDDI); sdl->sdl_nlen = 0; sdl->sdl_alen = FDDI_ADDR_LEN; sdl->sdl_slen = 0; Modified: head/sys/net/if_iso88025subr.c ============================================================================== --- head/sys/net/if_iso88025subr.c Sat Jan 18 22:59:10 2014 (r260869) +++ head/sys/net/if_iso88025subr.c Sat Jan 18 23:24:51 2014 (r260870) @@ -721,14 +721,7 @@ iso88025_resolvemulti (ifp, llsa, sa) if (!IN_MULTICAST(ntohl(sin->sin_addr.s_addr))) { return (EADDRNOTAVAIL); } - sdl = malloc(sizeof *sdl, M_IFMADDR, - M_NOWAIT|M_ZERO); - if (sdl == NULL) - return (ENOMEM); - sdl->sdl_len = sizeof *sdl; - sdl->sdl_family = AF_LINK; - sdl->sdl_index = ifp->if_index; - sdl->sdl_type = IFT_ISO88025; + sdl = link_init_sdl(ifp, *llsa, IFT_ISO88025); sdl->sdl_alen = ISO88025_ADDR_LEN; e_addr = LLADDR(sdl); ETHER_MAP_IP_MULTICAST(&sin->sin_addr, e_addr); @@ -751,14 +744,7 @@ iso88025_resolvemulti (ifp, llsa, sa) if (!IN6_IS_ADDR_MULTICAST(&sin6->sin6_addr)) { return (EADDRNOTAVAIL); } - sdl = malloc(sizeof *sdl, M_IFMADDR, - M_NOWAIT|M_ZERO); - if (sdl == NULL) - return (ENOMEM); - sdl->sdl_len = sizeof *sdl; - sdl->sdl_family = AF_LINK; - sdl->sdl_index = ifp->if_index; - sdl->sdl_type = IFT_ISO88025; + sdl = link_init_sdl(ifp, *llsa, IFT_ISO88025); sdl->sdl_alen = ISO88025_ADDR_LEN; e_addr = LLADDR(sdl); ETHER_MAP_IPV6_MULTICAST(&sin6->sin6_addr, e_addr); Modified: head/sys/net/if_lagg.c ============================================================================== --- head/sys/net/if_lagg.c Sat Jan 18 22:59:10 2014 (r260869) +++ head/sys/net/if_lagg.c Sat Jan 18 23:24:51 2014 (r260870) @@ -1214,12 +1214,8 @@ lagg_ether_cmdmulti(struct lagg_port *lp LAGG_WLOCK_ASSERT(sc); - bzero((char *)&sdl, sizeof(sdl)); - sdl.sdl_len = sizeof(sdl); - sdl.sdl_family = AF_LINK; - sdl.sdl_type = IFT_ETHER; + link_init_sdl(ifp, (struct sockaddr *)&sdl, IFT_ETHER); sdl.sdl_alen = ETHER_ADDR_LEN; - sdl.sdl_index = ifp->if_index; if (set) { TAILQ_FOREACH(ifma, &scifp->if_multiaddrs, ifma_link) { Modified: head/sys/ofed/drivers/infiniband/ulp/ipoib/ipoib_main.c ============================================================================== --- head/sys/ofed/drivers/infiniband/ulp/ipoib/ipoib_main.c Sat Jan 18 22:59:10 2014 (r260869) +++ head/sys/ofed/drivers/infiniband/ulp/ipoib/ipoib_main.c Sat Jan 18 23:24:51 2014 (r260870) @@ -1490,14 +1490,7 @@ ipoib_resolvemulti(struct ifnet *ifp, st sin = (struct sockaddr_in *)sa; if (!IN_MULTICAST(ntohl(sin->sin_addr.s_addr))) return EADDRNOTAVAIL; - sdl = malloc(sizeof *sdl, M_IFMADDR, - M_NOWAIT|M_ZERO); - if (sdl == NULL) - return ENOMEM; - sdl->sdl_len = sizeof *sdl; - sdl->sdl_family = AF_LINK; - sdl->sdl_index = ifp->if_index; - sdl->sdl_type = IFT_INFINIBAND; + sdl = link_init_sdl(ifp, *llsa, IFT_INFINIBAND); sdl->sdl_alen = INFINIBAND_ALEN; e_addr = LLADDR(sdl); ip_ib_mc_map(sin->sin_addr.s_addr, ifp->if_broadcastaddr, @@ -1517,14 +1510,7 @@ ipoib_resolvemulti(struct ifnet *ifp, st return EADDRNOTAVAIL; if (!IN6_IS_ADDR_MULTICAST(&sin6->sin6_addr)) return EADDRNOTAVAIL; - sdl = malloc(sizeof *sdl, M_IFMADDR, - M_NOWAIT|M_ZERO); - if (sdl == NULL) - return (ENOMEM); - sdl->sdl_len = sizeof *sdl; - sdl->sdl_family = AF_LINK; - sdl->sdl_index = ifp->if_index; - sdl->sdl_type = IFT_INFINIBAND; + sdl = link_init_sdl(ifp, *llsa, IFT_INFINIBAND); sdl->sdl_alen = INFINIBAND_ALEN; e_addr = LLADDR(sdl); ipv6_ib_mc_map(&sin6->sin6_addr, ifp->if_broadcastaddr, e_addr); From owner-svn-src-head@FreeBSD.ORG Sat Jan 18 23:48:21 2014 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [8.8.178.115]) (using TLSv1 with cipher ADH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id 11008F96; Sat, 18 Jan 2014 23:48:21 +0000 (UTC) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mx1.freebsd.org (Postfix) with ESMTPS id F12C81AC8; Sat, 18 Jan 2014 23:48:20 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.7/8.14.7) with ESMTP id s0INmKkG002467; Sat, 18 Jan 2014 23:48:20 GMT (envelope-from adrian@svn.freebsd.org) Received: (from adrian@localhost) by svn.freebsd.org (8.14.7/8.14.7/Submit) id s0INmK8S002466; Sat, 18 Jan 2014 23:48:20 GMT (envelope-from adrian@svn.freebsd.org) Message-Id: <201401182348.s0INmK8S002466@svn.freebsd.org> From: Adrian Chadd Date: Sat, 18 Jan 2014 23:48:20 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r260871 - head/sys/netinet X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.17 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 18 Jan 2014 23:48:21 -0000 Author: adrian Date: Sat Jan 18 23:48:20 2014 New Revision: 260871 URL: http://svnweb.freebsd.org/changeset/base/260871 Log: If the flowid is available for the mbuf that finalised the creation of a syncache connection, copy it into the inp_flowid field. Without this, an incoming TCP connection won't have an inp_flowid marked until some data comes in, and this means that things like the per-CPU TCP timer option will choose a different CPU for the timer work. (It also means that if one grabbed the flowid via an ioctl from userland, it won't be available until some data has been received.) Sponsored by: Netflix, Inc. Modified: head/sys/netinet/tcp_syncache.c Modified: head/sys/netinet/tcp_syncache.c ============================================================================== --- head/sys/netinet/tcp_syncache.c Sat Jan 18 23:24:51 2014 (r260870) +++ head/sys/netinet/tcp_syncache.c Sat Jan 18 23:48:20 2014 (r260871) @@ -722,6 +722,16 @@ syncache_socket(struct syncache *sc, str #endif /* + * If there's an mbuf and it has a flowid, then let's initialise the + * inp with that particular flowid. + */ + if (m != NULL && m->m_flags & M_FLOWID) { + inp->inp_flags |= INP_HW_FLOWID; + inp->inp_flags &= ~INP_SW_FLOWID; + inp->inp_flowid = m->m_pkthdr.flowid; + } + + /* * Install in the reservation hash table for now, but don't yet * install a connection group since the full 4-tuple isn't yet * configured.